xwayland: Add a helper function to update fullscreen

Whenever the output configuration changes, if Xwayland is running
fullscreen, we may need to update the viewport in use or even update the
output on which Xwayland is currently running fullscreen.

Add a new helper function xwl_window_rootful_update_fullscreen() that
will recompute the fullscreen state and the viewport setup so that the
fullscreen Xwayland rootful window matches the new setup.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Kenny Levinsen <kl@kl.wtf>
This commit is contained in:
Olivier Fourdan 2023-11-10 09:08:57 +01:00
parent 2f84e3fe0d
commit 73b9ff53c3
2 changed files with 25 additions and 1 deletions

View File

@ -569,6 +569,29 @@ xwl_window_set_fullscreen(struct xwl_window *xwl_window)
return TRUE;
}
void
xwl_window_rootful_update_fullscreen(struct xwl_window *xwl_window,
struct xwl_output *xwl_output)
{
struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
if (!xwl_screen->fullscreen)
return;
if (xwl_window->window != xwl_screen->screen->root)
return;
if (xwl_window->wl_output_fullscreen != xwl_output->output)
return;
/* The size and position of the output may have changed, clear our
* output to make sure the next call to xwl_window_set_fullscreen()
* recomputes the size and updates the viewport as needed.
*/
xwl_window->wl_output_fullscreen = NULL;
xwl_window_set_fullscreen(xwl_window);
}
void
xwl_window_rootful_update_title(struct xwl_window *xwl_window)
{

View File

@ -135,7 +135,8 @@ Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
Bool xwl_window_is_toplevel(WindowPtr window);
void xwl_window_check_resolution_change_emulation(struct xwl_window *xwl_window);
void xwl_window_rootful_update_title(struct xwl_window *xwl_window);
void xwl_window_rootful_update_fullscreen(struct xwl_window *xwl_window,
struct xwl_output *xwl_output);
void xwl_window_set_window_pixmap(WindowPtr window, PixmapPtr pixmap);
Bool xwl_realize_window(WindowPtr window);