x11: Don't keep an "in_init" variable

Instead, track the init state with a boolean argument.
This commit is contained in:
Benjamin Otte 2013-02-18 15:09:49 +01:00
parent 200d6fe664
commit b2043511ee
3 changed files with 11 additions and 17 deletions

View File

@ -1554,11 +1554,7 @@ _gdk_x11_screen_init_events (GdkScreen *screen)
{ {
GdkX11Screen *x11_screen = GDK_X11_SCREEN (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_client = _gdk_x11_xsettings_client_new (screen);
x11_screen->xsettings_in_init = FALSE;
} }
/** /**

View File

@ -69,7 +69,6 @@ struct _GdkX11Screen
* fetch of window manager name * fetch of window manager name
*/ */
guint need_refetch_wm_name : 1; guint need_refetch_wm_name : 1;
guint xsettings_in_init : 1;
guint is_composited : 1; guint is_composited : 1;
guint xft_init : 1; /* Whether we've intialized these values yet */ guint xft_init : 1; /* Whether we've intialized these values yet */
guint xft_antialias : 1; guint xft_antialias : 1;

View File

@ -76,10 +76,6 @@ gdk_xsettings_notify (const char *name,
GdkScreen *screen) GdkScreen *screen)
{ {
GdkEvent new_event; GdkEvent new_event;
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
if (x11_screen->xsettings_in_init)
return;
new_event.type = GDK_SETTING; new_event.type = GDK_SETTING;
new_event.setting.window = gdk_screen_get_root_window (screen); new_event.setting.window = gdk_screen_get_root_window (screen);
@ -408,7 +404,8 @@ parse_settings (unsigned char *data,
} }
static void static void
read_settings (XSettingsClient *client) read_settings (XSettingsClient *client,
gboolean do_notify)
{ {
Atom type; Atom type;
int format; int format;
@ -451,6 +448,7 @@ read_settings (XSettingsClient *client)
} }
} }
if (do_notify)
notify_changes (client, old_list); notify_changes (client, old_list);
if (old_list) if (old_list)
g_hash_table_unref (old_list); g_hash_table_unref (old_list);
@ -462,7 +460,8 @@ gdk_xsettings_manager_window_filter (GdkXEvent *xevent,
gpointer data); gpointer data);
static void static void
check_manager_window (XSettingsClient *client) check_manager_window (XSettingsClient *client,
gboolean notify_changes)
{ {
GdkDisplay *display; GdkDisplay *display;
Display *xdisplay; 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); gdk_window_add_filter (client->manager_window, gdk_xsettings_manager_window_filter, client->screen);
} }
read_settings (client); read_settings (client, notify_changes);
} }
static GdkFilterReturn 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.message_type == gdk_x11_get_xatom_by_name_for_display (display, "MANAGER") &&
xev->xclient.data.l[1] == client->selection_atom) xev->xclient.data.l[1] == client->selection_atom)
{ {
check_manager_window (client); check_manager_window (client, TRUE);
return GDK_FILTER_REMOVE; return GDK_FILTER_REMOVE;
} }
@ -539,13 +538,13 @@ gdk_xsettings_manager_window_filter (GdkXEvent *xevent,
if (xev->xany.type == DestroyNotify) if (xev->xany.type == DestroyNotify)
{ {
check_manager_window (client); check_manager_window (client, TRUE);
/* let GDK do its cleanup */ /* let GDK do its cleanup */
return GDK_FILTER_CONTINUE; return GDK_FILTER_CONTINUE;
} }
else if (xev->xany.type == PropertyNotify) else if (xev->xany.type == PropertyNotify)
{ {
read_settings (client); read_settings (client, TRUE);
return GDK_FILTER_REMOVE; 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); 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; return client;
} }