mirror of
https://github.com/labwc/labwc.git
synced 2026-04-13 08:21:15 -04:00
Only calculate offset points if needed
This commit is contained in:
parent
eb19d10d6d
commit
5df63feea5
1 changed files with 7 additions and 7 deletions
|
|
@ -58,10 +58,10 @@ touch_motion(struct wl_listener *listener, void *data)
|
||||||
struct touch_point *touch_point;
|
struct touch_point *touch_point;
|
||||||
wl_list_for_each(touch_point, &seat->touch_points, link) {
|
wl_list_for_each(touch_point, &seat->touch_points, link) {
|
||||||
if (touch_point->touch_id == event->touch_id) {
|
if (touch_point->touch_id == event->touch_id) {
|
||||||
double sx = lx - touch_point->x_offset;
|
|
||||||
double sy = ly - touch_point->y_offset;
|
|
||||||
|
|
||||||
if (touch_point->surface) {
|
if (touch_point->surface) {
|
||||||
|
double sx = lx - touch_point->x_offset;
|
||||||
|
double sy = ly - touch_point->y_offset;
|
||||||
|
|
||||||
wlr_seat_touch_notify_motion(seat->seat, event->time_msec,
|
wlr_seat_touch_notify_motion(seat->seat, event->time_msec,
|
||||||
event->touch_id, sx, sy);
|
event->touch_id, sx, sy);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -102,11 +102,11 @@ touch_down(struct wl_listener *listener, void *data)
|
||||||
wlr_cursor_absolute_to_layout_coords(seat->cursor, &event->touch->base,
|
wlr_cursor_absolute_to_layout_coords(seat->cursor, &event->touch->base,
|
||||||
event->x, event->y, &lx, &ly);
|
event->x, event->y, &lx, &ly);
|
||||||
|
|
||||||
/* Apply offsets to get surface coords before reporting event */
|
|
||||||
double sx = lx - x_offset;
|
|
||||||
double sy = ly - y_offset;
|
|
||||||
|
|
||||||
if (touch_point->surface) {
|
if (touch_point->surface) {
|
||||||
|
/* Apply offsets to get surface coords before reporting event */
|
||||||
|
double sx = lx - x_offset;
|
||||||
|
double sy = ly - y_offset;
|
||||||
|
|
||||||
wlr_seat_touch_notify_down(seat->seat, touch_point->surface,
|
wlr_seat_touch_notify_down(seat->seat, touch_point->surface,
|
||||||
event->time_msec, event->touch_id, sx, sy);
|
event->time_msec, event->touch_id, sx, sy);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue