From 15376957f7ecb76ac09d7a7955c296f2b94ef631 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Thu, 6 Aug 2009 12:08:45 -0400 Subject: [PATCH] Don't allow override-redirect windows to be META_WINDOW_NORMAL Many override-redirect windows (including the Metacity UI windows!) will have NET_WM_WINDOW_TYPE_NORMAL set on them because of shared code paths with normal windows in toolkits. Some current Compositor plugins (default plugin and gnome-shell) check type == NORMAL to determine if to run effects. While fixing such plugins to also check if the window is override-redirect is posisble, it seems cleanest to simply not allow any of the decorated window types to be set on an override-redirect window and to force these types to META_WINDOW_OVERRIDE_OTHER. This will prevent other similar problems from showing up in the future. http://bugzilla.gnome.org/show_bug.cgi?id=590971 --- src/core/window.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index 5f42416ef..3b1d93563 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -6481,8 +6481,6 @@ recalc_window_type (MetaWindow *window) 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 { char *atom_name; @@ -6518,6 +6516,39 @@ recalc_window_type (MetaWindow *window) window->wm_state_modal) window->type = META_WINDOW_MODAL_DIALOG; + /* We don't want to allow override-redirect windows to have decorated-window + * types since that's just confusing. + */ + if (window->override_redirect) + { + switch (window->type) + { + /* Decorated types */ + case META_WINDOW_NORMAL: + case META_WINDOW_DIALOG: + case META_WINDOW_MODAL_DIALOG: + case META_WINDOW_MENU: + case META_WINDOW_UTILITY: + window->type = META_WINDOW_OVERRIDE_OTHER; + break; + /* Undecorated types, normally not override-redirect */ + case META_WINDOW_DESKTOP: + case META_WINDOW_DOCK: + case META_WINDOW_TOOLBAR: + case META_WINDOW_SPLASHSCREEN: + /* Undecorated types, normally override-redirect types */ + case META_WINDOW_DROPDOWN_MENU: + case META_WINDOW_POPUP_MENU: + case META_WINDOW_TOOLTIP: + case META_WINDOW_NOTIFICATION: + case META_WINDOW_COMBO: + case META_WINDOW_DND: + /* To complete enum */ + case META_WINDOW_OVERRIDE_OTHER: + break; + } + } + meta_verbose ("Calculated type %u for %s, old type %u\n", window->type, window->desc, old_type);