]> granicus.if.org Git - vim/commitdiff
patch 8.2.4558: Motif: using default colors does not work as expected v8.2.4558
authorBram Moolenaar <Bram@vim.org>
Sun, 13 Mar 2022 14:45:03 +0000 (14:45 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 13 Mar 2022 14:45:03 +0000 (14:45 +0000)
Problem:    Motif: using default colors does not work as expected.
Solution:   Do not try to store the default colors, use the resources.
            (closes #9933)

src/gui.h
src/gui_motif.c
src/version.c

index 0bd29fceb9615fa8a5469cfba8e881f21449caf8..bb8a3d905e3543cf28aaca0aaed63b089ab99861 100644 (file)
--- a/src/gui.h
+++ b/src/gui.h
@@ -333,12 +333,6 @@ typedef struct Gui
     char       *rsrc_scroll_bg_name;   // Color of scrollbar background
     guicolor_T scroll_bg_pixel;        // Same in Pixel format
 
-# ifdef FEAT_GUI_MOTIF
-    guicolor_T menu_def_fg_pixel;  // Default menu foreground
-    guicolor_T menu_def_bg_pixel;  // Default menu background
-    guicolor_T scroll_def_fg_pixel;  // Default scrollbar foreground
-    guicolor_T scroll_def_bg_pixel;  // Default scrollbar background
-# endif
     Display    *dpy;               // X display
     Window     wid;                // Window id of text area
     int                visibility;         // Is shell partially/fully obscured?
index 564c0bb0747887a57c29a1e3c2c24bfdca5a68be..740288827bde631cc31f8122e733f678afae419a 100644 (file)
@@ -440,11 +440,6 @@ gui_x11_create_widgets(void)
        menuBar = XmCreateMenuBar(vimForm, "menuBar", al, ac);
        XtManageChild(menuBar);
 
-       // Remember the default colors, needed for ":hi clear".
-       XtVaGetValues(menuBar,
-           XmNbackground, &gui.menu_def_bg_pixel,
-           XmNforeground, &gui.menu_def_fg_pixel,
-           NULL);
        gui_motif_menu_colors(menuBar);
     }
 #endif
@@ -1672,12 +1667,10 @@ gui_mch_def_colors(void)
 {
     if (gui.in_use)
     {
-       // Use the values saved when starting up.  These should come from the
-       // window manager or a resources file.
-       gui.menu_fg_pixel = gui.menu_def_fg_pixel;
-       gui.menu_bg_pixel = gui.menu_def_bg_pixel;
-       gui.scroll_fg_pixel = gui.scroll_def_fg_pixel;
-       gui.scroll_bg_pixel = gui.scroll_def_bg_pixel;
+       gui.menu_fg_pixel = gui_get_color((char_u *)gui.rsrc_menu_fg_name);
+       gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name);
+       gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name);
+       gui.scroll_bg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_bg_name);
 #ifdef FEAT_BEVAL_GUI
        gui.tooltip_fg_pixel =
                        gui_get_color((char_u *)gui.rsrc_tooltip_fg_name);
@@ -1860,14 +1853,6 @@ gui_mch_create_scrollbar(
     sb->id = XtCreateWidget("scrollBar",
            xmScrollBarWidgetClass, textAreaForm, args, n);
 
-    // Remember the default colors, needed for ":hi clear".
-    if (gui.scroll_def_bg_pixel == (guicolor_T)0
-           && gui.scroll_def_fg_pixel == (guicolor_T)0)
-       XtVaGetValues(sb->id,
-               XmNbackground, &gui.scroll_def_bg_pixel,
-               XmNforeground, &gui.scroll_def_fg_pixel,
-               NULL);
-
     if (sb->id != (Widget)0)
     {
        gui_mch_set_scrollbar_colors(sb);
@@ -1895,12 +1880,16 @@ gui_mch_set_scrollbar_colors(scrollbar_T *sb)
        if (gui.scroll_bg_pixel != INVALCOLOR)
        {
 #if (XmVersion>=1002)
+           // This should not only set the through color but also adjust
+           // related colors, such as shadows.
            XmChangeColor(sb->id, gui.scroll_bg_pixel);
-#else
+#endif
+
+           // Set the through color directly, in case XmChangeColor() decided
+           // to change it.
            XtVaSetValues(sb->id,
                    XmNtroughColor, gui.scroll_bg_pixel,
                    NULL);
-#endif
        }
 
        if (gui.scroll_fg_pixel != INVALCOLOR)
index 9a624cfbc46e0053b9c8511e07405ba67920c678..f21159412756387218bfeb3fdf27cedebcb1da3f 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4558,
 /**/
     4557,
 /**/