summaryrefslogtreecommitdiff
path: root/gtk/gtkpopovermenubar.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-02-19 22:04:28 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-02-21 00:51:03 -0500
commitcadeca74e21a0990270b0527497bfcc0d6910158 (patch)
treea344b97c0ff7160469cdce989db1f52db3dc6c20 /gtk/gtkpopovermenubar.c
parent5a2f829a407241d784dd61e417f4d3166ab5e7a3 (diff)
downloadgtk+-cadeca74e21a0990270b0527497bfcc0d6910158.tar.gz
Go back to ::enter/::leave for pointer changes
These signals are behaving a little differently from what ::focus-in/::focus-out used to do.
Diffstat (limited to 'gtk/gtkpopovermenubar.c')
-rw-r--r--gtk/gtkpopovermenubar.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/gtk/gtkpopovermenubar.c b/gtk/gtkpopovermenubar.c
index 2e9a1dec4b..411d4c0358 100644
--- a/gtk/gtkpopovermenubar.c
+++ b/gtk/gtkpopovermenubar.c
@@ -166,12 +166,11 @@ clicked_cb (GtkGesture *gesture,
}
static void
-item_pointer_change_cb (GtkEventController *controller,
- GtkCrossingDirection direction,
- double x,
- double y,
- GdkCrossingMode mode,
- gpointer data)
+item_enter_cb (GtkEventController *controller,
+ double x,
+ double y,
+ GdkCrossingMode mode,
+ gpointer data)
{
GtkWidget *target;
GtkPopoverMenuBar *bar;
@@ -179,17 +178,13 @@ item_pointer_change_cb (GtkEventController *controller,
target = gtk_event_controller_get_widget (controller);
bar = GTK_POPOVER_MENU_BAR (gtk_widget_get_ancestor (target, GTK_TYPE_POPOVER_MENU_BAR));
- if (direction == GTK_CROSSING_IN)
- set_active_item (bar, GTK_POPOVER_MENU_BAR_ITEM (target), FALSE);
+ set_active_item (bar, GTK_POPOVER_MENU_BAR_ITEM (target), FALSE);
}
static void
-bar_pointer_change_cb (GtkEventController *controller,
- GtkCrossingDirection direction,
- double x,
- double y,
- GdkCrossingMode mode,
- gpointer data)
+bar_leave_cb (GtkEventController *controller,
+ GdkCrossingMode mode,
+ gpointer data)
{
GtkWidget *target;
GtkPopoverMenuBar *bar;
@@ -197,12 +192,9 @@ bar_pointer_change_cb (GtkEventController *controller,
target = gtk_event_controller_get_widget (controller);
bar = GTK_POPOVER_MENU_BAR (gtk_widget_get_ancestor (target, GTK_TYPE_POPOVER_MENU_BAR));
- if (direction == GTK_CROSSING_OUT)
- {
- if (bar->active_item &&
- !gtk_widget_get_mapped (GTK_WIDGET (bar->active_item->popover)))
- set_active_item (bar, NULL, FALSE);
- }
+ if (bar->active_item &&
+ !gtk_widget_get_mapped (GTK_WIDGET (bar->active_item->popover)))
+ set_active_item (bar, NULL, FALSE);
}
static gboolean
@@ -265,7 +257,7 @@ gtk_popover_menu_bar_item_init (GtkPopoverMenuBarItem *item)
controller = gtk_event_controller_motion_new ();
gtk_event_controller_set_propagation_limit (controller, GTK_LIMIT_NONE);
- g_signal_connect (controller, "pointer-change", G_CALLBACK (item_pointer_change_cb), NULL);
+ g_signal_connect (controller, "enter", G_CALLBACK (item_enter_cb), NULL);
gtk_widget_add_controller (GTK_WIDGET (item), controller);
}
@@ -617,7 +609,7 @@ gtk_popover_menu_bar_init (GtkPopoverMenuBar *bar)
controller = gtk_event_controller_motion_new ();
gtk_event_controller_set_propagation_limit (controller, GTK_LIMIT_NONE);
- g_signal_connect (controller, "pointer-change", G_CALLBACK (bar_pointer_change_cb), NULL);
+ g_signal_connect (controller, "leave", G_CALLBACK (bar_leave_cb), NULL);
gtk_widget_add_controller (GTK_WIDGET (bar), controller);
}