summaryrefslogtreecommitdiff
path: root/ivi-shell/ivi-layout.c
diff options
context:
space:
mode:
authorTomohito Esaki <etom@igel.co.jp>2023-04-17 15:34:20 +0900
committerMarius Vlad <marius.vlad0@gmail.com>2023-10-16 16:24:19 +0000
commit0e082315d75ab8bb7d206e36553e0a5a4b1bdc4b (patch)
tree9bdf38f2b167028d79123f188756c998f20bc378 /ivi-shell/ivi-layout.c
parentec3e2d2d36008bf85182f2a89f7184e455e01117 (diff)
ivi-shell: activate desktop surface
The keyboard focus is active, but the desktop surface itself is not displayed as active. Therefore, the surface should also be displayed as active, as in kiosk-shell. Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Diffstat (limited to 'ivi-shell/ivi-layout.c')
-rw-r--r--ivi-shell/ivi-layout.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 91f862c0..1c654798 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -1777,6 +1777,67 @@ ivi_layout_surface_set_id(struct ivi_layout_surface *ivisurf,
}
static void
+deactivate_current_surface(struct weston_seat *seat)
+{
+ struct ivi_layout_surface *ivisurf =
+ shell_get_focused_ivi_layout_surface(seat);
+ struct weston_desktop_surface *desktop_surface;
+
+ if (!ivisurf)
+ return;
+
+ shell_set_focused_ivi_layout_surface(NULL, seat);
+ desktop_surface = ivisurf->weston_desktop_surface;
+ if (--ivisurf->focus_count == 0 && desktop_surface)
+ weston_desktop_surface_set_activated(desktop_surface, false);
+}
+
+static void
+surface_activate(struct ivi_layout_surface *ivisurf, struct weston_seat *seat)
+{
+ struct weston_desktop_surface *dsurf = ivisurf->weston_desktop_surface;
+
+ deactivate_current_surface(seat);
+
+ shell_set_focused_ivi_layout_surface(ivisurf, seat);
+ if (ivisurf->focus_count++ == 0 && dsurf)
+ weston_desktop_surface_set_activated(dsurf, true);
+}
+
+static void
+ivi_layout_surface_activate(struct ivi_layout_surface *ivisurf)
+{
+ struct weston_seat *seat;
+
+ assert(ivisurf->ivi_view);
+
+ wl_list_for_each(seat, &ivisurf->surface->compositor->seat_list, link) {
+ weston_view_activate_input(ivisurf->ivi_view->view, seat,
+ WESTON_ACTIVATE_FLAG_NONE);
+ surface_activate(ivisurf, seat);
+ }
+}
+
+static bool
+ivi_layout_surface_is_active(struct ivi_layout_surface *ivisurf)
+{
+ assert(ivisurf);
+
+ return (ivisurf->focus_count > 0);
+}
+
+void
+ivi_layout_surface_activate_with_seat(struct ivi_layout_surface *ivisurf,
+ struct weston_seat *seat,
+ uint32_t activate_flags)
+{
+ weston_view_activate_input(ivisurf->ivi_view->view,
+ seat, activate_flags);
+
+ surface_activate(ivisurf, seat);
+}
+
+static void
ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
enum ivi_layout_transition_type type,
uint32_t duration)
@@ -2123,6 +2184,8 @@ static struct ivi_layout_interface ivi_layout_interface = {
.surface_set_transition = ivi_layout_surface_set_transition,
.surface_set_transition_duration = ivi_layout_surface_set_transition_duration,
.surface_set_id = ivi_layout_surface_set_id,
+ .surface_activate = ivi_layout_surface_activate,
+ .surface_is_active = ivi_layout_surface_is_active,
/**
* layer controller interfaces