Don't read most properties for override-redirect windows

Skipping handling of properties for override redirect windows has
two advantages: first it reduces the amount of work needed to get
an override-redirect window (menu, tooltip, drag icon) onto the
screen. But more importantly, it reduces the number of code-paths
for an override-redirect to get into some code portion where it
isn't expected.

* Integrate the list of properties we load initially with the
  list of property hooks; this avoids having two separate lists
  that we have to keep in sync.

* Add a flag to MetaWindowPropHooks to indicate whether the
  property should be handled for override-redirect windows;
  currently we load a) properties that identify the window -
  useful for debugging purposes b) WM_TRANSIENT_FOR (could be
  used to associate menus with toplevels.)

* For properties that aren't always loaded through window-props.c,
  add !window->override checks to places that trigger loading,
  and add g_return_if_fail(!window->override) to the load
  functions as a double-check.

http://bugzilla.gnome.org/show_bug.cgi?id=582639
This commit is contained in:
Owen W. Taylor
2009-06-14 08:37:57 -04:00
parent 27fb5fbbca
commit fd27647440
4 changed files with 138 additions and 74 deletions

View File

@ -426,14 +426,10 @@ meta_window_new_with_attrs (MetaDisplay *display,
gulong existing_wm_state;
gulong event_mask;
MetaMoveResizeFlags flags;
#define N_INITIAL_PROPS 19
Atom initial_props[N_INITIAL_PROPS];
int i;
gboolean has_shape;
MetaScreen *screen;
g_assert (attrs != NULL);
g_assert (N_INITIAL_PROPS == (int) G_N_ELEMENTS (initial_props));
meta_verbose ("Attempting to manage 0x%lx\n", xwindow);
@ -777,39 +773,15 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->xgroup_leader = None;
meta_window_compute_group (window);
/* Fill these in the order we want them to be gotten. we want to
* get window name and class first so we can use them in error
* messages and such. However, name is modified depending on
* wm_client_machine, so push it slightly sooner.
*/
i = 0;
initial_props[i++] = display->atom_WM_CLIENT_MACHINE;
initial_props[i++] = display->atom__NET_WM_NAME;
initial_props[i++] = XA_WM_CLASS;
initial_props[i++] = display->atom__NET_WM_PID;
initial_props[i++] = XA_WM_NAME;
initial_props[i++] = display->atom__NET_WM_ICON_NAME;
initial_props[i++] = XA_WM_ICON_NAME;
initial_props[i++] = display->atom__NET_WM_DESKTOP;
initial_props[i++] = display->atom__NET_STARTUP_ID;
initial_props[i++] = display->atom__NET_WM_SYNC_REQUEST_COUNTER;
initial_props[i++] = XA_WM_NORMAL_HINTS;
initial_props[i++] = display->atom_WM_PROTOCOLS;
initial_props[i++] = XA_WM_HINTS;
initial_props[i++] = display->atom__NET_WM_USER_TIME;
initial_props[i++] = display->atom__NET_WM_STATE;
initial_props[i++] = display->atom__MOTIF_WM_HINTS;
initial_props[i++] = XA_WM_TRANSIENT_FOR;
initial_props[i++] = display->atom__NET_WM_USER_TIME_WINDOW;
initial_props[i++] = display->atom__NET_WM_FULLSCREEN_MONITORS;
g_assert (N_INITIAL_PROPS == i);
meta_window_reload_properties (window, initial_props, N_INITIAL_PROPS, TRUE);
meta_window_load_initial_properties (window);
if (!window->override_redirect)
update_sm_hints (window); /* must come after transient_for */
{
update_sm_hints (window); /* must come after transient_for */
meta_window_update_role (window);
}
meta_window_update_role (window);
meta_window_update_net_wm_type (window);
if (!window->override_redirect)
@ -846,7 +818,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
* much we can do...except record the current time so that any children
* can use this time as a fallback.
*/
if (!window->net_wm_user_time_set) {
if (!window->override_redirect && !window->net_wm_user_time_set) {
MetaWindow *parent = NULL;
if (window->xtransient_for)
parent = meta_display_lookup_x_window (window->display,
@ -963,9 +935,11 @@ meta_window_new_with_attrs (MetaDisplay *display,
/* for the various on_all_workspaces = TRUE possible above */
if (!window->override_redirect)
meta_window_set_current_workspace_hint (window);
{
meta_window_set_current_workspace_hint (window);
meta_window_update_struts (window);
meta_window_update_struts (window);
}
/* Must add window to stack before doing move/resize, since the
* window might have fullscreen size (i.e. should have been
@ -6010,6 +5984,8 @@ meta_window_get_icon_geometry (MetaWindow *window,
gulong *geometry = NULL;
int nitems;
g_return_val_if_fail (!window->override_redirect, FALSE);
if (meta_prop_get_cardinal_list (window->display,
window->xwindow,
window->display->atom__NET_WM_ICON_GEOMETRY,
@ -6144,6 +6120,8 @@ meta_window_update_role (MetaWindow *window)
{
char *str;
g_return_if_fail (!window->override_redirect);
if (window->role)
g_free (window->role);
window->role = NULL;
@ -6245,6 +6223,8 @@ meta_window_update_icon_now (MetaWindow *window)
GdkPixbuf *icon;
GdkPixbuf *mini_icon;
g_return_if_fail (!window->override_redirect);
icon = NULL;
mini_icon = NULL;
@ -6353,6 +6333,8 @@ meta_window_update_struts (MetaWindow *window)
int nitems;
gboolean changed;
g_return_if_fail (!window->override_redirect);
meta_verbose ("Updating struts for %s\n", window->desc);
old_struts = window->struts;
@ -8545,6 +8527,8 @@ meta_window_set_user_time (MetaWindow *window,
* a future time.
*/
g_return_if_fail (!window->override_redirect);
/* Only update the time if this timestamp is newer... */
if (window->net_wm_user_time_set &&
XSERVER_TIME_IS_BEFORE (timestamp, window->net_wm_user_time))