aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog7
-rw-r--r--src/gtkutil.c9
-rw-r--r--src/xfns.c10
-rw-r--r--src/xterm.c2
-rw-r--r--src/xterm.h22
5 files changed, 33 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b05ee5efd9d..e152d8de951 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12013-05-09 Paul Eggert <eggert@cs.ucla.edu>
2
3 * xterm.h (GTK_PREREQ): Remove, replacing with GTK_CHECK_VERSION.
4 (GTK_CHECK_VERSION): New macro, if not already defined.
5 All uses of GTK_PREREQ, GTK_MAJOR_VERSION, etc.
6 replaced by GTK_CHECK_VERSION.
7
12013-05-08 Paul Eggert <eggert@cs.ucla.edu> 82013-05-08 Paul Eggert <eggert@cs.ucla.edu>
2 9
3 * xterm.h (GTK_PREREQ): New macro. 10 * xterm.h (GTK_PREREQ): New macro.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d4f72fd6b7f..8ac58f18158 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -70,13 +70,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
70#define gtk_adjustment_get_step_increment(w) ((w)->step_increment) 70#define gtk_adjustment_get_step_increment(w) ((w)->step_increment)
71#define gtk_adjustment_set_step_increment(w, s) ((w)->step_increment = (s)) 71#define gtk_adjustment_set_step_increment(w, s) ((w)->step_increment = (s))
72#endif 72#endif
73#if GTK_PREREQ (2, 12) 73#if GTK_CHECK_VERSION (2, 12, 0)
74#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL) 74#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
75#else 75#else
76#define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) 76#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
77#endif 77#endif
78 78
79#if GTK_PREREQ (3, 2) 79#if GTK_CHECK_VERSION (3, 2, 0)
80#define USE_NEW_GTK_FONT_CHOOSER 1 80#define USE_NEW_GTK_FONT_CHOOSER 1
81#else 81#else
82#define USE_NEW_GTK_FONT_CHOOSER 0 82#define USE_NEW_GTK_FONT_CHOOSER 0
@@ -202,7 +202,7 @@ xg_display_close (Display *dpy)
202 gdpy_def = gdpy_new; 202 gdpy_def = gdpy_new;
203 } 203 }
204 204
205#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 10 205#if GTK_CHECK_VERSION (2, 0, 0) && ! GTK_CHECK_VERSION (2, 10, 0)
206 /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug 206 /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug
207 http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way we 207 http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way we
208 can continue running, but there will be memory leaks. */ 208 can continue running, but there will be memory leaks. */
@@ -1155,7 +1155,8 @@ xg_create_frame_widgets (FRAME_PTR f)
1155 has backported it to Gtk+ 2.0 and they add the resize grip for 1155 has backported it to Gtk+ 2.0 and they add the resize grip for
1156 Gtk+ 2.0 applications also. But it has a bug that makes Emacs loop 1156 Gtk+ 2.0 applications also. But it has a bug that makes Emacs loop
1157 forever, so disable the grip. */ 1157 forever, so disable the grip. */
1158#if GTK_MAJOR_VERSION < 3 && defined (HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP) 1158#if (! GTK_CHECK_VERSION (3, 0, 0) \
1159 && defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP)
1159 gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE); 1160 gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE);
1160#endif 1161#endif
1161 1162
diff --git a/src/xfns.c b/src/xfns.c
index 6d1d68dcada..46cd10e5f2f 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3804,7 +3804,7 @@ If omitted or nil, that stands for the selected frame's display. */)
3804 Return false if and only if the workarea information cannot be 3804 Return false if and only if the workarea information cannot be
3805 obtained via the _NET_WORKAREA root window property. */ 3805 obtained via the _NET_WORKAREA root window property. */
3806 3806
3807#if ! (defined USE_GTK && GTK_PREREQ (3, 4)) 3807#if ! GTK_CHECK_VERSION (3, 4, 0)
3808static bool 3808static bool
3809x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect) 3809x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
3810{ 3810{
@@ -4265,7 +4265,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4265 / x_display_pixel_height (dpyinfo)); 4265 / x_display_pixel_height (dpyinfo));
4266 gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display); 4266 gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display);
4267 gscreen = gdk_display_get_default_screen (gdpy); 4267 gscreen = gdk_display_get_default_screen (gdpy);
4268#if GTK_PREREQ (2, 20) 4268#if GTK_CHECK_VERSION (2, 20, 0)
4269 primary_monitor = gdk_screen_get_primary_monitor (gscreen); 4269 primary_monitor = gdk_screen_get_primary_monitor (gscreen);
4270#endif 4270#endif
4271 n_monitors = gdk_screen_get_n_monitors (gscreen); 4271 n_monitors = gdk_screen_get_n_monitors (gscreen);
@@ -4300,7 +4300,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4300 gdk_screen_get_monitor_geometry (gscreen, i, &rec); 4300 gdk_screen_get_monitor_geometry (gscreen, i, &rec);
4301 geometry = list4i (rec.x, rec.y, rec.width, rec.height); 4301 geometry = list4i (rec.x, rec.y, rec.width, rec.height);
4302 4302
4303#if GTK_PREREQ (2, 14) 4303#if GTK_CHECK_VERSION (2, 14, 0)
4304 width_mm = gdk_screen_get_monitor_width_mm (gscreen, i); 4304 width_mm = gdk_screen_get_monitor_width_mm (gscreen, i);
4305 height_mm = gdk_screen_get_monitor_height_mm (gscreen, i); 4305 height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
4306#endif 4306#endif
@@ -4312,7 +4312,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4312 list2i (width_mm, height_mm)), 4312 list2i (width_mm, height_mm)),
4313 attributes); 4313 attributes);
4314 4314
4315#if GTK_PREREQ (3, 4) 4315#if GTK_CHECK_VERSION (3, 4, 0)
4316 gdk_screen_get_monitor_workarea (gscreen, i, &rec); 4316 gdk_screen_get_monitor_workarea (gscreen, i, &rec);
4317 workarea = list4i (rec.x, rec.y, rec.width, rec.height); 4317 workarea = list4i (rec.x, rec.y, rec.width, rec.height);
4318#else 4318#else
@@ -4339,7 +4339,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4339 attributes = Fcons (Fcons (Qworkarea, workarea), attributes); 4339 attributes = Fcons (Fcons (Qworkarea, workarea), attributes);
4340 4340
4341 attributes = Fcons (Fcons (Qgeometry, geometry), attributes); 4341 attributes = Fcons (Fcons (Qgeometry, geometry), attributes);
4342#if GTK_PREREQ (2, 14) 4342#if GTK_CHECK_VERSION (2, 14, 0)
4343 { 4343 {
4344 char *name = gdk_screen_get_monitor_plug_name (gscreen, i); 4344 char *name = gdk_screen_get_monitor_plug_name (gscreen, i);
4345 if (name) 4345 if (name)
diff --git a/src/xterm.c b/src/xterm.c
index 55458077750..7505aa3936b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9921,7 +9921,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9921 9921
9922 dpy = DEFAULT_GDK_DISPLAY (); 9922 dpy = DEFAULT_GDK_DISPLAY ();
9923 9923
9924#if ! GTK_PREREQ (2, 90) 9924#if ! GTK_CHECK_VERSION (2, 90, 0)
9925 /* Load our own gtkrc if it exists. */ 9925 /* Load our own gtkrc if it exists. */
9926 { 9926 {
9927 const char *file = "~/.emacs.d/gtkrc"; 9927 const char *file = "~/.emacs.d/gtkrc";
diff --git a/src/xterm.h b/src/xterm.h
index 7722372ce6b..4a5ebc66370 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -43,10 +43,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
43typedef Widget xt_or_gtk_widget; 43typedef Widget xt_or_gtk_widget;
44#endif 44#endif
45 45
46/* True iff GTK's version is at least MAJOR.MINOR. */
47#define GTK_PREREQ(major, minor) \
48 ((major) < GTK_MAJOR_VERSION + ((minor) <= GTK_MINOR_VERSION))
49
50#ifdef USE_GTK 46#ifdef USE_GTK
51#include <gtk/gtk.h> 47#include <gtk/gtk.h>
52#include <gdk/gdkx.h> 48#include <gdk/gdkx.h>
@@ -57,14 +53,26 @@ typedef GtkWidget *xt_or_gtk_widget;
57#undef XSync 53#undef XSync
58#define XSync(d, b) do { gdk_window_process_all_updates (); \ 54#define XSync(d, b) do { gdk_window_process_all_updates (); \
59 XSync (d, b); } while (0) 55 XSync (d, b); } while (0)
56#endif /* USE_GTK */
57
58/* True iff GTK's version is at least I.J.K. */
59#ifndef GTK_CHECK_VERSION
60# ifdef USE_GTK
61# define GTK_CHECK_VERSION(i, j, k) \
62 ((i) \
63 < GTK_MAJOR_VERSION + ((j) \
64 < GTK_MINOR_VERSION + ((k) \
65 <= GTK_MICRO_VERSION)))
66# else
67# define GTK_CHECK_VERSION(i, j, k) 0
68# endif
69#endif
60 70
61/* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */ 71/* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */
62#if GTK_PREREQ (2, 14) 72#if GTK_CHECK_VERSION (2, 14, 0)
63#define USE_GTK_TOOLTIP 73#define USE_GTK_TOOLTIP
64#endif 74#endif
65 75
66#endif /* USE_GTK */
67
68 76
69/* Bookkeeping to distinguish X versions. */ 77/* Bookkeeping to distinguish X versions. */
70 78