From e5d97666af9a62337dd8a5a8c15ad9e265d0b79d Mon Sep 17 00:00:00 2001 From: Horst3180 Date: Wed, 4 Mar 2015 16:33:57 +0100 Subject: [PATCH] Add style classes to the titlebuttons https://bugzilla.gnome.org/show_bug.cgi?id=745108 --- src/ui/theme.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ui/theme.c b/src/ui/theme.c index 60e653f07..df1eb2d73 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -662,6 +662,22 @@ get_button_rect (MetaButtonType type, } } +static const char * +get_class_from_button_type (MetaButtonType type) +{ + switch (type) + { + case META_BUTTON_TYPE_CLOSE: + return "close"; + case META_BUTTON_TYPE_MAXIMIZE: + return "maximize"; + case META_BUTTON_TYPE_MINIMIZE: + return "minimize"; + default: + return NULL; + } +} + static void meta_frame_layout_draw_with_style (MetaFrameLayout *layout, MetaStyleInfo *style_info, @@ -740,6 +756,10 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout, state = gtk_style_context_get_state (style); for (button_type = META_BUTTON_TYPE_CLOSE; button_type < META_BUTTON_TYPE_LAST; button_type++) { + const char *button_class = get_class_from_button_type (button_type); + if (button_class) + gtk_style_context_add_class (style, button_class); + get_button_rect (button_type, fgeom, &button_rect); if (button_states[button_type] == META_BUTTON_STATE_PRELIGHT) @@ -822,6 +842,8 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout, } } cairo_restore (cr); + if (button_class) + gtk_style_context_remove_class (style, button_class); } }