aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-05-08 15:56:08 -0700
committerPaul Eggert2013-05-08 15:56:08 -0700
commitad75d77ea30f940da9bcc3a96ee265896248e7ee (patch)
tree4a88d76b4d716ea9eed03224e555d00847f1c48b /src
parenta9e4425bc99733b6ecf3898801b6595f35c4ef30 (diff)
downloademacs-ad75d77ea30f940da9bcc3a96ee265896248e7ee.tar.gz
emacs-ad75d77ea30f940da9bcc3a96ee265896248e7ee.zip
* xterm.h (GTK_PREREQ): New macro.
All simple uses of GTK_MAJOR_VERSION and GTK_MINOR_VERSION changed to use this macro instead, for consistency and clarity.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/gtkutil.c4
-rw-r--r--src/xfns.c10
-rw-r--r--src/xterm.c2
-rw-r--r--src/xterm.h6
5 files changed, 19 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c8e2abf3bec..b05ee5efd9d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12013-05-08 Paul Eggert <eggert@cs.ucla.edu>
2
3 * xterm.h (GTK_PREREQ): New macro.
4 All simple uses of GTK_MAJOR_VERSION and GTK_MINOR_VERSION changed
5 to use this macro instead, for consistency and clarity.
6
12013-05-08 Eli Zaretskii <eliz@gnu.org> 72013-05-08 Eli Zaretskii <eliz@gnu.org>
2 8
3 * xdisp.c (row_for_charpos_p): New function, with code of 9 * xdisp.c (row_for_charpos_p): New function, with code of
diff --git a/src/gtkutil.c b/src/gtkutil.c
index f83d8660fcc..d4f72fd6b7f 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_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 11 73#if GTK_PREREQ (2, 12)
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_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 2) 79#if GTK_PREREQ (3, 2)
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
diff --git a/src/xfns.c b/src/xfns.c
index 2164ff5cd71..6d1d68dcada 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_MAJOR_VERSION < 3 + (GTK_MINOR_VERSION < 4) 3807#if ! (defined USE_GTK && GTK_PREREQ (3, 4))
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_MAJOR_VERSION > 2 || GTK_MINOR_VERSION >= 20 4268#if GTK_PREREQ (2, 20)
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_MAJOR_VERSION > 2 || GTK_MINOR_VERSION >= 14 4303#if GTK_PREREQ (2, 14)
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_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4) 4315#if GTK_PREREQ (3, 4)
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_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 14) 4342#if GTK_PREREQ (2, 14)
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 93473986ca5..55458077750 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_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 90 9924#if ! GTK_PREREQ (2, 90)
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 dc060fbbcff..7722372ce6b 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -43,6 +43,10 @@ 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
46#ifdef USE_GTK 50#ifdef USE_GTK
47#include <gtk/gtk.h> 51#include <gtk/gtk.h>
48#include <gdk/gdkx.h> 52#include <gdk/gdkx.h>
@@ -55,7 +59,7 @@ typedef GtkWidget *xt_or_gtk_widget;
55 XSync (d, b); } while (0) 59 XSync (d, b); } while (0)
56 60
57/* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */ 61/* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */
58#if GTK_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 13 62#if GTK_PREREQ (2, 14)
59#define USE_GTK_TOOLTIP 63#define USE_GTK_TOOLTIP
60#endif 64#endif
61 65