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
This commit is contained in:
Owen W. Taylor 2009-08-06 12:08:45 -04:00
parent da934be354
commit 15376957f7

View File

@ -6481,8 +6481,6 @@ recalc_window_type (MetaWindow *window)
window->type = META_WINDOW_COMBO; window->type = META_WINDOW_COMBO;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND) else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND)
window->type = META_WINDOW_DND; window->type = META_WINDOW_DND;
else if (window->override_redirect)
window->type = META_WINDOW_OVERRIDE_OTHER;
else else
{ {
char *atom_name; char *atom_name;
@ -6518,6 +6516,39 @@ recalc_window_type (MetaWindow *window)
window->wm_state_modal) window->wm_state_modal)
window->type = META_WINDOW_MODAL_DIALOG; 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", meta_verbose ("Calculated type %u for %s, old type %u\n",
window->type, window->desc, old_type); window->type, window->desc, old_type);