Problem: Dark them of GTK 3 not supported.
Solution: Add the "d" flag in 'guioptions'. (Jonathan Conder, closes #4934)
:set background&
< Vim will guess the value. In the GUI this should work correctly,
in other cases Vim might not be able to guess the right value.
+ If the GUI supports a dark them, you can use the "d" flag in
+ 'guioptions', see 'go-d'.
When the |t_RB| option is set, Vim will use it to request the background
color from the terminal. If the returned RGB value is dark/light and
*'go-c'*
'c' Use console dialogs instead of popup dialogs for simple
choices.
+ *'go-d'*
+ 'd' Use dark theme variant if available. Currently only works for
+ GTK+ GUI.
*'go-e'*
'e' Add tab pages when indicated with 'showtabline'.
'guitablabel' can be used to change the text in the labels.
# define FEAT_MENU
#endif
+/*
+ * GUI dark theme variant
+ */
+#if defined(FEAT_GUI_GTK) && defined(USE_GTK3)
+# define FEAT_GUI_DARKTHEME
+#endif
+
/*
* GUI tabline
*/
void
gui_init_which_components(char_u *oldval UNUSED)
{
+#ifdef FEAT_GUI_DARKTHEME
+ static int prev_dark_theme = -1;
+ int using_dark_theme = FALSE;
+#endif
#ifdef FEAT_MENU
static int prev_menu_is_active = -1;
#endif
case GO_BOT:
gui.which_scrollbars[SBAR_BOTTOM] = TRUE;
break;
+#ifdef FEAT_GUI_DARKTHEME
+ case GO_DARKTHEME:
+ using_dark_theme = TRUE;
+ break;
+#endif
#ifdef FEAT_MENU
case GO_MENUS:
gui.menu_is_active = TRUE;
need_set_size = 0;
fix_size = FALSE;
+#ifdef FEAT_GUI_DARKTHEME
+ if (using_dark_theme != prev_dark_theme)
+ {
+ gui_mch_set_dark_theme(using_dark_theme);
+ prev_dark_theme = using_dark_theme;
+ }
+#endif
+
#ifdef FEAT_GUI_TABLINE
/* Update the GUI tab line, it may appear or disappear. This may
* cause the non-GUI tab line to disappear or appear. */
}
}
+#if defined(FEAT_GUI_DARKTHEME) || defined(PROTO)
+ void
+gui_mch_set_dark_theme(int dark)
+{
+# if GTK_CHECK_VERSION(3,0,0)
+ GtkSettings *gtk_settings;
+
+ gtk_settings = gtk_settings_get_for_screen(gdk_screen_get_default());
+ g_object_set(gtk_settings, "gtk-application-prefer-dark-theme", (gboolean)dark, NULL);
+# endif
+}
+#endif /* FEAT_GUI_DARKTHEME */
+
#ifdef FEAT_TOOLBAR
/*
#define GO_ASELML 'A' // autoselect modeless selection
#define GO_BOT 'b' // use bottom scrollbar
#define GO_CONDIALOG 'c' // use console dialog
+#define GO_DARKTHEME 'd' // use dark theme variant
#define GO_TABLINE 'e' // may show tabline
#define GO_FORG 'f' // start GUI in foreground
#define GO_GREY 'g' // use grey menu items
#define GO_FOOTER 'F' // add footer
#define GO_VERTICAL 'v' // arrange dialog buttons vertically
#define GO_KEEPWINSIZE 'k' // keep GUI window size
-#define GO_ALL "!aAbcefFghilmMprtTvk" // all possible flags for 'go'
+#define GO_ALL "!aAbcdefFghilmMprtTvk" // all possible flags for 'go'
// flags for 'comments' option
#define COM_NEST 'n' // comments strings nest
void gui_mch_start_blink(void);
int gui_mch_early_init_check(int give_message);
int gui_mch_init_check(void);
+void gui_mch_set_dark_theme(int dark);
void gui_mch_show_tabline(int showit);
int gui_mch_showing_tabline(void);
void gui_mch_update_tabline(void);
call assert_equal('aegi', &guioptions)
endif
+ if has('gui_gtk3')
+ set guioptions+=d
+ exec 'sleep' . duration
+ call assert_equal('aegid', &guioptions)
+ set guioptions-=d
+ exec 'sleep' . duration
+ call assert_equal('aegi', &guioptions)
+ endif
+
" Restore GUI ornaments to the default state.
set guioptions+=m
exec 'sleep' . duration
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2034,
/**/
2033,
/**/