shell: Fix passing maximized state from the start 31/26831/2
authorMarius Vlad <marius.vlad@collabora.com>
Thu, 4 Nov 2021 15:32:28 +0000 (17:32 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Fri, 5 Nov 2021 10:46:25 +0000 (12:46 +0200)
We've added an optimization where we where sending to regular (desktop)
surfaces from the beginning the maximized state, together with the size
whenever the client signaled that it is ready to present.

That optimization failed to take into account other potential roles,
more importanly, the pop-op role which should not be getting any window
state, and implicitly shouldn't be getting any surface dimensions,
leaving it to the client to decide that. Patch checks all pending lists
to make sure we're not skipping any on purpose.

Bug-AGL: SPEC-4119

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I4f8c62af545c5955e7fa41c3fd73f52d6c73b600

src/desktop.c
src/ivi-compositor.h
src/shell.c

index 9c1dfae..ac68b78 100644 (file)
@@ -169,11 +169,15 @@ desktop_surface_added(struct weston_desktop_surface *dsurface, void *userdata)
        if (output && ivi->shell_client.ready) {
                struct ivi_output *ivi_output = to_ivi_output(output);
 
-               weston_log("Setting surface to initial size of surface to %dx%d\n",
-                               ivi_output->area.width, ivi_output->area.height);
-               weston_desktop_surface_set_maximized(dsurface, true);
-               weston_desktop_surface_set_size(dsurface,
-                               ivi_output->area.width, ivi_output->area.height);
+               /* verify if by any chance this surfaces hasn't been assigned a
+                * different role before sending the maximized state */
+               if (!ivi_check_pending_surface(surface)) {
+                       weston_log("Setting surface to initial size of surface to %dx%d\n",
+                                       ivi_output->area.width, ivi_output->area.height);
+                       weston_desktop_surface_set_maximized(dsurface, true);
+                       weston_desktop_surface_set_size(dsurface,
+                                       ivi_output->area.width, ivi_output->area.height);
+               }
        }
        /*
         * We delay creating "normal" desktop surfaces until later, to
index b2342eb..cdea455 100644 (file)
@@ -419,4 +419,8 @@ agl_shell_desktop_advertise_application_id(struct ivi_compositor *ivi,
                                           struct ivi_surface *surface);
 void
 ivi_destroy_waltham_destroy(struct ivi_surface *surface);
+
+bool
+ivi_check_pending_surface(struct ivi_surface *surface);
+
 #endif
index 9e7693e..301110a 100644 (file)
@@ -458,6 +458,53 @@ ivi_check_pending_desktop_surface_remote(struct ivi_surface *surface)
        return false;
 }
 
+bool
+ivi_check_pending_surface(struct ivi_surface *surface)
+{
+       struct ivi_compositor *ivi = surface->ivi;
+       struct wl_list *role_pending_list;
+       struct pending_popup *p_popup;
+       struct pending_split *p_split;
+       struct pending_fullscreen *p_fullscreen;
+       struct pending_remote *p_remote;
+       const char *app_id =
+               weston_desktop_surface_get_app_id(surface->dsurface);
+
+       if (!app_id)
+               return false;
+
+       role_pending_list = &ivi->popup_pending_apps;
+       wl_list_for_each(p_popup, role_pending_list, link) {
+               if (!strcmp(app_id, p_popup->app_id)) {
+                       return true;
+               }
+       }
+
+       role_pending_list = &ivi->split_pending_apps;
+       wl_list_for_each(p_split, role_pending_list, link) {
+               if (!strcmp(app_id, p_split->app_id)) {
+                       return true;
+               }
+       }
+
+       role_pending_list = &ivi->fullscreen_pending_apps;
+       wl_list_for_each(p_fullscreen, role_pending_list, link) {
+               if (!strcmp(app_id, p_fullscreen->app_id)) {
+                       return true;
+               }
+       }
+
+       role_pending_list = &ivi->remote_pending_apps;
+       wl_list_for_each(p_remote, role_pending_list, link) {
+               if (!strcmp(app_id, p_remote->app_id)) {
+                       return true;
+               }
+       }
+
+       /* else, we are a regular desktop surface */
+       return false;
+}
+
 
 void
 ivi_check_pending_desktop_surface(struct ivi_surface *surface)