summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2014-10-04 14:28:41 +0200
committerJan Djärv <jan.h.d@swipnet.se>2014-10-04 14:28:41 +0200
commit07e80dac81fb1f2ea263f7d272f80109d8f588b8 (patch)
treed51fc8a2dd027a3c022420628fe622b16a685e07 /src
parent3c6ba8b49bb87ada8a8cca6566ad0b6e3fc4e57d (diff)
downloademacs-07e80dac81fb1f2ea263f7d272f80109d8f588b8.tar.gz
Fix Gtk+ tearoff not present on Customize Emacs and not at menu top.
* gtkutil.c (create_menus): Only add tearoffs to empty menus. (xg_update_submenu): Remove has_tearoff_p, pass 1 to create_menus for add_tearoff_p.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/gtkutil.c19
2 files changed, 18 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4885778b920..8005b738d6d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-04 Jan Djärv <jan.h.d@swipnet.se>
+
+ * gtkutil.c (create_menus): Only add tearoffs to empty menus.
+ (xg_update_submenu): Remove has_tearoff_p, pass 1 to create_menus
+ for add_tearoff_p.
+
2014-10-04 Martin Rudalics <rudalics@gmx.at>
* buffer.c (scroll_bar_width, scroll_bar_height): Fix
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 595e6e0bb6a..445e59c335d 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2554,11 +2554,18 @@ create_menus (widget_value *data,
#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
if (! menu_bar_p && add_tearoff_p)
{
- GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
- gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), tearoff);
+ // Only add tearoff if menu is empty.
+ GList *list = gtk_container_get_children (GTK_CONTAINER (wmenu));
+ if (! list)
+ {
+ GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
+ gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), tearoff);
- g_signal_connect (G_OBJECT (tearoff), "activate",
- G_CALLBACK (tearoff_activate), 0);
+ g_signal_connect (G_OBJECT (tearoff), "activate",
+ G_CALLBACK (tearoff_activate), 0);
+ }
+ else
+ g_list_free (list);
}
#endif
@@ -3088,7 +3095,6 @@ xg_update_submenu (GtkWidget *submenu,
GList *list = 0;
GList *iter;
widget_value *cur;
- bool has_tearoff_p = 0;
GList *first_radio = 0;
if (submenu)
@@ -3104,7 +3110,6 @@ xg_update_submenu (GtkWidget *submenu,
/* Skip tearoff items, they have no counterpart in val. */
if (GTK_IS_TEAROFF_MENU_ITEM (w))
{
- has_tearoff_p = 1;
iter = g_list_next (iter);
if (iter) w = GTK_WIDGET (iter->data);
else break;
@@ -3198,7 +3203,7 @@ xg_update_submenu (GtkWidget *submenu,
highlight_cb,
0,
0,
- ! has_tearoff_p,
+ 1,
submenu,
cl_data,
0);