summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkmain.c17
-rw-r--r--gtk/gtktextview.c4
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);