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

@ -512,7 +512,7 @@ test_case_assert_stacking (TestCase *test,
GError **error)
{
MetaDisplay *display = meta_get_display ();
MetaStackWindow *windows;
guint64 *windows;
int n_windows;
GString *stack_string = g_string_new (NULL);
GString *expected_string = g_string_new (NULL);
@ -521,22 +521,14 @@ test_case_assert_stacking (TestCase *test,
meta_stack_tracker_get_stack (display->screen->stack_tracker, &windows, &n_windows);
for (i = 0; i < n_windows; i++)
{
MetaWindow *window;
if (windows[i].any.type == META_WINDOW_CLIENT_TYPE_X11)
window = meta_display_lookup_x_window (display,
windows[i].x11.xwindow);
else
window = windows[i].wayland.meta_window;
MetaWindow *window = meta_display_lookup_stack_id (display, windows[i]);
if (window != NULL && window->title)
{
/* See comment in meta_ui_new() about why the dummy window for GTK+ theming
* is managed as a MetaWindow.
*/
if (windows[i].any.type == META_WINDOW_CLIENT_TYPE_X11 &&
meta_ui_window_is_dummy (display->screen->ui, windows[i].x11.xwindow))
if (META_STACK_ID_IS_X11 (windows[i]) &&
meta_ui_window_is_dummy (display->screen->ui, windows[i]))
continue;
if (stack_string->len > 0)
@ -579,18 +571,18 @@ test_case_check_xserver_stacking (TestCase *test,
GString *x11_string = g_string_new (NULL);
int i;
MetaStackWindow *windows;
guint64 *windows;
int n_windows;
meta_stack_tracker_get_stack (display->screen->stack_tracker, &windows, &n_windows);
for (i = 0; i < n_windows; i++)
{
if (windows[i].any.type == META_WINDOW_CLIENT_TYPE_X11)
if (META_STACK_ID_IS_X11 (windows[i]))
{
if (local_string->len > 0)
g_string_append_c (local_string, ' ');
g_string_append_printf (local_string, "%#lx", windows[i].x11.xwindow);
g_string_append_printf (local_string, "%#lx", (Window)windows[i]);
}
}