kiosk-shell: Use weston_coord for grabs
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
643c9b929f
commit
aea5ca97ae
@ -32,7 +32,7 @@ struct kiosk_shell_grab {
|
|||||||
|
|
||||||
struct weston_pointer_grab pointer_grab;
|
struct weston_pointer_grab pointer_grab;
|
||||||
struct weston_touch_grab touch_grab;
|
struct weston_touch_grab touch_grab;
|
||||||
wl_fixed_t dx, dy;
|
struct weston_coord_global delta;
|
||||||
bool active;
|
bool active;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,9 +85,7 @@ pointer_move_grab_motion(struct weston_pointer_grab *pointer_grab,
|
|||||||
|
|
||||||
surface = weston_desktop_surface_get_surface(shsurf->desktop_surface);
|
surface = weston_desktop_surface_get_surface(shsurf->desktop_surface);
|
||||||
|
|
||||||
pos = pointer->pos;
|
pos = weston_coord_global_add(pointer->pos, shgrab->delta);
|
||||||
pos.c.x += wl_fixed_to_double(shgrab->dx);
|
|
||||||
pos.c.y += wl_fixed_to_double(shgrab->dy);
|
|
||||||
|
|
||||||
weston_view_set_position(shsurf->view, pos);
|
weston_view_set_position(shsurf->view, pos);
|
||||||
|
|
||||||
@ -164,17 +162,13 @@ touch_move_grab_motion(struct weston_touch_grab *touch_grab,
|
|||||||
struct kiosk_shell_surface *shsurf = shgrab->shsurf;
|
struct kiosk_shell_surface *shsurf = shgrab->shsurf;
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct weston_coord_global pos;
|
struct weston_coord_global pos;
|
||||||
int dx, dy;
|
|
||||||
|
|
||||||
if (!shsurf || !shgrab->active)
|
if (!shsurf || !shgrab->active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
surface = weston_desktop_surface_get_surface(shsurf->desktop_surface);
|
surface = weston_desktop_surface_get_surface(shsurf->desktop_surface);
|
||||||
|
|
||||||
dx = touch->grab_pos.c.x + wl_fixed_to_double(shgrab->dx);
|
pos = weston_coord_global_add(touch->grab_pos, shgrab->delta);
|
||||||
dy = touch->grab_pos.c.y + wl_fixed_to_double(shgrab->dy);
|
|
||||||
|
|
||||||
pos.c = weston_coord(dx, dy);
|
|
||||||
pos.c = weston_coord_truncate(pos.c);
|
pos.c = weston_coord_truncate(pos.c);
|
||||||
weston_view_set_position(shsurf->view, pos);
|
weston_view_set_position(shsurf->view, pos);
|
||||||
|
|
||||||
@ -242,7 +236,6 @@ kiosk_shell_grab_start_for_pointer_move(struct kiosk_shell_surface *shsurf,
|
|||||||
struct weston_pointer *pointer)
|
struct weston_pointer *pointer)
|
||||||
{
|
{
|
||||||
struct kiosk_shell_grab *shgrab;
|
struct kiosk_shell_grab *shgrab;
|
||||||
struct weston_coord_global offset;
|
|
||||||
|
|
||||||
if (!shsurf)
|
if (!shsurf)
|
||||||
return KIOSK_SHELL_GRAB_RESULT_ERROR;
|
return KIOSK_SHELL_GRAB_RESULT_ERROR;
|
||||||
@ -256,11 +249,9 @@ kiosk_shell_grab_start_for_pointer_move(struct kiosk_shell_surface *shsurf,
|
|||||||
if (!shgrab)
|
if (!shgrab)
|
||||||
return KIOSK_SHELL_GRAB_RESULT_ERROR;
|
return KIOSK_SHELL_GRAB_RESULT_ERROR;
|
||||||
|
|
||||||
offset.c = weston_coord_sub(
|
shgrab->delta = weston_coord_global_sub(
|
||||||
weston_view_get_pos_offset_global(shsurf->view).c,
|
weston_view_get_pos_offset_global(shsurf->view),
|
||||||
pointer->grab_pos.c);
|
pointer->grab_pos);
|
||||||
shgrab->dx = wl_fixed_from_double(offset.c.x);
|
|
||||||
shgrab->dy = wl_fixed_from_double(offset.c.y);
|
|
||||||
shgrab->active = true;
|
shgrab->active = true;
|
||||||
|
|
||||||
weston_seat_break_desktop_grabs(pointer->seat);
|
weston_seat_break_desktop_grabs(pointer->seat);
|
||||||
@ -276,7 +267,6 @@ kiosk_shell_grab_start_for_touch_move(struct kiosk_shell_surface *shsurf,
|
|||||||
struct weston_touch *touch)
|
struct weston_touch *touch)
|
||||||
{
|
{
|
||||||
struct kiosk_shell_grab *shgrab;
|
struct kiosk_shell_grab *shgrab;
|
||||||
struct weston_coord_global pos;
|
|
||||||
|
|
||||||
if (!shsurf)
|
if (!shsurf)
|
||||||
return KIOSK_SHELL_GRAB_RESULT_ERROR;
|
return KIOSK_SHELL_GRAB_RESULT_ERROR;
|
||||||
@ -290,11 +280,9 @@ kiosk_shell_grab_start_for_touch_move(struct kiosk_shell_surface *shsurf,
|
|||||||
if (!shgrab)
|
if (!shgrab)
|
||||||
return KIOSK_SHELL_GRAB_RESULT_ERROR;
|
return KIOSK_SHELL_GRAB_RESULT_ERROR;
|
||||||
|
|
||||||
pos.c = weston_coord_sub(
|
shgrab->delta = weston_coord_global_sub(
|
||||||
weston_view_get_pos_offset_global(shsurf->view).c,
|
weston_view_get_pos_offset_global(shsurf->view),
|
||||||
touch->grab_pos.c);
|
touch->grab_pos);
|
||||||
shgrab->dx = wl_fixed_from_double(pos.c.x);
|
|
||||||
shgrab->dy = wl_fixed_from_double(pos.c.y);
|
|
||||||
shgrab->active = true;
|
shgrab->active = true;
|
||||||
|
|
||||||
weston_seat_break_desktop_grabs(touch->seat);
|
weston_seat_break_desktop_grabs(touch->seat);
|
||||||
|
Loading…
Reference in New Issue
Block a user