changeset 2303:cdd8459add40

GTK4: Add code to setup the toplevel menu for popups.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 09 Feb 2021 03:25:09 +0000
parents 785775b9002f
children ae6f678cb1a9
files gtk4/dw.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gtk4/dw.c	Tue Feb 09 00:34:17 2021 +0000
+++ b/gtk4/dw.c	Tue Feb 09 03:25:09 2021 +0000
@@ -2581,6 +2581,17 @@
       GdkRectangle rect = { x, y, 1, 1 };
       
       gtk_widget_set_parent(tmp, GTK_WIDGET(parent));
+      if(!g_object_get_data(G_OBJECT(*menu), "_dw_menuparent"))
+      {
+         int menugroup = DW_POINTER_TO_INT(g_object_get_data(G_OBJECT(*menu), "_dw_menugroup"));
+         GSimpleActionGroup *group = g_object_get_data(G_OBJECT(*menu), "_dw_group");
+         char tempbuf[25] = {0};
+            
+         snprintf(tempbuf, 24, "menu%d", menugroup);
+         
+         gtk_widget_insert_action_group(GTK_WIDGET(tmp), tempbuf, G_ACTION_GROUP(group));
+         g_object_set_data(G_OBJECT(*menu), "_dw_menuparent", (gpointer)tmp);
+      }
       _dw_menu_set_group_recursive(*menu, GTK_WIDGET(tmp));
       gtk_popover_set_autohide(GTK_POPOVER(tmp), TRUE);
       gtk_popover_set_has_arrow (GTK_POPOVER(tmp), FALSE);