mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
Merge branch 'touch-patched' into touch-gestures
This commit is contained in:
commit
1a2cc72bf4
2 changed files with 12 additions and 22 deletions
|
|
@ -173,8 +173,6 @@ void gesture_consume(TouchGroup *tg, TouchPoint *t) {
|
||||||
void gesture_touch_down(TouchGroup *tg, TouchPoint *t, double x, double y) {
|
void gesture_touch_down(TouchGroup *tg, TouchPoint *t, double x, double y) {
|
||||||
wlr_log(WLR_DEBUG, "touch_down id: %d", t->touch_id);
|
wlr_log(WLR_DEBUG, "touch_down id: %d", t->touch_id);
|
||||||
|
|
||||||
t->start_x = x;
|
|
||||||
t->start_y = y;
|
|
||||||
t->end_x = x;
|
t->end_x = x;
|
||||||
t->end_y = y;
|
t->end_y = y;
|
||||||
|
|
||||||
|
|
|
||||||
32
src/mango.c
32
src/mango.c
|
|
@ -481,7 +481,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
int32_t touch_id;
|
int32_t touch_id;
|
||||||
double start_x, start_y, end_x, end_y;
|
double start_x, start_y, end_x, end_y, start_surface_x, start_surface_y;
|
||||||
bool consumed_by_gesture;
|
bool consumed_by_gesture;
|
||||||
} TouchPoint;
|
} TouchPoint;
|
||||||
|
|
||||||
|
|
@ -5975,11 +5975,15 @@ void touchdown(struct wl_listener *listener, void *data) {
|
||||||
event->y, &lx, &ly);
|
event->y, &lx, &ly);
|
||||||
|
|
||||||
t->touch_id = event->touch_id;
|
t->touch_id = event->touch_id;
|
||||||
|
t->start_x = lx;
|
||||||
|
t->start_y = ly;
|
||||||
gesture_touch_down(tg, t, lx, ly);
|
gesture_touch_down(tg, t, lx, ly);
|
||||||
wl_list_insert(&tg->touch_points, &t->link);
|
wl_list_insert(&tg->touch_points, &t->link);
|
||||||
|
|
||||||
/* Find the client under the pointer and send the event along. */
|
/* Find the client under the pointer and send the event along. */
|
||||||
xytonode(lx, ly, &surface, &c, NULL, &sx, &sy);
|
xytonode(lx, ly, &surface, &c, NULL, &sx, &sy);
|
||||||
|
t->start_surface_x = sx;
|
||||||
|
t->start_surface_y = sy;
|
||||||
if (surface != NULL && wlr_surface_accepts_touch(surface, seat)) {
|
if (surface != NULL && wlr_surface_accepts_touch(surface, seat)) {
|
||||||
if (c)
|
if (c)
|
||||||
focusclient(c, 0);
|
focusclient(c, 0);
|
||||||
|
|
@ -6074,10 +6078,8 @@ void touchmotion(struct wl_listener *listener, void *data) {
|
||||||
double lx, ly;
|
double lx, ly;
|
||||||
double sx, sy;
|
double sx, sy;
|
||||||
double dx, dy;
|
double dx, dy;
|
||||||
int32_t node_x, node_y;
|
|
||||||
struct wlr_surface *surface;
|
struct wlr_surface *surface;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
struct wlr_scene_tree *tree;
|
|
||||||
struct wlr_touch_point *p = NULL;
|
struct wlr_touch_point *p = NULL;
|
||||||
|
|
||||||
wl_list_for_each(t_iter, &tg->touch_points, link) {
|
wl_list_for_each(t_iter, &tg->touch_points, link) {
|
||||||
|
|
@ -6109,29 +6111,19 @@ void touchmotion(struct wl_listener *listener, void *data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sx = t->start_surface_x + (lx - t->start_x);
|
||||||
|
sy = t->start_surface_y + (ly - t->start_y);
|
||||||
|
|
||||||
surface = p->surface;
|
surface = p->surface;
|
||||||
if (surface && surface->data) {
|
if (surface && surface->data) {
|
||||||
tree = surface->data;
|
|
||||||
wlr_scene_node_coords(&tree->node, &node_x, &node_y);
|
|
||||||
sx = lx - node_x;
|
|
||||||
sy = ly - node_y;
|
|
||||||
|
|
||||||
toplevel_from_wlr_surface(surface, &c, NULL);
|
toplevel_from_wlr_surface(surface, &c, NULL);
|
||||||
if (c)
|
if (c)
|
||||||
focusclient(c, 0);
|
focusclient(c, 0);
|
||||||
|
|
||||||
wlr_seat_touch_point_focus(seat, surface, event->time_msec,
|
|
||||||
event->touch_id, sx, sy);
|
|
||||||
wlr_seat_touch_notify_motion(seat, event->time_msec, event->touch_id,
|
|
||||||
sx, sy);
|
|
||||||
|
|
||||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
|
||||||
} else {
|
|
||||||
focusclient(NULL, 0);
|
|
||||||
wlr_seat_touch_point_clear_focus(seat, event->time_msec,
|
|
||||||
event->touch_id);
|
|
||||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
|
||||||
}
|
}
|
||||||
|
wlr_seat_touch_notify_motion(seat, event->time_msec, event->touch_id, sx,
|
||||||
|
sy);
|
||||||
|
|
||||||
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void touchcancel(struct wl_listener *listener, void *data) {
|
void touchcancel(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue