[mutter] Add style classes to the titlebuttons



commit e5d97666af9a62337dd8a5a8c15ad9e265d0b79d
Author: Horst3180 <horst3180 users noreply github com>
Date:   Wed Mar 4 16:33:57 2015 +0100

    Add style classes to the titlebuttons
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745108

 src/ui/theme.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 60e653f..df1eb2d 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);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]