summaryrefslogtreecommitdiff
path: root/src/ui/tabpopup.c
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2023-10-04 10:42:54 +0200
committerraveit65 <[email protected]>2023-10-19 17:23:47 +0200
commitb87bed36282d767885da5450da26ddd92f6112fe (patch)
tree7714b96f6cd35b70cebaf539ab14e6eaa7f9d580 /src/ui/tabpopup.c
parent22df555ebe785c023471e6de3da7e037fc7f3b94 (diff)
downloadmarco-b87bed36282d767885da5450da26ddd92f6112fe.tar.bz2
marco-b87bed36282d767885da5450da26ddd92f6112fe.tar.xz
tabpopup: Use more contrasting background when not composited
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/ui/tabpopup.c')
-rw-r--r--src/ui/tabpopup.c21
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);