diff options
author | Alexandros Frantzis <alexandros.frantzis@collabora.com> | 2020-05-13 16:33:03 +0300 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2020-05-25 10:11:09 +0000 |
commit | f6bd2129245b6c949dfeb50c722834050876f529 (patch) | |
tree | 0d8b925bf6619e47780b8847da76a90a182d1f68 | |
parent | a2086bba6602408efda3b65ce3930111f049adcb (diff) | |
download | weston-f6bd2129245b6c949dfeb50c722834050876f529.tar.gz |
xdg-shell: Allow fullscreen surfaces to not cover the whole screen
The wording of the xdg-shell protocol allows surfaces to not cover the
whole screen when they are made fullscreen. From the description of the
fullscreen state in xdg-shell:
The window geometry specified in the configure event is a maximum; the
client cannot resize beyond it. For a surface to cover the whole
fullscreened area, the geometry dimensions must be obeyed by the
client.
The last sentence is the condition for fullscreen coverage, not a
requirement.
This commit updates the code to not flag size mismatches for fullscreen
surfaces as a protocol error when the surface fits within the screen. In
such cases, the shell is responsible for centering surfaces
appropriately and also for obscuring other screen content as described
in the xdg_toplevel.set_fullscreen request description (and, indeed,
desktop-shell does all this).
For reference, contrast with the corresponding, stricter wording in the
obsolete xdg-shell-unstable-v6 protocol for the fullscreen state:
The window geometry specified in the configure event must be obeyed by
the client.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
-rw-r--r-- | libweston-desktop/xdg-shell.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libweston-desktop/xdg-shell.c b/libweston-desktop/xdg-shell.c index 34e7be92..4a9eb977 100644 --- a/libweston-desktop/xdg-shell.c +++ b/libweston-desktop/xdg-shell.c @@ -673,7 +673,7 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev struct weston_geometry geometry = weston_desktop_surface_get_geometry(toplevel->base.desktop_surface); - if ((toplevel->next.state.maximized || toplevel->next.state.fullscreen) && + if (toplevel->next.state.maximized && (toplevel->next.size.width != geometry.width || toplevel->next.size.height != geometry.height)) { struct weston_desktop_client *client = @@ -684,7 +684,25 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev wl_resource_post_error(client_resource, XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE, "xdg_surface buffer (%" PRIi32 " x %" PRIi32 ") " - "does not match the configured state (%" PRIi32 " x %" PRIi32 ")", + "does not match the configured maximized state (%" PRIi32 " x %" PRIi32 ")", + geometry.width, geometry.height, + toplevel->next.size.width, + toplevel->next.size.height); + return; + } + + if (toplevel->next.state.fullscreen && + (toplevel->next.size.width < geometry.width || + toplevel->next.size.height < geometry.height)) { + struct weston_desktop_client *client = + weston_desktop_surface_get_client(toplevel->base.desktop_surface); + struct wl_resource *client_resource = + weston_desktop_client_get_resource(client); + + wl_resource_post_error(client_resource, + XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE, + "xdg_surface buffer (%" PRIi32 " x %" PRIi32 ") " + "is larger than the configured fullscreen state (%" PRIi32 " x %" PRIi32 ")", geometry.width, geometry.height, toplevel->next.size.width, toplevel->next.size.height); |