comparison gtk4/dw.c @ 2326:258c1b9c29f4

GTK4: Implement DW_MENU_AUTO and DW_MENU_POPUP. These weren't necessary on GTK3 and earlier, so the options were just ignored. In GTK4 they are required for creating the GActions so it functions more like OS/2 and Windows now.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 23 Feb 2021 22:43:19 +0000
parents 55524dbe6a54
children 0d7f8136d771
comparison
equal deleted inserted replaced
2325:55524dbe6a54 2326:258c1b9c29f4
2837 char numbuf[25] = {0}; 2837 char numbuf[25] = {0};
2838 GSimpleActionGroup *group = g_object_get_data(G_OBJECT(menu), "_dw_group"); 2838 GSimpleActionGroup *group = g_object_get_data(G_OBJECT(menu), "_dw_group");
2839 int menugroup = DW_POINTER_TO_INT(g_object_get_data(G_OBJECT(menu), "_dw_menugroup")); 2839 int menugroup = DW_POINTER_TO_INT(g_object_get_data(G_OBJECT(menu), "_dw_menugroup"));
2840 char *actionname; 2840 char *actionname;
2841 2841
2842 /* Code to autogenerate a menu ID if not specified or invalid
2843 * First pool is smaller for transient popup menus
2844 */
2845 if(id == (ULONG)-1)
2846 {
2847 static ULONG tempid = 60000;
2848
2849 tempid++;
2850 id = tempid;
2851
2852 if(tempid > 65500)
2853 tempid = 60000;
2854 }
2855 /* Second pool is larger for more static windows */
2856 else if(!id || id >= 30000)
2857 {
2858 static ULONG menuid = 30000;
2859
2860 menuid++;
2861 if(menuid > 60000)
2862 menuid = 30000;
2863 id = menuid;
2864 }
2865
2842 snprintf(tempbuf, 100, "menu%d.action%lu", menugroup, id); 2866 snprintf(tempbuf, 100, "menu%d.action%lu", menugroup, id);
2843 actionname = strchr(tempbuf, '.'); 2867 actionname = strchr(tempbuf, '.');
2844 if(check) 2868 if(check)
2845 action = g_simple_action_new_stateful(&actionname[1], NULL, g_variant_new_boolean (FALSE)); 2869 action = g_simple_action_new_stateful(&actionname[1], NULL, g_variant_new_boolean (FALSE));
2846 else 2870 else