summaryrefslogtreecommitdiff
path: root/src/core/screen.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-04-05 11:22:13 +0100
committerNeil Roberts <neil@linux.intel.com>2013-05-07 18:11:33 +0100
commit542bba57a84447f1545c9779995c5b62dd5813ae (patch)
tree0517044852e712283b2d313609945ab309f47b3d /src/core/screen.c
parentb4ceea2b9356f8f64e9833bdda1e406addf6aefb (diff)
downloadmutter-wip/wayland-stacking.tar.gz
Add support for stacking X and Wayland windows togetherwip/wayland-stacking
This breaks down the assumptions in stack-tracker.c and stack.c that Mutter is only stacking X windows. The stack tracker now tracks windows using a MetaStackWindow structure which is a union with a type member so that X windows can be distinguished from Wayland windows. Some notable changes are: Queued stack tracker operations that affect Wayland windows will not be associated with an X serial number. If an operation only affects a Wayland window and there are no queued stack tracker operations ("unvalidated predictions") then the operation is applied immediately since there is no server involved with changing the stacking for Wayland windows. The stack tracker can no longer respond to X events by turning them into stack operations and discarding the predicted operations made prior to that event because operations based on X events don't know anything about the stacking of Wayland windows. Instead of discarding old predictions the new approach is to trust the predictions but whenever we receive an event from the server that affects stacking we cross-reference with the predicted stack and check for consistency. So e.g. if we have an event that says ADD window A then we apply the predictions (up to the serial for that event) and verify the predicted state includes a window A. Similarly if an event says RAISE_ABOVE(B, C) we can apply the predictions (up to the serial for that event) and verify that window B is above C. If we ever receive spurious stacking events (with a serial older than we would expect) or find an inconsistency (some things aren't possible to predict from the compositor) then we hit a re-synchronization code-path that will query the X server for the full stacking order and then use that stack to walk through our combined stack and force the X windows to match the just queried stack but avoiding disrupting the relative stacking of Wayland windows. This will be relatively expensive but shouldn't be hit for compositor initiated restacking operations where our predictions should be accurate. The code in core/stack.c that deals with synchronizing the window stack with the X server had to be updated quite heavily. In general the patch avoids changing the fundamental approach being used but most of the code did need some amount of re-factoring to consider what re-stacking operations actually involve X or not and when we need to restack X windows we sometimes need to search for a suitable X sibling to restack relative too since the closest siblings may be Wayland windows.
Diffstat (limited to 'src/core/screen.c')
-rw-r--r--src/core/screen.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/screen.c b/src/core/screen.c
index 4d9ffd2ea..ccbbbec2e 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -612,6 +612,7 @@ meta_screen_create_guard_window (Display *xdisplay, MetaScreen *screen)
XSetWindowAttributes attributes;
Window guard_window;
gulong create_serial;
+ MetaStackWindow stack_window;
attributes.event_mask = NoEventMask;
attributes.override_redirect = True;
@@ -644,12 +645,14 @@ meta_screen_create_guard_window (Display *xdisplay, MetaScreen *screen)
XISelectEvents (xdisplay, guard_window, &mask, 1);
}
+ stack_window.any.type = META_WINDOW_CLIENT_TYPE_X11;
+ stack_window.x11.xwindow = guard_window;
meta_stack_tracker_record_add (screen->stack_tracker,
- guard_window,
+ &stack_window,
create_serial);
meta_stack_tracker_record_lower (screen->stack_tracker,
- guard_window,
+ &stack_window,
XNextRequest (xdisplay));
XLowerWindow (xdisplay, guard_window);
XMapWindow (xdisplay, guard_window);
@@ -1917,12 +1920,15 @@ meta_screen_tile_preview_update_timeout (gpointer data)
{
Window xwindow;
gulong create_serial;
+ MetaStackWindow stack_window;
screen->tile_preview = meta_tile_preview_new (screen->number);
xwindow = meta_tile_preview_get_xwindow (screen->tile_preview,
&create_serial);
+ stack_window.any.type = META_WINDOW_CLIENT_TYPE_X11;
+ stack_window.x11.xwindow = xwindow;
meta_stack_tracker_record_add (screen->stack_tracker,
- xwindow,
+ &stack_window,
create_serial);
}