[gtk/wip/baedert/for-master: 44/57] modelbutton: Un-select on mouse leave



commit 6e0d38a67b3734ac401788559c96a62fd8f380d8
Author: Timm Bäder <mail baedert org>
Date:   Tue Feb 18 10:02:38 2020 +0100

    modelbutton: Un-select on mouse leave
    
    This brings us closer to the old GtkMenuItem behavior and also makes
    more sense.

 gtk/gtkmodelbutton.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index aea36907dd..5545ed95df 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -1348,7 +1348,14 @@ leave_cb (GtkEventController *controller,
           GdkNotifyType       type,
           gpointer            data)
 {
+  GtkPopoverMenu *popover;
+
+  popover = (GtkPopoverMenu*)gtk_widget_get_ancestor (GTK_WIDGET (data), GTK_TYPE_POPOVER_MENU);
+
   stop_open (GTK_MODEL_BUTTON (data));
+
+  if (popover)
+    gtk_popover_menu_set_active_item (popover, NULL);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]