diff options
author | Chris Dalton <csmartdalton@gmail.com> | 2021-11-23 12:27:48 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-11-23 12:27:48 +0000 |
commit | ee93e327ba31e8efb1b7de6209bdc992778b809b (patch) | |
tree | 9ff64321d9f6787a5433f5d4ab7bddc915fee6a6 | |
parent | b771b6b5fe2ec36d23c21ab8229b15c80780468c (diff) | |
download | vim-git-ee93e327ba31e8efb1b7de6209bdc992778b809b.tar.gz |
patch 8.2.3654: GTK: a touch-drag does not update the selectionv8.2.3654
Problem: GTK: a touch-drag does not update the selection.
Solution: Add GDK_BUTTON1_MASK to the state. (Chris Dalton, close #9196,
closes #9194)
-rw-r--r-- | src/gui_gtk_x11.c | 22 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 4e89c4e70..6381a95f6 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -397,6 +397,12 @@ static int using_gnome = 0; #endif /* + * GTK doesn't set the GDK_BUTTON1_MASK state when dragging a touch. Add this + * state when dragging. + */ +static guint dragging_button_state = 0; + +/* * Parse the GUI related command-line arguments. Any arguments used are * deleted from argv, and *argc is decremented accordingly. This is called * when vim is started, whether or not the GUI has been started. @@ -1585,6 +1591,9 @@ process_motion_notify(int x, int y, GdkModifierType state) int_u vim_modifiers; GtkAllocation allocation; + // Need to add GDK_BUTTON1_MASK state when dragging a touch. + state |= dragging_button_state; + button = (state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | GDK_BUTTON5_MASK)) @@ -1811,7 +1820,11 @@ button_press_event(GtkWidget *widget, { // Keep in sync with gui_x11.c. // Buttons 4-7 are handled in scroll_event() - case 1: button = MOUSE_LEFT; break; + case 1: + button = MOUSE_LEFT; + // needed for touch-drag + dragging_button_state |= GDK_BUTTON1_MASK; + break; case 2: button = MOUSE_MIDDLE; break; case 3: button = MOUSE_RIGHT; break; case 8: button = MOUSE_X1; break; @@ -1906,6 +1919,13 @@ button_release_event(GtkWidget *widget UNUSED, gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, vim_modifiers); + switch (event->button) + { + case 1: // MOUSE_LEFT + dragging_button_state = 0; + break; + } + return TRUE; } diff --git a/src/version.c b/src/version.c index 8566cc3ff..f84925212 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3654, +/**/ 3653, /**/ 3652, |