aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Mark Bolhuis <mark@bolhuis.dev>2023-06-26 21:43:13 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2023-06-26 22:57:46 +0200
commit20c91335f6ba515e43b444fafd52b822bd460eda (patch)
treedd7b8bf58795108127336a75933f190fd89ef244
parentUse "default" XCursor instead of "left_ptr" (diff)
downloadsway-20c91335f6ba515e43b444fafd52b822bd460eda.tar.gz
sway-20c91335f6ba515e43b444fafd52b822bd460eda.tar.zst
sway-20c91335f6ba515e43b444fafd52b822bd460eda.zip
input: Move wlr_pointer_gestures_v1 to sway_input_manager
On multi-seat configurations a zwp_pointer_gestures_v1 global was created for every seat. Instead, create the global once in the input manager, to be shared across all seats.
-rw-r--r--include/sway/input/cursor.h1
-rw-r--r--include/sway/input/input-manager.h1
-rw-r--r--sway/input/cursor.c3
-rw-r--r--sway/input/input-manager.c2
-rw-r--r--sway/input/seatop_default.c16
5 files changed, 11 insertions, 12 deletions
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h
index c7da8829..1636588a 100644
--- a/include/sway/input/cursor.h
+++ b/include/sway/input/cursor.h
@@ -35,7 +35,6 @@ struct sway_cursor {
35 pixman_region32_t confine; // invalid if active_constraint == NULL 35 pixman_region32_t confine; // invalid if active_constraint == NULL
36 bool active_confine_requires_warp; 36 bool active_confine_requires_warp;
37 37
38 struct wlr_pointer_gestures_v1 *pointer_gestures;
39 struct wl_listener hold_begin; 38 struct wl_listener hold_begin;
40 struct wl_listener hold_end; 39 struct wl_listener hold_end;
41 struct wl_listener pinch_begin; 40 struct wl_listener pinch_begin;
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h
index c9bd08f0..b651e3dd 100644
--- a/include/sway/input/input-manager.h
+++ b/include/sway/input/input-manager.h
@@ -25,6 +25,7 @@ struct sway_input_manager {
25 struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit; 25 struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
26 struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; 26 struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
27 struct wlr_virtual_pointer_manager_v1 *virtual_pointer; 27 struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
28 struct wlr_pointer_gestures_v1 *pointer_gestures;
28 29
29 struct wl_listener new_input; 30 struct wl_listener new_input;
30 struct wl_listener inhibit_activate; 31 struct wl_listener inhibit_activate;
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 7a4dd19f..f970e6a2 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -1154,9 +1154,6 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) {
1154 wl_list_init(&cursor->image_surface_destroy.link); 1154 wl_list_init(&cursor->image_surface_destroy.link);
1155 cursor->image_surface_destroy.notify = handle_image_surface_destroy; 1155 cursor->image_surface_destroy.notify = handle_image_surface_destroy;
1156 1156
1157 // gesture events
1158 cursor->pointer_gestures = wlr_pointer_gestures_v1_create(server.wl_display);
1159
1160 wl_signal_add(&wlr_cursor->events.hold_begin, &cursor->hold_begin); 1157 wl_signal_add(&wlr_cursor->events.hold_begin, &cursor->hold_begin);
1161 cursor->hold_begin.notify = handle_pointer_hold_begin; 1158 cursor->hold_begin.notify = handle_pointer_hold_begin;
1162 wl_signal_add(&wlr_cursor->events.hold_end, &cursor->hold_end); 1159 wl_signal_add(&wlr_cursor->events.hold_end, &cursor->hold_end);
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 5f7dfb42..db82bb4c 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -495,6 +495,8 @@ struct sway_input_manager *input_manager_create(struct sway_server *server) {
495 wl_signal_add(&input->keyboard_shortcuts_inhibit->events.new_inhibitor, 495 wl_signal_add(&input->keyboard_shortcuts_inhibit->events.new_inhibitor,
496 &input->keyboard_shortcuts_inhibit_new_inhibitor); 496 &input->keyboard_shortcuts_inhibit_new_inhibitor);
497 497
498 input->pointer_gestures = wlr_pointer_gestures_v1_create(server->wl_display);
499
498 return input; 500 return input;
499} 501}
500 502
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index f4c63808..1dce6dae 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -949,7 +949,7 @@ static void handle_hold_begin(struct sway_seat *seat,
949 // ... otherwise forward to client 949 // ... otherwise forward to client
950 struct sway_cursor *cursor = seat->cursor; 950 struct sway_cursor *cursor = seat->cursor;
951 wlr_pointer_gestures_v1_send_hold_begin( 951 wlr_pointer_gestures_v1_send_hold_begin(
952 cursor->pointer_gestures, cursor->seat->wlr_seat, 952 server.input->pointer_gestures, cursor->seat->wlr_seat,
953 event->time_msec, event->fingers); 953 event->time_msec, event->fingers);
954 } 954 }
955} 955}
@@ -961,7 +961,7 @@ static void handle_hold_end(struct sway_seat *seat,
961 if (!gesture_tracker_check(&seatop->gestures, GESTURE_TYPE_HOLD)) { 961 if (!gesture_tracker_check(&seatop->gestures, GESTURE_TYPE_HOLD)) {
962 struct sway_cursor *cursor = seat->cursor; 962 struct sway_cursor *cursor = seat->cursor;
963 wlr_pointer_gestures_v1_send_hold_end( 963 wlr_pointer_gestures_v1_send_hold_end(
964 cursor->pointer_gestures, cursor->seat->wlr_seat, 964 server.input->pointer_gestures, cursor->seat->wlr_seat,
965 event->time_msec, event->cancelled); 965 event->time_msec, event->cancelled);
966 return; 966 return;
967 } 967 }
@@ -994,7 +994,7 @@ static void handle_pinch_begin(struct sway_seat *seat,
994 // ... otherwise forward to client 994 // ... otherwise forward to client
995 struct sway_cursor *cursor = seat->cursor; 995 struct sway_cursor *cursor = seat->cursor;
996 wlr_pointer_gestures_v1_send_pinch_begin( 996 wlr_pointer_gestures_v1_send_pinch_begin(
997 cursor->pointer_gestures, cursor->seat->wlr_seat, 997 server.input->pointer_gestures, cursor->seat->wlr_seat,
998 event->time_msec, event->fingers); 998 event->time_msec, event->fingers);
999 } 999 }
1000} 1000}
@@ -1010,7 +1010,7 @@ static void handle_pinch_update(struct sway_seat *seat,
1010 // ... otherwise forward to client 1010 // ... otherwise forward to client
1011 struct sway_cursor *cursor = seat->cursor; 1011 struct sway_cursor *cursor = seat->cursor;
1012 wlr_pointer_gestures_v1_send_pinch_update( 1012 wlr_pointer_gestures_v1_send_pinch_update(
1013 cursor->pointer_gestures, 1013 server.input->pointer_gestures,
1014 cursor->seat->wlr_seat, 1014 cursor->seat->wlr_seat,
1015 event->time_msec, event->dx, event->dy, 1015 event->time_msec, event->dx, event->dy,
1016 event->scale, event->rotation); 1016 event->scale, event->rotation);
@@ -1024,7 +1024,7 @@ static void handle_pinch_end(struct sway_seat *seat,
1024 if (!gesture_tracker_check(&seatop->gestures, GESTURE_TYPE_PINCH)) { 1024 if (!gesture_tracker_check(&seatop->gestures, GESTURE_TYPE_PINCH)) {
1025 struct sway_cursor *cursor = seat->cursor; 1025 struct sway_cursor *cursor = seat->cursor;
1026 wlr_pointer_gestures_v1_send_pinch_end( 1026 wlr_pointer_gestures_v1_send_pinch_end(
1027 cursor->pointer_gestures, cursor->seat->wlr_seat, 1027 server.input->pointer_gestures, cursor->seat->wlr_seat,
1028 event->time_msec, event->cancelled); 1028 event->time_msec, event->cancelled);
1029 return; 1029 return;
1030 } 1030 }
@@ -1057,7 +1057,7 @@ static void handle_swipe_begin(struct sway_seat *seat,
1057 // ... otherwise forward to client 1057 // ... otherwise forward to client
1058 struct sway_cursor *cursor = seat->cursor; 1058 struct sway_cursor *cursor = seat->cursor;
1059 wlr_pointer_gestures_v1_send_swipe_begin( 1059 wlr_pointer_gestures_v1_send_swipe_begin(
1060 cursor->pointer_gestures, cursor->seat->wlr_seat, 1060 server.input->pointer_gestures, cursor->seat->wlr_seat,
1061 event->time_msec, event->fingers); 1061 event->time_msec, event->fingers);
1062 } 1062 }
1063} 1063}
@@ -1074,7 +1074,7 @@ static void handle_swipe_update(struct sway_seat *seat,
1074 // ... otherwise forward to client 1074 // ... otherwise forward to client
1075 struct sway_cursor *cursor = seat->cursor; 1075 struct sway_cursor *cursor = seat->cursor;
1076 wlr_pointer_gestures_v1_send_swipe_update( 1076 wlr_pointer_gestures_v1_send_swipe_update(
1077 cursor->pointer_gestures, cursor->seat->wlr_seat, 1077 server.input->pointer_gestures, cursor->seat->wlr_seat,
1078 event->time_msec, event->dx, event->dy); 1078 event->time_msec, event->dx, event->dy);
1079 } 1079 }
1080} 1080}
@@ -1085,7 +1085,7 @@ static void handle_swipe_end(struct sway_seat *seat,
1085 struct seatop_default_event *seatop = seat->seatop_data; 1085 struct seatop_default_event *seatop = seat->seatop_data;
1086 if (!gesture_tracker_check(&seatop->gestures, GESTURE_TYPE_SWIPE)) { 1086 if (!gesture_tracker_check(&seatop->gestures, GESTURE_TYPE_SWIPE)) {
1087 struct sway_cursor *cursor = seat->cursor; 1087 struct sway_cursor *cursor = seat->cursor;
1088 wlr_pointer_gestures_v1_send_swipe_end(cursor->pointer_gestures, 1088 wlr_pointer_gestures_v1_send_swipe_end(server.input->pointer_gestures,
1089 cursor->seat->wlr_seat, event->time_msec, event->cancelled); 1089 cursor->seat->wlr_seat, event->time_msec, event->cancelled);
1090 return; 1090 return;
1091 } 1091 }