Commit fc0f469f authored by Alexander Gramiak's avatar Alexander Gramiak

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.
parent 5c2f94a1
Pipeline #1295 failed with stage
in 50 minutes and 6 seconds
...@@ -2688,8 +2688,8 @@ check_gtk2=no ...@@ -2688,8 +2688,8 @@ check_gtk2=no
gtk3_pkg_errors= gtk3_pkg_errors=
if test "${opsys}" != "mingw32"; then if test "${opsys}" != "mingw32"; then
if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
GLIB_REQUIRED=2.28 GLIB_REQUIRED=2.37.5
GTK_REQUIRED=3.0 GTK_REQUIRED=3.10
GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries. dnl Checks for libraries.
...@@ -2716,8 +2716,8 @@ if test "${opsys}" != "mingw32"; then ...@@ -2716,8 +2716,8 @@ if test "${opsys}" != "mingw32"; then
fi fi
if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
GLIB_REQUIRED=2.10 GLIB_REQUIRED=2.28
GTK_REQUIRED=2.10 GTK_REQUIRED=2.24
GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries. dnl Checks for libraries.
...@@ -2804,30 +2804,8 @@ if test "${HAVE_GTK}" = "yes"; then ...@@ -2804,30 +2804,8 @@ if test "${HAVE_GTK}" = "yes"; then
AC_CHECK_FUNCS(gtk_file_selection_new) AC_CHECK_FUNCS(gtk_file_selection_new)
fi fi
dnl Same as above for gtk_handle_box. dnl This procedure causes a bug on certain Ubuntu GTK+2 builds
HAVE_GTK_HANDLE_BOX=no AC_CHECK_FUNCS(gtk_window_set_has_resize_grip)
AC_CHECK_DECL(GTK_TYPE_HANDLE_BOX, HAVE_GTK_HANDLE_BOX=yes,
HAVE_GTK_HANDLE_BOX=no, [AC_INCLUDES_DEFAULT
#include <gtk/gtk.h>])
if test "$HAVE_GTK_HANDLE_BOX" = yes; then
AC_CHECK_FUNCS(gtk_handle_box_new)
fi
dnl Same as above for gtk_tearoff_menu_item.
HAVE_GTK_TEAROFF_MENU_ITEM=no
AC_CHECK_DECL(GTK_TYPE_TEAROFF_MENU_ITEM, HAVE_GTK_TEAROFF_MENU_ITEM=yes,
HAVE_GTK_TEAROFF_MENU_ITEM=no, [AC_INCLUDES_DEFAULT
#include <gtk/gtk.h>])
if test "$HAVE_GTK_TEAROFF_MENU_ITEM" = yes; then
AC_CHECK_FUNCS(gtk_tearoff_menu_item_new)
fi
dnl Check for functions introduced in 2.14 and later.
AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
gtk_dialog_get_action_area gtk_widget_get_sensitive \
gtk_widget_get_mapped gtk_adjustment_get_page_size \
gtk_orientable_set_orientation \
gtk_window_set_has_resize_grip)
term_header=gtkutil.h term_header=gtkutil.h
fi fi
......
...@@ -89,6 +89,10 @@ Options" in the Emacs manual for more information. ...@@ -89,6 +89,10 @@ Options" in the Emacs manual for more information.
check that the portable dumper code has been updated to match the last check that the portable dumper code has been updated to match the last
change to one of the data structures that it relies on. change to one of the data structures that it relies on.
---
** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3
builds respectively.
* Startup Changes in Emacs 27.1 * Startup Changes in Emacs 27.1
......
This diff is collapsed.
...@@ -4496,7 +4496,7 @@ On MS Windows, this just returns nil. */) ...@@ -4496,7 +4496,7 @@ On MS Windows, this just returns nil. */)
Return false if and only if the workarea information cannot be Return false if and only if the workarea information cannot be
obtained via the _NET_WORKAREA root window property. */ obtained via the _NET_WORKAREA root window property. */
#if ! GTK_CHECK_VERSION (3, 4, 0) #ifndef HAVE_GTK3
static bool static bool
x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect) x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
{ {
...@@ -4906,9 +4906,9 @@ Internal use only, use `display-monitor-attributes-list' instead. */) ...@@ -4906,9 +4906,9 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
Lisp_Object attributes_list = Qnil; Lisp_Object attributes_list = Qnil;
#ifdef USE_GTK #ifdef USE_GTK
double mm_width_per_pixel, mm_height_per_pixel;
GdkDisplay *gdpy; GdkDisplay *gdpy;
#if ! GTK_CHECK_VERSION (3, 22, 0) #if ! GTK_CHECK_VERSION (3, 22, 0)
double mm_width_per_pixel, mm_height_per_pixel;
GdkScreen *gscreen; GdkScreen *gscreen;
#endif #endif
gint primary_monitor = 0, n_monitors, i; gint primary_monitor = 0, n_monitors, i;
...@@ -4917,19 +4917,18 @@ Internal use only, use `display-monitor-attributes-list' instead. */) ...@@ -4917,19 +4917,18 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
struct MonitorInfo *monitors; struct MonitorInfo *monitors;
block_input (); block_input ();
mm_width_per_pixel = ((double) WidthMMOfScreen (dpyinfo->screen)
/ x_display_pixel_width (dpyinfo));
mm_height_per_pixel = ((double) HeightMMOfScreen (dpyinfo->screen)
/ x_display_pixel_height (dpyinfo));
gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display); gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display);
#if GTK_CHECK_VERSION (3, 22, 0) #if GTK_CHECK_VERSION (3, 22, 0)
n_monitors = gdk_display_get_n_monitors (gdpy); n_monitors = gdk_display_get_n_monitors (gdpy);
#else #else
gscreen = gdk_display_get_default_screen (gdpy); gscreen = gdk_display_get_default_screen (gdpy);
#if GTK_CHECK_VERSION (2, 20, 0)
primary_monitor = gdk_screen_get_primary_monitor (gscreen);
#endif
n_monitors = gdk_screen_get_n_monitors (gscreen); n_monitors = gdk_screen_get_n_monitors (gscreen);
primary_monitor = gdk_screen_get_primary_monitor (gscreen);
/* Fallback if gdk_screen_get_monitor_{width,height}_mm fail */
mm_width_per_pixel = ((double) WidthMMOfScreen (dpyinfo->screen)
/ x_display_pixel_width (dpyinfo));
mm_height_per_pixel = ((double) HeightMMOfScreen (dpyinfo->screen)
/ x_display_pixel_height (dpyinfo));
#endif #endif
monitor_frames = make_nil_vector (n_monitors); monitor_frames = make_nil_vector (n_monitors);
monitors = xzalloc (n_monitors * sizeof *monitors); monitors = xzalloc (n_monitors * sizeof *monitors);
...@@ -4958,7 +4957,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) ...@@ -4958,7 +4957,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
for (i = 0; i < n_monitors; ++i) for (i = 0; i < n_monitors; ++i)
{ {
gint width_mm = -1, height_mm = -1; gint width_mm, height_mm;
GdkRectangle rec, work; GdkRectangle rec, work;
struct MonitorInfo *mi = &monitors[i]; struct MonitorInfo *mi = &monitors[i];
int scale = 1; int scale = 1;
...@@ -4975,18 +4974,17 @@ Internal use only, use `display-monitor-attributes-list' instead. */) ...@@ -4975,18 +4974,17 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0) #if GTK_CHECK_VERSION (3, 22, 0)
width_mm = gdk_monitor_get_width_mm (monitor); width_mm = gdk_monitor_get_width_mm (monitor);
height_mm = gdk_monitor_get_height_mm (monitor); height_mm = gdk_monitor_get_height_mm (monitor);
#elif GTK_CHECK_VERSION (2, 14, 0) #else
width_mm = gdk_screen_get_monitor_width_mm (gscreen, i); width_mm = gdk_screen_get_monitor_width_mm (gscreen, i);
height_mm = gdk_screen_get_monitor_height_mm (gscreen, i); height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
#endif
if (width_mm < 0) if (width_mm < 0)
width_mm = rec.width * mm_width_per_pixel + 0.5; width_mm = rec.width * mm_width_per_pixel + 0.5;
if (height_mm < 0) if (height_mm < 0)
height_mm = rec.height * mm_height_per_pixel + 0.5; height_mm = rec.height * mm_height_per_pixel + 0.5;
#endif
#if GTK_CHECK_VERSION (3, 22, 0) #if GTK_CHECK_VERSION (3, 22, 0)
gdk_monitor_get_workarea (monitor, &work); gdk_monitor_get_workarea (monitor, &work);
#elif GTK_CHECK_VERSION (3, 4, 0) #elif defined HAVE_GTK3
gdk_screen_get_monitor_workarea (gscreen, i, &work); gdk_screen_get_monitor_workarea (gscreen, i, &work);
#else #else
/* Emulate the behavior of GTK+ 3.4. */ /* Emulate the behavior of GTK+ 3.4. */
...@@ -5010,7 +5008,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) ...@@ -5010,7 +5008,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
/* GTK returns scaled sizes for the workareas. */ /* GTK returns scaled sizes for the workareas. */
#if GTK_CHECK_VERSION (3, 22, 0) #if GTK_CHECK_VERSION (3, 22, 0)
scale = gdk_monitor_get_scale_factor (monitor); scale = gdk_monitor_get_scale_factor (monitor);
#elif GTK_CHECK_VERSION (3, 10, 0) #elif defined HAVE_GTK3
scale = gdk_screen_get_monitor_scale_factor (gscreen, i); scale = gdk_screen_get_monitor_scale_factor (gscreen, i);
#endif #endif
rec.width *= scale; rec.width *= scale;
...@@ -5031,7 +5029,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) ...@@ -5031,7 +5029,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0) #if GTK_CHECK_VERSION (3, 22, 0)
dupstring (&mi->name, (gdk_monitor_get_model (monitor))); dupstring (&mi->name, (gdk_monitor_get_model (monitor)));
#elif GTK_CHECK_VERSION (2, 14, 0) #else
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i); mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
#endif #endif
} }
...@@ -5041,11 +5039,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) ...@@ -5041,11 +5039,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
primary_monitor, primary_monitor,
monitor_frames, monitor_frames,
source); source);
#if GTK_CHECK_VERSION (2, 14, 0)
free_monitors (monitors, n_monitors); free_monitors (monitors, n_monitors);
#else
xfree (monitors);
#endif
unblock_input (); unblock_input ();
#else /* not USE_GTK */ #else /* not USE_GTK */
...@@ -5380,7 +5374,7 @@ Frames are listed from topmost (first) to bottommost (last). */) ...@@ -5380,7 +5374,7 @@ Frames are listed from topmost (first) to bottommost (last). */)
static void static void
x_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) x_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
{ {
#if defined (USE_GTK) && GTK_CHECK_VERSION (2, 18, 0) #ifdef USE_GTK
block_input (); block_input ();
xg_frame_restack (f1, f2, above_flag); xg_frame_restack (f1, f2, above_flag);
unblock_input (); unblock_input ();
......
...@@ -12514,7 +12514,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) ...@@ -12514,7 +12514,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
dpy = DEFAULT_GDK_DISPLAY (); dpy = DEFAULT_GDK_DISPLAY ();
#if ! GTK_CHECK_VERSION (2, 90, 0) #ifndef HAVE_GTK3
/* Load our own gtkrc if it exists. */ /* Load our own gtkrc if it exists. */
{ {
const char *file = "~/.emacs.d/gtkrc"; const char *file = "~/.emacs.d/gtkrc";
......
...@@ -50,17 +50,8 @@ typedef Widget xt_or_gtk_widget; ...@@ -50,17 +50,8 @@ typedef Widget xt_or_gtk_widget;
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#endif /* USE_GTK */ #endif /* USE_GTK */
/* True iff GTK's version is at least I.J.K. */ #ifndef USE_GTK
#ifndef GTK_CHECK_VERSION #define GTK_CHECK_VERSION(i, j, k) false
# 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) false
# endif
#endif #endif
#ifdef USE_GTK #ifdef USE_GTK
...@@ -76,11 +67,6 @@ typedef GtkWidget *xt_or_gtk_widget; ...@@ -76,11 +67,6 @@ typedef GtkWidget *xt_or_gtk_widget;
#endif #endif
#endif /* USE_GTK */ #endif /* USE_GTK */
/* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */
#if GTK_CHECK_VERSION (2, 14, 0)
#define USE_GTK_TOOLTIP
#endif
#ifdef USE_CAIRO #ifdef USE_CAIRO
#include <cairo-xlib.h> #include <cairo-xlib.h>
#ifdef CAIRO_HAS_PDF_SURFACE #ifdef CAIRO_HAS_PDF_SURFACE
...@@ -594,12 +580,9 @@ struct x_output ...@@ -594,12 +580,9 @@ struct x_output
GdkGeometry size_hints; GdkGeometry size_hints;
long hint_flags; long hint_flags;
#ifdef USE_GTK_TOOLTIP
GtkTooltip *ttip_widget; GtkTooltip *ttip_widget;
GtkWidget *ttip_lbl; GtkWidget *ttip_lbl;
GtkWindow *ttip_window; GtkWindow *ttip_window;
#endif /* USE_GTK_TOOLTIP */
#endif /* USE_GTK */ #endif /* USE_GTK */
/* If >=0, a bitmap index. The indicated bitmap is used for the /* If >=0, a bitmap index. The indicated bitmap is used for the
...@@ -793,18 +776,6 @@ extern void x_mark_frame_dirty (struct frame *f); ...@@ -793,18 +776,6 @@ extern void x_mark_frame_dirty (struct frame *f);
FRAME_X_WINDOW (f)) FRAME_X_WINDOW (f))
#else #else
#ifdef USE_GTK #ifdef USE_GTK
/* Functions not present in older Gtk+ */
#ifndef HAVE_GTK_WIDGET_GET_WINDOW
#define gtk_widget_get_window(w) ((w)->window)
#endif
#ifndef HAVE_GTK_WIDGET_GET_MAPPED
#define gtk_widget_get_mapped(w) (GTK_WIDGET_MAPPED (w))
#endif
#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
#define gtk_adjustment_get_page_size(w) ((w)->page_size)
#define gtk_adjustment_get_upper(w) ((w)->upper)
#endif
#ifdef HAVE_GTK3 #ifdef HAVE_GTK3
#define DEFAULT_GDK_DISPLAY() \ #define DEFAULT_GDK_DISPLAY() \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment