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



commit 84f6d9a577d89dc054a398377247b2e323fbe421
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]