summaryrefslogtreecommitdiff
path: root/kiosk-shell
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2021-04-30 21:53:16 +0300
committerDaniel Stone <daniels@collabora.com>2022-02-03 15:37:03 +0000
commit8a1849db8a3e1d1e3bc5da33d5b78f600fe19fe7 (patch)
tree861483937f57a0de901c1756d18a42b342f01c02 /kiosk-shell
parentb0ed4a2e3b16e14df395f854b905a37aea5d9924 (diff)
downloadweston-8a1849db8a3e1d1e3bc5da33d5b78f600fe19fe7.tar.gz
kiosk-shell: Check if app_ids have been set after initial commit
Some applications would set-up the app_id after the initial commit (without a buffer) which is too late to correctly assign the application to the corresponding output set-up in the configuration file. This patch fixes that by checking one more time, after a buffer has been attached, if indeed there's an output with an app_id set. Fixes: #469 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Diffstat (limited to 'kiosk-shell')
-rw-r--r--kiosk-shell/kiosk-shell.c25
-rw-r--r--kiosk-shell/kiosk-shell.h2
2 files changed, 26 insertions, 1 deletions
diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c
index 5995baea..477c85c3 100644
--- a/kiosk-shell/kiosk-shell.c
+++ b/kiosk-shell/kiosk-shell.c
@@ -173,8 +173,10 @@ kiosk_shell_surface_find_best_output(struct kiosk_shell_surface *shsurf)
app_id = weston_desktop_surface_get_app_id(shsurf->desktop_surface);
if (app_id) {
wl_list_for_each(shoutput, &shsurf->shell->output_list, link) {
- if (kiosk_shell_output_has_app_id(shoutput, app_id))
+ if (kiosk_shell_output_has_app_id(shoutput, app_id)) {
+ shsurf->appid_output_assigned = true;
return shoutput->output;
+ }
}
}
@@ -354,6 +356,7 @@ kiosk_shell_surface_create(struct kiosk_shell *shell,
shsurf->desktop_surface = desktop_surface;
shsurf->view = view;
shsurf->shell = shell;
+ shsurf->appid_output_assigned = false;
weston_desktop_surface_set_user_data(desktop_surface, shsurf);
@@ -721,6 +724,8 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
weston_desktop_surface_get_user_data(desktop_surface);
struct weston_surface *surface =
weston_desktop_surface_get_surface(desktop_surface);
+ const char *app_id =
+ weston_desktop_surface_get_app_id(desktop_surface);
bool is_resized;
bool is_fullscreen;
@@ -729,6 +734,24 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
if (surface->width == 0)
return;
+ if (!shsurf->appid_output_assigned && app_id) {
+ struct weston_output *output = NULL;
+
+ /* reset previous output being set in _added() as the output is
+ * being cached */
+ shsurf->output = NULL;
+ output = kiosk_shell_surface_find_best_output(shsurf);
+
+ kiosk_shell_surface_set_output(shsurf, output);
+ weston_desktop_surface_set_size(shsurf->desktop_surface,
+ shsurf->output->width,
+ shsurf->output->height);
+ /* even if we couldn't find an appid set for a particular
+ * output still flag the shsurf as to a avoid changing the
+ * output every time */
+ shsurf->appid_output_assigned = true;
+ }
+
/* TODO: When the top-level surface is committed with a new size after an
* output resize, sometimes the view appears scaled. What state are we not
* updating?
diff --git a/kiosk-shell/kiosk-shell.h b/kiosk-shell/kiosk-shell.h
index 9f680806..070ba1ab 100644
--- a/kiosk-shell/kiosk-shell.h
+++ b/kiosk-shell/kiosk-shell.h
@@ -73,6 +73,8 @@ struct kiosk_shell_surface {
int32_t x;
int32_t y;
} xwayland;
+
+ bool appid_output_assigned;
};
struct kiosk_shell_seat {