summaryrefslogtreecommitdiffstats
path: root/src/layout.c
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-04-29 17:41:58 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-06-08 17:26:36 +0300
commit831d1b21b5e786d2e5e804ca5a6a2a2b1dfacd1e (patch)
tree8d1892a1fd7bf073b12516ed0f9b332b12762739 /src/layout.c
parenta2d066f067e01ce8ff56abdcd98d22fd1af51e85 (diff)
layout: Allow to commit the fullscreen and split surface roles
Now that we have the ability to discern between fullscreend and split roles, use specific functions when doing the commit to further customize them. Bug-AGL: SPEC-3334 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Idf4ed55533c46925638a466e9713465d710b6845
Diffstat (limited to 'src/layout.c')
-rw-r--r--src/layout.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/layout.c b/src/layout.c
index 60197b0..f5beb9f 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -285,6 +285,98 @@ skip_config_check:
}
void
+ivi_layout_fullscreen_committed(struct ivi_surface *surface)
+{
+ struct ivi_compositor *ivi = surface->ivi;
+
+ struct weston_desktop_surface *dsurface = surface->dsurface;
+ struct weston_surface *wsurface =
+ weston_desktop_surface_get_surface(dsurface);
+
+ struct ivi_output *output = surface->split.output;
+ struct weston_output *woutput = output->output;
+
+ struct weston_view *view = surface->view;
+ struct weston_geometry geom;
+
+ if (surface->view->is_mapped)
+ return;
+
+ geom = weston_desktop_surface_get_geometry(dsurface);
+ weston_log("(fs) geom x %d, y %d, width %d, height %d\n", geom.x, geom.y,
+ geom.width, geom.height);
+
+ assert(surface->role == IVI_SURFACE_ROLE_FS);
+
+ weston_desktop_surface_set_fullscreen(dsurface, true);
+
+ weston_view_set_output(view, woutput);
+ weston_view_set_position(view, woutput->x, woutput->y);
+ weston_layer_entry_insert(&ivi->fullscreen.view_list, &view->layer_link);
+
+ weston_view_update_transform(view);
+ weston_view_damage_below(view);
+
+ wsurface->is_mapped = true;
+ surface->view->is_mapped = true;
+}
+
+void
+ivi_layout_split_committed(struct ivi_surface *surface)
+{
+ struct ivi_compositor *ivi = surface->ivi;
+
+ struct weston_desktop_surface *dsurface = surface->dsurface;
+ struct weston_surface *wsurface =
+ weston_desktop_surface_get_surface(dsurface);
+
+ struct ivi_output *output = surface->split.output;
+ struct weston_output *woutput = output->output;
+
+ struct weston_view *view = surface->view;
+ struct weston_geometry geom;
+ int x;
+ int y;
+
+ x = woutput->x;
+ y = woutput->y;
+
+ if (surface->view->is_mapped)
+ return;
+
+ geom = weston_desktop_surface_get_geometry(dsurface);
+ weston_log("(split) geom x %d, y %d, width %d, height %d\n", geom.x, geom.y,
+ geom.width, geom.height);
+
+ assert(surface->role == IVI_SURFACE_ROLE_SPLIT_H ||
+ surface->role == IVI_SURFACE_ROLE_SPLIT_V);
+
+ weston_view_set_output(view, woutput);
+
+ switch (surface->role) {
+ case IVI_SURFACE_ROLE_SPLIT_V:
+ x += woutput->width - geom.width;
+ output->area.width -= geom.width;
+ break;
+ case IVI_SURFACE_ROLE_SPLIT_H:
+ output->area.y += geom.height;
+ output->area.height -= geom.height;
+ break;
+ default:
+ abort();
+ }
+
+ weston_view_set_position(view, x, y);
+ weston_layer_entry_insert(&ivi->normal.view_list, &view->layer_link);
+
+ weston_view_update_transform(view);
+ weston_view_damage_below(view);
+
+ wsurface->is_mapped = true;
+ surface->view->is_mapped = true;
+}
+
+void
ivi_layout_popup_committed(struct ivi_surface *surface)
{
struct ivi_compositor *ivi = surface->ivi;