[Xfce4-commits] [xfce/xfce4-panel] 01/01: Make sure borders are redrawn on Gtk theme changes

noreply at xfce.org noreply at xfce.org
Wed Mar 8 23:49:39 CET 2017


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository xfce/xfce4-panel.

commit 889d657508a44cba2db46fc465762802d95ca766
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Wed Mar 8 23:48:11 2017 +0100

    Make sure borders are redrawn on Gtk theme changes
    
    Also switch from the deprecated style-set signal to style-updated
    and call the background resetting function to make sure the borders
    actually get redrawn with the newly selected Gtk theme (so far we
    were only watching changes in the panel style settings).
---
 panel/panel-base-window.c |  3 +--
 panel/panel-base-window.h | 23 ++++++++++++-----------
 panel/panel-window.c      | 17 +++++++++--------
 3 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index 3ce2020..e3e44f1 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -65,7 +65,6 @@ static void     panel_base_window_set_background_color_css    (PanelBaseWindow
 static void     panel_base_window_set_background_image_css    (PanelBaseWindow      *window);
 static void     panel_base_window_set_background_css          (PanelBaseWindow      *window,
                                                                gchar                *css_string);
-static void     panel_base_window_reset_background_css        (PanelBaseWindow      *window);
 static void     panel_base_window_set_plugin_data             (PanelBaseWindow      *window,
                                                                GtkCallback           func);
 static void     panel_base_window_set_plugin_background_color (GtkWidget            *widget,
@@ -639,7 +638,7 @@ panel_base_window_set_background_css (PanelBaseWindow *window, gchar *css_string
 
 
 
-static void
+void
 panel_base_window_reset_background_css (PanelBaseWindow *window) {
   PanelBaseWindowPrivate  *priv = window->priv;
   GtkStyleContext         *context;
diff --git a/panel/panel-base-window.h b/panel/panel-base-window.h
index 3bbd8d5..04efd6d 100644
--- a/panel/panel-base-window.h
+++ b/panel/panel-base-window.h
@@ -72,17 +72,18 @@ struct _PanelBaseWindow
   gchar                   *background_image;
 };
 
-GType        panel_base_window_get_type    (void) G_GNUC_CONST;
-
-void         panel_base_window_move_resize (PanelBaseWindow *window,
-                                            gint             x,
-                                            gint             y,
-                                            gint             width,
-                                            gint             height);
-
-void         panel_base_window_set_borders (PanelBaseWindow *window,
-                                            PanelBorders     borders);
-PanelBorders panel_base_window_get_borders (PanelBaseWindow *window);
+GType        panel_base_window_get_type                    (void) G_GNUC_CONST;
+
+void         panel_base_window_move_resize                 (PanelBaseWindow *window,
+                                                            gint             x,
+                                                            gint             y,
+                                                            gint             width,
+                                                            gint             height);
+
+void         panel_base_window_reset_background_css        (PanelBaseWindow      *window);
+void         panel_base_window_set_borders                 (PanelBaseWindow *window,
+                                                            PanelBorders     borders);
+PanelBorders panel_base_window_get_borders                 (PanelBaseWindow *window);
 
 G_END_DECLS
 
diff --git a/panel/panel-window.c b/panel/panel-window.c
index e023bda..e7b23b2 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -138,8 +138,8 @@ static void         panel_window_size_allocate_set_xy                 (PanelWind
                                                                        gint             *return_y);
 static void         panel_window_screen_changed                       (GtkWidget        *widget,
                                                                        GdkScreen        *previous_screen);
-static void         panel_window_style_set                            (GtkWidget        *widget,
-                                                                       GtkStyle         *previous_style);
+static void         panel_window_style_updated                        (GtkWidget        *widget,
+                                                                       gpointer          user_data);
 static void         panel_window_realize                              (GtkWidget        *widget);
 static StrutsEgde   panel_window_screen_struts_edge                   (PanelWindow      *window);
 static void         panel_window_screen_struts_set                    (PanelWindow      *window);
@@ -393,7 +393,7 @@ panel_window_class_init (PanelWindowClass *klass)
   gtkwidget_class->get_preferred_height_for_width = panel_window_get_preferred_height_for_width;
   gtkwidget_class->size_allocate = panel_window_size_allocate;
   gtkwidget_class->screen_changed = panel_window_screen_changed;
-  gtkwidget_class->style_set = panel_window_style_set;
+  gtkwidget_class->style_updated = panel_window_style_updated;
   gtkwidget_class->realize = panel_window_realize;
 
   g_object_class_install_property (gobject_class,
@@ -1573,19 +1573,20 @@ panel_window_screen_changed (GtkWidget *widget,
 
 
 static void
-panel_window_style_set (GtkWidget *widget,
-                        GtkStyle  *previous_style)
+panel_window_style_updated (GtkWidget *widget,
+                            gpointer   user_data)
 {
   PanelWindow *window = PANEL_WINDOW (widget);
-
-  /* let gtk update the widget style */
-  (*GTK_WIDGET_CLASS (panel_window_parent_class)->style_set) (widget, previous_style);
+  PanelBaseWindow *base_window = PANEL_BASE_WINDOW (window);
 
   gtk_widget_style_get (GTK_WIDGET (widget),
                         "popup-delay", &window->popup_delay,
                         "popdown-delay", &window->popdown_delay,
                         "autohide-size", &window->autohide_size,
                         NULL);
+  /* Make sure the background and borders are redrawn on Gtk theme changes */
+  if (base_window->background_style == PANEL_BG_STYLE_NONE)
+    panel_base_window_reset_background_css (base_window);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list