From a576f7a1ea98840dd3c83f011f78583c1437fba1 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Fri, 31 Jul 2009 19:11:54 +0100 Subject: [PATCH] Tolerate all standard _NET_WM_WINDOW_TYPE types for managed windows Although the spec designates some window types as typically used for override redirect windows, it does not prohibit the use of these with managed windows, so we should not abort if we encounter one of these. http://bugzilla.gnome.org/show_bug.cgi?id=583870 --- src/core/window.c | 58 +++++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index c0e4e8adb..cbad732b3 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -6413,24 +6413,7 @@ recalc_window_type (MetaWindow *window) old_type = window->type; - if (window->override_redirect) - { - if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU) - window->type = META_WINDOW_DROPDOWN_MENU; - else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU) - window->type = META_WINDOW_POPUP_MENU; - else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP) - window->type = META_WINDOW_TOOLTIP; - else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION) - window->type = META_WINDOW_NOTIFICATION; - else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO) - window->type = META_WINDOW_COMBO; - else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND) - window->type = META_WINDOW_DND; - else - window->type = META_WINDOW_OVERRIDE_OTHER; - } - else if (window->type_atom != None) + if (window->type_atom != None) { if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP) window->type = META_WINDOW_DESKTOP; @@ -6448,9 +6431,44 @@ recalc_window_type (MetaWindow *window) window->type = META_WINDOW_DIALOG; else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL) window->type = META_WINDOW_NORMAL; + /* The below are *typically* override-redirect windows, but the spec does + * not disallow using them for managed windows. + */ + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU) + window->type = META_WINDOW_DROPDOWN_MENU; + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU) + window->type = META_WINDOW_POPUP_MENU; + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP) + window->type = META_WINDOW_TOOLTIP; + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION) + window->type = META_WINDOW_NOTIFICATION; + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO) + window->type = META_WINDOW_COMBO; + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND) + window->type = META_WINDOW_DND; + else if (window->override_redirect) + window->type = META_WINDOW_OVERRIDE_OTHER; else - meta_bug ("Set a type atom for %s that wasn't handled in recalc_window_type\n", - window->desc); + { + char *atom_name; + + /* + * Fallback on a normal type, and print warning. Don't abort. + */ + window->type = META_WINDOW_NORMAL; + + meta_error_trap_push (window->display); + atom_name = XGetAtomName (window->display->xdisplay, + window->type_atom); + meta_error_trap_pop (window->display, TRUE); + + meta_warning ("Unrecognized type atom [%s] set for %s \n", + atom_name ? atom_name : "unknown", + window->desc); + + if (atom_name) + XFree (atom_name); + } } else if (window->xtransient_for != None) {