fix incorrectly applied table forground color, because fg_set was ignored (GTK)

Sun, 13 Sep 2026 10:39:34 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 13 Sep 2026 10:39:34 +0200
changeset 1251
a1623c48c998
parent 1250
0b7df75d4ecf
child 1252
40f17cf43302

fix incorrectly applied table forground color, because fg_set was ignored (GTK)

application/main.c file | annotate | diff | comparison | revisions
ui/gtk/list.c file | annotate | diff | comparison | revisions
ui/gtk/menu.c file | annotate | diff | comparison | revisions
--- a/application/main.c	Sat Sep 12 20:14:29 2026 +0200
+++ b/application/main.c	Sun Sep 13 10:39:34 2026 +0200
@@ -582,7 +582,9 @@
         style->fg.blue = col == 1 ? 255 : 0;
         style->fg.green = col == 2 ? 255 : 0;
         style->fg.red = col == 5 ? 255 : 0;
-        style->fg_set = TRUE;
+        if(col == 1 || col == 2 || col == 5) {
+            style->fg_set = TRUE;
+        }
         return TRUE;
     }
     return FALSE;
--- a/ui/gtk/list.c	Sat Sep 12 20:14:29 2026 +0200
+++ b/ui/gtk/list.c	Sun Sep 13 10:39:34 2026 +0200
@@ -283,11 +283,13 @@
         pango_attr_list_insert(attr, pango_attr_underline_new(PANGO_UNDERLINE_SINGLE));
     }
     
-    // foreground color, convert from 8bit to 16bit
-    guint16 r = (guint16)style.fg.red   * 257;
-    guint16 g = (guint16)style.fg.green * 257;
-    guint16 b = (guint16)style.fg.blue  * 257;
-    pango_attr_list_insert(attr, pango_attr_foreground_new(r, g, b));
+    if(style.fg_set) {
+        // foreground color, convert from 8bit to 16bit
+        guint16 r = (guint16)style.fg.red   * 257;
+        guint16 g = (guint16)style.fg.green * 257;
+        guint16 b = (guint16)style.fg.blue  * 257;
+        pango_attr_list_insert(attr, pango_attr_foreground_new(r, g, b));
+    }
     
     return attr;
 }
--- a/ui/gtk/menu.c	Sat Sep 12 20:14:29 2026 +0200
+++ b/ui/gtk/menu.c	Sun Sep 13 10:39:34 2026 +0200
@@ -502,6 +502,7 @@
 }
 
 void ui_contextmenu_popup(UIMENU menu, GtkWidget *widget, int x, int y) {
+    gtk_widget_show_all(GTK_WIDGET(menu));
 #if GTK_MAJOR_VERSION >= 3 && GTK_MINOR_VERSION >= 16
     gtk_menu_popup_at_pointer(menu, NULL);
 #else
@@ -1014,7 +1015,6 @@
 }
 
 void ui_contextmenu_popup(UIMENU menu, UIWIDGET widget, int x, int y) {
-    gtk_widget_show_all(GTK_WIDGET(menu));
     gtk_popover_set_pointing_to(GTK_POPOVER(menu), &(GdkRectangle){ x, y, 0, 0 });
     gtk_popover_popup(GTK_POPOVER(menu));
 }

mercurial