diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-12-09 15:04:01 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-12-09 15:04:01 +0000 |
commit | c5dd34344f0c660ceffffb3bf9da43c263db16e1 (patch) | |
tree | d7a8037b0b3d9da9cf5f6d28b2d46ab020fa9307 /gtk | |
parent | c90cc976a5acf591c2ba83fe389af11de207fa59 (diff) | |
parent | 43e484887264595049da292148fcf01bc12a1acc (diff) | |
download | gtk+-c5dd34344f0c660ceffffb3bf9da43c263db16e1.tar.gz |
Merge branch 'wip/carlosg/for-master' into 'master'
Wip/carlosg/for master
Closes #3426 and #3264
See merge request GNOME/gtk!2933
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkmain.c | 17 | ||||
-rw-r--r-- | gtk/gtktextview.c | 4 |
2 files changed, 17 insertions, 4 deletions
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index b9d12e19aa..13aa3dd10e 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -1375,6 +1375,7 @@ handle_pointing_event (GdkEvent *event) GtkWidget *native; GdkEventType type; gboolean has_implicit; + GdkModifierType modifiers; event_widget = gtk_get_event_widget (event); device = gdk_event_get_device (event); @@ -1480,14 +1481,17 @@ handle_pointing_event (GdkEvent *event) gtk_window_lookup_pointer_focus_implicit_grab (toplevel, device, sequence) != NULL; + modifiers = gdk_event_get_modifier_state (event); - gtk_window_set_pointer_focus_grab (toplevel, device, sequence, - type == GDK_BUTTON_PRESS ? target : NULL); - - if (type == GDK_BUTTON_RELEASE) + if (type == GDK_BUTTON_RELEASE && + __builtin_popcount (modifiers & + (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK | + GDK_BUTTON4_MASK | GDK_BUTTON5_MASK)) == 1) { GtkWidget *new_target = gtk_widget_pick (native, x, y, GTK_PICK_DEFAULT); + gtk_window_set_pointer_focus_grab (toplevel, device, sequence, NULL); + if (new_target == NULL) new_target = GTK_WIDGET (toplevel); @@ -1496,6 +1500,11 @@ handle_pointing_event (GdkEvent *event) gtk_window_maybe_update_cursor (toplevel, NULL, device); update_pointer_focus_state (toplevel, event, new_target); } + else if (type == GDK_BUTTON_PRESS) + { + gtk_window_set_pointer_focus_grab (toplevel, device, + sequence, target); + } if (type == GDK_BUTTON_PRESS) set_widget_active_state (target, FALSE); diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index ce097cb586..5a4ad33e2a 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -8666,11 +8666,15 @@ gtk_text_view_do_popup (GtkTextView *text_view, } else { + GtkTextBuffer *buffer; GtkTextIter iter; GdkRectangle iter_location; GdkRectangle visible_rect; gboolean is_visible; + buffer = get_buffer (text_view); + gtk_text_buffer_get_iter_at_mark (buffer, &iter, + gtk_text_buffer_get_insert (buffer)); gtk_text_view_get_iter_location (text_view, &iter, &iter_location); gtk_text_view_get_visible_rect (text_view, &visible_rect); |