Commit 060f1006 authored by Roman Gilg's avatar Roman Gilg Committed by Hans de Goede

xwayland: Make window_get_none_wm_owner return a Window instead of a Client

Make window_get_none_wm_owner return the first non-wm-window instead of the
owner (client) of the first non-wm-window and rename it to
window_get_client_toplevel to match its new behavior.

This is a preparation patch for switching to using the drawable coordinates
in xwl_window_should_enable_viewport()

Changes by Hans de Goede:
- Split this change out into a separate patch for easier reviewing
- Rename window_get_none_wm_owner to window_get_client_toplevel to match
  its new behavior
Signed-off-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent a69f7fbb
......@@ -246,10 +246,10 @@ window_is_wm_window(WindowPtr window)
return CLIENT_ID(window->drawable.id) == xwl_screen->wm_client_id;
}
static ClientPtr
window_get_none_wm_owner(WindowPtr window)
static WindowPtr
window_get_client_toplevel(WindowPtr window)
{
ClientPtr client = wClient(window);
assert(window);
/* If the toplevel window is owned by the window-manager, then the
* actual client toplevel window has been reparented to some window-manager
......@@ -258,12 +258,12 @@ window_get_none_wm_owner(WindowPtr window)
*/
if (window_is_wm_window(window)) {
if (window->firstChild && window->firstChild == window->lastChild)
return window_get_none_wm_owner(window->firstChild);
return window_get_client_toplevel(window->firstChild);
else
return NULL; /* Should never happen, skip resolution emulation */
}
return client;
return window;
}
static Bool
......@@ -275,14 +275,17 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
struct xwl_emulated_mode *emulated_mode;
struct xwl_output *xwl_output;
ClientPtr owner;
WindowPtr window;
if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
return FALSE;
owner = window_get_none_wm_owner(xwl_window->window);
if (!owner)
window = window_get_client_toplevel(xwl_window->window);
if (!window)
return FALSE;
owner = wClient(window);
/* 1. Test if the window matches the emulated mode on one of the outputs
* This path gets hit by most games / libs (e.g. SDL, SFML, OGRE)
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment