aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2019-01-13 20:40:42 -0500
committerLibravatar GitHub <noreply@github.com>2019-01-13 20:40:42 -0500
commit9f9ef761753e11235c85c232e7521506cfea512d (patch)
tree1f391e6a4a1d7d6d8eef0dc894d4c165ba7fbdbd /sway/input/cursor.c
parentMerge pull request #3342 from RedSoxFan/scroll-buttons-improved (diff)
parentseat_cmd_cursor: utilize mouse button helpers (diff)
downloadsway-9f9ef761753e11235c85c232e7521506cfea512d.tar.gz
sway-9f9ef761753e11235c85c232e7521506cfea512d.tar.zst
sway-9f9ef761753e11235c85c232e7521506cfea512d.zip
Merge pull request #3343 from RedSoxFan/seat-cursor-buttons-improved
Improve mouse button parsing: seat cursor buttons
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index c65548c3..08222494 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -716,11 +716,13 @@ static uint32_t wl_axis_to_button(struct wlr_event_pointer_axis *event) {
716 } 716 }
717} 717}
718 718
719static void dispatch_cursor_axis(struct sway_cursor *cursor, 719void dispatch_cursor_axis(struct sway_cursor *cursor,
720 struct wlr_event_pointer_axis *event) { 720 struct wlr_event_pointer_axis *event) {
721 struct sway_seat *seat = cursor->seat; 721 struct sway_seat *seat = cursor->seat;
722 struct sway_input_device *input_device = event->device->data; 722 struct sway_input_device *input_device =
723 struct input_config *ic = input_device_get_config(input_device); 723 event->device ? event->device->data : NULL;
724 struct input_config *ic =
725 input_device ? input_device_get_config(input_device) : NULL;
724 726
725 // Determine what's under the cursor 727 // Determine what's under the cursor
726 struct wlr_surface *surface = NULL; 728 struct wlr_surface *surface = NULL;
@@ -743,7 +745,8 @@ static void dispatch_cursor_axis(struct sway_cursor *cursor,
743 // Gather information needed for mouse bindings 745 // Gather information needed for mouse bindings
744 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat); 746 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
745 uint32_t modifiers = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0; 747 uint32_t modifiers = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
746 struct wlr_input_device *device = input_device->wlr_device; 748 struct wlr_input_device *device =
749 input_device ? input_device->wlr_device : NULL;
747 char *dev_id = device ? input_device_get_identifier(device) : strdup("*"); 750 char *dev_id = device ? input_device_get_identifier(device) : strdup("*");
748 uint32_t button = wl_axis_to_button(event); 751 uint32_t button = wl_axis_to_button(event);
749 752