[gtk+] x11: Don't keep an "in_init" variable



commit b2043511eedbba93336c4b46c74a31e24f9d6452
Author: Benjamin Otte <otte redhat com>
Date:   Mon Feb 18 15:09:49 2013 +0100

    x11: Don't keep an "in_init" variable
    
    Instead, track the init state with a boolean argument.

 gdk/x11/gdkscreen-x11.c    |    4 ----
 gdk/x11/gdkscreen-x11.h    |    1 -
 gdk/x11/xsettings-client.c |   23 +++++++++++------------
 3 files changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 785a24d..ac0b843 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -1554,11 +1554,7 @@ _gdk_x11_screen_init_events (GdkScreen *screen)
 {
   GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
 
-  /* Keep a flag to avoid extra notifies that we don't need
-   */
-  x11_screen->xsettings_in_init = TRUE;
   x11_screen->xsettings_client = _gdk_x11_xsettings_client_new (screen);
-  x11_screen->xsettings_in_init = FALSE;
 }
 
 /**
diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h
index f4a15b8..ffee2cf 100644
--- a/gdk/x11/gdkscreen-x11.h
+++ b/gdk/x11/gdkscreen-x11.h
@@ -69,7 +69,6 @@ struct _GdkX11Screen
    * fetch of window manager name
    */
   guint need_refetch_wm_name : 1;
-  guint xsettings_in_init : 1;
   guint is_composited : 1;
   guint xft_init : 1; /* Whether we've intialized these values yet */
   guint xft_antialias : 1;
diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c
index 78bd0ec..5eb1681 100644
--- a/gdk/x11/xsettings-client.c
+++ b/gdk/x11/xsettings-client.c
@@ -76,11 +76,7 @@ gdk_xsettings_notify (const char       *name,
                      GdkScreen        *screen)
 {
   GdkEvent new_event;
-  GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
 
-  if (x11_screen->xsettings_in_init)
-    return;
-  
   new_event.type = GDK_SETTING;
   new_event.setting.window = gdk_screen_get_root_window (screen);
   new_event.setting.send_event = FALSE;
@@ -408,7 +404,8 @@ parse_settings (unsigned char *data,
 }
 
 static void
-read_settings (XSettingsClient *client)
+read_settings (XSettingsClient *client,
+               gboolean         do_notify)
 {
   Atom type;
   int format;
@@ -451,7 +448,8 @@ read_settings (XSettingsClient *client)
        }
     }
 
-  notify_changes (client, old_list);
+  if (do_notify)
+    notify_changes (client, old_list);
   if (old_list)
     g_hash_table_unref (old_list);
 }
@@ -462,7 +460,8 @@ gdk_xsettings_manager_window_filter (GdkXEvent *xevent,
                                      gpointer   data);
 
 static void
-check_manager_window (XSettingsClient *client)
+check_manager_window (XSettingsClient *client,
+                      gboolean         notify_changes)
 {
   GdkDisplay *display;
   Display *xdisplay;
@@ -499,7 +498,7 @@ check_manager_window (XSettingsClient *client)
       gdk_window_add_filter (client->manager_window, gdk_xsettings_manager_window_filter, client->screen);
     }
       
-  read_settings (client);
+  read_settings (client, notify_changes);
 }
 
 static GdkFilterReturn
@@ -521,7 +520,7 @@ gdk_xsettings_root_window_filter (GdkXEvent *xevent,
       xev->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "MANAGER") &&
       xev->xclient.data.l[1] == client->selection_atom)
     {
-      check_manager_window (client);
+      check_manager_window (client, TRUE);
       return GDK_FILTER_REMOVE;
     }
   
@@ -539,13 +538,13 @@ gdk_xsettings_manager_window_filter (GdkXEvent *xevent,
 
   if (xev->xany.type == DestroyNotify)
     {
-      check_manager_window (client);
+      check_manager_window (client, TRUE);
       /* let GDK do its cleanup */
       return GDK_FILTER_CONTINUE; 
     }
   else if (xev->xany.type == PropertyNotify)
     {
-      read_settings (client);
+      read_settings (client, TRUE);
       return GDK_FILTER_REMOVE;
     }
   
@@ -572,7 +571,7 @@ _gdk_x11_xsettings_client_new (GdkScreen *screen)
 
   gdk_window_add_filter (gdk_screen_get_root_window (screen), gdk_xsettings_root_window_filter, screen);
 
-  check_manager_window (client);
+  check_manager_window (client, FALSE);
 
   return client;
 }


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