[gtk+/wip/carlosg/event-delivery: 102/104] gtk: Check implicit grab status before sending crossing events
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/event-delivery: 102/104] gtk: Check implicit grab status before sending crossing events
- Date: Thu, 25 May 2017 14:48:41 +0000 (UTC)
commit 0d7fe2ec09e24560443fd4acc0cc96b163f12a9b
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu May 25 01:57:22 2017 +0200
gtk: Check implicit grab status before sending crossing events
As we now refrain from sending the crossing events if there's an
implicit grab, those events must be sent on button release when
the implicit grab is broken.
gtk/gtkmain.c | 16 +++++++++++++---
gtk/gtkwindow.c | 11 +++++++++++
gtk/gtkwindowprivate.h | 3 +++
3 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index c484b49..c5f601d 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1508,8 +1508,12 @@ handle_pointing_event (GdkEvent *event)
if (event->type == GDK_MOTION_NOTIFY || event->type == GDK_ENTER_NOTIFY)
{
- gtk_synthesize_crossing_events (toplevel, old_target, target,
- event, GDK_CROSSING_NORMAL);
+ if (!gtk_window_lookup_pointer_focus_implicit_grab (toplevel, device,
+ sequence))
+ {
+ gtk_synthesize_crossing_events (toplevel, old_target, target,
+ event, GDK_CROSSING_NORMAL);
+ }
gtk_window_maybe_update_cursor (toplevel, NULL, device);
}
@@ -1532,7 +1536,13 @@ handle_pointing_event (GdkEvent *event)
target : NULL);
if (event->type == GDK_BUTTON_RELEASE)
- gtk_window_maybe_update_cursor (toplevel, NULL, device);
+ {
+ old_target = target;
+ target = _gtk_toplevel_pick (toplevel, x, y, NULL, NULL);
+ gtk_synthesize_crossing_events (toplevel, old_target, target, event,
+ GDK_CROSSING_UNGRAB);
+ gtk_window_maybe_update_cursor (toplevel, NULL, device);
+ }
break;
case GDK_SCROLL:
case GDK_TOUCHPAD_PINCH:
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 1f7e3d8..0304673 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -11327,6 +11327,17 @@ gtk_window_lookup_effective_pointer_focus_widget (GtkWindow *window,
return focus ? gtk_pointer_focus_get_effective_target (focus) : NULL;
}
+GtkWidget *
+gtk_window_lookup_pointer_focus_implicit_grab (GtkWindow *window,
+ GdkDevice *device,
+ GdkEventSequence *sequence)
+{
+ GtkPointerFocus *focus;
+
+ focus = gtk_window_lookup_pointer_focus (window, device, sequence);
+ return focus ? gtk_pointer_focus_get_implicit_grab (focus) : NULL;
+}
+
void
gtk_window_update_pointer_focus (GtkWindow *window,
GdkDevice *device,
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index 1d97de7..94b5aee 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -146,6 +146,9 @@ GtkWidget * gtk_window_lookup_pointer_focus_widget (GtkWindow *windo
GtkWidget * gtk_window_lookup_effective_pointer_focus_widget (GtkWindow *window,
GdkDevice *device,
GdkEventSequence *sequence);
+GtkWidget * gtk_window_lookup_pointer_focus_implicit_grab (GtkWindow *window,
+ GdkDevice *device,
+ GdkEventSequence *sequence);
void gtk_window_update_pointer_focus (GtkWindow *window,
GdkDevice *device,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]