This is a backport of https://github.com/emacs-mirror/emacs/commit/3f4c6d52d345999938bc2d4a53246af4c61ef176 with a part of https://github.com/emacs-mirror/emacs/commit/5a1d858bbc5410916d764e7f9c62b4e405fab592 (everything related to (struct x_output).toolbar_is_packed). Resolves: #1477745 diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 4cbcf767c0..a7e695da2a 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1484,47 +1484,47 @@ This returns an error if any Emacs frames are X frames." (mapcar (lambda (arg) (cons (purecopy (car arg)) (purecopy (cdr arg)))) '( - ("etc/images/new" . "gtk-new") - ("etc/images/open" . "gtk-open") + ("etc/images/new" . ("document-new" "gtk-new")) + ("etc/images/open" . ("document-open" "gtk-open")) ("etc/images/diropen" . "n:system-file-manager") - ("etc/images/close" . "gtk-close") - ("etc/images/save" . "gtk-save") - ("etc/images/saveas" . "gtk-save-as") - ("etc/images/undo" . "gtk-undo") - ("etc/images/cut" . "gtk-cut") - ("etc/images/copy" . "gtk-copy") - ("etc/images/paste" . "gtk-paste") - ("etc/images/search" . "gtk-find") - ("etc/images/print" . "gtk-print") - ("etc/images/preferences" . "gtk-preferences") - ("etc/images/help" . "gtk-help") - ("etc/images/left-arrow" . "gtk-go-back") - ("etc/images/right-arrow" . "gtk-go-forward") - ("etc/images/home" . "gtk-home") - ("etc/images/jump-to" . "gtk-jump-to") + ("etc/images/close" . ("window-close" "gtk-close")) + ("etc/images/save" . ("document-save" "gtk-save")) + ("etc/images/saveas" . ("document-save-as" "gtk-save-as")) + ("etc/images/undo" . ("edit-undo" "gtk-undo")) + ("etc/images/cut" . ("edit-cut" "gtk-cut")) + ("etc/images/copy" . ("edit-copy" "gtk-copy")) + ("etc/images/paste" . ("edit-paste" "gtk-paste")) + ("etc/images/search" . ("edit-find" "gtk-find")) + ("etc/images/print" . ("document-print" "gtk-print")) + ("etc/images/preferences" . ("preferences-system" "gtk-preferences")) + ("etc/images/help" . ("help-browser" "gtk-help")) + ("etc/images/left-arrow" . ("go-previous" "gtk-go-back")) + ("etc/images/right-arrow" . ("go-next" "gtk-go-forward")) + ("etc/images/home" . ("go-home" "gtk-home")) + ("etc/images/jump-to" . ("go-jump" "gtk-jump-to")) ("etc/images/index" . "gtk-index") - ("etc/images/search" . "gtk-find") - ("etc/images/exit" . "gtk-quit") + ("etc/images/exit" . ("application-exit" "gtk-quit")) ("etc/images/cancel" . "gtk-cancel") - ("etc/images/info" . "gtk-info") + ("etc/images/info" . ("dialog-information" "gtk-info")) ("etc/images/bookmark_add" . "n:bookmark_add") ;; Used in Gnus and/or MH-E: ("etc/images/attach" . "gtk-attach") ("etc/images/connect" . "gtk-connect") ("etc/images/contact" . "gtk-contact") - ("etc/images/delete" . "gtk-delete") - ("etc/images/describe" . "gtk-properties") + ("etc/images/delete" . ("edit-delete" "gtk-delete")) + ("etc/images/describe" . ("document-properties" "gtk-properties")) ("etc/images/disconnect" . "gtk-disconnect") ;; ("etc/images/exit" . "gtk-exit") ("etc/images/lock-broken" . "gtk-lock_broken") ("etc/images/lock-ok" . "gtk-lock_ok") ("etc/images/lock" . "gtk-lock") ("etc/images/next-page" . "gtk-next-page") - ("etc/images/refresh" . "gtk-refresh") - ("etc/images/sort-ascending" . "gtk-sort-ascending") + ("etc/images/refresh" . ("view-refresh" "gtk-refresh")) + ("etc/images/sort-ascending" . ("view-sort-ascending" "gtk-sort-ascending")) ("etc/images/sort-column-ascending" . "gtk-sort-column-ascending") ("etc/images/sort-criteria" . "gtk-sort-criteria") - ("etc/images/sort-descending" . "gtk-sort-descending") + ("etc/images/sort-descending" . ("view-sort-descending" + "gtk-sort-descending")) ("etc/images/sort-row-ascending" . "gtk-sort-row-ascending") ("images/gnus/toggle-subscription" . "gtk-task-recurring") ("images/mail/compose" . "gtk-mail-compose") @@ -1541,8 +1541,8 @@ This returns an error if any Emacs frames are X frames." ("images/mail/spam" . "gtk-spam") ;; Used for GDB Graphical Interface ("images/gud/break" . "gtk-no") - ("images/gud/recstart" . "gtk-media-record") - ("images/gud/recstop" . "gtk-media-stop") + ("images/gud/recstart" . ("media-record" "gtk-media-record")) + ("images/gud/recstop" . ("media-playback-stop" "gtk-media-stop")) ;; No themed versions available: ;; mail/preview (combining stock_mail and stock_zoom) ;; mail/save (combining stock_mail, stock_save and stock_convert) @@ -1551,9 +1551,12 @@ This returns an error if any Emacs frames are X frames." Emacs must be compiled with the Gtk+ toolkit for this to have any effect. A value that begins with n: denotes a named icon instead of a stock icon." :version "22.2" - :type '(choice (repeat (choice symbol - (cons (string :tag "Emacs icon") - (string :tag "Stock/named"))))) + :type '(choice (repeat + (choice symbol + (cons (string :tag "Emacs icon") + (choice (group (string :tag "Named") + (string :tag "Stock")) + (string :tag "Stock/named")))))) :group 'x) (defcustom icon-map-list '(x-gtk-stock-map) diff --git a/src/xmenu.c b/src/xmenu.c index e3f1a17fbc..eb783fe507 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -733,12 +733,6 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) f->output_data.x->saved_menu_event->type = 0; } -#ifdef USE_GTK - /* If we have detached menus, we must update deep so detached menus - also gets updated. */ - deep_p = deep_p || xg_have_tear_offs (); -#endif - if (deep_p) { /* Make a widget-value tree representing the entire menu trees. */ diff --git a/src/xterm.h b/src/xterm.h index ed611f1d19..0842195f33 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -474,12 +474,11 @@ struct x_output GtkWidget *menubar_widget; /* The tool bar in this frame */ GtkWidget *toolbar_widget; - /* The handle box that makes the tool bar detachable. */ - GtkWidget *handlebox_widget; /* Non-zero if the tool bar is detached. */ int toolbar_detached; /* Non-zero if tool bar is packed into the hbox widget (i.e. vertical). */ int toolbar_in_hbox; + int toolbar_is_packed; /* The last size hints set. */ GdkGeometry size_hints; diff --git a/src/gtkutil.c b/src/gtkutil.c --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -2428,45 +2428,6 @@ make_menu_item (const char *utf8_label, return w; } -static int xg_detached_menus; - -/* Return true if there are detached menus. */ - -bool -xg_have_tear_offs (void) -{ - return xg_detached_menus > 0; -} - -/* Callback invoked when a detached menu window is removed. Here we - decrease the xg_detached_menus count. - WIDGET is the top level window that is removed (the parent of the menu). - CLIENT_DATA is not used. */ - -static void -tearoff_remove (GtkWidget *widget, gpointer client_data) -{ - if (xg_detached_menus > 0) --xg_detached_menus; -} - -/* Callback invoked when a menu is detached. It increases the - xg_detached_menus count. - WIDGET is the GtkTearoffMenuItem. - CLIENT_DATA is not used. */ - -static void -tearoff_activate (GtkWidget *widget, gpointer client_data) -{ - GtkWidget *menu = gtk_widget_get_parent (widget); - if (gtk_menu_get_tearoff_state (GTK_MENU (menu))) - { - ++xg_detached_menus; - g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)), - "destroy", - G_CALLBACK (tearoff_remove), 0); - } -} - /* Create a menu item widget, and connect the callbacks. ITEM describes the menu item. @@ -2538,8 +2499,6 @@ xg_create_one_menuitem (widget_value *it HIGHLIGHT_CB is the callback to call when entering/leaving menu items. If POP_UP_P, create a popup menu. If MENU_BAR_P, create a menu bar. - If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P. - TOPMENU is the topmost GtkWidget that others shall be placed under. It may be NULL, in that case we create the appropriate widget (menu bar or menu item depending on POP_UP_P and MENU_BAR_P) CL_DATA is the callback data we shall use for this menu, or NULL @@ -2560,7 +2519,6 @@ create_menus (widget_value *data, GCallback highlight_cb, bool pop_up_p, bool menu_bar_p, - bool add_tearoff_p, GtkWidget *topmenu, xg_menu_cb_data *cl_data, const char *name) @@ -2611,15 +2569,6 @@ create_menus (widget_value *data, "selection-done", deactivate_cb, 0); } - if (! menu_bar_p && add_tearoff_p) - { - 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); - } - for (item = data; item; item = item->next) { GtkWidget *w; @@ -2633,7 +2582,6 @@ create_menus (widget_value *data, group = NULL; utf8_label = get_utf8_string (item->name); - gtk_menu_set_title (GTK_MENU (wmenu), utf8_label); w = gtk_menu_item_new_with_label (utf8_label); gtk_widget_set_sensitive (w, FALSE); if (utf8_label) g_free (utf8_label); @@ -2664,7 +2612,6 @@ create_menus (widget_value *data, highlight_cb, 0, 0, - add_tearoff_p, 0, cl_data, 0); @@ -2722,7 +2669,6 @@ xg_create_widget (const char *type, cons highlight_cb, pop_up_p, menu_bar_p, - menu_bar_p, 0, 0, name); @@ -2832,7 +2778,7 @@ xg_update_menubar (GtkWidget *menubar, { /* Item(s) added. Add all new items in one call. */ create_menus (val, f, select_cb, deactivate_cb, highlight_cb, - 0, 1, 0, menubar, cl_data, 0); + 0, 1, menubar, cl_data, 0); /* All updated. */ val = 0; @@ -2909,12 +2855,6 @@ xg_update_menubar (GtkWidget *menubar, gtk_label_set_text (wlabel, utf8_label); - /* If this item has a submenu that has been detached, change - the title in the WM decorations also. */ - if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu))) - /* Set the title of the detached window. */ - gtk_menu_set_title (GTK_MENU (submenu), utf8_label); - if (utf8_label) g_free (utf8_label); iter = g_list_next (iter); val = val->next; @@ -2941,7 +2881,7 @@ xg_update_menubar (GtkWidget *menubar, GtkWidget *submenu = create_menus (NULL, f, select_cb, deactivate_cb, highlight_cb, - 0, 0, 0, 0, cl_data, 0); + 0, 0, 0, cl_data, 0); gtk_widget_set_name (w, MENU_ITEM_NAME); gtk_menu_shell_insert (GTK_MENU_SHELL (menubar), w, pos); gtk_menu_item_set_submenu (GTK_MENU_ITEM (w), submenu); @@ -3141,15 +3081,6 @@ xg_update_submenu (GtkWidget *submenu, { GtkWidget *w = GTK_WIDGET (iter->data); - /* 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; - } - /* Remember first radio button in a group. If we get a mismatch in a radio group we must rebuild the whole group so that the connections in GTK becomes correct. */ @@ -3237,7 +3168,6 @@ xg_update_submenu (GtkWidget *submenu, highlight_cb, 0, 0, - ! has_tearoff_p, submenu, cl_data, 0); @@ -4026,186 +3956,6 @@ xg_get_tool_bar_widgets (GtkWidget *vb, } -/* This callback is called when a tool item should create a proxy item, - such as for the overflow menu. Also called when the tool bar is detached. - If we don't create a proxy menu item, the detached tool bar will be - blank. */ - -static gboolean -xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) -{ - GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (XG_BIN_CHILD (toolitem))); - GtkWidget *vb = XG_BIN_CHILD (wbutton); - GtkWidget *c1; - GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); - GtkImage *wimage = GTK_IMAGE (c1); - GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label - (wlbl ? gtk_label_get_text (wlbl) : ""); - GtkWidget *wmenuimage; - - - if (gtk_button_get_use_stock (wbutton)) - wmenuimage = gtk_image_new_from_stock (gtk_button_get_label (wbutton), - GTK_ICON_SIZE_MENU); - else - { - GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton)); - GtkImageType store_type = gtk_image_get_storage_type (wimage); - - g_object_set (G_OBJECT (settings), "gtk-menu-images", TRUE, NULL); - - if (store_type == GTK_IMAGE_STOCK) - { - gchar *stock_id; - gtk_image_get_stock (wimage, &stock_id, NULL); - wmenuimage = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU); - } - else if (store_type == GTK_IMAGE_ICON_SET) - { - GtkIconSet *icon_set; - gtk_image_get_icon_set (wimage, &icon_set, NULL); - wmenuimage = gtk_image_new_from_icon_set (icon_set, - GTK_ICON_SIZE_MENU); - } - else if (store_type == GTK_IMAGE_PIXBUF) - { - gint width, height; - - if (settings && - gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, - &width, &height)) - { - GdkPixbuf *src_pixbuf, *dest_pixbuf; - - src_pixbuf = gtk_image_get_pixbuf (wimage); - dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, width, height, - GDK_INTERP_BILINEAR); - - wmenuimage = gtk_image_new_from_pixbuf (dest_pixbuf); - } - else - { - fprintf (stderr, "internal error: GTK_IMAGE_PIXBUF failed\n"); - emacs_abort (); - } - } - else if (store_type == GTK_IMAGE_ICON_NAME) - { - const gchar *icon_name; - GtkIconSize icon_size; - - gtk_image_get_icon_name (wimage, &icon_name, &icon_size); - wmenuimage = gtk_image_new_from_icon_name (icon_name, - GTK_ICON_SIZE_MENU); - } - else - { - fprintf (stderr, "internal error: store_type is %d\n", store_type); - emacs_abort (); - } - } - if (wmenuimage) - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (wmenuitem), wmenuimage); - - g_signal_connect (G_OBJECT (wmenuitem), - "activate", - G_CALLBACK (xg_tool_bar_proxy_callback), - user_data); - - - g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON, - (gpointer) wbutton); - gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem); - gtk_widget_set_sensitive (wmenuitem, - gtk_widget_get_sensitive (GTK_WIDGET (wbutton))); - - /* Use enter/leave notify to show help. We use the events - rather than the GtkButton specific signals "enter" and - "leave", so we can have only one callback. The event - will tell us what kind of event it is. */ - g_signal_connect (G_OBJECT (wmenuitem), - "enter-notify-event", - G_CALLBACK (xg_tool_bar_proxy_help_callback), - user_data); - g_signal_connect (G_OBJECT (wmenuitem), - "leave-notify-event", - G_CALLBACK (xg_tool_bar_proxy_help_callback), - user_data); - - return TRUE; -} - -/* This callback is called when a tool bar is detached. We must set - the height of the tool bar to zero when this happens so frame sizes - are correctly calculated. - WBOX is the handle box widget that enables detach/attach of the tool bar. - W is the tool bar widget. - CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ - -static void -xg_tool_bar_detach_callback (GtkHandleBox *wbox, - GtkWidget *w, - gpointer client_data) -{ - FRAME_PTR f = (FRAME_PTR) client_data; - - g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar, - NULL); - - if (f) - { - GtkRequisition req, req2; - FRAME_X_OUTPUT (f)->toolbar_detached = 1; - gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); - gtk_widget_get_preferred_size (w, NULL, &req2); - req.width -= req2.width; - req.height -= req2.height; - if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) - FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; - else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) - FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; - else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) - FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; - else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) - FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; - xg_height_or_width_changed (f); - } -} - -/* This callback is called when a tool bar is reattached. We must set - the height of the tool bar when this happens so frame sizes - are correctly calculated. - WBOX is the handle box widget that enables detach/attach of the tool bar. - W is the tool bar widget. - CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ - -static void -xg_tool_bar_attach_callback (GtkHandleBox *wbox, - GtkWidget *w, - gpointer client_data) -{ - FRAME_PTR f = (FRAME_PTR) client_data; - g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); - - if (f) - { - GtkRequisition req, req2; - FRAME_X_OUTPUT (f)->toolbar_detached = 0; - gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); - gtk_widget_get_preferred_size (w, NULL, &req2); - req.width += req2.width; - req.height += req2.height; - if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) - FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; - else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) - FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; - else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) - FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; - else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) - FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; - xg_height_or_width_changed (f); - } -} /* This callback is called when the mouse enters or leaves a tool bar item. It is used for displaying and hiding the help text. @@ -4298,44 +4048,30 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Obje into_hbox ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL); - if (!x->handlebox_widget) - { - x->handlebox_widget = gtk_handle_box_new (); - g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", - G_CALLBACK (xg_tool_bar_detach_callback), f); - g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", - G_CALLBACK (xg_tool_bar_attach_callback), f); - gtk_container_add (GTK_CONTAINER (x->handlebox_widget), - x->toolbar_widget); - } - if (into_hbox) { - gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), - GTK_POS_TOP); - gtk_box_pack_start (GTK_BOX (x->hbox_widget), x->handlebox_widget, + gtk_box_pack_start (GTK_BOX (x->hbox_widget), x->toolbar_widget, FALSE, FALSE, 0); if (EQ (pos, Qleft)) gtk_box_reorder_child (GTK_BOX (x->hbox_widget), - x->handlebox_widget, + x->toolbar_widget, 0); x->toolbar_in_hbox = 1; } else { bool vbox_pos = x->menubar_widget != 0; - gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), - GTK_POS_LEFT); - gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, + gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->toolbar_widget, FALSE, FALSE, 0); if (EQ (pos, Qtop)) gtk_box_reorder_child (GTK_BOX (x->vbox_widget), - x->handlebox_widget, + x->toolbar_widget, vbox_pos); x->toolbar_in_hbox = 0; } + x->toolbar_is_packed = 1; } /* Create a tool bar for frame F. */ @@ -4462,10 +4198,6 @@ xg_make_tool_item (FRAME_PTR f, intptr_t ii = i; gpointer gi = (gpointer) ii; - g_signal_connect (G_OBJECT (ti), "create-menu-proxy", - G_CALLBACK (xg_tool_bar_menu_proxy), - gi); - g_signal_connect (G_OBJECT (wb), "clicked", G_CALLBACK (xg_tool_bar_callback), gi); @@ -4580,12 +4312,12 @@ xg_update_tool_bar_sizes (FRAME_PTR f) GtkRequisition req; int nl = 0, nr = 0, nt = 0, nb = 0; - gtk_widget_get_preferred_size (GTK_WIDGET (x->handlebox_widget), NULL, &req); + gtk_widget_get_preferred_size (GTK_WIDGET (x->toolbar_widget), NULL, &req); if (x->toolbar_in_hbox) { int pos; gtk_container_child_get (GTK_CONTAINER (x->hbox_widget), - x->handlebox_widget, + x->toolbar_widget, "position", &pos, NULL); if (pos == 0) nl = req.width; else nr = req.width; @@ -4594,7 +4326,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f) { int pos; gtk_container_child_get (GTK_CONTAINER (x->vbox_widget), - x->handlebox_widget, + x->toolbar_widget, "position", &pos, NULL); if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height; else nb = req.height; @@ -4665,7 +4397,6 @@ update_frame_tool_bar (FRAME_PTR f) GtkToolbar *wtoolbar; GtkToolItem *ti; GtkTextDirection dir; - bool pack_tool_bar = x->handlebox_widget == NULL; Lisp_Object style; bool text_image, horiz; struct xg_frame_tb_info *tbinfo; @@ -4924,9 +4655,9 @@ update_frame_tool_bar (FRAME_PTR f) if (f->n_tool_bar_items != 0) { - if (pack_tool_bar) + if (! x->toolbar_is_packed) xg_pack_tool_bar (f, f->tool_bar_position); - gtk_widget_show_all (GTK_WIDGET (x->handlebox_widget)); + gtk_widget_show_all (GTK_WIDGET (x->toolbar_widget)); if (xg_update_tool_bar_sizes (f)) xg_height_or_width_changed (f); } @@ -4945,24 +4676,21 @@ free_frame_tool_bar (FRAME_PTR f) if (x->toolbar_widget) { struct xg_frame_tb_info *tbinfo; - bool is_packed = x->handlebox_widget != 0; block_input (); - /* We may have created the toolbar_widget in xg_create_tool_bar, but - not the x->handlebox_widget which is created in xg_pack_tool_bar. */ - if (is_packed) + if (x->toolbar_is_packed) { if (x->toolbar_in_hbox) gtk_container_remove (GTK_CONTAINER (x->hbox_widget), - x->handlebox_widget); + x->toolbar_widget); else gtk_container_remove (GTK_CONTAINER (x->vbox_widget), - x->handlebox_widget); + x->toolbar_widget); } else gtk_widget_destroy (x->toolbar_widget); x->toolbar_widget = 0; - x->handlebox_widget = 0; + x->toolbar_is_packed = 0; FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0; @@ -4987,19 +4715,22 @@ xg_change_toolbar_position (FRAME_PTR f, { struct x_output *x = f->output_data.x; - if (! x->toolbar_widget || ! x->handlebox_widget) + if (! x->toolbar_widget) return; block_input (); - g_object_ref (x->handlebox_widget); - if (x->toolbar_in_hbox) - gtk_container_remove (GTK_CONTAINER (x->hbox_widget), - x->handlebox_widget); - else - gtk_container_remove (GTK_CONTAINER (x->vbox_widget), - x->handlebox_widget); + g_object_ref (x->toolbar_widget); + if (x->toolbar_is_packed) + { + if (x->toolbar_in_hbox) + gtk_container_remove (GTK_CONTAINER (x->hbox_widget), + x->toolbar_widget); + else + gtk_container_remove (GTK_CONTAINER (x->vbox_widget), + x->toolbar_widget); + } xg_pack_tool_bar (f, pos); - g_object_unref (x->handlebox_widget); + g_object_unref (x->toolbar_widget); if (xg_update_tool_bar_sizes (f)) xg_height_or_width_changed (f); @@ -5025,7 +4756,6 @@ xg_initialize (void) gdpy_def = NULL; xg_ignore_gtk_scrollbar = 0; - xg_detached_menus = 0; xg_menu_cb_list.prev = xg_menu_cb_list.next = xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0;