summaryrefslogtreecommitdiff
path: root/kiosk-shell
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman@collabora.com>2022-11-09 13:39:08 -0600
committerDerek Foreman <derek.foreman@collabora.com>2023-06-12 16:55:19 -0500
commit244dc963b93fa17ba9f0f817703e704df52d37d1 (patch)
tree1d7b61e5bf32059330dd03215f411d8581c844c4 /kiosk-shell
parentfff8dbd9b8ed22bd92eceb8dce16aa540ab4a41a (diff)
libweston: use weston_coord for weston_view_set_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Diffstat (limited to 'kiosk-shell')
-rw-r--r--kiosk-shell/kiosk-shell-grab.c13
-rw-r--r--kiosk-shell/kiosk-shell.c21
2 files changed, 21 insertions, 13 deletions
diff --git a/kiosk-shell/kiosk-shell-grab.c b/kiosk-shell/kiosk-shell-grab.c
index 1a4db85a..86363f82 100644
--- a/kiosk-shell/kiosk-shell-grab.c
+++ b/kiosk-shell/kiosk-shell-grab.c
@@ -76,7 +76,7 @@ pointer_move_grab_motion(struct weston_pointer_grab *pointer_grab,
struct weston_pointer *pointer = pointer_grab->pointer;
struct kiosk_shell_surface *shsurf = shgrab->shsurf;
struct weston_surface *surface;
- int dx, dy;
+ struct weston_coord_global pos;
weston_pointer_move(pointer, event);
@@ -85,10 +85,11 @@ pointer_move_grab_motion(struct weston_pointer_grab *pointer_grab,
surface = weston_desktop_surface_get_surface(shsurf->desktop_surface);
- dx = pointer->pos.c.x + wl_fixed_to_double(shgrab->dx);
- dy = pointer->pos.c.y + wl_fixed_to_double(shgrab->dy);
+ pos = pointer->pos;
+ pos.c.x += wl_fixed_to_double(shgrab->dx);
+ pos.c.y += wl_fixed_to_double(shgrab->dy);
- weston_view_set_position(shsurf->view, dx, dy);
+ weston_view_set_position(shsurf->view, pos);
weston_compositor_schedule_repaint(surface->compositor);
}
@@ -162,6 +163,7 @@ touch_move_grab_motion(struct weston_touch_grab *touch_grab,
struct weston_touch *touch = touch_grab->touch;
struct kiosk_shell_surface *shsurf = shgrab->shsurf;
struct weston_surface *surface;
+ struct weston_coord_global pos;
int dx, dy;
if (!shsurf || !shgrab->active)
@@ -172,7 +174,8 @@ touch_move_grab_motion(struct weston_touch_grab *touch_grab,
dx = wl_fixed_to_int(touch->grab_x + shgrab->dx);
dy = wl_fixed_to_int(touch->grab_y + shgrab->dy);
- weston_view_set_position(shsurf->view, dx, dy);
+ pos.c = weston_coord(dx, dy);
+ weston_view_set_position(shsurf->view, pos);
weston_compositor_schedule_repaint(surface->compositor);
}
diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c
index 19c32650..418891fd 100644
--- a/kiosk-shell/kiosk-shell.c
+++ b/kiosk-shell/kiosk-shell.c
@@ -781,12 +781,14 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
weston_shell_utils_center_on_output(shsurf->view,
shsurf->output);
} else {
+ struct weston_coord_global tmp;
struct weston_geometry geometry =
weston_desktop_surface_get_geometry(desktop_surface);
float x = shsurf->xwayland.x - geometry.x;
float y = shsurf->xwayland.y - geometry.y;
- weston_view_set_position(shsurf->view, x, y);
+ tmp.c = weston_coord(x, y);
+ weston_view_set_position(shsurf->view, tmp);
}
weston_view_update_transform(shsurf->view);
@@ -822,7 +824,7 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
pos.c = weston_coord_add(shsurf->view->geometry.pos_offset,
offset.c);
- weston_view_set_position(shsurf->view, pos.c.x, pos.c.y);
+ weston_view_set_position(shsurf->view, pos);
weston_view_update_transform(shsurf->view);
}
@@ -1128,23 +1130,26 @@ kiosk_shell_handle_output_moved(struct wl_listener *listener, void *data)
container_of(listener, struct kiosk_shell, output_moved_listener);
struct weston_output *output = data;
struct weston_view *view;
+ struct weston_coord_global pos;
wl_list_for_each(view, &shell->background_layer.view_list.link,
layer_link.link) {
if (view->output != output)
continue;
- weston_view_set_position(view,
- view->geometry.pos_offset.x + output->move_x,
- view->geometry.pos_offset.y + output->move_y);
+ pos.c = view->geometry.pos_offset;
+ pos.c.x += output->move_x;
+ pos.c.y += output->move_y;
+ weston_view_set_position(view, pos);
}
wl_list_for_each(view, &shell->normal_layer.view_list.link,
layer_link.link) {
if (view->output != output)
continue;
- weston_view_set_position(view,
- view->geometry.pos_offset.x + output->move_x,
- view->geometry.pos_offset.y + output->move_y);
+ pos.c = view->geometry.pos_offset;
+ pos.c.x += output->move_x;
+ pos.c.x += output->move_y;
+ weston_view_set_position(view, pos);
}
}