mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-16 19:00:30 +01:00
xwayland: Make sure output is suitable for fullscreen
Since commitd370f1e58, Xwayland can optionally be started rootful and fullscreen. To do so, it will setup a viewport to scale the root window to match the size of the output. However, if the rootful Xwayland window receives an xdg-surface configure event before the output definition is complete, as with e.g. the labwc Wayland compositor, we might end up trying to setup a viewport with a destination size of 0x0 which is a protocol violation, and that kills Xwayland. To avoid that issue, only setup the viewport if the output size is meaningful. Also, please note that once the output definition is complete, i.e. when the "done" event is eventually received, we shall recompute the size for fullscreen again, hence achieving the desired fullscreen state. Fixes:d370f1e58- xwayland: add fullscreen mode for rootful Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1717 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1621> (cherry picked from commit66f5e7e96a)
This commit is contained in:
parent
409545421e
commit
47c4e38e50
1 changed files with 14 additions and 2 deletions
|
|
@ -494,6 +494,18 @@ window_get_client_toplevel(WindowPtr window)
|
|||
return window;
|
||||
}
|
||||
|
||||
static Bool
|
||||
is_output_suitable_for_fullscreen(struct xwl_output *xwl_output)
|
||||
{
|
||||
if (xwl_output == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (xwl_output->width == 0 || xwl_output->height == 0)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static struct xwl_output *
|
||||
xwl_window_get_output(struct xwl_window *xwl_window)
|
||||
{
|
||||
|
|
@ -501,11 +513,11 @@ xwl_window_get_output(struct xwl_window *xwl_window)
|
|||
struct xwl_output *xwl_output;
|
||||
|
||||
xwl_output = xwl_output_get_output_from_name(xwl_screen, xwl_screen->output_name);
|
||||
if (xwl_output)
|
||||
if (is_output_suitable_for_fullscreen(xwl_output))
|
||||
return xwl_output;
|
||||
|
||||
xwl_output = xwl_output_from_wl_output(xwl_screen, xwl_window->wl_output);
|
||||
if (xwl_output)
|
||||
if (is_output_suitable_for_fullscreen(xwl_output))
|
||||
return xwl_output;
|
||||
|
||||
return xwl_screen_get_first_output(xwl_screen);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue