layout/shell: Reset split type of windows 16/29616/6
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 30 Jan 2024 15:34:24 +0000 (17:34 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Thu, 22 Feb 2024 13:51:33 +0000 (13:51 +0000)
This change would reset to default (none) orientation when activating a
different window, than those split and currently active.

The use-case is that when activating a different window all previous
split ones would reset to their original state (none orientation), such
that when the user tries to activate any former split windows it would get
the window without being split plus the other active window in the same
time. IOW going back and activating an former split window would also
display the other window which would complicate things a bit.

Bug-AGL: SPEC-4839
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I315d42b656962bf3f68f140466ab58429a0e972c

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

index 1c1d678..9f3cc47 100644 (file)
@@ -541,4 +541,8 @@ is_shell_surface_xwayland(struct ivi_surface *surf);
 void
 ivi_layout_reset_split_surfaces(struct ivi_compositor *ivi);
 
+void
+_ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *output,
+                            uint32_t orientation, bool to_activate);
+
 #endif
index 63ef9f9..0ab7e7c 100644 (file)
@@ -1036,16 +1036,47 @@ void
 ivi_layout_reset_split_surfaces(struct ivi_compositor *ivi)
 {
        struct ivi_surface *ivisurf;
+       bool found_split_surface = false;
+       struct ivi_output *output = NULL;
 
        wl_list_for_each(ivisurf, &ivi->surfaces, link) {
-               struct weston_desktop_surface *dsurf = ivisurf->dsurface;
-
                if (ivisurf->orientation != AGL_SHELL_TILE_ORIENTATION_NONE) {
-                       weston_log("%s() resetting apps to none orientation\n", __func__);
-                       ivisurf->orientation = AGL_SHELL_TILE_ORIENTATION_NONE;
-                       weston_desktop_surface_set_orientation(dsurf, ivisurf->orientation);
+                       found_split_surface = true;
+                       break;
                }
        }
+
+       if (!found_split_surface)
+               return;
+
+       output = ivisurf->current_completed_output;
+       if (output->previous_active) {
+               struct weston_view *ev = output->previous_active->view;
+               struct weston_output *woutput = output->output;
+
+               if (!weston_view_is_mapped(ev))
+                       weston_view_update_transform(ev);
+               else
+                       weston_layer_entry_remove(&ev->layer_link);
+
+               ev->is_mapped = true;
+               ev->surface->is_mapped = true;
+               output->previous_active->mapped = true;
+
+               weston_view_set_output(ev, woutput);
+
+               weston_layer_entry_insert(&ivi->normal.view_list, &ev->layer_link);
+
+               _ivi_set_shell_surface_split(output->previous_active, NULL,
+                                            AGL_SHELL_TILE_ORIENTATION_NONE, false);
+
+               if (output->active == ivisurf) {
+                       output->active = output->previous_active;
+               }
+       }
+
+       _ivi_set_shell_surface_split(ivisurf, NULL,
+                                    AGL_SHELL_TILE_ORIENTATION_NONE, false);
 }
 
 void
index 020c169..b8f096a 100644 (file)
 static void
 create_black_curtain_view(struct ivi_output *output);
 
-static void
-_ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *output,
-                            uint32_t orientation, bool to_activate);
-
 static uint32_t
 reverse_orientation(uint32_t orientation);
 
@@ -1792,7 +1788,7 @@ reverse_orientation(uint32_t orientation)
        }
 }
 
-static void
+void
 _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *ioutput,
                             uint32_t orientation, bool to_activate)
 {