summaryrefslogtreecommitdiff
path: root/kiosk-shell
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman@collabora.com>2023-06-13 12:04:26 -0500
committerPekka Paalanen <pq@iki.fi>2023-06-19 13:09:03 +0000
commitd961e59d4aeb3e4b1c9f8cabdfe7e5a99f807da6 (patch)
treea196cc90038aaf349ff941625e70a4c3b1d93007 /kiosk-shell
parent1f81c082b5fa7eb3de8ed3364603781ece91b00d (diff)
libweston: Add getters for view position/offset
This is stored as an unadorned weston_coord internally, but with getter functions we can put together the appropriate global or surface coordinate. Use them where appropriate. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Diffstat (limited to 'kiosk-shell')
-rw-r--r--kiosk-shell/kiosk-shell-grab.c10
-rw-r--r--kiosk-shell/kiosk-shell.c15
2 files changed, 15 insertions, 10 deletions
diff --git a/kiosk-shell/kiosk-shell-grab.c b/kiosk-shell/kiosk-shell-grab.c
index 73bf44b1..12313caa 100644
--- a/kiosk-shell/kiosk-shell-grab.c
+++ b/kiosk-shell/kiosk-shell-grab.c
@@ -256,8 +256,9 @@ kiosk_shell_grab_start_for_pointer_move(struct kiosk_shell_surface *shsurf,
if (!shgrab)
return KIOSK_SHELL_GRAB_RESULT_ERROR;
- offset.c = weston_coord_sub(shsurf->view->geometry.pos_offset,
- pointer->grab_pos.c);
+ offset.c = weston_coord_sub(
+ weston_view_get_pos_offset_global(shsurf->view).c,
+ pointer->grab_pos.c);
shgrab->dx = wl_fixed_from_double(offset.c.x);
shgrab->dy = wl_fixed_from_double(offset.c.y);
shgrab->active = true;
@@ -289,8 +290,9 @@ kiosk_shell_grab_start_for_touch_move(struct kiosk_shell_surface *shsurf,
if (!shgrab)
return KIOSK_SHELL_GRAB_RESULT_ERROR;
- pos.c = weston_coord_sub(shsurf->view->geometry.pos_offset,
- touch->grab_pos.c);
+ pos.c = weston_coord_sub(
+ weston_view_get_pos_offset_global(shsurf->view).c,
+ touch->grab_pos.c);
shgrab->dx = wl_fixed_from_double(pos.c.x);
shgrab->dy = wl_fixed_from_double(pos.c.y);
shgrab->active = true;
diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c
index 0f66ed48..14bb78a5 100644
--- a/kiosk-shell/kiosk-shell.c
+++ b/kiosk-shell/kiosk-shell.c
@@ -821,8 +821,9 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
from_g = weston_coord_surface_to_global(shsurf->view, from_s);
to_g = weston_coord_surface_to_global(shsurf->view, to_s);
offset.c = weston_coord_sub(to_g.c, from_g.c);
- pos.c = weston_coord_add(shsurf->view->geometry.pos_offset,
- offset.c);
+ pos.c = weston_coord_add(
+ weston_view_get_pos_offset_global(shsurf->view).c,
+ offset.c);
weston_view_set_position(shsurf->view, pos);
weston_view_update_transform(shsurf->view);
@@ -1138,8 +1139,9 @@ kiosk_shell_handle_output_moved(struct wl_listener *listener, void *data)
if (view->output != output)
continue;
- pos.c = weston_coord_add(view->geometry.pos_offset,
- output->move.c);
+ pos.c = weston_coord_add(
+ weston_view_get_pos_offset_global(view).c,
+ output->move.c);
weston_view_set_position(view, pos);
}
@@ -1150,8 +1152,9 @@ kiosk_shell_handle_output_moved(struct wl_listener *listener, void *data)
if (view->output != output)
continue;
- pos.c = weston_coord_add(view->geometry.pos_offset,
- output->move.c);
+ pos.c = weston_coord_add(
+ weston_view_get_pos_offset_global(view).c,
+ output->move.c);
weston_view_set_position(view, pos);
}
}