Replace MetaStackWindow with a 64-bit "stack ID"

Putting X windows and pointers to MetaWindows into a union had a number of
problems:

 - It caused awkward initialization and conditionalization
 - There was no way to refer to Wayland windows (represented by
   MetaWindow *) in the past, which is necessary for the MetaStackTracker
   algorithms
 - We never even cleaned up old MetaStackWindow so there could be
   records in MetaStackWindow pointing to freed MetaWindow.

Replace MetaStackWindow with a 64-bit "stack ID" which is:

 - The XID for X Windows
 - a "window stamp" for Wayland windows - window stamps are assigned
   for all MetaWindow and are unique across the life of the process.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
This commit is contained in:
Owen W. Taylor
2014-09-08 21:20:14 -04:00
parent b49a4ae0bc
commit 73573a85de
11 changed files with 373 additions and 414 deletions

View File

@ -71,6 +71,10 @@
static int destroying_windows_disallowed = 0;
// Each window has a "stamp" which is a non-recycled 64-bit ID. They
// start after the end of the XID space so that, for stacking
// we can keep a guint64 that represents one or the other
static guint64 next_window_stamp = G_GUINT64_CONSTANT(0x100000000);
static void invalidate_work_areas (MetaWindow *window);
static void set_wm_state (MetaWindow *window);
@ -642,6 +646,7 @@ meta_window_class_init (MetaWindowClass *klass)
static void
meta_window_init (MetaWindow *self)
{
self->stamp = next_window_stamp++;
meta_prefs_add_listener (prefs_changed_callback, self);
}
@ -803,6 +808,8 @@ _meta_window_shared_new (MetaDisplay *display,
* type
*/
window->display = display;
meta_display_register_stamp (window->display, &window->stamp, window);
window->workspace = NULL;
window->sync_request_counter = None;
@ -1239,6 +1246,8 @@ meta_window_unmanage (MetaWindow *window,
meta_bug ("Tried to destroy window %s while destruction was not allowed\n",
window->desc);
meta_display_unregister_stamp (window->display, window->stamp);
window->unmanaging = TRUE;
if (meta_prefs_get_attach_modal_dialogs ())