diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2022-12-27 18:38:02 +0200 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2023-01-20 12:05:03 +0000 |
commit | 285de23dc83e438486d1a1625199870e6bffff71 (patch) | |
tree | 7aa7f72407cd59c1aca42ad629ffa42a9ac55f58 /meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch | |
parent | 34ff95e9d6c86b4a987ec0835b4de0a069e7e34f (diff) |
weston/0001-simple-touch-Add-maximized-fullscreen: Add maximized/fullscreen for simple-touch
simple-touch wasn't able to resize itself to max/fullscreen to this
patch adds support for that. It is quite useful to have this client
test out touch support, so we can re-use it whenever, for instance in
the virtio aarch64 machine to test if we have indeed or not a
touchscreen device.
Upstream-Status: Submitted
See: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1095
Bug-AGL: SPEC-4656
Change-Id: I974b4c5ea8a85f1b3efe4a114f345de948441300
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/28314
Tested-by: Jenkins Job builder account
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch')
-rw-r--r-- | meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch new file mode 100644 index 000000000..5634e8160 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch @@ -0,0 +1,136 @@ +From 666300564093838c7d6a723fbce7e3b1a719e873 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Thu, 22 Dec 2022 18:27:14 +0200 +Subject: [PATCH 1/3] simple-touch: Add maximized/fullscreen states + +Helpful to have other states like maximized or fullscreen for +the simple-touch client. + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + clients/simple-touch.c | 55 ++++++++++++++++++++++++++++++++++++------ + 1 file changed, 48 insertions(+), 7 deletions(-) + +diff --git a/clients/simple-touch.c b/clients/simple-touch.c +index 6559aa24d..e32013161 100644 +--- a/clients/simple-touch.c ++++ b/clients/simple-touch.c +@@ -64,9 +64,13 @@ struct touch { + struct xdg_toplevel *xdg_toplevel; + struct buffer *buffer; + int width, height; ++ int init_width, init_height; + bool running; + bool wait_for_configure; ++ bool needs_buffer_update; + bool has_argb; ++ bool maximized; ++ bool fullscreen; + }; + + static struct buffer * +@@ -111,7 +115,7 @@ create_shm_buffer(struct touch *touch) + } + + static void +-initial_redraw(void *data) ++redraw(void *data) + { + struct touch *touch = data; + struct buffer *buffer = NULL; +@@ -119,6 +123,9 @@ initial_redraw(void *data) + buffer = create_shm_buffer(touch); + assert(buffer); + ++ if (touch->buffer) ++ free(touch->buffer); ++ + touch->buffer = buffer; + + /* paint the "work-area" */ +@@ -283,9 +290,10 @@ handle_xdg_surface_configure(void *data, struct xdg_surface *surface, + + xdg_surface_ack_configure(surface, serial); + +- if (touch->wait_for_configure) { +- initial_redraw(touch); ++ if (touch->wait_for_configure || touch->needs_buffer_update) { ++ redraw(touch); + touch->wait_for_configure = false; ++ touch->needs_buffer_update = false; + } + } + +@@ -340,9 +348,40 @@ static const struct wl_registry_listener registry_listener = { + + static void + handle_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel, +- int32_t width, int32_t height, +- struct wl_array *state) ++ int32_t width, int32_t height, struct wl_array *states) + { ++ struct touch *touch = data; ++ uint32_t *p; ++ ++ touch->fullscreen = false; ++ touch->maximized = false; ++ ++ wl_array_for_each(p, states) { ++ uint32_t state = *p; ++ switch (state) { ++ case XDG_TOPLEVEL_STATE_FULLSCREEN: ++ touch->fullscreen = true; ++ break; ++ case XDG_TOPLEVEL_STATE_MAXIMIZED: ++ touch->maximized = true; ++ break; ++ } ++ } ++ ++ if (width > 0 && height > 0) { ++ if (!touch->fullscreen && !touch->maximized) { ++ touch->init_width = width; ++ touch->init_width = height; ++ } ++ touch->width = width; ++ touch->height = height; ++ } else if (!touch->fullscreen && !touch->maximized) { ++ touch->width = touch->init_width; ++ touch->height = touch->init_height; ++ ++ } ++ ++ touch->needs_buffer_update = true; + } + + static void +@@ -371,6 +410,7 @@ touch_create(int width, int height) + assert(touch->display); + + touch->has_argb = false; ++ touch->buffer = NULL; + touch->registry = wl_display_get_registry(touch->display); + wl_registry_add_listener(touch->registry, ®istry_listener, touch); + wl_display_dispatch(touch->display); +@@ -386,8 +426,8 @@ touch_create(int width, int height) + exit(1); + } + +- touch->width = width; +- touch->height = height; ++ touch->init_width = width; ++ touch->init_height = height; + touch->surface = wl_compositor_create_surface(touch->compositor); + + touch->xdg_surface = +@@ -403,6 +443,7 @@ touch_create(int width, int height) + xdg_toplevel_set_title(touch->xdg_toplevel, "simple-touch"); + xdg_toplevel_set_app_id(touch->xdg_toplevel, "simple-touch"); + touch->wait_for_configure = true; ++ touch->needs_buffer_update = false; + wl_surface_commit(touch->surface); + + touch->running = true; +-- +2.35.1 + |