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>
This commit is contained in:
parent
aec722db36
commit
66f5e7e96a
|
@ -496,6 +496,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)
|
||||
{
|
||||
|
@ -503,11 +515,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…
Reference in New Issue