[devhelp] window: override object signal handler for ::screen-changed



commit e040089eccb10bd416ecc56eb65cfb5b58120c58
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Nov 15 18:42:37 2015 +0100

    window: override object signal handler for ::screen-changed
    
    The signal was connected on the same object as self, so it's better to
    override the object handler and chain-up.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758141

 src/dh-window.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index 2a2c117..80e3bfc 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -552,10 +552,10 @@ gtk_xft_dpi_changed_cb (GtkSettings *gtk_settings,
         update_fonts_on_dpi_change (window);
 }
 
+/* Monitor GdkScreen and GtkSettings for DPI changes. */
 static void
-screen_changed_cb (GtkWidget *window,
-                   GdkScreen *previous_screen,
-                   gpointer   user_data)
+dh_window_screen_changed (GtkWidget *window,
+                          GdkScreen *previous_screen)
 {
         DhWindow *dh_window = DH_WINDOW(window);
         DhWindowPrivate *priv = dh_window_get_instance_private (dh_window);
@@ -589,6 +589,10 @@ screen_changed_cb (GtkWidget *window,
         }
 
         update_fonts_on_dpi_change (dh_window);
+
+        if (GTK_WIDGET_CLASS (dh_window_parent_class)->screen_changed != NULL)
+                GTK_WIDGET_CLASS (dh_window_parent_class)->screen_changed (window,
+                                                                           previous_screen);
 }
 
 static gboolean
@@ -631,12 +635,6 @@ dh_window_init (DhWindow *window)
                                  window,
                                  0);
 
-        /* monitor GdkScreen and GtkSettings for DPI changes */
-        g_signal_connect (window,
-                          "screen-changed",
-                          G_CALLBACK (screen_changed_cb),
-                          NULL);
-
         /* we can't get the GdkScreen for the widget here, so get the
          * GtkSettings associated to the default one instead for now */
         priv->gtk_settings = gtk_settings_get_default ();
@@ -695,6 +693,8 @@ dh_window_class_init (DhWindowClass *klass)
 
         object_class->dispose = dh_window_dispose;
 
+        widget_class->screen_changed = dh_window_screen_changed;
+
         signals[OPEN_LINK] =
                 g_signal_new ("open-link",
                               G_TYPE_FROM_CLASS (klass),


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