diff options
author | Colomban Wendling <[email protected]> | 2023-10-04 10:42:54 +0200 |
---|---|---|
committer | Colomban Wendling <[email protected]> | 2023-10-24 10:58:21 +0200 |
commit | 7a017ddaeb4921663f6d8211d10d2b6c6672f2ff (patch) | |
tree | 81f799373a373a7be599260171ebcb12d6aadc09 /src | |
parent | fdfc8bdd01242a38d87684b9c5e80e06edd2adad (diff) | |
download | marco-7a017ddaeb4921663f6d8211d10d2b6c6672f2ff.tar.bz2 marco-7a017ddaeb4921663f6d8211d10d2b6c6672f2ff.tar.xz |
tabpopup: Use more contrasting background when not composited1.26
When composited, the tab popup uses an OSD style which typically has a
dark background, so we use a light background highlight color.
However, when not composited the popup uses a light color and should
thus use a dark highlight. This was done for the workspace popup, but
not for the window one, leading to the highlight being hardly visible
in several themes.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/tabpopup.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c index 57973fb0..abd37b6d 100644 --- a/src/ui/tabpopup.c +++ b/src/ui/tabpopup.c @@ -234,6 +234,13 @@ tab_entry_new (const MetaTabEntry *entry, return te; } +static gboolean +screen_use_osd_style (MetaScreen *screen) +{ + return (meta_prefs_get_compositing_manager () && screen && + !!(meta_display_get_compositor (meta_screen_get_display (screen)))); +} + MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries, MetaScreen *meta_screen, @@ -287,8 +294,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, gtk_window_set_resizable (GTK_WINDOW (popup->window), TRUE); /* This style should only be set for composited mode. */ - if (meta_prefs_get_compositing_manager () && meta_screen && - !!(meta_display_get_compositor (meta_screen_get_display (meta_screen)))) + if (screen_use_osd_style (meta_screen)) { frame_shadow = GTK_SHADOW_NONE; gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (popup->window)), @@ -872,10 +878,13 @@ meta_select_image_draw (GtkWidget *widget, if (META_SELECT_IMAGE (widget)->selected) { + MetaScreen *screen; GtkRequisition requisition; GdkRGBA color; int x, y, w, h; + screen = meta_screen_for_x_screen (GDK_SCREEN_XSCREEN (gtk_widget_get_screen (widget))); + gtk_widget_get_preferred_size (widget, &requisition, 0); x = INSIDE_SELECT_RECT; @@ -885,7 +894,10 @@ meta_select_image_draw (GtkWidget *widget, h = requisition.height - OUTSIDE_SELECT_RECT * 2; gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED); - meta_gtk_style_get_light_color (context, GTK_STATE_FLAG_SELECTED, &color); + if (screen_use_osd_style (screen)) + meta_gtk_style_get_light_color (context, GTK_STATE_FLAG_SELECTED, &color); + else + meta_gtk_style_get_dark_color (context, GTK_STATE_FLAG_SELECTED, &color); /* We set the line width absurdly high to overflow it behind the icon. */ cairo_set_line_width (cr, 256.0); @@ -1127,8 +1139,7 @@ meta_select_workspace_draw (GtkWidget *widget, gtk_style_context_set_state (context, gtk_widget_get_state_flags (widget)); - if (meta_prefs_get_compositing_manager () && screen && - !!(meta_display_get_compositor (meta_screen_get_display (screen)))) + if (screen_use_osd_style (screen)) { /* compositing manager creates a dark background: show the selection in a light color */ meta_gtk_style_get_light_color (context, GTK_STATE_FLAG_SELECTED, &color); |