From 351ebd8bd2d04f9d8e6767e4ea6b511fb8275a02 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 10 Feb 2004 18:51:19 +0000 Subject: [PATCH] Avoid triggering an X error when the client->manager_window is Tue Feb 10 12:02:14 2004 Owen Taylor * gdk/x11/xsettings-client.c (read_settings): Avoid triggering an X error when the client->manager_window is None...makes logs look cleaner. * gdk/x11/gdkproperty-x11.c (gdk_property_get): Handle GDK_NONE to mean AnyPropertyType as documented. (Reported by Yu Shao) * gdk/x11/gdkevents-x11.c (fetch_net_wm_check_window, gdk_x11_screen_get_window_manager_name): Fix error trap we've been leaking since 2002... (#129538) --- ChangeLog | 14 ++++++++++++++ ChangeLog.pre-2-10 | 14 ++++++++++++++ ChangeLog.pre-2-4 | 14 ++++++++++++++ ChangeLog.pre-2-6 | 14 ++++++++++++++ ChangeLog.pre-2-8 | 14 ++++++++++++++ gdk/x11/gdkevents-x11.c | 22 ++++++++++++++-------- gdk/x11/gdkproperty-x11.c | 5 ++++- gdk/x11/xsettings-client.c | 31 +++++++++++++++++-------------- 8 files changed, 105 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f72b5076c..eb909cdff9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Tue Feb 10 12:02:14 2004 Owen Taylor + + * gdk/x11/xsettings-client.c (read_settings): Avoid + triggering an X error when the client->manager_window + is None...makes logs look cleaner. + + * gdk/x11/gdkproperty-x11.c (gdk_property_get): Handle + GDK_NONE to mean AnyPropertyType as documented. (Reported + by Yu Shao) + + * gdk/x11/gdkevents-x11.c (fetch_net_wm_check_window, + gdk_x11_screen_get_window_manager_name): Fix error trap + we've been leaking since 2002... (#129538) + 2004-02-10 Federico Mena Quintero Fixes the entry-related part of #133852. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3f72b5076c..eb909cdff9 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +Tue Feb 10 12:02:14 2004 Owen Taylor + + * gdk/x11/xsettings-client.c (read_settings): Avoid + triggering an X error when the client->manager_window + is None...makes logs look cleaner. + + * gdk/x11/gdkproperty-x11.c (gdk_property_get): Handle + GDK_NONE to mean AnyPropertyType as documented. (Reported + by Yu Shao) + + * gdk/x11/gdkevents-x11.c (fetch_net_wm_check_window, + gdk_x11_screen_get_window_manager_name): Fix error trap + we've been leaking since 2002... (#129538) + 2004-02-10 Federico Mena Quintero Fixes the entry-related part of #133852. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 3f72b5076c..eb909cdff9 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,17 @@ +Tue Feb 10 12:02:14 2004 Owen Taylor + + * gdk/x11/xsettings-client.c (read_settings): Avoid + triggering an X error when the client->manager_window + is None...makes logs look cleaner. + + * gdk/x11/gdkproperty-x11.c (gdk_property_get): Handle + GDK_NONE to mean AnyPropertyType as documented. (Reported + by Yu Shao) + + * gdk/x11/gdkevents-x11.c (fetch_net_wm_check_window, + gdk_x11_screen_get_window_manager_name): Fix error trap + we've been leaking since 2002... (#129538) + 2004-02-10 Federico Mena Quintero Fixes the entry-related part of #133852. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3f72b5076c..eb909cdff9 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +Tue Feb 10 12:02:14 2004 Owen Taylor + + * gdk/x11/xsettings-client.c (read_settings): Avoid + triggering an X error when the client->manager_window + is None...makes logs look cleaner. + + * gdk/x11/gdkproperty-x11.c (gdk_property_get): Handle + GDK_NONE to mean AnyPropertyType as documented. (Reported + by Yu Shao) + + * gdk/x11/gdkevents-x11.c (fetch_net_wm_check_window, + gdk_x11_screen_get_window_manager_name): Fix error trap + we've been leaking since 2002... (#129538) + 2004-02-10 Federico Mena Quintero Fixes the entry-related part of #133852. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3f72b5076c..eb909cdff9 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +Tue Feb 10 12:02:14 2004 Owen Taylor + + * gdk/x11/xsettings-client.c (read_settings): Avoid + triggering an X error when the client->manager_window + is None...makes logs look cleaner. + + * gdk/x11/gdkproperty-x11.c (gdk_property_get): Handle + GDK_NONE to mean AnyPropertyType as documented. (Reported + by Yu Shao) + + * gdk/x11/gdkevents-x11.c (fetch_net_wm_check_window, + gdk_x11_screen_get_window_manager_name): Fix error trap + we've been leaking since 2002... (#129538) + 2004-02-10 Federico Mena Quintero Fixes the entry-related part of #133852. diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index d39f76e8c5..f10be2154a 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -2406,15 +2406,19 @@ fetch_net_wm_check_window (GdkScreen *screen) /* Find out if this WM goes away, so we can reset everything. */ XSelectInput (screen_x11->xdisplay, *xwindow, StructureNotifyMask); + gdk_display_sync (display); - screen_x11->wmspec_check_window = *xwindow; - XFree (xwindow); - - screen_x11->need_refetch_net_supported = TRUE; - screen_x11->need_refetch_wm_name = TRUE; - - /* Careful, reentrancy */ - _gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11)); + if (gdk_error_trap_pop () == Success) + { + screen_x11->wmspec_check_window = *xwindow; + XFree (xwindow); + + screen_x11->need_refetch_net_supported = TRUE; + screen_x11->need_refetch_wm_name = TRUE; + + /* Careful, reentrancy */ + _gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11)); + } } /** @@ -2455,6 +2459,8 @@ gdk_x11_screen_get_window_manager_name (GdkScreen *screen) guchar *name; name = NULL; + + gdk_error_trap_push (); XGetWindowProperty (GDK_DISPLAY_XDISPLAY (screen_x11->display), screen_x11->wmspec_check_window, diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c index 96cb6317db..70134d6356 100644 --- a/gdk/x11/gdkproperty-x11.c +++ b/gdk/x11/gdkproperty-x11.c @@ -505,7 +505,10 @@ gdk_property_get (GdkWindow *window, display = gdk_drawable_get_display (window); xproperty = gdk_x11_atom_to_xatom_for_display (display, property); - xtype = gdk_x11_atom_to_xatom_for_display (display, type); + if (type == GDK_NONE) + xtype = AnyPropertyType; + else + xtype = GDK_NONE; ret_data = NULL; diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index dd59908ea2..891d477e76 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -373,24 +373,27 @@ read_settings (XSettingsClient *client) XSettingsList *old_list = client->settings; client->settings = NULL; - - old_handler = XSetErrorHandler (ignore_errors); - result = XGetWindowProperty (client->display, client->manager_window, - client->xsettings_atom, 0, LONG_MAX, - False, client->xsettings_atom, - &type, &format, &n_items, &bytes_after, &data); - XSetErrorHandler (old_handler); - if (result == Success && type == client->xsettings_atom) + if (client->manager_window) { - if (format != 8) + old_handler = XSetErrorHandler (ignore_errors); + result = XGetWindowProperty (client->display, client->manager_window, + client->xsettings_atom, 0, LONG_MAX, + False, client->xsettings_atom, + &type, &format, &n_items, &bytes_after, &data); + XSetErrorHandler (old_handler); + + if (result == Success && type == client->xsettings_atom) { - fprintf (stderr, "Invalid format for XSETTINGS property %d", format); + if (format != 8) + { + fprintf (stderr, "Invalid format for XSETTINGS property %d", format); + } + else + client->settings = parse_settings (data, n_items); + + XFree (data); } - else - client->settings = parse_settings (data, n_items); - - XFree (data); } notify_changes (client, old_list);