summaryrefslogtreecommitdiff
path: root/gtk/gtkeventcontrollermotion.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-02-20 23:20:58 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-02-21 00:51:03 -0500
commite062137b2ce59fd52ab5604b65345a00200631dc (patch)
tree8fb4c3153301c7476a7fabff3ecec158d6bcb4b9 /gtk/gtkeventcontrollermotion.c
parent77aed615e803d3039af62a1416368248c0457c39 (diff)
downloadgtk+-e062137b2ce59fd52ab5604b65345a00200631dc.tar.gz
motion controller: Match focus event propagation
Make the crossing event generation for pointer events match what we do for focus now.
Diffstat (limited to 'gtk/gtkeventcontrollermotion.c')
-rw-r--r--gtk/gtkeventcontrollermotion.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/gtk/gtkeventcontrollermotion.c b/gtk/gtkeventcontrollermotion.c
index d0182cbcc0..aaea7081d9 100644
--- a/gtk/gtkeventcontrollermotion.c
+++ b/gtk/gtkeventcontrollermotion.c
@@ -41,9 +41,6 @@ struct _GtkEventControllerMotion
{
GtkEventController parent_instance;
- GdkEvent *current_event;
- const GtkCrossingData *current_crossing;
-
guint is_pointer : 1;
guint contains_pointer : 1;
};
@@ -105,18 +102,28 @@ update_pointer_focus (GtkEventController *controller,
if (crossing->direction == GTK_CROSSING_IN)
{
+ if (crossing->new_descendent != NULL)
+ {
+ contains_pointer = TRUE;
+ }
if (crossing->new_target == widget)
- is_pointer = TRUE;
- if (crossing->new_target != NULL)
+ {
+ contains_pointer = TRUE;
+ is_pointer = TRUE;
+ }
+ }
+ else
+ {
+ if (crossing->new_descendent != NULL ||
+ crossing->new_target == widget)
contains_pointer = TRUE;
+ is_pointer = FALSE;
}
if (motion->contains_pointer != contains_pointer)
{
- if (contains_pointer)
- enter = TRUE;
- else
- leave = TRUE;
+ enter = contains_pointer;
+ leave = !contains_pointer;
}
if (leave)
@@ -145,16 +152,8 @@ gtk_event_controller_motion_handle_crossing (GtkEventController *controller,
double x,
double y)
{
- GtkEventControllerMotion *motion = GTK_EVENT_CONTROLLER_MOTION (controller);
-
- if (crossing->type != GTK_CROSSING_POINTER)
- return;
-
- motion->current_crossing = crossing;
-
- update_pointer_focus (controller, crossing, x, y);
-
- motion->current_crossing = NULL;
+ if (crossing->type == GTK_CROSSING_POINTER)
+ update_pointer_focus (controller, crossing, x, y);
}
static void