diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-09-03 16:16:46 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-09-03 16:17:21 +0200 |
commit | 7b88e894897383d80a4f71c6e96d8fd380ce91f3 (patch) | |
tree | a84a34d705f15908dc3044cef260da7048b8b1de | |
parent | 9c2d659d892a95f88a53aef2c7329dada65e9649 (diff) | |
download | fiv-7b88e894897383d80a4f71c6e96d8fd380ce91f3.tar.gz fiv-7b88e894897383d80a4f71c6e96d8fd380ce91f3.tar.xz fiv-7b88e894897383d80a4f71c6e96d8fd380ce91f3.zip |
Allow dragging with the middle mouse button
-rw-r--r-- | fiv-view.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -921,8 +921,18 @@ on_drag_begin(GtkGestureDrag *drag, G_GNUC_UNUSED gdouble start_x, G_GNUC_UNUSED gdouble start_y, gpointer user_data) { GtkGesture *gesture = GTK_GESTURE(drag); - GdkEventSequence *sequence = gtk_gesture_get_last_updated_sequence(gesture); + switch ( + gtk_gesture_single_get_current_button(GTK_GESTURE_SINGLE(gesture))) { + case GDK_BUTTON_PRIMARY: + case GDK_BUTTON_MIDDLE: + break; + default: + gtk_gesture_set_state(gesture, GTK_EVENT_SEQUENCE_DENIED); + return; + } + GdkModifierType state = 0; + GdkEventSequence *sequence = gtk_gesture_get_last_updated_sequence(gesture); gdk_event_get_state(gtk_gesture_get_last_event(gesture, sequence), &state); if (state & gtk_accelerator_get_default_mod_mask()) { gtk_gesture_set_state(gesture, GTK_EVENT_SEQUENCE_DENIED); @@ -1325,6 +1335,7 @@ fiv_view_init(FivView *self) // so we can't change this), hopefully this is mutually exclusive with that. // Though note that the GdkWindow doesn't register for touch events now. gtk_gesture_single_set_exclusive(GTK_GESTURE_SINGLE(drag), TRUE); + gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(drag), 0); g_signal_connect(drag, "drag-begin", G_CALLBACK(on_drag_begin), self); |