[gtk+/wip/otte/gadget: 16/22] window: Refactor function



commit 97783774104c501a9f1f7bee46331ea31812d15f
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 7 21:31:57 2015 +0200

    window: Refactor function
    
    Move gtk_style_context_save() into the function that sets up the
    decoration rendering.

 gtk/gtkwindow.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index efde842..f141979 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6523,8 +6523,10 @@ subtract_borders (GtkBorder *one,
 }
 
 static void
-add_window_frame_style_class (GtkStyleContext *context)
+style_context_save_to_decoration (GtkStyleContext *context)
 {
+  gtk_style_context_save (context);
+
   gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BACKGROUND);
   gtk_style_context_add_class (context, "window-frame");
 }
@@ -6562,8 +6564,7 @@ get_shadow_width (GtkWindow *window,
   state = _gtk_widget_get_state_flags (GTK_WIDGET (window));
   context = _gtk_widget_get_style_context (GTK_WIDGET (window));
 
-  gtk_style_context_save (context);
-  add_window_frame_style_class (context);
+  style_context_save_to_decoration (context);
 
   /* We don't want windows to jump as they go to backdrop,
    * therefore we use the maximum of the decoration sizes
@@ -6654,8 +6655,7 @@ update_border_windows (GtkWindow *window)
   state = _gtk_widget_get_state_flags (widget);
   context = _gtk_widget_get_style_context (widget);
 
-  gtk_style_context_save (context);
-  add_window_frame_style_class (context);
+  style_context_save_to_decoration (context);
   gtk_style_context_set_state (context, state);
   gtk_style_context_get_margin (context, state, &border);
   gtk_widget_style_get (widget,
@@ -6891,8 +6891,7 @@ subtract_corners_from_region (cairo_region_t        *region,
 {
   cairo_rectangle_int_t rect;
 
-  gtk_style_context_save (context);
-  add_window_frame_style_class (context);
+  style_context_save_to_decoration (context);
 
   corner_rect (&rect, _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS));
   rect.x = extents->x;
@@ -9795,9 +9794,7 @@ gtk_window_draw (GtkWidget *widget,
           !priv->fullscreen &&
           !priv->maximized)
         {
-          gtk_style_context_save (context);
-
-          add_window_frame_style_class (context);
+          style_context_save_to_decoration (context);
 
           if (priv->use_client_shadow)
             {


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