From: Paul Eggert Date: Wed, 8 May 2013 22:56:08 +0000 (-0700) Subject: * xterm.h (GTK_PREREQ): New macro. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~240 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ad75d77ea30f940da9bcc3a96ee265896248e7ee;p=emacs.git * 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index c8e2abf3bec..b05ee5efd9d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-05-08 Paul Eggert + + * 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. + 2013-05-08 Eli Zaretskii * 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 . */ #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_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 11 +#if GTK_PREREQ (2, 12) #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_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 2) +#if GTK_PREREQ (3, 2) #define USE_NEW_GTK_FONT_CHOOSER 1 #else #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. */) Return false if and only if the workarea information cannot be obtained via the _NET_WORKAREA root window property. */ -#if !defined USE_GTK || GTK_MAJOR_VERSION < 3 + (GTK_MINOR_VERSION < 4) +#if ! (defined USE_GTK && GTK_PREREQ (3, 4)) 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_MAJOR_VERSION > 2 || GTK_MINOR_VERSION >= 20 +#if GTK_PREREQ (2, 20) 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_MAJOR_VERSION > 2 || GTK_MINOR_VERSION >= 14 +#if GTK_PREREQ (2, 14) 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_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4) +#if GTK_PREREQ (3, 4) 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_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 14) +#if GTK_PREREQ (2, 14) { char *name = gdk_screen_get_monitor_plug_name (gscreen, i); 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) dpy = DEFAULT_GDK_DISPLAY (); -#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 90 +#if ! GTK_PREREQ (2, 90) /* Load our own gtkrc if it exists. */ { 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 . */ 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 #include @@ -55,7 +59,7 @@ typedef GtkWidget *xt_or_gtk_widget; XSync (d, b); } while (0) /* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */ -#if GTK_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 13 +#if GTK_PREREQ (2, 14) #define USE_GTK_TOOLTIP #endif