aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorAlexander Gramiak2019-04-07 19:02:03 -0600
committerAlexander Gramiak2019-04-14 19:15:45 -0600
commitfc0f469fb5b5eb28ca4d9948190be6cb1bd8156e (patch)
treea872db9e55d150d03c7378b599d860214cab28b5 /src/gtkutil.c
parent5c2f94a182a1154766154040eb5b4b39275fd3b6 (diff)
downloademacs-fc0f469fb5b5eb28ca4d9948190be6cb1bd8156e.tar.gz
emacs-fc0f469fb5b5eb28ca4d9948190be6cb1bd8156e.zip
Bump minimum GTK versions to 2.24 and 3.10
* configure.ac: Bump required GTK 2 and GTK 3 versions and the associated GLib versions. Remove obsolete AC_CHECK_FUNCS calls. These check for functions available in later GTK 2 versions. These checks and can safely be removed with the exception of gtk_window_set_has_resize_grip, which according to a comment in gtkutil.c causes an issue in Ubuntu's GTK 2. * src/gtkutil.c: * src/xfns.c: * src/xterm.c: * src/xterm.h: Remove now unused conditional blocks. Use HAVE_GTK3 instead of GTK_CHECK_VERSION where now applicable. Remove checks of now always true USE_GTK_TOOLTIP.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r--src/gtkutil.c154
1 files changed, 33 insertions, 121 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index b130692c87a..2612683bcb2 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -52,48 +52,19 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
52#include <X11/extensions/Xdbe.h> 52#include <X11/extensions/Xdbe.h>
53#endif 53#endif
54 54
55#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW 55#ifdef HAVE_GTK3
56#define gtk_widget_set_has_window(w, b) \ 56#define XG_TEXT_CANCEL "Cancel"
57 (gtk_fixed_set_has_window (GTK_FIXED (w), b)) 57#define XG_TEXT_OK "OK"
58#endif 58#define XG_TEXT_OPEN "Open"
59#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA
60#define gtk_dialog_get_action_area(w) ((w)->action_area)
61#define gtk_dialog_get_content_area(w) ((w)->vbox)
62#endif
63#ifndef HAVE_GTK_WIDGET_GET_SENSITIVE
64#define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w))
65#endif
66#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
67#define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s))
68#define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s))
69#define gtk_adjustment_get_step_increment(w) ((w)->step_increment)
70#define gtk_adjustment_set_step_increment(w, s) ((w)->step_increment = (s))
71#endif
72#if GTK_CHECK_VERSION (2, 12, 0)
73#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
74#else 59#else
75#define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) 60#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
61#define XG_TEXT_OK GTK_STOCK_OK
62#define XG_TEXT_OPEN GTK_STOCK_OPEN
76#endif 63#endif
77 64
78#if ! GTK_CHECK_VERSION (2, 14, 0) 65#ifndef HAVE_GTK3
79#define gtk_adjustment_configure(adj, xvalue, xlower, \
80 xupper, xstep_increment, \
81 xpage_increment, xpagesize) \
82 do { \
83 adj->lower = xlower; \
84 adj->upper = xupper; \
85 adj->page_size = xpagesize; \
86 gtk_adjustment_set_value (adj, xvalue); \
87 adj->page_increment = xpage_increment; \
88 adj->step_increment = xstep_increment; \
89 } while (0)
90#endif /* < Gtk+ 2.14 */
91 66
92#ifdef HAVE_FREETYPE 67#ifdef HAVE_FREETYPE
93#if GTK_CHECK_VERSION (3, 2, 0)
94#define USE_NEW_GTK_FONT_CHOOSER 1
95#else
96#define USE_NEW_GTK_FONT_CHOOSER 0
97#define gtk_font_chooser_dialog_new(x, y) \ 68#define gtk_font_chooser_dialog_new(x, y) \
98 gtk_font_selection_dialog_new (x) 69 gtk_font_selection_dialog_new (x)
99#undef GTK_FONT_CHOOSER 70#undef GTK_FONT_CHOOSER
@@ -101,35 +72,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
101#define gtk_font_chooser_set_font(x, y) \ 72#define gtk_font_chooser_set_font(x, y) \
102 gtk_font_selection_dialog_set_font_name (x, y) 73 gtk_font_selection_dialog_set_font_name (x, y)
103#endif 74#endif
104#endif /* HAVE_FREETYPE */
105
106#if GTK_CHECK_VERSION (3, 10, 0)
107#define XG_TEXT_CANCEL "Cancel"
108#define XG_TEXT_OK "OK"
109#define XG_TEXT_OPEN "Open"
110#else
111#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
112#define XG_TEXT_OK GTK_STOCK_OK
113#define XG_TEXT_OPEN GTK_STOCK_OPEN
114#endif
115 75
116#ifndef HAVE_GTK3
117#ifdef USE_GTK_TOOLTIP
118#define gdk_window_get_screen(w) gdk_drawable_get_screen (w)
119#endif
120#define gdk_window_get_geometry(w, a, b, c, d) \ 76#define gdk_window_get_geometry(w, a, b, c, d) \
121 gdk_window_get_geometry (w, a, b, c, d, 0) 77 gdk_window_get_geometry (w, a, b, c, d, 0)
122#define gdk_x11_window_lookup_for_display(d, w) \
123 gdk_xid_table_lookup_for_display (d, w)
124#define gtk_box_new(ori, spacing) \ 78#define gtk_box_new(ori, spacing) \
125 ((ori) == GTK_ORIENTATION_HORIZONTAL \ 79 ((ori) == GTK_ORIENTATION_HORIZONTAL \
126 ? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing))) 80 ? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing)))
127#define gtk_scrollbar_new(ori, spacing) \ 81#define gtk_scrollbar_new(ori, spacing) \
128 ((ori) == GTK_ORIENTATION_HORIZONTAL \ 82 ((ori) == GTK_ORIENTATION_HORIZONTAL \
129 ? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing))) 83 ? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing)))
130#ifndef GDK_KEY_g
131#define GDK_KEY_g GDK_g
132#endif
133#endif /* HAVE_GTK3 */ 84#endif /* HAVE_GTK3 */
134 85
135#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) 86#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x))
@@ -227,7 +178,7 @@ xg_get_gdk_scale (void)
227int 178int
228xg_get_scale (struct frame *f) 179xg_get_scale (struct frame *f)
229{ 180{
230#if GTK_CHECK_VERSION (3, 10, 0) 181#ifdef HAVE_GTK3
231 if (FRAME_GTK_WIDGET (f)) 182 if (FRAME_GTK_WIDGET (f))
232 return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f)); 183 return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f));
233#endif 184#endif
@@ -261,15 +212,7 @@ xg_display_close (Display *dpy)
261 gdpy_def = gdpy_new; 212 gdpy_def = gdpy_new;
262 } 213 }
263 214
264#if GTK_CHECK_VERSION (2, 0, 0) && ! GTK_CHECK_VERSION (2, 10, 0)
265 /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash
266 <https://gitlab.gnome.org/GNOME/gtk/issues/221>. This way we
267 can continue running, but there will be memory leaks. */
268 g_object_run_dispose (G_OBJECT (gdpy));
269#else
270 /* This seems to be fixed in GTK 2.10. */
271 gdk_display_close (gdpy); 215 gdk_display_close (gdpy);
272#endif
273} 216}
274 217
275 218
@@ -368,7 +311,7 @@ xg_get_image_for_pixmap (struct frame *f,
368 GtkWidget *widget, 311 GtkWidget *widget,
369 GtkImage *old_widget) 312 GtkImage *old_widget)
370{ 313{
371#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) 314#if defined USE_CAIRO && defined HAVE_GTK3
372 cairo_surface_t *surface; 315 cairo_surface_t *surface;
373#else 316#else
374 GdkPixbuf *icon_buf; 317 GdkPixbuf *icon_buf;
@@ -400,7 +343,7 @@ xg_get_image_for_pixmap (struct frame *f,
400 on a monochrome display, and sometimes bad on all displays with 343 on a monochrome display, and sometimes bad on all displays with
401 certain themes. */ 344 certain themes. */
402 345
403#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) 346#if defined USE_CAIRO && defined HAVE_GTK3
404 surface = img->cr_data; 347 surface = img->cr_data;
405 348
406 if (surface) 349 if (surface)
@@ -643,8 +586,6 @@ xg_check_special_colors (struct frame *f,
643 We use that to pop down the tooltip. This happens if Gtk+ for some 586 We use that to pop down the tooltip. This happens if Gtk+ for some
644 reason wants to change or hide the tooltip. */ 587 reason wants to change or hide the tooltip. */
645 588
646#ifdef USE_GTK_TOOLTIP
647
648static void 589static void
649hierarchy_ch_cb (GtkWidget *widget, 590hierarchy_ch_cb (GtkWidget *widget,
650 GtkWidget *previous_toplevel, 591 GtkWidget *previous_toplevel,
@@ -711,8 +652,6 @@ qttip_cb (GtkWidget *widget,
711 return FALSE; 652 return FALSE;
712} 653}
713 654
714#endif /* USE_GTK_TOOLTIP */
715
716/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT. 655/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT.
717 Return true if a system tooltip is available. */ 656 Return true if a system tooltip is available. */
718 657
@@ -722,9 +661,6 @@ xg_prepare_tooltip (struct frame *f,
722 int *width, 661 int *width,
723 int *height) 662 int *height)
724{ 663{
725#ifndef USE_GTK_TOOLTIP
726 return 0;
727#else
728 struct x_output *x = f->output_data.x; 664 struct x_output *x = f->output_data.x;
729 GtkWidget *widget; 665 GtkWidget *widget;
730 GdkWindow *gwin; 666 GdkWindow *gwin;
@@ -768,7 +704,6 @@ xg_prepare_tooltip (struct frame *f,
768 unblock_input (); 704 unblock_input ();
769 705
770 return TRUE; 706 return TRUE;
771#endif /* USE_GTK_TOOLTIP */
772} 707}
773 708
774/* Show the tooltip at ROOT_X and ROOT_Y. 709/* Show the tooltip at ROOT_X and ROOT_Y.
@@ -777,7 +712,6 @@ xg_prepare_tooltip (struct frame *f,
777void 712void
778xg_show_tooltip (struct frame *f, int root_x, int root_y) 713xg_show_tooltip (struct frame *f, int root_x, int root_y)
779{ 714{
780#ifdef USE_GTK_TOOLTIP
781 struct x_output *x = f->output_data.x; 715 struct x_output *x = f->output_data.x;
782 if (x->ttip_window) 716 if (x->ttip_window)
783 { 717 {
@@ -787,7 +721,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
787 gtk_widget_show (GTK_WIDGET (x->ttip_window)); 721 gtk_widget_show (GTK_WIDGET (x->ttip_window));
788 unblock_input (); 722 unblock_input ();
789 } 723 }
790#endif
791} 724}
792 725
793 726
@@ -797,7 +730,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
797bool 730bool
798xg_hide_tooltip (struct frame *f) 731xg_hide_tooltip (struct frame *f)
799{ 732{
800#ifdef USE_GTK_TOOLTIP
801 if (f->output_data.x->ttip_window) 733 if (f->output_data.x->ttip_window)
802 { 734 {
803 GtkWindow *win = f->output_data.x->ttip_window; 735 GtkWindow *win = f->output_data.x->ttip_window;
@@ -816,7 +748,6 @@ xg_hide_tooltip (struct frame *f)
816 748
817 return TRUE; 749 return TRUE;
818 } 750 }
819#endif
820 return FALSE; 751 return FALSE;
821} 752}
822 753
@@ -1193,7 +1124,7 @@ xg_create_frame_widgets (struct frame *f)
1193 has backported it to Gtk+ 2.0 and they add the resize grip for 1124 has backported it to Gtk+ 2.0 and they add the resize grip for
1194 Gtk+ 2.0 applications also. But it has a bug that makes Emacs loop 1125 Gtk+ 2.0 applications also. But it has a bug that makes Emacs loop
1195 forever, so disable the grip. */ 1126 forever, so disable the grip. */
1196#if (! GTK_CHECK_VERSION (3, 0, 0) \ 1127#if (! defined HAVE_GTK3 \
1197 && defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP) 1128 && defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP)
1198 gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE); 1129 gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE);
1199#endif 1130#endif
@@ -1328,14 +1259,12 @@ xg_create_frame_widgets (struct frame *f)
1328 gdk_window_set_override_redirect (gwin, TRUE); 1259 gdk_window_set_override_redirect (gwin, TRUE);
1329 } 1260 }
1330 1261
1331#ifdef USE_GTK_TOOLTIP
1332 /* Steal a tool tip window we can move ourselves. */ 1262 /* Steal a tool tip window we can move ourselves. */
1333 f->output_data.x->ttip_widget = 0; 1263 f->output_data.x->ttip_widget = 0;
1334 f->output_data.x->ttip_lbl = 0; 1264 f->output_data.x->ttip_lbl = 0;
1335 f->output_data.x->ttip_window = 0; 1265 f->output_data.x->ttip_window = 0;
1336 gtk_widget_set_tooltip_text (wtop, "Dummy text"); 1266 gtk_widget_set_tooltip_text (wtop, "Dummy text");
1337 g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); 1267 g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
1338#endif
1339 1268
1340 { 1269 {
1341 GdkScreen *screen = gtk_widget_get_screen (wtop); 1270 GdkScreen *screen = gtk_widget_get_screen (wtop);
@@ -1363,9 +1292,7 @@ xg_free_frame_widgets (struct frame *f)
1363{ 1292{
1364 if (FRAME_GTK_OUTER_WIDGET (f)) 1293 if (FRAME_GTK_OUTER_WIDGET (f))
1365 { 1294 {
1366#ifdef USE_GTK_TOOLTIP
1367 struct x_output *x = f->output_data.x; 1295 struct x_output *x = f->output_data.x;
1368#endif
1369 struct xg_frame_tb_info *tbinfo 1296 struct xg_frame_tb_info *tbinfo
1370 = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), 1297 = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
1371 TB_INFO_KEY); 1298 TB_INFO_KEY);
@@ -1378,12 +1305,10 @@ xg_free_frame_widgets (struct frame *f)
1378 FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */ 1305 FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */
1379 FRAME_X_RAW_DRAWABLE (f) = 0; 1306 FRAME_X_RAW_DRAWABLE (f) = 0;
1380 FRAME_GTK_OUTER_WIDGET (f) = 0; 1307 FRAME_GTK_OUTER_WIDGET (f) = 0;
1381#ifdef USE_GTK_TOOLTIP
1382 if (x->ttip_lbl) 1308 if (x->ttip_lbl)
1383 gtk_widget_destroy (x->ttip_lbl); 1309 gtk_widget_destroy (x->ttip_lbl);
1384 if (x->ttip_widget) 1310 if (x->ttip_widget)
1385 g_object_unref (G_OBJECT (x->ttip_widget)); 1311 g_object_unref (G_OBJECT (x->ttip_widget));
1386#endif
1387 } 1312 }
1388} 1313}
1389 1314
@@ -1561,7 +1486,6 @@ xg_set_undecorated (struct frame *f, Lisp_Object undecorated)
1561void 1486void
1562xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) 1487xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
1563{ 1488{
1564#if GTK_CHECK_VERSION (2, 18, 0)
1565 block_input (); 1489 block_input ();
1566 if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2)) 1490 if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2))
1567 { 1491 {
@@ -1576,7 +1500,6 @@ xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
1576 x_sync (f1); 1500 x_sync (f1);
1577 } 1501 }
1578 unblock_input (); 1502 unblock_input ();
1579#endif
1580} 1503}
1581 1504
1582 1505
@@ -2216,7 +2139,7 @@ xg_get_file_name (struct frame *f,
2216 2139
2217#ifdef HAVE_FREETYPE 2140#ifdef HAVE_FREETYPE
2218 2141
2219#if USE_NEW_GTK_FONT_CHOOSER 2142#ifdef HAVE_GTK3
2220 2143
2221#define XG_WEIGHT_TO_SYMBOL(w) \ 2144#define XG_WEIGHT_TO_SYMBOL(w) \
2222 (w <= PANGO_WEIGHT_THIN ? Qextra_light \ 2145 (w <= PANGO_WEIGHT_THIN ? Qextra_light \
@@ -2233,7 +2156,7 @@ xg_get_file_name (struct frame *f,
2233 : s == PANGO_STYLE_ITALIC ? Qitalic \ 2156 : s == PANGO_STYLE_ITALIC ? Qitalic \
2234 : Qnormal) 2157 : Qnormal)
2235 2158
2236#endif /* USE_NEW_GTK_FONT_CHOOSER */ 2159#endif /* HAVE_GTK3 */
2237 2160
2238 2161
2239static char *x_last_font_name; 2162static char *x_last_font_name;
@@ -2280,7 +2203,7 @@ xg_get_font (struct frame *f, const char *default_name)
2280 done = xg_dialog_run (f, w); 2203 done = xg_dialog_run (f, w);
2281 if (done == GTK_RESPONSE_OK) 2204 if (done == GTK_RESPONSE_OK)
2282 { 2205 {
2283#if USE_NEW_GTK_FONT_CHOOSER 2206#ifdef HAVE_GTK3
2284 /* Use the GTK3 font chooser. */ 2207 /* Use the GTK3 font chooser. */
2285 PangoFontDescription *desc 2208 PangoFontDescription *desc
2286 = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w)); 2209 = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w));
@@ -2320,7 +2243,7 @@ xg_get_font (struct frame *f, const char *default_name)
2320 g_free (x_last_font_name); 2243 g_free (x_last_font_name);
2321 x_last_font_name = font_name; 2244 x_last_font_name = font_name;
2322 } 2245 }
2323#endif /* USE_NEW_GTK_FONT_CHOOSER */ 2246#endif /* HAVE_GTK3 */
2324 } 2247 }
2325 2248
2326 gtk_widget_destroy (w); 2249 gtk_widget_destroy (w);
@@ -3041,9 +2964,7 @@ xg_update_menubar (GtkWidget *menubar,
3041 bridge that might be loaded) that the item's label has 2964 bridge that might be loaded) that the item's label has
3042 changed. */ 2965 changed. */
3043 gtk_label_set_text (wlabel, utf8_label); 2966 gtk_label_set_text (wlabel, utf8_label);
3044#if GTK_CHECK_VERSION (2, 16, 0)
3045 g_object_notify (G_OBJECT (witem), "label"); 2967 g_object_notify (G_OBJECT (witem), "label");
3046#endif
3047 if (utf8_label) g_free (utf8_label); 2968 if (utf8_label) g_free (utf8_label);
3048 iter = g_list_next (iter); 2969 iter = g_list_next (iter);
3049 val = val->next; 2970 val = val->next;
@@ -3222,10 +3143,8 @@ xg_update_menu_item (widget_value *val,
3222 } 3143 }
3223 } 3144 }
3224 3145
3225#if GTK_CHECK_VERSION (2, 16, 0)
3226 if (label_changed) /* See comment in xg_update_menubar. */ 3146 if (label_changed) /* See comment in xg_update_menubar. */
3227 g_object_notify (G_OBJECT (w), "label"); 3147 g_object_notify (G_OBJECT (w), "label");
3228#endif
3229} 3148}
3230 3149
3231/* Update the toggle menu item W so it corresponds to VAL. */ 3150/* Update the toggle menu item W so it corresponds to VAL. */
@@ -3324,7 +3243,7 @@ xg_update_submenu (GtkWidget *submenu,
3324 { 3243 {
3325 /* Not a submenu anymore. */ 3244 /* Not a submenu anymore. */
3326 g_object_ref (G_OBJECT (sub)); 3245 g_object_ref (G_OBJECT (sub));
3327 remove_submenu (witem); 3246 gtk_menu_item_set_submenu (witem, NULL);
3328 gtk_widget_destroy (sub); 3247 gtk_widget_destroy (sub);
3329 } 3248 }
3330 else if (cur->contents) 3249 else if (cur->contents)
@@ -4492,14 +4411,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
4492} 4411}
4493#endif 4412#endif
4494 4413
4495#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
4496#define toolbar_set_orientation(w, o) \
4497 gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o)
4498#else
4499#define toolbar_set_orientation(w, o) \
4500 gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
4501#endif
4502
4503/* Attach a tool bar to frame F. */ 4414/* Attach a tool bar to frame F. */
4504 4415
4505static void 4416static void
@@ -4509,10 +4420,10 @@ xg_pack_tool_bar (struct frame *f, Lisp_Object pos)
4509 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); 4420 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
4510 GtkWidget *top_widget = x->toolbar_widget; 4421 GtkWidget *top_widget = x->toolbar_widget;
4511 4422
4512 toolbar_set_orientation (x->toolbar_widget, 4423 gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
4513 into_hbox 4424 into_hbox
4514 ? GTK_ORIENTATION_VERTICAL 4425 ? GTK_ORIENTATION_VERTICAL
4515 : GTK_ORIENTATION_HORIZONTAL); 4426 : GTK_ORIENTATION_HORIZONTAL);
4516 4427
4517 if (into_hbox) 4428 if (into_hbox)
4518 { 4429 {
@@ -4565,7 +4476,7 @@ static void
4565xg_create_tool_bar (struct frame *f) 4476xg_create_tool_bar (struct frame *f)
4566{ 4477{
4567 struct x_output *x = f->output_data.x; 4478 struct x_output *x = f->output_data.x;
4568#if GTK_CHECK_VERSION (3, 3, 6) 4479#ifdef HAVE_GTK3
4569 GtkStyleContext *gsty; 4480 GtkStyleContext *gsty;
4570#endif 4481#endif
4571 struct xg_frame_tb_info *tbinfo 4482 struct xg_frame_tb_info *tbinfo
@@ -4589,10 +4500,11 @@ xg_create_tool_bar (struct frame *f)
4589 gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar"); 4500 gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
4590 4501
4591 gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); 4502 gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
4592 toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL); 4503 gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
4504 GTK_ORIENTATION_HORIZONTAL);
4593 g_signal_connect (x->toolbar_widget, "size-allocate", 4505 g_signal_connect (x->toolbar_widget, "size-allocate",
4594 G_CALLBACK (tb_size_cb), f); 4506 G_CALLBACK (tb_size_cb), f);
4595#if GTK_CHECK_VERSION (3, 3, 6) 4507#ifdef HAVE_GTK3
4596 gsty = gtk_widget_get_style_context (x->toolbar_widget); 4508 gsty = gtk_widget_get_style_context (x->toolbar_widget);
4597 gtk_style_context_add_class (gsty, "primary-toolbar"); 4509 gtk_style_context_add_class (gsty, "primary-toolbar");
4598#endif 4510#endif
@@ -4645,7 +4557,7 @@ xg_make_tool_item (struct frame *f,
4645 GtkWidget *wb = gtk_button_new (); 4557 GtkWidget *wb = gtk_button_new ();
4646 /* The eventbox is here so we can have tooltips on disabled items. */ 4558 /* The eventbox is here so we can have tooltips on disabled items. */
4647 GtkWidget *weventbox = gtk_event_box_new (); 4559 GtkWidget *weventbox = gtk_event_box_new ();
4648#if GTK_CHECK_VERSION (3, 3, 6) 4560#ifdef HAVE_GTK3
4649 GtkCssProvider *css_prov = gtk_css_provider_new (); 4561 GtkCssProvider *css_prov = gtk_css_provider_new ();
4650 GtkStyleContext *gsty; 4562 GtkStyleContext *gsty;
4651 4563
@@ -4777,7 +4689,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
4777 { 4689 {
4778 gpointer gold_img = g_object_get_data (G_OBJECT (wimage), 4690 gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
4779 XG_TOOL_BAR_IMAGE_DATA); 4691 XG_TOOL_BAR_IMAGE_DATA);
4780#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) 4692#if defined USE_CAIRO && defined HAVE_GTK3
4781 void *old_img = (void *) gold_img; 4693 void *old_img = (void *) gold_img;
4782 if (old_img != img->cr_data) 4694 if (old_img != img->cr_data)
4783 return 1; 4695 return 1;
@@ -4850,7 +4762,7 @@ find_icon_from_name (char *name,
4850 GtkIconTheme *icon_theme, 4762 GtkIconTheme *icon_theme,
4851 char **icon_name) 4763 char **icon_name)
4852{ 4764{
4853#if ! GTK_CHECK_VERSION (3, 10, 0) 4765#ifndef HAVE_GTK3
4854 GtkStockItem stock_item; 4766 GtkStockItem stock_item;
4855#endif 4767#endif
4856 4768
@@ -4863,7 +4775,7 @@ find_icon_from_name (char *name,
4863 *icon_name = NULL; 4775 *icon_name = NULL;
4864 } 4776 }
4865 4777
4866#if ! GTK_CHECK_VERSION (3, 10, 0) 4778#ifndef HAVE_GTK3
4867 else if (gtk_stock_lookup (name, &stock_item)) 4779 else if (gtk_stock_lookup (name, &stock_item))
4868 *icon_name = NULL; 4780 *icon_name = NULL;
4869#endif 4781#endif
@@ -5078,7 +4990,7 @@ update_frame_tool_bar (struct frame *f)
5078 prepare_image_for_display (f, img); 4990 prepare_image_for_display (f, img);
5079 4991
5080 if (img->load_failed_p 4992 if (img->load_failed_p
5081#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) 4993#if defined USE_CAIRO && defined HAVE_GTK3
5082 || img->cr_data == NULL 4994 || img->cr_data == NULL
5083#else 4995#else
5084 || img->pixmap == None 4996 || img->pixmap == None
@@ -5113,7 +5025,7 @@ update_frame_tool_bar (struct frame *f)
5113 else if (stock_name) 5025 else if (stock_name)
5114 { 5026 {
5115 5027
5116#if GTK_CHECK_VERSION (3, 10, 0) 5028#ifdef HAVE_GTK3
5117 w = gtk_image_new_from_icon_name (stock_name, icon_size); 5029 w = gtk_image_new_from_icon_name (stock_name, icon_size);
5118#else 5030#else
5119 w = gtk_image_new_from_stock (stock_name, icon_size); 5031 w = gtk_image_new_from_stock (stock_name, icon_size);
@@ -5133,7 +5045,7 @@ update_frame_tool_bar (struct frame *f)
5133 { 5045 {
5134 w = xg_get_image_for_pixmap (f, img, x->widget, NULL); 5046 w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
5135 g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, 5047 g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
5136#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0) 5048#if defined USE_CAIRO && defined HAVE_GTK3
5137 (gpointer)img->cr_data 5049 (gpointer)img->cr_data
5138#else 5050#else
5139 (gpointer)img->pixmap 5051 (gpointer)img->pixmap
@@ -5309,7 +5221,7 @@ xg_initialize (void)
5309 5221
5310 settings = gtk_settings_get_for_screen (gdk_display_get_default_screen 5222 settings = gtk_settings_get_for_screen (gdk_display_get_default_screen
5311 (gdk_display_get_default ())); 5223 (gdk_display_get_default ()));
5312#if ! GTK_CHECK_VERSION (3, 10, 0) 5224#ifndef HAVE_GTK3
5313 /* Remove F10 as a menu accelerator, it does not mix well with Emacs key 5225 /* Remove F10 as a menu accelerator, it does not mix well with Emacs key
5314 bindings. It doesn't seem to be any way to remove properties, 5226 bindings. It doesn't seem to be any way to remove properties,
5315 so we set it to "" which in means "no key". */ 5227 so we set it to "" which in means "no key". */