summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-05-09 07:49:56 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-05-09 07:49:56 -0700
commit7583e2a0e23b20ecd29fa0e308e710bde4873ea4 (patch)
tree9081dd49133c3f6f0a7f2e56f66f5c2876442fb4 /src
parent59c886717271b57d661027685d203a3dd5cfafa7 (diff)
downloademacs-7583e2a0e23b20ecd29fa0e308e710bde4873ea4.tar.gz
* xterm.h (GTK_PREREQ): Remove, replacing with GTK_CHECK_VERSION.
(GTK_CHECK_VERSION): New macro, if not already defined. All uses of GTK_PREREQ, GTK_MAJOR_VERSION, etc. replaced by GTK_CHECK_VERSION.
Diffstat (limited to 'src')
-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 @@
+2013-05-09 Paul Eggert <eggert@cs.ucla.edu>
+
+ * xterm.h (GTK_PREREQ): Remove, replacing with GTK_CHECK_VERSION.
+ (GTK_CHECK_VERSION): New macro, if not already defined.
+ All uses of GTK_PREREQ, GTK_MAJOR_VERSION, etc.
+ replaced by GTK_CHECK_VERSION.
+
2013-05-08 Paul Eggert <eggert@cs.ucla.edu>
* 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/>. */
#define gtk_adjustment_get_step_increment(w) ((w)->step_increment)
#define gtk_adjustment_set_step_increment(w, s) ((w)->step_increment = (s))
#endif
-#if GTK_PREREQ (2, 12)
+#if GTK_CHECK_VERSION (2, 12, 0)
#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
#else
#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
#endif
-#if GTK_PREREQ (3, 2)
+#if GTK_CHECK_VERSION (3, 2, 0)
#define USE_NEW_GTK_FONT_CHOOSER 1
#else
#define USE_NEW_GTK_FONT_CHOOSER 0
@@ -202,7 +202,7 @@ xg_display_close (Display *dpy)
gdpy_def = gdpy_new;
}
-#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 10
+#if GTK_CHECK_VERSION (2, 0, 0) && ! GTK_CHECK_VERSION (2, 10, 0)
/* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug
http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way we
can continue running, but there will be memory leaks. */
@@ -1155,7 +1155,8 @@ xg_create_frame_widgets (FRAME_PTR f)
has backported it to Gtk+ 2.0 and they add the resize grip for
Gtk+ 2.0 applications also. But it has a bug that makes Emacs loop
forever, so disable the grip. */
-#if GTK_MAJOR_VERSION < 3 && defined (HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP)
+#if (! GTK_CHECK_VERSION (3, 0, 0) \
+ && defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP)
gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE);
#endif
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. */)
Return false if and only if the workarea information cannot be
obtained via the _NET_WORKAREA root window property. */
-#if ! (defined USE_GTK && GTK_PREREQ (3, 4))
+#if ! GTK_CHECK_VERSION (3, 4, 0)
static bool
x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
{
@@ -4265,7 +4265,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
/ x_display_pixel_height (dpyinfo));
gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display);
gscreen = gdk_display_get_default_screen (gdpy);
-#if GTK_PREREQ (2, 20)
+#if GTK_CHECK_VERSION (2, 20, 0)
primary_monitor = gdk_screen_get_primary_monitor (gscreen);
#endif
n_monitors = gdk_screen_get_n_monitors (gscreen);
@@ -4300,7 +4300,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
gdk_screen_get_monitor_geometry (gscreen, i, &rec);
geometry = list4i (rec.x, rec.y, rec.width, rec.height);
-#if GTK_PREREQ (2, 14)
+#if GTK_CHECK_VERSION (2, 14, 0)
width_mm = gdk_screen_get_monitor_width_mm (gscreen, i);
height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
#endif
@@ -4312,7 +4312,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
list2i (width_mm, height_mm)),
attributes);
-#if GTK_PREREQ (3, 4)
+#if GTK_CHECK_VERSION (3, 4, 0)
gdk_screen_get_monitor_workarea (gscreen, i, &rec);
workarea = list4i (rec.x, rec.y, rec.width, rec.height);
#else
@@ -4339,7 +4339,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
attributes = Fcons (Fcons (Qworkarea, workarea), attributes);
attributes = Fcons (Fcons (Qgeometry, geometry), attributes);
-#if GTK_PREREQ (2, 14)
+#if GTK_CHECK_VERSION (2, 14, 0)
{
char *name = gdk_screen_get_monitor_plug_name (gscreen, i);
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)
dpy = DEFAULT_GDK_DISPLAY ();
-#if ! GTK_PREREQ (2, 90)
+#if ! GTK_CHECK_VERSION (2, 90, 0)
/* Load our own gtkrc if it exists. */
{
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/>. */
typedef Widget xt_or_gtk_widget;
#endif
-/* True iff GTK's version is at least MAJOR.MINOR. */
-#define GTK_PREREQ(major, minor) \
- ((major) < GTK_MAJOR_VERSION + ((minor) <= GTK_MINOR_VERSION))
-
#ifdef USE_GTK
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
@@ -57,14 +53,26 @@ typedef GtkWidget *xt_or_gtk_widget;
#undef XSync
#define XSync(d, b) do { gdk_window_process_all_updates (); \
XSync (d, b); } while (0)
+#endif /* USE_GTK */
+
+/* True iff GTK's version is at least I.J.K. */
+#ifndef GTK_CHECK_VERSION
+# ifdef USE_GTK
+# define GTK_CHECK_VERSION(i, j, k) \
+ ((i) \
+ < GTK_MAJOR_VERSION + ((j) \
+ < GTK_MINOR_VERSION + ((k) \
+ <= GTK_MICRO_VERSION)))
+# else
+# define GTK_CHECK_VERSION(i, j, k) 0
+# endif
+#endif
/* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */
-#if GTK_PREREQ (2, 14)
+#if GTK_CHECK_VERSION (2, 14, 0)
#define USE_GTK_TOOLTIP
#endif
-#endif /* USE_GTK */
-
/* Bookkeeping to distinguish X versions. */