Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/emacs-tools:patchsets commit in: emacs/24.5/
Date: Thu, 14 Jul 2016 04:48:53
Message-Id: 1468440822.2c73e513ba90e484a2755cfd2797af18f7aead7b.ulm@gentoo
1 commit: 2c73e513ba90e484a2755cfd2797af18f7aead7b
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 13 20:13:42 2016 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 13 20:13:42 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=2c73e513
7
8 Fix icons in toolbar with GTK+ 3.20.6, bug 588704.
9
10 emacs/24.5/06_all_gtk-toolbar.patch | 922 ++++++++++++++++++++++++++++++++++++
11 1 file changed, 922 insertions(+)
12
13 diff --git a/emacs/24.5/06_all_gtk-toolbar.patch b/emacs/24.5/06_all_gtk-toolbar.patch
14 new file mode 100644
15 index 0000000..d3cc5d6
16 --- /dev/null
17 +++ b/emacs/24.5/06_all_gtk-toolbar.patch
18 @@ -0,0 +1,922 @@
19 +Fix icons in toolbar with GTK+ 3.20.6.
20 +https://bugs.gentoo.org/588704
21 +https://bugs.archlinux.org/task/48862
22 +
23 +This comprises the following commits from upstream git, backported
24 +to Emacs 24.5:
25 +
26 +commit 4e94689452f3a895a52e67787b795596c2390462
27 +Author: Paul Eggert <eggert@×××××××.edu>
28 +Date: Sat Oct 18 12:07:17 2014 -0700
29 +
30 + * gtkutil.c: Remove no-longer-used code.
31 +
32 +commit 6e5ff6166647e6af30beff38f67f2bca86cf9786
33 +Author: Jan Djärv <jan.h.d@×××××××.se>
34 +Date: Sat Oct 18 18:26:47 2014 +0200
35 +
36 + * cus-start.el (x-gtk-whole-detached-tool-bar): Remove.
37 +
38 +commit ac225d22f68af9531bc25d6ab83c11797105b5bc
39 +Author: Jan Djärv <jan.h.d@×××××××.se>
40 +Date: Sat Oct 18 18:25:24 2014 +0200
41 +
42 + * xfns.c (syms_of_xfns): Remove x-gtk-whole-detached-tool-bar.
43 +
44 +commit 3f4c6d52d345999938bc2d4a53246af4c61ef176
45 +Author: Jan Djärv <jan.h.d@×××××××.se>
46 +Date: Sat Oct 18 18:19:53 2014 +0200
47 +
48 + Handle deprecated Gtk+ stuff for version <= 3.10
49 +
50 +--- emacs-24.5-orig/lisp/cus-start.el
51 ++++ emacs-24.5/lisp/cus-start.el
52 +@@ -519,7 +519,6 @@
53 + (x-gtk-use-old-file-dialog menu boolean "22.1")
54 + (x-gtk-show-hidden-files menu boolean "22.1")
55 + (x-gtk-file-dialog-help-text menu boolean "22.1")
56 +- (x-gtk-whole-detached-tool-bar x boolean "22.1")
57 + (x-gtk-use-system-tooltips tooltip boolean "23.3")
58 + ;; xterm.c
59 + (x-use-underline-position-properties display boolean "22.1")
60 +--- emacs-24.5-orig/lisp/term/x-win.el
61 ++++ emacs-24.5/lisp/term/x-win.el
62 +@@ -1475,47 +1475,47 @@
63 + (mapcar (lambda (arg)
64 + (cons (purecopy (car arg)) (purecopy (cdr arg))))
65 + '(
66 +- ("etc/images/new" . "gtk-new")
67 +- ("etc/images/open" . "gtk-open")
68 ++ ("etc/images/new" . ("document-new" "gtk-new"))
69 ++ ("etc/images/open" . ("document-open" "gtk-open"))
70 + ("etc/images/diropen" . "n:system-file-manager")
71 +- ("etc/images/close" . "gtk-close")
72 +- ("etc/images/save" . "gtk-save")
73 +- ("etc/images/saveas" . "gtk-save-as")
74 +- ("etc/images/undo" . "gtk-undo")
75 +- ("etc/images/cut" . "gtk-cut")
76 +- ("etc/images/copy" . "gtk-copy")
77 +- ("etc/images/paste" . "gtk-paste")
78 +- ("etc/images/search" . "gtk-find")
79 +- ("etc/images/print" . "gtk-print")
80 +- ("etc/images/preferences" . "gtk-preferences")
81 +- ("etc/images/help" . "gtk-help")
82 +- ("etc/images/left-arrow" . "gtk-go-back")
83 +- ("etc/images/right-arrow" . "gtk-go-forward")
84 +- ("etc/images/home" . "gtk-home")
85 +- ("etc/images/jump-to" . "gtk-jump-to")
86 ++ ("etc/images/close" . ("window-close" "gtk-close"))
87 ++ ("etc/images/save" . ("document-save" "gtk-save"))
88 ++ ("etc/images/saveas" . ("document-save-as" "gtk-save-as"))
89 ++ ("etc/images/undo" . ("edit-undo" "gtk-undo"))
90 ++ ("etc/images/cut" . ("edit-cut" "gtk-cut"))
91 ++ ("etc/images/copy" . ("edit-copy" "gtk-copy"))
92 ++ ("etc/images/paste" . ("edit-paste" "gtk-paste"))
93 ++ ("etc/images/search" . ("edit-find" "gtk-find"))
94 ++ ("etc/images/print" . ("document-print" "gtk-print"))
95 ++ ("etc/images/preferences" . ("preferences-system" "gtk-preferences"))
96 ++ ("etc/images/help" . ("help-browser" "gtk-help"))
97 ++ ("etc/images/left-arrow" . ("go-previous" "gtk-go-back"))
98 ++ ("etc/images/right-arrow" . ("go-next" "gtk-go-forward"))
99 ++ ("etc/images/home" . ("go-home" "gtk-home"))
100 ++ ("etc/images/jump-to" . ("go-jump" "gtk-jump-to"))
101 + ("etc/images/index" . "gtk-index")
102 +- ("etc/images/search" . "gtk-find")
103 +- ("etc/images/exit" . "gtk-quit")
104 ++ ("etc/images/exit" . ("application-exit" "gtk-quit"))
105 + ("etc/images/cancel" . "gtk-cancel")
106 +- ("etc/images/info" . "gtk-info")
107 ++ ("etc/images/info" . ("dialog-information" "gtk-info"))
108 + ("etc/images/bookmark_add" . "n:bookmark_add")
109 + ;; Used in Gnus and/or MH-E:
110 + ("etc/images/attach" . "gtk-attach")
111 + ("etc/images/connect" . "gtk-connect")
112 + ("etc/images/contact" . "gtk-contact")
113 +- ("etc/images/delete" . "gtk-delete")
114 +- ("etc/images/describe" . "gtk-properties")
115 ++ ("etc/images/delete" . ("edit-delete" "gtk-delete"))
116 ++ ("etc/images/describe" . ("ocument-properties" "gtk-properties"))
117 + ("etc/images/disconnect" . "gtk-disconnect")
118 + ;; ("etc/images/exit" . "gtk-exit")
119 + ("etc/images/lock-broken" . "gtk-lock_broken")
120 + ("etc/images/lock-ok" . "gtk-lock_ok")
121 + ("etc/images/lock" . "gtk-lock")
122 + ("etc/images/next-page" . "gtk-next-page")
123 +- ("etc/images/refresh" . "gtk-refresh")
124 +- ("etc/images/sort-ascending" . "gtk-sort-ascending")
125 ++ ("etc/images/refresh" . ("view-refresh" "gtk-refresh"))
126 ++ ("etc/images/sort-ascending" . ("view-sort-ascending" "gtk-sort-ascending"))
127 + ("etc/images/sort-column-ascending" . "gtk-sort-column-ascending")
128 + ("etc/images/sort-criteria" . "gtk-sort-criteria")
129 +- ("etc/images/sort-descending" . "gtk-sort-descending")
130 ++ ("etc/images/sort-descending" . ("view-sort-descending"
131 ++ "gtk-sort-descending"))
132 + ("etc/images/sort-row-ascending" . "gtk-sort-row-ascending")
133 + ("images/gnus/toggle-subscription" . "gtk-task-recurring")
134 + ("images/mail/compose" . "gtk-mail-compose")
135 +@@ -1532,8 +1532,8 @@
136 + ("images/mail/spam" . "gtk-spam")
137 + ;; Used for GDB Graphical Interface
138 + ("images/gud/break" . "gtk-no")
139 +- ("images/gud/recstart" . "gtk-media-record")
140 +- ("images/gud/recstop" . "gtk-media-stop")
141 ++ ("images/gud/recstart" . ("media-record" "gtk-media-record"))
142 ++ ("images/gud/recstop" . ("media-playback-stop" "gtk-media-stop"))
143 + ;; No themed versions available:
144 + ;; mail/preview (combining stock_mail and stock_zoom)
145 + ;; mail/save (combining stock_mail, stock_save and stock_convert)
146 +@@ -1542,9 +1542,12 @@
147 + Emacs must be compiled with the Gtk+ toolkit for this to have any effect.
148 + A value that begins with n: denotes a named icon instead of a stock icon."
149 + :version "22.2"
150 +- :type '(choice (repeat (choice symbol
151 +- (cons (string :tag "Emacs icon")
152 +- (string :tag "Stock/named")))))
153 ++ :type '(choice (repeat
154 ++ (choice symbol
155 ++ (cons (string :tag "Emacs icon")
156 ++ (choice (group (string :tag "Named")
157 ++ (string :tag "Stock"))
158 ++ (string :tag "Stock/named"))))))
159 + :group 'x)
160 +
161 + (defcustom icon-map-list '(x-gtk-stock-map)
162 +--- emacs-24.5-orig/src/gtkutil.c
163 ++++ emacs-24.5/src/gtkutil.c
164 +@@ -92,6 +92,16 @@
165 + #endif
166 + #endif /* HAVE_FREETYPE */
167 +
168 ++#if GTK_CHECK_VERSION (3, 10, 0)
169 ++#define XG_TEXT_CANCEL "Cancel"
170 ++#define XG_TEXT_OK "OK"
171 ++#define XG_TEXT_OPEN "Open"
172 ++#else
173 ++#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
174 ++#define XG_TEXT_OK GTK_STOCK_OK
175 ++#define XG_TEXT_OPEN GTK_STOCK_OPEN
176 ++#endif
177 ++
178 + #ifndef HAVE_GTK3
179 + #ifdef USE_GTK_TOOLTIP
180 + #define gdk_window_get_screen(w) gdk_drawable_get_screen (w)
181 +@@ -1826,9 +1836,9 @@
182 + action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
183 +
184 + filewin = gtk_file_chooser_dialog_new (prompt, gwin, action,
185 +- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
186 ++ XG_TEXT_CANCEL, GTK_RESPONSE_CANCEL,
187 + (mustmatch_p || only_dir_p ?
188 +- GTK_STOCK_OPEN : GTK_STOCK_OK),
189 ++ XG_TEXT_OPEN : XG_TEXT_OK),
190 + GTK_RESPONSE_OK,
191 + NULL);
192 + gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE);
193 +@@ -2408,57 +2418,6 @@
194 + return w;
195 + }
196 +
197 +-#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
198 +-
199 +-static int xg_detached_menus;
200 +-
201 +-/* Return true if there are detached menus. */
202 +-
203 +-bool
204 +-xg_have_tear_offs (struct frame *f)
205 +-{
206 +- /* If the frame's menubar height is zero, the menu bar is probably
207 +- being redirected outside the window to some kind of global menu;
208 +- this situation is the moral equivalent of a tear-off. */
209 +- return FRAME_MENUBAR_HEIGHT (f) == 0 || xg_detached_menus > 0;
210 +-}
211 +-
212 +-/* Callback invoked when a detached menu window is removed. Here we
213 +- decrease the xg_detached_menus count.
214 +- WIDGET is the top level window that is removed (the parent of the menu).
215 +- CLIENT_DATA is not used. */
216 +-
217 +-static void
218 +-tearoff_remove (GtkWidget *widget, gpointer client_data)
219 +-{
220 +- if (xg_detached_menus > 0) --xg_detached_menus;
221 +-}
222 +-
223 +-/* Callback invoked when a menu is detached. It increases the
224 +- xg_detached_menus count.
225 +- WIDGET is the GtkTearoffMenuItem.
226 +- CLIENT_DATA is not used. */
227 +-
228 +-static void
229 +-tearoff_activate (GtkWidget *widget, gpointer client_data)
230 +-{
231 +- GtkWidget *menu = gtk_widget_get_parent (widget);
232 +- if (gtk_menu_get_tearoff_state (GTK_MENU (menu)))
233 +- {
234 +- ++xg_detached_menus;
235 +- g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)),
236 +- "destroy",
237 +- G_CALLBACK (tearoff_remove), 0);
238 +- }
239 +-}
240 +-#else /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */
241 +-bool
242 +-xg_have_tear_offs (struct frame *f)
243 +-{
244 +- return FRAME_MENUBAR_HEIGHT (f) == 0;
245 +-}
246 +-#endif /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */
247 +-
248 + /* Create a menu item widget, and connect the callbacks.
249 + ITEM describes the menu item.
250 + F is the frame the created menu belongs to.
251 +@@ -2529,8 +2488,6 @@
252 + HIGHLIGHT_CB is the callback to call when entering/leaving menu items.
253 + If POP_UP_P, create a popup menu.
254 + If MENU_BAR_P, create a menu bar.
255 +- If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P or
256 +- the Gtk+ version used does not have tearoffs.
257 + TOPMENU is the topmost GtkWidget that others shall be placed under.
258 + It may be NULL, in that case we create the appropriate widget
259 + (menu bar or menu item depending on POP_UP_P and MENU_BAR_P)
260 +@@ -2552,7 +2509,6 @@
261 + GCallback highlight_cb,
262 + bool pop_up_p,
263 + bool menu_bar_p,
264 +- bool add_tearoff_p,
265 + GtkWidget *topmenu,
266 + xg_menu_cb_data *cl_data,
267 + const char *name)
268 +@@ -2603,17 +2559,6 @@
269 + "selection-done", deactivate_cb, 0);
270 + }
271 +
272 +-#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
273 +- if (! menu_bar_p && add_tearoff_p)
274 +- {
275 +- GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
276 +- gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), tearoff);
277 +-
278 +- g_signal_connect (G_OBJECT (tearoff), "activate",
279 +- G_CALLBACK (tearoff_activate), 0);
280 +- }
281 +-#endif
282 +-
283 + for (item = data; item; item = item->next)
284 + {
285 + GtkWidget *w;
286 +@@ -2627,7 +2572,6 @@
287 + group = NULL;
288 + utf8_label = get_utf8_string (item->name);
289 +
290 +- gtk_menu_set_title (GTK_MENU (wmenu), utf8_label);
291 + w = gtk_menu_item_new_with_label (utf8_label);
292 + gtk_widget_set_sensitive (w, FALSE);
293 + if (utf8_label) g_free (utf8_label);
294 +@@ -2658,7 +2602,6 @@
295 + highlight_cb,
296 + 0,
297 + 0,
298 +- add_tearoff_p,
299 + 0,
300 + cl_data,
301 + 0);
302 +@@ -2716,7 +2659,6 @@
303 + highlight_cb,
304 + pop_up_p,
305 + menu_bar_p,
306 +- menu_bar_p,
307 + 0,
308 + 0,
309 + name);
310 +@@ -2826,7 +2768,7 @@
311 + {
312 + /* Item(s) added. Add all new items in one call. */
313 + create_menus (val, f, select_cb, deactivate_cb, highlight_cb,
314 +- 0, 1, 0, menubar, cl_data, 0);
315 ++ 0, 1, menubar, cl_data, 0);
316 +
317 + /* All updated. */
318 + val = 0;
319 +@@ -2899,7 +2841,6 @@
320 + is up to date when leaving the minibuffer. */
321 + GtkLabel *wlabel = GTK_LABEL (XG_BIN_CHILD (witem));
322 + char *utf8_label = get_utf8_string (val->name);
323 +- GtkWidget *submenu = gtk_menu_item_get_submenu (witem);
324 +
325 + /* GTK menu items don't notice when their labels have been
326 + changed from underneath them, so we have to explicitly
327 +@@ -2909,14 +2850,6 @@
328 + gtk_label_set_text (wlabel, utf8_label);
329 + g_object_notify (G_OBJECT (witem), "label");
330 +
331 +-#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
332 +- /* If this item has a submenu that has been detached, change
333 +- the title in the WM decorations also. */
334 +- if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu)))
335 +- /* Set the title of the detached window. */
336 +- gtk_menu_set_title (GTK_MENU (submenu), utf8_label);
337 +-#endif
338 +-
339 + if (utf8_label) g_free (utf8_label);
340 + iter = g_list_next (iter);
341 + val = val->next;
342 +@@ -2943,7 +2876,7 @@
343 + GtkWidget *submenu = create_menus (NULL, f,
344 + select_cb, deactivate_cb,
345 + highlight_cb,
346 +- 0, 0, 0, 0, cl_data, 0);
347 ++ 0, 0, 0, cl_data, 0);
348 +
349 + gtk_widget_set_name (w, MENU_ITEM_NAME);
350 + gtk_menu_shell_insert (GTK_MENU_SHELL (menubar), w, pos);
351 +@@ -3140,7 +3073,6 @@
352 + GList *list = 0;
353 + GList *iter;
354 + widget_value *cur;
355 +- bool has_tearoff_p = 0;
356 + GList *first_radio = 0;
357 +
358 + if (submenu)
359 +@@ -3152,17 +3084,6 @@
360 + {
361 + GtkWidget *w = GTK_WIDGET (iter->data);
362 +
363 +-#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
364 +- /* Skip tearoff items, they have no counterpart in val. */
365 +- if (GTK_IS_TEAROFF_MENU_ITEM (w))
366 +- {
367 +- has_tearoff_p = 1;
368 +- iter = g_list_next (iter);
369 +- if (iter) w = GTK_WIDGET (iter->data);
370 +- else break;
371 +- }
372 +-#endif
373 +-
374 + /* Remember first radio button in a group. If we get a mismatch in
375 + a radio group we must rebuild the whole group so that the connections
376 + in GTK becomes correct. */
377 +@@ -3250,7 +3171,6 @@
378 + highlight_cb,
379 + 0,
380 + 0,
381 +- ! has_tearoff_p,
382 + submenu,
383 + cl_data,
384 + 0);
385 +@@ -3908,9 +3828,6 @@
386 + get them. */
387 + #define XG_TOOL_BAR_LAST_MODIFIER "emacs-tool-bar-modifier"
388 +
389 +-/* The key for storing the button widget in its proxy menu item. */
390 +-#define XG_TOOL_BAR_PROXY_BUTTON "emacs-tool-bar-proxy-button"
391 +-
392 + /* The key for the data we put in the GtkImage widgets. The data is
393 + the stock name used by Emacs. We use this to see if we need to update
394 + the GtkImage with a new image. */
395 +@@ -3983,41 +3900,6 @@
396 + x_focus_frame (f);
397 + }
398 +
399 +-/* Callback function invoked when a tool bar item is pressed in a detached
400 +- tool bar or the overflow drop down menu.
401 +- We just call xg_tool_bar_callback.
402 +- W is the menu item widget that got pressed,
403 +- CLIENT_DATA is an integer that is the index of the button in the
404 +- tool bar. 0 is the first button. */
405 +-
406 +-static void
407 +-xg_tool_bar_proxy_callback (GtkWidget *w, gpointer client_data)
408 +-{
409 +- GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w),
410 +- XG_TOOL_BAR_PROXY_BUTTON));
411 +- xg_tool_bar_callback (wbutton, client_data);
412 +-}
413 +-
414 +-
415 +-static gboolean
416 +-xg_tool_bar_help_callback (GtkWidget *w,
417 +- GdkEventCrossing *event,
418 +- gpointer client_data);
419 +-
420 +-/* This callback is called when a help is to be shown for an item in
421 +- the detached tool bar when the detached tool bar it is not expanded. */
422 +-
423 +-static gboolean
424 +-xg_tool_bar_proxy_help_callback (GtkWidget *w,
425 +- GdkEventCrossing *event,
426 +- gpointer client_data)
427 +-{
428 +- GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w),
429 +- XG_TOOL_BAR_PROXY_BUTTON));
430 +-
431 +- return xg_tool_bar_help_callback (wbutton, event, client_data);
432 +-}
433 +-
434 + static GtkWidget *
435 + xg_get_tool_bar_widgets (GtkWidget *vb, GtkWidget **wimage)
436 + {
437 +@@ -4031,187 +3913,6 @@
438 + }
439 +
440 +
441 +-/* This callback is called when a tool item should create a proxy item,
442 +- such as for the overflow menu. Also called when the tool bar is detached.
443 +- If we don't create a proxy menu item, the detached tool bar will be
444 +- blank. */
445 +-
446 +-static gboolean
447 +-xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
448 +-{
449 +- GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (XG_BIN_CHILD (toolitem)));
450 +- GtkWidget *vb = XG_BIN_CHILD (wbutton);
451 +- GtkWidget *c1;
452 +- GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1));
453 +- GtkImage *wimage = GTK_IMAGE (c1);
454 +- GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label
455 +- (wlbl ? gtk_label_get_text (wlbl) : "");
456 +- GtkWidget *wmenuimage;
457 +-
458 +-
459 +- if (gtk_button_get_use_stock (wbutton))
460 +- wmenuimage = gtk_image_new_from_stock (gtk_button_get_label (wbutton),
461 +- GTK_ICON_SIZE_MENU);
462 +- else
463 +- {
464 +- GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton));
465 +- GtkImageType store_type = gtk_image_get_storage_type (wimage);
466 +-
467 +- g_object_set (G_OBJECT (settings), "gtk-menu-images", TRUE, NULL);
468 +-
469 +- if (store_type == GTK_IMAGE_STOCK)
470 +- {
471 +- gchar *stock_id;
472 +- gtk_image_get_stock (wimage, &stock_id, NULL);
473 +- wmenuimage = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
474 +- }
475 +- else if (store_type == GTK_IMAGE_ICON_SET)
476 +- {
477 +- GtkIconSet *icon_set;
478 +- gtk_image_get_icon_set (wimage, &icon_set, NULL);
479 +- wmenuimage = gtk_image_new_from_icon_set (icon_set,
480 +- GTK_ICON_SIZE_MENU);
481 +- }
482 +- else if (store_type == GTK_IMAGE_PIXBUF)
483 +- {
484 +- gint width, height;
485 +-
486 +- if (settings &&
487 +- gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
488 +- &width, &height))
489 +- {
490 +- GdkPixbuf *src_pixbuf, *dest_pixbuf;
491 +-
492 +- src_pixbuf = gtk_image_get_pixbuf (wimage);
493 +- dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, width, height,
494 +- GDK_INTERP_BILINEAR);
495 +-
496 +- wmenuimage = gtk_image_new_from_pixbuf (dest_pixbuf);
497 +- }
498 +- else
499 +- {
500 +- fprintf (stderr, "internal error: GTK_IMAGE_PIXBUF failed\n");
501 +- emacs_abort ();
502 +- }
503 +- }
504 +- else if (store_type == GTK_IMAGE_ICON_NAME)
505 +- {
506 +- const gchar *icon_name;
507 +- GtkIconSize icon_size;
508 +-
509 +- gtk_image_get_icon_name (wimage, &icon_name, &icon_size);
510 +- wmenuimage = gtk_image_new_from_icon_name (icon_name,
511 +- GTK_ICON_SIZE_MENU);
512 +- }
513 +- else
514 +- {
515 +- fprintf (stderr, "internal error: store_type is %d\n", store_type);
516 +- emacs_abort ();
517 +- }
518 +- }
519 +- if (wmenuimage)
520 +- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (wmenuitem), wmenuimage);
521 +-
522 +- g_signal_connect (G_OBJECT (wmenuitem),
523 +- "activate",
524 +- G_CALLBACK (xg_tool_bar_proxy_callback),
525 +- user_data);
526 +-
527 +-
528 +- g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON,
529 +- (gpointer) wbutton);
530 +- gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem);
531 +- gtk_widget_set_sensitive (wmenuitem,
532 +- gtk_widget_get_sensitive (GTK_WIDGET (wbutton)));
533 +-
534 +- /* Use enter/leave notify to show help. We use the events
535 +- rather than the GtkButton specific signals "enter" and
536 +- "leave", so we can have only one callback. The event
537 +- will tell us what kind of event it is. */
538 +- g_signal_connect (G_OBJECT (wmenuitem),
539 +- "enter-notify-event",
540 +- G_CALLBACK (xg_tool_bar_proxy_help_callback),
541 +- user_data);
542 +- g_signal_connect (G_OBJECT (wmenuitem),
543 +- "leave-notify-event",
544 +- G_CALLBACK (xg_tool_bar_proxy_help_callback),
545 +- user_data);
546 +-
547 +- return TRUE;
548 +-}
549 +-
550 +-/* This callback is called when a tool bar is detached. We must set
551 +- the height of the tool bar to zero when this happens so frame sizes
552 +- are correctly calculated.
553 +- WBOX is the handle box widget that enables detach/attach of the tool bar.
554 +- W is the tool bar widget.
555 +- CLIENT_DATA is a pointer to the frame the tool bar belongs to. */
556 +-
557 +-static void
558 +-xg_tool_bar_detach_callback (GtkHandleBox *wbox,
559 +- GtkWidget *w,
560 +- gpointer client_data)
561 +-{
562 +- struct frame *f = client_data;
563 +-
564 +- g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar,
565 +- NULL);
566 +-
567 +- if (f)
568 +- {
569 +- GtkRequisition req, req2;
570 +-
571 +- gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req);
572 +- gtk_widget_get_preferred_size (w, NULL, &req2);
573 +- req.width -= req2.width;
574 +- req.height -= req2.height;
575 +- if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0)
576 +- FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height;
577 +- else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0)
578 +- FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height;
579 +- else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0)
580 +- FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width;
581 +- else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0)
582 +- FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width;
583 +- xg_height_or_width_changed (f);
584 +- }
585 +-}
586 +-
587 +-/* This callback is called when a tool bar is reattached. We must set
588 +- the height of the tool bar when this happens so frame sizes
589 +- are correctly calculated.
590 +- WBOX is the handle box widget that enables detach/attach of the tool bar.
591 +- W is the tool bar widget.
592 +- CLIENT_DATA is a pointer to the frame the tool bar belongs to. */
593 +-
594 +-static void
595 +-xg_tool_bar_attach_callback (GtkHandleBox *wbox,
596 +- GtkWidget *w,
597 +- gpointer client_data)
598 +-{
599 +- struct frame *f = client_data;
600 +- g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL);
601 +-
602 +- if (f)
603 +- {
604 +- GtkRequisition req, req2;
605 +-
606 +- gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req);
607 +- gtk_widget_get_preferred_size (w, NULL, &req2);
608 +- req.width += req2.width;
609 +- req.height += req2.height;
610 +- if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0)
611 +- FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height;
612 +- else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0)
613 +- FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height;
614 +- else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0)
615 +- FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width;
616 +- else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0)
617 +- FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width;
618 +- xg_height_or_width_changed (f);
619 +- }
620 +-}
621 +-
622 + /* This callback is called when the mouse enters or leaves a tool bar item.
623 + It is used for displaying and hiding the help text.
624 + W is the tool bar item, a button.
625 +@@ -4291,12 +3992,6 @@
626 + gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
627 + #endif
628 +
629 +-#ifdef HAVE_GTK_HANDLE_BOX_NEW
630 +-#define TOOLBAR_TOP_WIDGET(x) ((x)->handlebox_widget)
631 +-#else
632 +-#define TOOLBAR_TOP_WIDGET(x) ((x)->toolbar_widget)
633 +-#endif
634 +-
635 + /* Attach a tool bar to frame F. */
636 +
637 + static void
638 +@@ -4304,31 +3999,15 @@
639 + {
640 + struct x_output *x = f->output_data.x;
641 + bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
642 +- GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
643 ++ GtkWidget *top_widget = x->toolbar_widget;
644 +
645 + toolbar_set_orientation (x->toolbar_widget,
646 + into_hbox
647 + ? GTK_ORIENTATION_VERTICAL
648 + : GTK_ORIENTATION_HORIZONTAL);
649 +-#ifdef HAVE_GTK_HANDLE_BOX_NEW
650 +- if (!x->handlebox_widget)
651 +- {
652 +- top_widget = x->handlebox_widget = gtk_handle_box_new ();
653 +- g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached",
654 +- G_CALLBACK (xg_tool_bar_detach_callback), f);
655 +- g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached",
656 +- G_CALLBACK (xg_tool_bar_attach_callback), f);
657 +- gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
658 +- x->toolbar_widget);
659 +- }
660 +-#endif
661 +
662 + if (into_hbox)
663 + {
664 +-#ifdef HAVE_GTK_HANDLE_BOX_NEW
665 +- gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
666 +- GTK_POS_TOP);
667 +-#endif
668 + gtk_box_pack_start (GTK_BOX (x->hbox_widget), top_widget,
669 + FALSE, FALSE, 0);
670 +
671 +@@ -4341,10 +4020,6 @@
672 + else
673 + {
674 + bool vbox_pos = x->menubar_widget != 0;
675 +-#ifdef HAVE_GTK_HANDLE_BOX_NEW
676 +- gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
677 +- GTK_POS_LEFT);
678 +-#endif
679 + gtk_box_pack_start (GTK_BOX (x->vbox_widget), top_widget,
680 + FALSE, FALSE, 0);
681 +
682 +@@ -4497,10 +4172,6 @@
683 + intptr_t ii = i;
684 + gpointer gi = (gpointer) ii;
685 +
686 +- g_signal_connect (G_OBJECT (ti), "create-menu-proxy",
687 +- G_CALLBACK (xg_tool_bar_menu_proxy),
688 +- gi);
689 +-
690 + g_signal_connect (G_OBJECT (wb), "clicked",
691 + G_CALLBACK (xg_tool_bar_callback),
692 + gi);
693 +@@ -4614,7 +4285,7 @@
694 + struct x_output *x = f->output_data.x;
695 + GtkRequisition req;
696 + int nl = 0, nr = 0, nt = 0, nb = 0;
697 +- GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
698 ++ GtkWidget *top_widget = x->toolbar_widget;
699 +
700 + gtk_widget_get_preferred_size (GTK_WIDGET (top_widget), NULL, &req);
701 + if (x->toolbar_in_hbox)
702 +@@ -4653,6 +4324,42 @@
703 + return 0;
704 + }
705 +
706 ++static char *
707 ++find_icon_from_name (char *name,
708 ++ GtkIconTheme *icon_theme,
709 ++ char **icon_name)
710 ++{
711 ++#if ! GTK_CHECK_VERSION (3, 10, 0)
712 ++ GtkStockItem stock_item;
713 ++#endif
714 ++
715 ++ if (name[0] == 'n' && name[1] == ':')
716 ++ {
717 ++ *icon_name = name + 2;
718 ++ name = NULL;
719 ++
720 ++ if (! gtk_icon_theme_has_icon (icon_theme, *icon_name))
721 ++ *icon_name = NULL;
722 ++ }
723 ++
724 ++#if ! GTK_CHECK_VERSION (3, 10, 0)
725 ++ else if (gtk_stock_lookup (name, &stock_item))
726 ++ *icon_name = NULL;
727 ++#endif
728 ++ else if (gtk_icon_theme_has_icon (icon_theme, name))
729 ++ {
730 ++ *icon_name = name;
731 ++ name = NULL;
732 ++ }
733 ++ else
734 ++ {
735 ++ name = NULL;
736 ++ *icon_name = NULL;
737 ++ }
738 ++
739 ++ return name;
740 ++}
741 ++
742 +
743 + /* Update the tool bar for frame F. Add new buttons and remove old. */
744 +
745 +@@ -4668,6 +4375,9 @@
746 + Lisp_Object style;
747 + bool text_image, horiz;
748 + struct xg_frame_tb_info *tbinfo;
749 ++ GdkScreen *screen;
750 ++ GtkIconTheme *icon_theme;
751 ++
752 +
753 + if (! FRAME_GTK_WIDGET (f))
754 + return;
755 +@@ -4702,6 +4412,8 @@
756 + dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar));
757 +
758 + style = Ftool_bar_get_system_style ();
759 ++ screen = gtk_widget_get_screen (GTK_WIDGET (wtoolbar));
760 ++ icon_theme = gtk_icon_theme_get_for_screen (screen);
761 +
762 + /* Are we up to date? */
763 + tbinfo = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
764 +@@ -4738,7 +4450,6 @@
765 + struct image *img = NULL;
766 + Lisp_Object image;
767 + Lisp_Object stock = Qnil;
768 +- GtkStockItem stock_item;
769 + char *stock_name = NULL;
770 + char *icon_name = NULL;
771 + Lisp_Object rtl;
772 +@@ -4792,32 +4503,28 @@
773 + if (!NILP (specified_file) && !NILP (Ffboundp (Qx_gtk_map_stock)))
774 + stock = call1 (Qx_gtk_map_stock, specified_file);
775 +
776 +- if (STRINGP (stock))
777 ++ if (CONSP (stock))
778 + {
779 +- stock_name = SSDATA (stock);
780 +- if (stock_name[0] == 'n' && stock_name[1] == ':')
781 +- {
782 +- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wtoolbar));
783 +- GtkIconTheme *icon_theme = gtk_icon_theme_get_for_screen (screen);
784 +-
785 +- icon_name = stock_name + 2;
786 +- stock_name = NULL;
787 +- stock = Qnil;
788 +-
789 +- if (! gtk_icon_theme_has_icon (icon_theme, icon_name))
790 +- icon_name = NULL;
791 +- else
792 +- icon_size = gtk_toolbar_get_icon_size (wtoolbar);
793 +- }
794 +- else if (gtk_stock_lookup (SSDATA (stock), &stock_item))
795 +- icon_size = gtk_toolbar_get_icon_size (wtoolbar);
796 +- else
797 +- {
798 +- stock = Qnil;
799 +- stock_name = NULL;
800 +- }
801 ++ Lisp_Object tem;
802 ++ for (tem = stock; CONSP (tem); tem = XCDR (tem))
803 ++ if (! NILP (tem) && STRINGP (XCAR (tem)))
804 ++ {
805 ++ stock_name = find_icon_from_name (SSDATA (XCAR (tem)),
806 ++ icon_theme,
807 ++ &icon_name);
808 ++ if (stock_name || icon_name) break;
809 ++ }
810 ++ }
811 ++ else if (STRINGP (stock))
812 ++ {
813 ++ stock_name = find_icon_from_name (SSDATA (stock),
814 ++ icon_theme,
815 ++ &icon_name);
816 + }
817 +
818 ++ if (stock_name || icon_name)
819 ++ icon_size = gtk_toolbar_get_icon_size (wtoolbar);
820 ++
821 + if (stock_name == NULL && icon_name == NULL)
822 + {
823 + /* No stock image, or stock item not known. Try regular
824 +@@ -4878,7 +4585,12 @@
825 + w = NULL;
826 + else if (stock_name)
827 + {
828 ++
829 ++#if GTK_CHECK_VERSION (3, 10, 0)
830 ++ w = gtk_image_new_from_icon_name (stock_name, icon_size);
831 ++#else
832 + w = gtk_image_new_from_stock (stock_name, icon_size);
833 ++#endif
834 + g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME,
835 + (gpointer) xstrdup (stock_name),
836 + (GDestroyNotify) xfree);
837 +@@ -4920,7 +4632,7 @@
838 + {
839 + if (! x->toolbar_is_packed)
840 + xg_pack_tool_bar (f, f->tool_bar_position);
841 +- gtk_widget_show_all (TOOLBAR_TOP_WIDGET (x));
842 ++ gtk_widget_show_all (x->toolbar_widget);
843 + if (xg_update_tool_bar_sizes (f))
844 + xg_height_or_width_changed (f);
845 + }
846 +@@ -4939,11 +4651,9 @@
847 + if (x->toolbar_widget)
848 + {
849 + struct xg_frame_tb_info *tbinfo;
850 +- GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
851 ++ GtkWidget *top_widget = x->toolbar_widget;
852 +
853 + block_input ();
854 +- /* We may have created the toolbar_widget in xg_create_tool_bar, but
855 +- not the x->handlebox_widget which is created in xg_pack_tool_bar. */
856 + if (x->toolbar_is_packed)
857 + {
858 + if (x->toolbar_in_hbox)
859 +@@ -4957,7 +4667,7 @@
860 + gtk_widget_destroy (x->toolbar_widget);
861 +
862 + x->toolbar_widget = 0;
863 +- TOOLBAR_TOP_WIDGET (x) = 0;
864 ++ x->toolbar_widget = 0;
865 + x->toolbar_is_packed = false;
866 + FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0;
867 + FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0;
868 +@@ -4982,7 +4692,7 @@
869 + xg_change_toolbar_position (struct frame *f, Lisp_Object pos)
870 + {
871 + struct x_output *x = f->output_data.x;
872 +- GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
873 ++ GtkWidget *top_widget = x->toolbar_widget;
874 +
875 + if (! x->toolbar_widget || ! top_widget)
876 + return;
877 +@@ -5026,9 +4736,6 @@
878 +
879 + gdpy_def = NULL;
880 + xg_ignore_gtk_scrollbar = 0;
881 +-#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
882 +- xg_detached_menus = 0;
883 +-#endif
884 + xg_menu_cb_list.prev = xg_menu_cb_list.next =
885 + xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0;
886 +
887 +--- emacs-24.5-orig/src/gtkutil.h
888 ++++ emacs-24.5/src/gtkutil.h
889 +@@ -107,8 +107,6 @@
890 +
891 + extern bool xg_event_is_for_menubar (struct frame *, const XEvent *);
892 +
893 +-extern bool xg_have_tear_offs (struct frame *f);
894 +-
895 + extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
896 +
897 + extern void xg_create_scroll_bar (struct frame *f,
898 +--- emacs-24.5-orig/src/xfns.c
899 ++++ emacs-24.5/src/xfns.c
900 +@@ -6221,12 +6221,6 @@
901 + to turn the additional text off. */);
902 + x_gtk_file_dialog_help_text = 1;
903 +
904 +- DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", x_gtk_whole_detached_tool_bar,
905 +- doc: /* If non-nil, a detached tool bar is shown in full.
906 +-The default is to just show an arrow and pressing on that arrow shows
907 +-the tool bar buttons. */);
908 +- x_gtk_whole_detached_tool_bar = 0;
909 +-
910 + DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips,
911 + doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used.
912 + Otherwise use Emacs own tooltip implementation.
913 +--- emacs-24.5-orig/src/xmenu.c
914 ++++ emacs-24.5/src/xmenu.c
915 +@@ -793,12 +793,6 @@
916 + f->output_data.x->saved_menu_event->type = 0;
917 + }
918 +
919 +-#ifdef USE_GTK
920 +- /* If we have detached menus, we must update deep so detached menus
921 +- also gets updated. */
922 +- deep_p = deep_p || xg_have_tear_offs (f);
923 +-#endif
924 +-
925 + if (deep_p)
926 + {
927 + /* Make a widget-value tree representing the entire menu trees. */
928 +--- emacs-24.5-orig/src/xterm.h
929 ++++ emacs-24.5/src/xterm.h
930 +@@ -491,10 +491,6 @@
931 + GtkWidget *menubar_widget;
932 + /* The tool bar in this frame */
933 + GtkWidget *toolbar_widget;
934 +-#ifdef HAVE_GTK_HANDLE_BOX_NEW
935 +-/* The handle box that makes the tool bar detachable. */
936 +- GtkWidget *handlebox_widget;
937 +-#endif
938 + /* True if tool bar is packed into the hbox widget (i.e. vertical). */
939 + bool_bf toolbar_in_hbox : 1;
940 + bool_bf toolbar_is_packed : 1;