To: vim_dev@googlegroups.com Subject: Patch 8.2.4558 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4558 Problem: Motif: using default colors does not work as expected. Solution: Do not try to store the default colors, use the resources. (closes #9933) Files: src/gui_motif.c, src/gui.h *** ../vim-8.2.4557/src/gui_motif.c 2022-03-12 12:21:24.230165381 +0000 --- src/gui_motif.c 2022-03-13 14:41:30.720872991 +0000 *************** *** 440,450 **** 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 --- 440,445 ---- *************** *** 1672,1683 **** { 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; #ifdef FEAT_BEVAL_GUI gui.tooltip_fg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_fg_name); --- 1667,1676 ---- { if (gui.in_use) { ! 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,1873 **** 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); --- 1853,1858 ---- *************** *** 1895,1906 **** if (gui.scroll_bg_pixel != INVALCOLOR) { #if (XmVersion>=1002) XmChangeColor(sb->id, gui.scroll_bg_pixel); ! #else XtVaSetValues(sb->id, XmNtroughColor, gui.scroll_bg_pixel, NULL); - #endif } if (gui.scroll_fg_pixel != INVALCOLOR) --- 1880,1895 ---- 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); ! #endif ! ! // Set the through color directly, in case XmChangeColor() decided ! // to change it. XtVaSetValues(sb->id, XmNtroughColor, gui.scroll_bg_pixel, NULL); } if (gui.scroll_fg_pixel != INVALCOLOR) *** ../vim-8.2.4557/src/gui.h 2022-01-16 14:15:45.513044987 +0000 --- src/gui.h 2022-03-13 14:41:43.508845290 +0000 *************** *** 333,344 **** 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? --- 333,338 ---- *** ../vim-8.2.4557/src/version.c 2022-03-13 13:40:42.237939908 +0000 --- src/version.c 2022-03-13 14:42:51.204698797 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4558, /**/ -- hundred-and-one symptoms of being an internet addict: 249. You've forgotten what the outside looks like. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///