* Increase minimum required GTK versions?
@ 2019-04-07 19:03 Alex
2019-04-07 19:08 ` Eli Zaretskii
0 siblings, 1 reply; 29+ messages in thread
From: Alex @ 2019-04-07 19:03 UTC (permalink / raw)
To: emacs-devel
I'd like to clean up the GTK code a bit by removing some of the obsolete
codepaths; what's the policy was on supporting obsolete toolkit
versions?
Looking at the GTK version history [1], the current minimum versions
were released 2006-07-03 and 2011-02-10. Bumping the versions to 2.14
(2008-09-04) and 3.10 (2013-09-23) would remove a good few checks. Is
this still too recent? If not, perhaps the GTK+2 requirement could be
bumped to the latest (2.24 -- 2011-01-30)?
[1] https://en.wikipedia.org/wiki/GTK#History
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-07 19:03 Increase minimum required GTK versions? Alex
@ 2019-04-07 19:08 ` Eli Zaretskii
2019-04-07 19:25 ` Alex
0 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-07 19:08 UTC (permalink / raw)
To: Alex; +Cc: emacs-devel
> From: Alex <agrambot@gmail.com>
> Date: Sun, 07 Apr 2019 13:03:07 -0600
>
> I'd like to clean up the GTK code a bit by removing some of the obsolete
> codepaths; what's the policy was on supporting obsolete toolkit
> versions?
>
> Looking at the GTK version history [1], the current minimum versions
> were released 2006-07-03 and 2011-02-10. Bumping the versions to 2.14
> (2008-09-04) and 3.10 (2013-09-23) would remove a good few checks. Is
> this still too recent? If not, perhaps the GTK+2 requirement could be
> bumped to the latest (2.24 -- 2011-01-30)?
The main factor is not how many years have passed, it's what the
distros provide.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-07 19:08 ` Eli Zaretskii
@ 2019-04-07 19:25 ` Alex
2019-04-08 4:45 ` Paul Eggert
0 siblings, 1 reply; 29+ messages in thread
From: Alex @ 2019-04-07 19:25 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Alex <agrambot@gmail.com>
>> Date: Sun, 07 Apr 2019 13:03:07 -0600
>>
>> I'd like to clean up the GTK code a bit by removing some of the obsolete
>> codepaths; what's the policy was on supporting obsolete toolkit
>> versions?
>>
>> Looking at the GTK version history [1], the current minimum versions
>> were released 2006-07-03 and 2011-02-10. Bumping the versions to 2.14
>> (2008-09-04) and 3.10 (2013-09-23) would remove a good few checks. Is
>> this still too recent? If not, perhaps the GTK+2 requirement could be
>> bumped to the latest (2.24 -- 2011-01-30)?
>
> The main factor is not how many years have passed, it's what the
> distros provide.
Both Debian Jessie (oldstable) and Ubuntu 14.04LTS include GTK 2.24 and
3.10. Is that good enough?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-07 19:25 ` Alex
@ 2019-04-08 4:45 ` Paul Eggert
2019-04-08 15:03 ` Alex
0 siblings, 1 reply; 29+ messages in thread
From: Paul Eggert @ 2019-04-08 4:45 UTC (permalink / raw)
To: Alex, Eli Zaretskii; +Cc: emacs-devel
Alex wrote:
> Both Debian Jessie (oldstable) and Ubuntu 14.04LTS include GTK 2.24 and
> 3.10. Is that good enough?
I also suggest looking at RHEL 5, since Red Hat says they'll support it until
2020-11-30 (see <https://access.redhat.com/articles/2986371>).
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-08 4:45 ` Paul Eggert
@ 2019-04-08 15:03 ` Alex
2019-04-08 16:03 ` Kaushal Modi
2019-04-08 16:15 ` Glenn Morris
0 siblings, 2 replies; 29+ messages in thread
From: Alex @ 2019-04-08 15:03 UTC (permalink / raw)
To: Paul Eggert; +Cc: Eli Zaretskii, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]
Paul Eggert <eggert@cs.ucla.edu> writes:
> Alex wrote:
>> Both Debian Jessie (oldstable) and Ubuntu 14.04LTS include GTK 2.24 and
>> 3.10. Is that good enough?
>
> I also suggest looking at RHEL 5, since Red Hat says they'll support it until
> 2020-11-30 (see <https://access.redhat.com/articles/2986371>).
Do we really have to consider RHEL 5, considering that it's on "Extended
Life Cycle Support"[1]? If someone is paying extra for post-Production
support for a "retired"[1] enterprise distro from 2007, then I doubt
that they or their users will be running the latest Emacs, especially a
GTK build instead of terminal-only or another toolkit such as Lucid.
Even if they are, they can probably install a later version of GTK as
well, right?
RHEL 5 also only has GCC 4.1.2; is this enough for Emacs?
FWIW, RHEL 6, which is still in Production phase, has GTK 2.24.
I've attached a patch that bumps both versions and removes obsolete
cruft. Bumping the GTK2 version helps the most here.
[1] https://access.redhat.com/solutions/690063
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Bump-minimum-GTK-versions-to-2.24-and-3.10.patch --]
[-- Type: text/x-patch, Size: 32204 bytes --]
From 6073476ed8cabd9790a9e954347e55eba8bf7cb7 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sun, 7 Apr 2019 19:02:03 -0600
Subject: [PATCH] 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.
* 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.
* src/gtkutil.c: Remove old file selection dialog.
* lisp/term/x-win.el: Obsolete old file selection dialog interface.
---
configure.ac | 46 ++------
etc/NEWS | 4 +
lisp/term/x-win.el | 10 ++
src/gtkutil.c | 264 ++++++++-------------------------------------
src/xfns.c | 36 ++-----
src/xterm.c | 2 +-
src/xterm.h | 33 +-----
7 files changed, 73 insertions(+), 322 deletions(-)
diff --git a/configure.ac b/configure.ac
index c93cfbbb59..3c5b9a0fb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2671,8 +2671,8 @@ AC_DEFUN
gtk3_pkg_errors=
if test "${opsys}" != "mingw32"; then
if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
- GLIB_REQUIRED=2.28
- GTK_REQUIRED=3.0
+ GLIB_REQUIRED=2.37.5
+ GTK_REQUIRED=3.10
GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries.
@@ -2699,8 +2699,8 @@ AC_DEFUN
fi
if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
- GLIB_REQUIRED=2.10
- GTK_REQUIRED=2.10
+ GLIB_REQUIRED=2.28
+ GTK_REQUIRED=2.24
GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries.
@@ -2775,42 +2775,8 @@ AC_DEFUN
with_toolkit_scroll_bars=yes
fi
- dnl Check if we have the old file selection dialog declared and
- dnl in the link library. In 2.x it may be in the library,
- dnl but not declared if deprecated featured has been selected out.
- dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
- HAVE_GTK_FILE_SELECTION=no
- AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
- HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
-#include <gtk/gtk.h>])
- if test "$HAVE_GTK_FILE_SELECTION" = yes; then
- AC_CHECK_FUNCS(gtk_file_selection_new)
- fi
-
- dnl Same as above for gtk_handle_box.
- HAVE_GTK_HANDLE_BOX=no
- 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)
+ dnl This procedure causes a bug on certain Ubuntu GTK+2 builds
+ AC_CHECK_FUNCS(gtk_window_set_has_resize_grip)
term_header=gtkutil.h
fi
diff --git a/etc/NEWS b/etc/NEWS
index c7456c681a..87176245e0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -84,6 +84,10 @@ The new command-line argument '--dump-file=FILE' allows to specify a
non-default '.pdmp' file to load the state from; see the node "Initial
Options" in the Emacs manual for more information.
+---
+** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3
+builds respectively.
+
\f
* Startup Changes in Emacs 27.1
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 56061371fe..74e8ba0a57 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1486,6 +1486,16 @@ x-gtk-map-stock
(global-set-key [XF86WakeUp] 'ignore)
+;;; Obsolete definitions
+(defun x-uses-old-gtk-dialog ()
+ "Return t if the old Gtk+ file selection dialog is used.
+Note that the old Gtk+ file selection dialog is never used since
+version 27.1."
+ nil)
+(make-obsolete 'x-uses-old-gtk-dialog nil "27.1")
+
+(make-obsolete 'x-gtk-use-old-file-dialog nil "27.1")
+
(provide 'x-win)
(provide 'term/x-win)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index b130692c87..9894e02065 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -52,48 +52,19 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <X11/extensions/Xdbe.h>
#endif
-#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW
-#define gtk_widget_set_has_window(w, b) \
- (gtk_fixed_set_has_window (GTK_FIXED (w), b))
-#endif
-#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA
-#define gtk_dialog_get_action_area(w) ((w)->action_area)
-#define gtk_dialog_get_content_area(w) ((w)->vbox)
-#endif
-#ifndef HAVE_GTK_WIDGET_GET_SENSITIVE
-#define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w))
-#endif
-#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
-#define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s))
-#define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s))
-#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_CHECK_VERSION (2, 12, 0)
-#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
+#ifdef HAVE_GTK3
+#define XG_TEXT_CANCEL "Cancel"
+#define XG_TEXT_OK "OK"
+#define XG_TEXT_OPEN "Open"
#else
-#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
+#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
+#define XG_TEXT_OK GTK_STOCK_OK
+#define XG_TEXT_OPEN GTK_STOCK_OPEN
#endif
-#if ! GTK_CHECK_VERSION (2, 14, 0)
-#define gtk_adjustment_configure(adj, xvalue, xlower, \
- xupper, xstep_increment, \
- xpage_increment, xpagesize) \
- do { \
- adj->lower = xlower; \
- adj->upper = xupper; \
- adj->page_size = xpagesize; \
- gtk_adjustment_set_value (adj, xvalue); \
- adj->page_increment = xpage_increment; \
- adj->step_increment = xstep_increment; \
- } while (0)
-#endif /* < Gtk+ 2.14 */
+#ifndef HAVE_GTK3
#ifdef HAVE_FREETYPE
-#if GTK_CHECK_VERSION (3, 2, 0)
-#define USE_NEW_GTK_FONT_CHOOSER 1
-#else
-#define USE_NEW_GTK_FONT_CHOOSER 0
#define gtk_font_chooser_dialog_new(x, y) \
gtk_font_selection_dialog_new (x)
#undef GTK_FONT_CHOOSER
@@ -101,35 +72,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#define gtk_font_chooser_set_font(x, y) \
gtk_font_selection_dialog_set_font_name (x, y)
#endif
-#endif /* HAVE_FREETYPE */
-#if GTK_CHECK_VERSION (3, 10, 0)
-#define XG_TEXT_CANCEL "Cancel"
-#define XG_TEXT_OK "OK"
-#define XG_TEXT_OPEN "Open"
-#else
-#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
-#define XG_TEXT_OK GTK_STOCK_OK
-#define XG_TEXT_OPEN GTK_STOCK_OPEN
-#endif
-
-#ifndef HAVE_GTK3
-#ifdef USE_GTK_TOOLTIP
-#define gdk_window_get_screen(w) gdk_drawable_get_screen (w)
-#endif
#define gdk_window_get_geometry(w, a, b, c, d) \
gdk_window_get_geometry (w, a, b, c, d, 0)
-#define gdk_x11_window_lookup_for_display(d, w) \
- gdk_xid_table_lookup_for_display (d, w)
#define gtk_box_new(ori, spacing) \
((ori) == GTK_ORIENTATION_HORIZONTAL \
? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing)))
#define gtk_scrollbar_new(ori, spacing) \
((ori) == GTK_ORIENTATION_HORIZONTAL \
? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing)))
-#ifndef GDK_KEY_g
-#define GDK_KEY_g GDK_g
-#endif
#endif /* HAVE_GTK3 */
#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x))
@@ -227,7 +178,7 @@ xg_get_gdk_scale (void)
int
xg_get_scale (struct frame *f)
{
-#if GTK_CHECK_VERSION (3, 10, 0)
+#ifdef HAVE_GTK3
if (FRAME_GTK_WIDGET (f))
return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f));
#endif
@@ -261,15 +212,7 @@ xg_display_close (Display *dpy)
gdpy_def = gdpy_new;
}
-#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
- <https://gitlab.gnome.org/GNOME/gtk/issues/221>. This way we
- can continue running, but there will be memory leaks. */
- g_object_run_dispose (G_OBJECT (gdpy));
-#else
- /* This seems to be fixed in GTK 2.10. */
gdk_display_close (gdpy);
-#endif
}
\f
@@ -368,7 +311,7 @@ xg_get_image_for_pixmap (struct frame *f,
GtkWidget *widget,
GtkImage *old_widget)
{
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
cairo_surface_t *surface;
#else
GdkPixbuf *icon_buf;
@@ -400,7 +343,7 @@ xg_get_image_for_pixmap (struct frame *f,
on a monochrome display, and sometimes bad on all displays with
certain themes. */
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
surface = img->cr_data;
if (surface)
@@ -643,8 +586,6 @@ xg_check_special_colors (struct frame *f,
We use that to pop down the tooltip. This happens if Gtk+ for some
reason wants to change or hide the tooltip. */
-#ifdef USE_GTK_TOOLTIP
-
static void
hierarchy_ch_cb (GtkWidget *widget,
GtkWidget *previous_toplevel,
@@ -711,8 +652,6 @@ qttip_cb (GtkWidget *widget,
return FALSE;
}
-#endif /* USE_GTK_TOOLTIP */
-
/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT.
Return true if a system tooltip is available. */
@@ -722,9 +661,6 @@ xg_prepare_tooltip (struct frame *f,
int *width,
int *height)
{
-#ifndef USE_GTK_TOOLTIP
- return 0;
-#else
struct x_output *x = f->output_data.x;
GtkWidget *widget;
GdkWindow *gwin;
@@ -768,7 +704,6 @@ xg_prepare_tooltip (struct frame *f,
unblock_input ();
return TRUE;
-#endif /* USE_GTK_TOOLTIP */
}
/* Show the tooltip at ROOT_X and ROOT_Y.
@@ -777,7 +712,6 @@ xg_prepare_tooltip (struct frame *f,
void
xg_show_tooltip (struct frame *f, int root_x, int root_y)
{
-#ifdef USE_GTK_TOOLTIP
struct x_output *x = f->output_data.x;
if (x->ttip_window)
{
@@ -787,7 +721,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
gtk_widget_show (GTK_WIDGET (x->ttip_window));
unblock_input ();
}
-#endif
}
@@ -797,7 +730,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
bool
xg_hide_tooltip (struct frame *f)
{
-#ifdef USE_GTK_TOOLTIP
if (f->output_data.x->ttip_window)
{
GtkWindow *win = f->output_data.x->ttip_window;
@@ -816,7 +748,6 @@ xg_hide_tooltip (struct frame *f)
return TRUE;
}
-#endif
return FALSE;
}
@@ -1193,7 +1124,7 @@ xg_create_frame_widgets (struct frame *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_CHECK_VERSION (3, 0, 0) \
+#if (! defined HAVE_GTK3 \
&& defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP)
gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE);
#endif
@@ -1328,14 +1259,12 @@ xg_create_frame_widgets (struct frame *f)
gdk_window_set_override_redirect (gwin, TRUE);
}
-#ifdef USE_GTK_TOOLTIP
/* Steal a tool tip window we can move ourselves. */
f->output_data.x->ttip_widget = 0;
f->output_data.x->ttip_lbl = 0;
f->output_data.x->ttip_window = 0;
gtk_widget_set_tooltip_text (wtop, "Dummy text");
g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
-#endif
{
GdkScreen *screen = gtk_widget_get_screen (wtop);
@@ -1363,9 +1292,7 @@ xg_free_frame_widgets (struct frame *f)
{
if (FRAME_GTK_OUTER_WIDGET (f))
{
-#ifdef USE_GTK_TOOLTIP
struct x_output *x = f->output_data.x;
-#endif
struct xg_frame_tb_info *tbinfo
= g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
TB_INFO_KEY);
@@ -1378,12 +1305,10 @@ xg_free_frame_widgets (struct frame *f)
FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */
FRAME_X_RAW_DRAWABLE (f) = 0;
FRAME_GTK_OUTER_WIDGET (f) = 0;
-#ifdef USE_GTK_TOOLTIP
if (x->ttip_lbl)
gtk_widget_destroy (x->ttip_lbl);
if (x->ttip_widget)
g_object_unref (G_OBJECT (x->ttip_widget));
-#endif
}
}
@@ -1561,7 +1486,6 @@ xg_set_undecorated (struct frame *f, Lisp_Object undecorated)
void
xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
{
-#if GTK_CHECK_VERSION (2, 18, 0)
block_input ();
if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2))
{
@@ -1576,7 +1500,6 @@ xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
x_sync (f1);
}
unblock_input ();
-#endif
}
@@ -1937,29 +1860,6 @@ xg_dialog_run (struct frame *f, GtkWidget *w)
/***********************************************************************
File dialog functions
***********************************************************************/
-/* Return true if the old file selection dialog is being used. */
-
-bool
-xg_uses_old_file_dialog (void)
-{
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
- return x_gtk_use_old_file_dialog;
-#else
- return 0;
-#endif
-}
-
-
-typedef char * (*xg_get_file_func) (GtkWidget *);
-
-/* Return the selected file for file chooser dialog W.
- The returned string must be free:d. */
-
-static char *
-xg_get_file_name_from_chooser (GtkWidget *w)
-{
- return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
-}
/* Callback called when the "Show hidden files" toggle is pressed.
WIDGET is the toggle widget, DATA is the file chooser dialog. */
@@ -2017,8 +1917,7 @@ static GtkWidget *
xg_get_file_with_chooser (struct frame *f,
char *prompt,
char *default_filename,
- bool mustmatch_p, bool only_dir_p,
- xg_get_file_func *func)
+ bool mustmatch_p, bool only_dir_p)
{
char msgbuf[1024];
@@ -2036,7 +1935,7 @@ xg_get_file_with_chooser (struct frame *f,
XG_TEXT_CANCEL, GTK_RESPONSE_CANCEL,
(mustmatch_p || only_dir_p ?
XG_TEXT_OPEN : XG_TEXT_OK),
- GTK_RESPONSE_OK,
+ GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE);
@@ -2059,9 +1958,7 @@ xg_get_file_with_chooser (struct frame *f,
if (x_gtk_file_dialog_help_text)
{
char *z = msgbuf;
- /* Gtk+ 2.10 has the file name text entry box integrated in the dialog.
- Show the C-l help text only for versions < 2.10. */
- if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (action != GTK_FILE_CHOOSER_ACTION_SAVE)
z = stpcpy (z, "\nType C-l to display a file name text entry box.\n");
strcpy (z, "\nIf you don't like this file selector, use the "
"corresponding\nkey binding or customize "
@@ -2106,60 +2003,8 @@ xg_get_file_with_chooser (struct frame *f,
}
}
- *func = xg_get_file_name_from_chooser;
- return filewin;
-}
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-
-/* Return the selected file for file selector dialog W.
- The returned string must be free:d. */
-
-static char *
-xg_get_file_name_from_selector (GtkWidget *w)
-{
- GtkFileSelection *filesel = GTK_FILE_SELECTION (w);
- return xstrdup (gtk_file_selection_get_filename (filesel));
-}
-
-/* Create a file selection dialog.
- F is the current frame.
- PROMPT is a prompt to show to the user. May not be NULL.
- DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
- If MUSTMATCH_P, the returned file name must be an existing
- file. *FUNC is set to a function that can be used to retrieve the
- selected file name from the returned widget.
-
- Returns the created widget. */
-
-static GtkWidget *
-xg_get_file_with_selection (struct frame *f,
- char *prompt,
- char *default_filename,
- bool mustmatch_p, bool only_dir_p,
- xg_get_file_func *func)
-{
- GtkWidget *filewin;
- GtkFileSelection *filesel;
-
- filewin = gtk_file_selection_new (prompt);
- filesel = GTK_FILE_SELECTION (filewin);
-
- if (default_filename)
- gtk_file_selection_set_filename (filesel, default_filename);
-
- if (mustmatch_p)
- {
- /* The selection_entry part of filesel is not documented. */
- gtk_widget_set_sensitive (filesel->selection_entry, FALSE);
- gtk_file_selection_hide_fileop_buttons (filesel);
- }
-
- *func = xg_get_file_name_from_selector;
-
return filewin;
}
-#endif /* HAVE_GTK_FILE_SELECTION_NEW */
/* Read a file name from the user using a file dialog, either the old
file selection dialog, or the new file chooser dialog. Which to use
@@ -2181,33 +2026,21 @@ xg_get_file_name (struct frame *f,
bool mustmatch_p,
bool only_dir_p)
{
- GtkWidget *w = 0;
- char *fn = 0;
- int filesel_done = 0;
- xg_get_file_func func;
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-
- if (xg_uses_old_file_dialog ())
- w = xg_get_file_with_selection (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
- else
- w = xg_get_file_with_chooser (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
+ GtkWidget *w;
+ char *name = NULL;
+ int filesel_done;
-#else /* not HAVE_GTK_FILE_SELECTION_NEW */
w = xg_get_file_with_chooser (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
-#endif /* not HAVE_GTK_FILE_SELECTION_NEW */
+ mustmatch_p, only_dir_p);
gtk_widget_set_name (w, "emacs-filedialog");
filesel_done = xg_dialog_run (f, w);
- if (filesel_done == GTK_RESPONSE_OK)
- fn = (*func) (w);
+ if (filesel_done == GTK_RESPONSE_ACCEPT)
+ name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
gtk_widget_destroy (w);
- return fn;
+ return name;
}
/***********************************************************************
@@ -2216,7 +2049,7 @@ xg_get_file_name (struct frame *f,
#ifdef HAVE_FREETYPE
-#if USE_NEW_GTK_FONT_CHOOSER
+#ifdef HAVE_GTK3
#define XG_WEIGHT_TO_SYMBOL(w) \
(w <= PANGO_WEIGHT_THIN ? Qextra_light \
@@ -2233,7 +2066,7 @@ xg_get_file_name (struct frame *f,
: s == PANGO_STYLE_ITALIC ? Qitalic \
: Qnormal)
-#endif /* USE_NEW_GTK_FONT_CHOOSER */
+#endif /* HAVE_GTK3 */
static char *x_last_font_name;
@@ -2280,7 +2113,7 @@ xg_get_font (struct frame *f, const char *default_name)
done = xg_dialog_run (f, w);
if (done == GTK_RESPONSE_OK)
{
-#if USE_NEW_GTK_FONT_CHOOSER
+#ifdef HAVE_GTK3
/* Use the GTK3 font chooser. */
PangoFontDescription *desc
= gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w));
@@ -2320,7 +2153,7 @@ xg_get_font (struct frame *f, const char *default_name)
g_free (x_last_font_name);
x_last_font_name = font_name;
}
-#endif /* USE_NEW_GTK_FONT_CHOOSER */
+#endif /* HAVE_GTK3 */
}
gtk_widget_destroy (w);
@@ -3041,9 +2874,7 @@ xg_update_menubar (GtkWidget *menubar,
bridge that might be loaded) that the item's label has
changed. */
gtk_label_set_text (wlabel, utf8_label);
-#if GTK_CHECK_VERSION (2, 16, 0)
g_object_notify (G_OBJECT (witem), "label");
-#endif
if (utf8_label) g_free (utf8_label);
iter = g_list_next (iter);
val = val->next;
@@ -3222,10 +3053,8 @@ xg_update_menu_item (widget_value *val,
}
}
-#if GTK_CHECK_VERSION (2, 16, 0)
if (label_changed) /* See comment in xg_update_menubar. */
g_object_notify (G_OBJECT (w), "label");
-#endif
}
/* Update the toggle menu item W so it corresponds to VAL. */
@@ -3324,7 +3153,7 @@ xg_update_submenu (GtkWidget *submenu,
{
/* Not a submenu anymore. */
g_object_ref (G_OBJECT (sub));
- remove_submenu (witem);
+ gtk_menu_item_set_submenu (witem, NULL);
gtk_widget_destroy (sub);
}
else if (cur->contents)
@@ -4492,14 +4321,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
}
#endif
-#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
-#define toolbar_set_orientation(w, o) \
- gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o)
-#else
-#define toolbar_set_orientation(w, o) \
- gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
-#endif
-
/* Attach a tool bar to frame F. */
static void
@@ -4509,10 +4330,10 @@ xg_pack_tool_bar (struct frame *f, Lisp_Object pos)
bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
GtkWidget *top_widget = x->toolbar_widget;
- toolbar_set_orientation (x->toolbar_widget,
- into_hbox
- ? GTK_ORIENTATION_VERTICAL
- : GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
+ into_hbox
+ ? GTK_ORIENTATION_VERTICAL
+ : GTK_ORIENTATION_HORIZONTAL);
if (into_hbox)
{
@@ -4565,7 +4386,7 @@ static void
xg_create_tool_bar (struct frame *f)
{
struct x_output *x = f->output_data.x;
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
GtkStyleContext *gsty;
#endif
struct xg_frame_tb_info *tbinfo
@@ -4589,10 +4410,11 @@ xg_create_tool_bar (struct frame *f)
gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
- toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
+ GTK_ORIENTATION_HORIZONTAL);
g_signal_connect (x->toolbar_widget, "size-allocate",
G_CALLBACK (tb_size_cb), f);
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
gsty = gtk_widget_get_style_context (x->toolbar_widget);
gtk_style_context_add_class (gsty, "primary-toolbar");
#endif
@@ -4645,7 +4467,7 @@ xg_make_tool_item (struct frame *f,
GtkWidget *wb = gtk_button_new ();
/* The eventbox is here so we can have tooltips on disabled items. */
GtkWidget *weventbox = gtk_event_box_new ();
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
GtkCssProvider *css_prov = gtk_css_provider_new ();
GtkStyleContext *gsty;
@@ -4777,7 +4599,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
{
gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
XG_TOOL_BAR_IMAGE_DATA);
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
void *old_img = (void *) gold_img;
if (old_img != img->cr_data)
return 1;
@@ -4850,7 +4672,7 @@ find_icon_from_name (char *name,
GtkIconTheme *icon_theme,
char **icon_name)
{
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
GtkStockItem stock_item;
#endif
@@ -4863,7 +4685,7 @@ find_icon_from_name (char *name,
*icon_name = NULL;
}
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
else if (gtk_stock_lookup (name, &stock_item))
*icon_name = NULL;
#endif
@@ -5078,7 +4900,7 @@ update_frame_tool_bar (struct frame *f)
prepare_image_for_display (f, img);
if (img->load_failed_p
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
|| img->cr_data == NULL
#else
|| img->pixmap == None
@@ -5113,7 +4935,7 @@ update_frame_tool_bar (struct frame *f)
else if (stock_name)
{
-#if GTK_CHECK_VERSION (3, 10, 0)
+#ifdef HAVE_GTK3
w = gtk_image_new_from_icon_name (stock_name, icon_size);
#else
w = gtk_image_new_from_stock (stock_name, icon_size);
@@ -5133,7 +4955,7 @@ update_frame_tool_bar (struct frame *f)
{
w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
(gpointer)img->cr_data
#else
(gpointer)img->pixmap
@@ -5309,7 +5131,7 @@ xg_initialize (void)
settings = gtk_settings_get_for_screen (gdk_display_get_default_screen
(gdk_display_get_default ()));
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
/* Remove F10 as a menu accelerator, it does not mix well with Emacs key
bindings. It doesn't seem to be any way to remove properties,
so we set it to "" which in means "no key". */
diff --git a/src/xfns.c b/src/xfns.c
index 13f66f0718..4664c138a0 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4496,7 +4496,7 @@ On MS Windows, this just returns nil. */)
Return false if and only if the workarea information cannot be
obtained via the _NET_WORKAREA root window property. */
-#if ! GTK_CHECK_VERSION (3, 4, 0)
+#ifndef HAVE_GTK3
static bool
x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
{
@@ -4958,7 +4958,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
for (i = 0; i < n_monitors; ++i)
{
- gint width_mm = -1, height_mm = -1;
+ gint width_mm, height_mm;
GdkRectangle rec, work;
struct MonitorInfo *mi = &monitors[i];
int scale = 1;
@@ -4975,7 +4975,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
width_mm = gdk_monitor_get_width_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);
height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
#endif
@@ -4986,7 +4986,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
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);
#else
/* Emulate the behavior of GTK+ 3.4. */
@@ -5010,7 +5010,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
/* GTK returns scaled sizes for the workareas. */
#if GTK_CHECK_VERSION (3, 22, 0)
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);
#endif
rec.width *= scale;
@@ -5031,7 +5031,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
mi->name = xstrdup (gdk_monitor_get_model (monitor));
-#elif GTK_CHECK_VERSION (2, 14, 0)
+#else
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
#endif
}
@@ -5041,11 +5041,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
primary_monitor,
monitor_frames,
source);
-#if GTK_CHECK_VERSION (2, 14, 0)
free_monitors (monitors, n_monitors);
-#else
- xfree (monitors);
-#endif
unblock_input ();
#else /* not USE_GTK */
@@ -5380,7 +5376,7 @@ Frames are listed from topmost (first) to bottommost (last). */)
static void
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 ();
xg_frame_restack (f1, f2, above_flag);
unblock_input ();
@@ -7003,23 +6999,6 @@ DEFUN ("x-double-buffered-p", Fx_double_buffered_p, Sx_double_buffered_p,
File selection dialog
***********************************************************************/
-DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog,
- Sx_uses_old_gtk_dialog,
- 0, 0, 0,
- doc: /* Return t if the old Gtk+ file selection dialog is used. */)
- (void)
-{
-#ifdef USE_GTK
- if (use_dialog_box
- && use_file_dialog
- && window_system_available (SELECTED_FRAME ())
- && xg_uses_old_file_dialog ())
- return Qt;
-#endif
- return Qnil;
-}
-
-
#ifdef USE_MOTIF
/* Callback for "OK" and "Cancel" on file selection dialog. */
@@ -7936,7 +7915,6 @@ When using Gtk+ tooltips, the tooltip face is not used. */);
tip_last_parms = Qnil;
staticpro (&tip_last_parms);
- defsubr (&Sx_uses_old_gtk_dialog);
#if defined (USE_MOTIF) || defined (USE_GTK)
defsubr (&Sx_file_dialog);
#endif
diff --git a/src/xterm.c b/src/xterm.c
index 2f830afe61..998b7d971d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -12513,7 +12513,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
dpy = DEFAULT_GDK_DISPLAY ();
-#if ! GTK_CHECK_VERSION (2, 90, 0)
+#ifndef HAVE_GTK3
/* Load our own gtkrc if it exists. */
{
const char *file = "~/.emacs.d/gtkrc";
diff --git a/src/xterm.h b/src/xterm.h
index 972a10f4d4..c4346aabd4 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -50,17 +50,8 @@ typedef Widget xt_or_gtk_widget;
#include <gdk/gdkx.h>
#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) false
-# endif
+#ifndef USE_GTK
+#define GTK_CHECK_VERSION(i, j, k) false
#endif
#ifdef USE_GTK
@@ -76,11 +67,6 @@ typedef GtkWidget *xt_or_gtk_widget;
#endif
#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
#include <cairo-xlib.h>
#ifdef CAIRO_HAS_PDF_SURFACE
@@ -594,12 +580,9 @@ struct x_output
GdkGeometry size_hints;
long hint_flags;
-#ifdef USE_GTK_TOOLTIP
GtkTooltip *ttip_widget;
GtkWidget *ttip_lbl;
GtkWindow *ttip_window;
-#endif /* USE_GTK_TOOLTIP */
-
#endif /* USE_GTK */
/* 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);
FRAME_X_WINDOW (f))
#else
#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
#define DEFAULT_GDK_DISPLAY() \
--
2.21.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-08 15:03 ` Alex
@ 2019-04-08 16:03 ` Kaushal Modi
2019-04-08 16:15 ` Glenn Morris
1 sibling, 0 replies; 29+ messages in thread
From: Kaushal Modi @ 2019-04-08 16:03 UTC (permalink / raw)
To: Alex; +Cc: Eli Zaretskii, Paul Eggert, Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]
On Mon, Apr 8, 2019 at 11:05 AM Alex <agrambot@gmail.com> wrote:
> Paul Eggert <eggert@cs.ucla.edu> writes:
>
> > Alex wrote:
> >> Both Debian Jessie (oldstable) and Ubuntu 14.04LTS include GTK 2.24 and
> >> 3.10. Is that good enough?
> >
> > I also suggest looking at RHEL 5, since Red Hat says they'll support it
> until
> > 2020-11-30 (see <https://access.redhat.com/articles/2986371>).
>
> Do we really have to consider RHEL 5, considering that it's on "Extended
> Life Cycle Support"[1]? If someone is paying extra for post-Production
> support for a "retired"[1] enterprise distro from 2007, then I doubt
> that they or their users will be running the latest Emacs, especially a
> GTK build instead of terminal-only or another toolkit such as Lucid.
> Even if they are, they can probably install a later version of GTK as
> well, right?
>
> RHEL 5 also only has GCC 4.1.2; is this enough for Emacs?
>
> FWIW, RHEL 6, which is still in Production phase, has GTK 2.24.
>
> I've attached a patch that bumps both versions and removes obsolete
> cruft. Bumping the GTK2 version helps the most here.
>
> [1] https://access.redhat.com/solutions/690063
>
I am on RHEL 6.8 (work) and my GTK version is 2.24.23. So thanks for
keeping the min supported GTK version as 2.24.
[-- Attachment #2: Type: text/html, Size: 1950 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-08 15:03 ` Alex
2019-04-08 16:03 ` Kaushal Modi
@ 2019-04-08 16:15 ` Glenn Morris
2019-04-08 23:58 ` Paul Eggert
1 sibling, 1 reply; 29+ messages in thread
From: Glenn Morris @ 2019-04-08 16:15 UTC (permalink / raw)
To: Alex; +Cc: Eli Zaretskii, Paul Eggert, emacs-devel
Alex wrote:
> Do we really have to consider RHEL 5, considering that it's on "Extended
> Life Cycle Support"[1]? If someone is paying extra for post-Production
> support for a "retired"[1] enterprise distro from 2007, then I doubt
> that they or their users will be running the latest Emacs, especially a
> GTK build instead of terminal-only or another toolkit such as Lucid.
I'm a long-term RHEL user, and I completely agree that there is no need
for Emacs 27 to worry about supporting RHEL5 (at all, never mind for GTK).
(IIRC, RHEL5 shipped with Emacs 21.)
(Since RHEL7 was released 5 years ago, I also have no problem with
dropping RHEL6 support in Emacs 27 if it makes maintenance significantly
easier.)
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-08 16:15 ` Glenn Morris
@ 2019-04-08 23:58 ` Paul Eggert
2019-04-09 1:55 ` Stefan Monnier
0 siblings, 1 reply; 29+ messages in thread
From: Paul Eggert @ 2019-04-08 23:58 UTC (permalink / raw)
To: Glenn Morris, Alex; +Cc: Eli Zaretskii, emacs-devel
On 4/8/19 9:15 AM, Glenn Morris wrote:
> I also have no problem with
> dropping RHEL6 support in Emacs 27 if it makes maintenance significantly
> easier.)
That would be a bridge too far. Several of the servers in my school are
still running RHEL 6, and people build and install recently-released
software like Emacs on them.
Although I don't know of any servers at UCLA still running RHEL 5, my
department's main server is still running Solaris 10 (released 2005,
"Extended Support" through 2021) and current Emacs is still relevant on
that platform, at least to me. I don't doubt there are still people
running RHEL 5 (released 2005, "Extended Life Cycle support" through
2020) and I suspect it's possible that some of them might like to run
current Emacs.
Emacs and most other GNU packages still run on Solaris 10, and it would
feel odd for a GNU package like Emacs to support a mostly-proprietary
system like Solaris for longer than it supports a mostly-free system
like Red Hat. That being said, Emacs still supports Windows 95
(originally released 1995, "extended support" through 2001) so there is
a precedent for Emacs supporting an old proprietary platform better than
an old mostly-free platform.
How much easier is it to drop support for RHEL 5 now, as opposed to
doing it next year when Red Hat stops supporting it?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-08 23:58 ` Paul Eggert
@ 2019-04-09 1:55 ` Stefan Monnier
2019-04-09 4:47 ` Paul Eggert
2019-04-09 5:00 ` Van L
0 siblings, 2 replies; 29+ messages in thread
From: Stefan Monnier @ 2019-04-09 1:55 UTC (permalink / raw)
To: emacs-devel
> How much easier is it to drop support for RHEL 5 now, as opposed to
> doing it next year when Red Hat stops supporting it?
AFAIK the proposition is only to drop support for the Gtk lib that comes
with RHEL 5, so you could still build Emacs on it, just not using the
Gtk toolkit.
I'd expect most of the RHEL 5 systems still running are mostly-headless
servers, which is another argument to say that supporting their old Gtk
toolkit is not worth the trouble.
Stefan
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-09 1:55 ` Stefan Monnier
@ 2019-04-09 4:47 ` Paul Eggert
2019-04-09 17:28 ` Alex
2019-04-09 5:00 ` Van L
1 sibling, 1 reply; 29+ messages in thread
From: Paul Eggert @ 2019-04-09 4:47 UTC (permalink / raw)
To: Stefan Monnier, emacs-devel
Stefan Monnier wrote:
> AFAIK the proposition is only to drop support for the Gtk lib that comes
> with RHEL 5, so you could still build Emacs on it, just not using the
> Gtk toolkit.
That would probably suffice, yes.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-09 1:55 ` Stefan Monnier
2019-04-09 4:47 ` Paul Eggert
@ 2019-04-09 5:00 ` Van L
1 sibling, 0 replies; 29+ messages in thread
From: Van L @ 2019-04-09 5:00 UTC (permalink / raw)
To: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
> I'd expect most of the RHEL 5 systems still running are mostly-headless
> servers, which is another argument to say that supporting their old Gtk
> toolkit is not worth the trouble.
>
A famously bigdata company such as IBM/RHEL ought to know in RT the actual usage
rates of their products. Does it hurt to ask them? first, and for the way to go.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-09 4:47 ` Paul Eggert
@ 2019-04-09 17:28 ` Alex
2019-04-09 18:21 ` Eli Zaretskii
0 siblings, 1 reply; 29+ messages in thread
From: Alex @ 2019-04-09 17:28 UTC (permalink / raw)
To: Paul Eggert; +Cc: Stefan Monnier, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
Paul Eggert <eggert@cs.ucla.edu> writes:
> Stefan Monnier wrote:
>> AFAIK the proposition is only to drop support for the Gtk lib that comes
>> with RHEL 5, so you could still build Emacs on it, just not using the
>> Gtk toolkit.
>
> That would probably suffice, yes.
That's indeed what I'm proposing.
If there are no objections I'll push the revised patch in a few days.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Bump GTK versions --]
[-- Type: text/x-patch, Size: 34906 bytes --]
From fe8a788913a5d683007bdd820c863779f4e8b9d2 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sun, 7 Apr 2019 19:02:03 -0600
Subject: [PATCH] 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.
* 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.
* src/gtkutil.c: Remove old file selection dialog.
* lisp/term/x-win.el: Obsolete old file selection dialog interface.
* lisp/subr.el: Move GTK obsolete variable declaration to
lisp/term/x-win.el.
---
configure.ac | 46 ++------
etc/NEWS | 4 +
lisp/subr.el | 2 -
lisp/term/x-win.el | 5 +
src/gtkutil.c | 264 ++++++++-------------------------------------
src/xfns.c | 53 ++++-----
src/xterm.c | 2 +-
src/xterm.h | 33 +-----
8 files changed, 83 insertions(+), 326 deletions(-)
diff --git a/configure.ac b/configure.ac
index c93cfbbb59..3c5b9a0fb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2671,8 +2671,8 @@ AC_DEFUN
gtk3_pkg_errors=
if test "${opsys}" != "mingw32"; then
if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
- GLIB_REQUIRED=2.28
- GTK_REQUIRED=3.0
+ GLIB_REQUIRED=2.37.5
+ GTK_REQUIRED=3.10
GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries.
@@ -2699,8 +2699,8 @@ AC_DEFUN
fi
if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
- GLIB_REQUIRED=2.10
- GTK_REQUIRED=2.10
+ GLIB_REQUIRED=2.28
+ GTK_REQUIRED=2.24
GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries.
@@ -2775,42 +2775,8 @@ AC_DEFUN
with_toolkit_scroll_bars=yes
fi
- dnl Check if we have the old file selection dialog declared and
- dnl in the link library. In 2.x it may be in the library,
- dnl but not declared if deprecated featured has been selected out.
- dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
- HAVE_GTK_FILE_SELECTION=no
- AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
- HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
-#include <gtk/gtk.h>])
- if test "$HAVE_GTK_FILE_SELECTION" = yes; then
- AC_CHECK_FUNCS(gtk_file_selection_new)
- fi
-
- dnl Same as above for gtk_handle_box.
- HAVE_GTK_HANDLE_BOX=no
- 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)
+ dnl This procedure causes a bug on certain Ubuntu GTK+2 builds
+ AC_CHECK_FUNCS(gtk_window_set_has_resize_grip)
term_header=gtkutil.h
fi
diff --git a/etc/NEWS b/etc/NEWS
index 620d88c32a..18da0f580b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -84,6 +84,10 @@ The new command-line argument '--dump-file=FILE' allows to specify a
non-default '.pdmp' file to load the state from; see the node "Initial
Options" in the Emacs manual for more information.
+---
+** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3
+builds respectively.
+
\f
* Startup Changes in Emacs 27.1
diff --git a/lisp/subr.el b/lisp/subr.el
index bdf98979c4..3f17b4774b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1557,8 +1557,6 @@ log10
;; but Stefan insists to mark it so.
(make-obsolete-variable 'translation-table-for-input nil "23.1")
-(make-obsolete-variable 'x-gtk-use-window-move nil "26.1")
-
(defvaralias 'messages-buffer-max-lines 'message-log-max)
(define-obsolete-variable-alias 'inhibit-null-byte-detection
'inhibit-nul-byte-detection "27.1")
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 56061371fe..0f0c3f163f 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1486,6 +1486,11 @@ x-gtk-map-stock
(global-set-key [XF86WakeUp] 'ignore)
+;;; Obsolete definitions
+(make-obsolete-variable 'x-gtk-use-window-move nil "26.1")
+(make-obsolete 'x-uses-old-gtk-dialog nil "27.1")
+(make-obsolete-variable 'x-gtk-use-old-file-dialog nil "27.1")
+
(provide 'x-win)
(provide 'term/x-win)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index b130692c87..9894e02065 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -52,48 +52,19 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <X11/extensions/Xdbe.h>
#endif
-#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW
-#define gtk_widget_set_has_window(w, b) \
- (gtk_fixed_set_has_window (GTK_FIXED (w), b))
-#endif
-#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA
-#define gtk_dialog_get_action_area(w) ((w)->action_area)
-#define gtk_dialog_get_content_area(w) ((w)->vbox)
-#endif
-#ifndef HAVE_GTK_WIDGET_GET_SENSITIVE
-#define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w))
-#endif
-#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
-#define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s))
-#define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s))
-#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_CHECK_VERSION (2, 12, 0)
-#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
+#ifdef HAVE_GTK3
+#define XG_TEXT_CANCEL "Cancel"
+#define XG_TEXT_OK "OK"
+#define XG_TEXT_OPEN "Open"
#else
-#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
+#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
+#define XG_TEXT_OK GTK_STOCK_OK
+#define XG_TEXT_OPEN GTK_STOCK_OPEN
#endif
-#if ! GTK_CHECK_VERSION (2, 14, 0)
-#define gtk_adjustment_configure(adj, xvalue, xlower, \
- xupper, xstep_increment, \
- xpage_increment, xpagesize) \
- do { \
- adj->lower = xlower; \
- adj->upper = xupper; \
- adj->page_size = xpagesize; \
- gtk_adjustment_set_value (adj, xvalue); \
- adj->page_increment = xpage_increment; \
- adj->step_increment = xstep_increment; \
- } while (0)
-#endif /* < Gtk+ 2.14 */
+#ifndef HAVE_GTK3
#ifdef HAVE_FREETYPE
-#if GTK_CHECK_VERSION (3, 2, 0)
-#define USE_NEW_GTK_FONT_CHOOSER 1
-#else
-#define USE_NEW_GTK_FONT_CHOOSER 0
#define gtk_font_chooser_dialog_new(x, y) \
gtk_font_selection_dialog_new (x)
#undef GTK_FONT_CHOOSER
@@ -101,35 +72,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#define gtk_font_chooser_set_font(x, y) \
gtk_font_selection_dialog_set_font_name (x, y)
#endif
-#endif /* HAVE_FREETYPE */
-#if GTK_CHECK_VERSION (3, 10, 0)
-#define XG_TEXT_CANCEL "Cancel"
-#define XG_TEXT_OK "OK"
-#define XG_TEXT_OPEN "Open"
-#else
-#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
-#define XG_TEXT_OK GTK_STOCK_OK
-#define XG_TEXT_OPEN GTK_STOCK_OPEN
-#endif
-
-#ifndef HAVE_GTK3
-#ifdef USE_GTK_TOOLTIP
-#define gdk_window_get_screen(w) gdk_drawable_get_screen (w)
-#endif
#define gdk_window_get_geometry(w, a, b, c, d) \
gdk_window_get_geometry (w, a, b, c, d, 0)
-#define gdk_x11_window_lookup_for_display(d, w) \
- gdk_xid_table_lookup_for_display (d, w)
#define gtk_box_new(ori, spacing) \
((ori) == GTK_ORIENTATION_HORIZONTAL \
? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing)))
#define gtk_scrollbar_new(ori, spacing) \
((ori) == GTK_ORIENTATION_HORIZONTAL \
? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing)))
-#ifndef GDK_KEY_g
-#define GDK_KEY_g GDK_g
-#endif
#endif /* HAVE_GTK3 */
#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x))
@@ -227,7 +178,7 @@ xg_get_gdk_scale (void)
int
xg_get_scale (struct frame *f)
{
-#if GTK_CHECK_VERSION (3, 10, 0)
+#ifdef HAVE_GTK3
if (FRAME_GTK_WIDGET (f))
return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f));
#endif
@@ -261,15 +212,7 @@ xg_display_close (Display *dpy)
gdpy_def = gdpy_new;
}
-#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
- <https://gitlab.gnome.org/GNOME/gtk/issues/221>. This way we
- can continue running, but there will be memory leaks. */
- g_object_run_dispose (G_OBJECT (gdpy));
-#else
- /* This seems to be fixed in GTK 2.10. */
gdk_display_close (gdpy);
-#endif
}
\f
@@ -368,7 +311,7 @@ xg_get_image_for_pixmap (struct frame *f,
GtkWidget *widget,
GtkImage *old_widget)
{
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
cairo_surface_t *surface;
#else
GdkPixbuf *icon_buf;
@@ -400,7 +343,7 @@ xg_get_image_for_pixmap (struct frame *f,
on a monochrome display, and sometimes bad on all displays with
certain themes. */
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
surface = img->cr_data;
if (surface)
@@ -643,8 +586,6 @@ xg_check_special_colors (struct frame *f,
We use that to pop down the tooltip. This happens if Gtk+ for some
reason wants to change or hide the tooltip. */
-#ifdef USE_GTK_TOOLTIP
-
static void
hierarchy_ch_cb (GtkWidget *widget,
GtkWidget *previous_toplevel,
@@ -711,8 +652,6 @@ qttip_cb (GtkWidget *widget,
return FALSE;
}
-#endif /* USE_GTK_TOOLTIP */
-
/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT.
Return true if a system tooltip is available. */
@@ -722,9 +661,6 @@ xg_prepare_tooltip (struct frame *f,
int *width,
int *height)
{
-#ifndef USE_GTK_TOOLTIP
- return 0;
-#else
struct x_output *x = f->output_data.x;
GtkWidget *widget;
GdkWindow *gwin;
@@ -768,7 +704,6 @@ xg_prepare_tooltip (struct frame *f,
unblock_input ();
return TRUE;
-#endif /* USE_GTK_TOOLTIP */
}
/* Show the tooltip at ROOT_X and ROOT_Y.
@@ -777,7 +712,6 @@ xg_prepare_tooltip (struct frame *f,
void
xg_show_tooltip (struct frame *f, int root_x, int root_y)
{
-#ifdef USE_GTK_TOOLTIP
struct x_output *x = f->output_data.x;
if (x->ttip_window)
{
@@ -787,7 +721,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
gtk_widget_show (GTK_WIDGET (x->ttip_window));
unblock_input ();
}
-#endif
}
@@ -797,7 +730,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
bool
xg_hide_tooltip (struct frame *f)
{
-#ifdef USE_GTK_TOOLTIP
if (f->output_data.x->ttip_window)
{
GtkWindow *win = f->output_data.x->ttip_window;
@@ -816,7 +748,6 @@ xg_hide_tooltip (struct frame *f)
return TRUE;
}
-#endif
return FALSE;
}
@@ -1193,7 +1124,7 @@ xg_create_frame_widgets (struct frame *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_CHECK_VERSION (3, 0, 0) \
+#if (! defined HAVE_GTK3 \
&& defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP)
gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE);
#endif
@@ -1328,14 +1259,12 @@ xg_create_frame_widgets (struct frame *f)
gdk_window_set_override_redirect (gwin, TRUE);
}
-#ifdef USE_GTK_TOOLTIP
/* Steal a tool tip window we can move ourselves. */
f->output_data.x->ttip_widget = 0;
f->output_data.x->ttip_lbl = 0;
f->output_data.x->ttip_window = 0;
gtk_widget_set_tooltip_text (wtop, "Dummy text");
g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
-#endif
{
GdkScreen *screen = gtk_widget_get_screen (wtop);
@@ -1363,9 +1292,7 @@ xg_free_frame_widgets (struct frame *f)
{
if (FRAME_GTK_OUTER_WIDGET (f))
{
-#ifdef USE_GTK_TOOLTIP
struct x_output *x = f->output_data.x;
-#endif
struct xg_frame_tb_info *tbinfo
= g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
TB_INFO_KEY);
@@ -1378,12 +1305,10 @@ xg_free_frame_widgets (struct frame *f)
FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */
FRAME_X_RAW_DRAWABLE (f) = 0;
FRAME_GTK_OUTER_WIDGET (f) = 0;
-#ifdef USE_GTK_TOOLTIP
if (x->ttip_lbl)
gtk_widget_destroy (x->ttip_lbl);
if (x->ttip_widget)
g_object_unref (G_OBJECT (x->ttip_widget));
-#endif
}
}
@@ -1561,7 +1486,6 @@ xg_set_undecorated (struct frame *f, Lisp_Object undecorated)
void
xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
{
-#if GTK_CHECK_VERSION (2, 18, 0)
block_input ();
if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2))
{
@@ -1576,7 +1500,6 @@ xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
x_sync (f1);
}
unblock_input ();
-#endif
}
@@ -1937,29 +1860,6 @@ xg_dialog_run (struct frame *f, GtkWidget *w)
/***********************************************************************
File dialog functions
***********************************************************************/
-/* Return true if the old file selection dialog is being used. */
-
-bool
-xg_uses_old_file_dialog (void)
-{
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
- return x_gtk_use_old_file_dialog;
-#else
- return 0;
-#endif
-}
-
-
-typedef char * (*xg_get_file_func) (GtkWidget *);
-
-/* Return the selected file for file chooser dialog W.
- The returned string must be free:d. */
-
-static char *
-xg_get_file_name_from_chooser (GtkWidget *w)
-{
- return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
-}
/* Callback called when the "Show hidden files" toggle is pressed.
WIDGET is the toggle widget, DATA is the file chooser dialog. */
@@ -2017,8 +1917,7 @@ static GtkWidget *
xg_get_file_with_chooser (struct frame *f,
char *prompt,
char *default_filename,
- bool mustmatch_p, bool only_dir_p,
- xg_get_file_func *func)
+ bool mustmatch_p, bool only_dir_p)
{
char msgbuf[1024];
@@ -2036,7 +1935,7 @@ xg_get_file_with_chooser (struct frame *f,
XG_TEXT_CANCEL, GTK_RESPONSE_CANCEL,
(mustmatch_p || only_dir_p ?
XG_TEXT_OPEN : XG_TEXT_OK),
- GTK_RESPONSE_OK,
+ GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE);
@@ -2059,9 +1958,7 @@ xg_get_file_with_chooser (struct frame *f,
if (x_gtk_file_dialog_help_text)
{
char *z = msgbuf;
- /* Gtk+ 2.10 has the file name text entry box integrated in the dialog.
- Show the C-l help text only for versions < 2.10. */
- if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (action != GTK_FILE_CHOOSER_ACTION_SAVE)
z = stpcpy (z, "\nType C-l to display a file name text entry box.\n");
strcpy (z, "\nIf you don't like this file selector, use the "
"corresponding\nkey binding or customize "
@@ -2106,60 +2003,8 @@ xg_get_file_with_chooser (struct frame *f,
}
}
- *func = xg_get_file_name_from_chooser;
- return filewin;
-}
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-
-/* Return the selected file for file selector dialog W.
- The returned string must be free:d. */
-
-static char *
-xg_get_file_name_from_selector (GtkWidget *w)
-{
- GtkFileSelection *filesel = GTK_FILE_SELECTION (w);
- return xstrdup (gtk_file_selection_get_filename (filesel));
-}
-
-/* Create a file selection dialog.
- F is the current frame.
- PROMPT is a prompt to show to the user. May not be NULL.
- DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
- If MUSTMATCH_P, the returned file name must be an existing
- file. *FUNC is set to a function that can be used to retrieve the
- selected file name from the returned widget.
-
- Returns the created widget. */
-
-static GtkWidget *
-xg_get_file_with_selection (struct frame *f,
- char *prompt,
- char *default_filename,
- bool mustmatch_p, bool only_dir_p,
- xg_get_file_func *func)
-{
- GtkWidget *filewin;
- GtkFileSelection *filesel;
-
- filewin = gtk_file_selection_new (prompt);
- filesel = GTK_FILE_SELECTION (filewin);
-
- if (default_filename)
- gtk_file_selection_set_filename (filesel, default_filename);
-
- if (mustmatch_p)
- {
- /* The selection_entry part of filesel is not documented. */
- gtk_widget_set_sensitive (filesel->selection_entry, FALSE);
- gtk_file_selection_hide_fileop_buttons (filesel);
- }
-
- *func = xg_get_file_name_from_selector;
-
return filewin;
}
-#endif /* HAVE_GTK_FILE_SELECTION_NEW */
/* Read a file name from the user using a file dialog, either the old
file selection dialog, or the new file chooser dialog. Which to use
@@ -2181,33 +2026,21 @@ xg_get_file_name (struct frame *f,
bool mustmatch_p,
bool only_dir_p)
{
- GtkWidget *w = 0;
- char *fn = 0;
- int filesel_done = 0;
- xg_get_file_func func;
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-
- if (xg_uses_old_file_dialog ())
- w = xg_get_file_with_selection (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
- else
- w = xg_get_file_with_chooser (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
+ GtkWidget *w;
+ char *name = NULL;
+ int filesel_done;
-#else /* not HAVE_GTK_FILE_SELECTION_NEW */
w = xg_get_file_with_chooser (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
-#endif /* not HAVE_GTK_FILE_SELECTION_NEW */
+ mustmatch_p, only_dir_p);
gtk_widget_set_name (w, "emacs-filedialog");
filesel_done = xg_dialog_run (f, w);
- if (filesel_done == GTK_RESPONSE_OK)
- fn = (*func) (w);
+ if (filesel_done == GTK_RESPONSE_ACCEPT)
+ name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
gtk_widget_destroy (w);
- return fn;
+ return name;
}
/***********************************************************************
@@ -2216,7 +2049,7 @@ xg_get_file_name (struct frame *f,
#ifdef HAVE_FREETYPE
-#if USE_NEW_GTK_FONT_CHOOSER
+#ifdef HAVE_GTK3
#define XG_WEIGHT_TO_SYMBOL(w) \
(w <= PANGO_WEIGHT_THIN ? Qextra_light \
@@ -2233,7 +2066,7 @@ xg_get_file_name (struct frame *f,
: s == PANGO_STYLE_ITALIC ? Qitalic \
: Qnormal)
-#endif /* USE_NEW_GTK_FONT_CHOOSER */
+#endif /* HAVE_GTK3 */
static char *x_last_font_name;
@@ -2280,7 +2113,7 @@ xg_get_font (struct frame *f, const char *default_name)
done = xg_dialog_run (f, w);
if (done == GTK_RESPONSE_OK)
{
-#if USE_NEW_GTK_FONT_CHOOSER
+#ifdef HAVE_GTK3
/* Use the GTK3 font chooser. */
PangoFontDescription *desc
= gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w));
@@ -2320,7 +2153,7 @@ xg_get_font (struct frame *f, const char *default_name)
g_free (x_last_font_name);
x_last_font_name = font_name;
}
-#endif /* USE_NEW_GTK_FONT_CHOOSER */
+#endif /* HAVE_GTK3 */
}
gtk_widget_destroy (w);
@@ -3041,9 +2874,7 @@ xg_update_menubar (GtkWidget *menubar,
bridge that might be loaded) that the item's label has
changed. */
gtk_label_set_text (wlabel, utf8_label);
-#if GTK_CHECK_VERSION (2, 16, 0)
g_object_notify (G_OBJECT (witem), "label");
-#endif
if (utf8_label) g_free (utf8_label);
iter = g_list_next (iter);
val = val->next;
@@ -3222,10 +3053,8 @@ xg_update_menu_item (widget_value *val,
}
}
-#if GTK_CHECK_VERSION (2, 16, 0)
if (label_changed) /* See comment in xg_update_menubar. */
g_object_notify (G_OBJECT (w), "label");
-#endif
}
/* Update the toggle menu item W so it corresponds to VAL. */
@@ -3324,7 +3153,7 @@ xg_update_submenu (GtkWidget *submenu,
{
/* Not a submenu anymore. */
g_object_ref (G_OBJECT (sub));
- remove_submenu (witem);
+ gtk_menu_item_set_submenu (witem, NULL);
gtk_widget_destroy (sub);
}
else if (cur->contents)
@@ -4492,14 +4321,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
}
#endif
-#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
-#define toolbar_set_orientation(w, o) \
- gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o)
-#else
-#define toolbar_set_orientation(w, o) \
- gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
-#endif
-
/* Attach a tool bar to frame F. */
static void
@@ -4509,10 +4330,10 @@ xg_pack_tool_bar (struct frame *f, Lisp_Object pos)
bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
GtkWidget *top_widget = x->toolbar_widget;
- toolbar_set_orientation (x->toolbar_widget,
- into_hbox
- ? GTK_ORIENTATION_VERTICAL
- : GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
+ into_hbox
+ ? GTK_ORIENTATION_VERTICAL
+ : GTK_ORIENTATION_HORIZONTAL);
if (into_hbox)
{
@@ -4565,7 +4386,7 @@ static void
xg_create_tool_bar (struct frame *f)
{
struct x_output *x = f->output_data.x;
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
GtkStyleContext *gsty;
#endif
struct xg_frame_tb_info *tbinfo
@@ -4589,10 +4410,11 @@ xg_create_tool_bar (struct frame *f)
gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
- toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
+ GTK_ORIENTATION_HORIZONTAL);
g_signal_connect (x->toolbar_widget, "size-allocate",
G_CALLBACK (tb_size_cb), f);
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
gsty = gtk_widget_get_style_context (x->toolbar_widget);
gtk_style_context_add_class (gsty, "primary-toolbar");
#endif
@@ -4645,7 +4467,7 @@ xg_make_tool_item (struct frame *f,
GtkWidget *wb = gtk_button_new ();
/* The eventbox is here so we can have tooltips on disabled items. */
GtkWidget *weventbox = gtk_event_box_new ();
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
GtkCssProvider *css_prov = gtk_css_provider_new ();
GtkStyleContext *gsty;
@@ -4777,7 +4599,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
{
gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
XG_TOOL_BAR_IMAGE_DATA);
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
void *old_img = (void *) gold_img;
if (old_img != img->cr_data)
return 1;
@@ -4850,7 +4672,7 @@ find_icon_from_name (char *name,
GtkIconTheme *icon_theme,
char **icon_name)
{
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
GtkStockItem stock_item;
#endif
@@ -4863,7 +4685,7 @@ find_icon_from_name (char *name,
*icon_name = NULL;
}
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
else if (gtk_stock_lookup (name, &stock_item))
*icon_name = NULL;
#endif
@@ -5078,7 +4900,7 @@ update_frame_tool_bar (struct frame *f)
prepare_image_for_display (f, img);
if (img->load_failed_p
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
|| img->cr_data == NULL
#else
|| img->pixmap == None
@@ -5113,7 +4935,7 @@ update_frame_tool_bar (struct frame *f)
else if (stock_name)
{
-#if GTK_CHECK_VERSION (3, 10, 0)
+#ifdef HAVE_GTK3
w = gtk_image_new_from_icon_name (stock_name, icon_size);
#else
w = gtk_image_new_from_stock (stock_name, icon_size);
@@ -5133,7 +4955,7 @@ update_frame_tool_bar (struct frame *f)
{
w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
(gpointer)img->cr_data
#else
(gpointer)img->pixmap
@@ -5309,7 +5131,7 @@ xg_initialize (void)
settings = gtk_settings_get_for_screen (gdk_display_get_default_screen
(gdk_display_get_default ()));
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
/* Remove F10 as a menu accelerator, it does not mix well with Emacs key
bindings. It doesn't seem to be any way to remove properties,
so we set it to "" which in means "no key". */
diff --git a/src/xfns.c b/src/xfns.c
index 13f66f0718..2d445ad6fb 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4496,7 +4496,7 @@ On MS Windows, this just returns nil. */)
Return false if and only if the workarea information cannot be
obtained via the _NET_WORKAREA root window property. */
-#if ! GTK_CHECK_VERSION (3, 4, 0)
+#ifndef HAVE_GTK3
static bool
x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
{
@@ -4906,9 +4906,9 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
Lisp_Object attributes_list = Qnil;
#ifdef USE_GTK
- double mm_width_per_pixel, mm_height_per_pixel;
GdkDisplay *gdpy;
#if ! GTK_CHECK_VERSION (3, 22, 0)
+ double mm_width_per_pixel, mm_height_per_pixel;
GdkScreen *gscreen;
#endif
gint primary_monitor = 0, n_monitors, i;
@@ -4917,19 +4917,18 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
struct MonitorInfo *monitors;
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);
#if GTK_CHECK_VERSION (3, 22, 0)
n_monitors = gdk_display_get_n_monitors (gdpy);
#else
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);
+ 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
monitor_frames = make_nil_vector (n_monitors);
monitors = xzalloc (n_monitors * sizeof *monitors);
@@ -4958,7 +4957,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
for (i = 0; i < n_monitors; ++i)
{
- gint width_mm = -1, height_mm = -1;
+ gint width_mm, height_mm;
GdkRectangle rec, work;
struct MonitorInfo *mi = &monitors[i];
int scale = 1;
@@ -4975,18 +4974,17 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
width_mm = gdk_monitor_get_width_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);
height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
-#endif
if (width_mm < 0)
width_mm = rec.width * mm_width_per_pixel + 0.5;
if (height_mm < 0)
height_mm = rec.height * mm_height_per_pixel + 0.5;
-
+#endif
#if GTK_CHECK_VERSION (3, 22, 0)
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);
#else
/* Emulate the behavior of GTK+ 3.4. */
@@ -5010,7 +5008,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
/* GTK returns scaled sizes for the workareas. */
#if GTK_CHECK_VERSION (3, 22, 0)
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);
#endif
rec.width *= scale;
@@ -5031,7 +5029,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
mi->name = xstrdup (gdk_monitor_get_model (monitor));
-#elif GTK_CHECK_VERSION (2, 14, 0)
+#else
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
#endif
}
@@ -5041,11 +5039,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
primary_monitor,
monitor_frames,
source);
-#if GTK_CHECK_VERSION (2, 14, 0)
free_monitors (monitors, n_monitors);
-#else
- xfree (monitors);
-#endif
unblock_input ();
#else /* not USE_GTK */
@@ -5380,7 +5374,7 @@ Frames are listed from topmost (first) to bottommost (last). */)
static void
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 ();
xg_frame_restack (f1, f2, above_flag);
unblock_input ();
@@ -7003,19 +6997,15 @@ DEFUN ("x-double-buffered-p", Fx_double_buffered_p, Sx_double_buffered_p,
File selection dialog
***********************************************************************/
+/* Obsoleted in 27.1. */
DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog,
Sx_uses_old_gtk_dialog,
0, 0, 0,
- doc: /* Return t if the old Gtk+ file selection dialog is used. */)
+ doc: /* Return t if the old Gtk+ file selection dialog is used.
+Note that since version 27.1 the old Gtk+ file selection dialog is
+never used. */)
(void)
{
-#ifdef USE_GTK
- if (use_dialog_box
- && use_file_dialog
- && window_system_available (SELECTED_FRAME ())
- && xg_uses_old_file_dialog ())
- return Qt;
-#endif
return Qnil;
}
@@ -7812,11 +7802,12 @@ such a font. This is especially effective for large fonts such as
Chinese, Japanese, and Korean. */);
Vx_pixel_size_width_font_regexp = Qnil;
+/* Obsoleted in 27.1. */
/* This is not ifdef:ed, so other builds than GTK can customize it. */
DEFVAR_BOOL ("x-gtk-use-old-file-dialog", x_gtk_use_old_file_dialog,
doc: /* Non-nil means prompt with the old GTK file selection dialog.
-If nil or if the file selection dialog is not available, the new GTK file
-chooser is used instead. To turn off all file dialogs set the
+Since 27.1 Emacs ignores the value of this variable and uses the
+new GTK file chooser. To turn off all file dialogs set the
variable `use-file-dialog'. */);
x_gtk_use_old_file_dialog = false;
diff --git a/src/xterm.c b/src/xterm.c
index 5aa3e3ff25..c711950a5a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -12513,7 +12513,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
dpy = DEFAULT_GDK_DISPLAY ();
-#if ! GTK_CHECK_VERSION (2, 90, 0)
+#ifndef HAVE_GTK3
/* Load our own gtkrc if it exists. */
{
const char *file = "~/.emacs.d/gtkrc";
diff --git a/src/xterm.h b/src/xterm.h
index c5ad38650c..bb7631a3f4 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -50,17 +50,8 @@ typedef Widget xt_or_gtk_widget;
#include <gdk/gdkx.h>
#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) false
-# endif
+#ifndef USE_GTK
+#define GTK_CHECK_VERSION(i, j, k) false
#endif
#ifdef USE_GTK
@@ -76,11 +67,6 @@ typedef GtkWidget *xt_or_gtk_widget;
#endif
#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
#include <cairo-xlib.h>
#ifdef CAIRO_HAS_PDF_SURFACE
@@ -594,12 +580,9 @@ struct x_output
GdkGeometry size_hints;
long hint_flags;
-#ifdef USE_GTK_TOOLTIP
GtkTooltip *ttip_widget;
GtkWidget *ttip_lbl;
GtkWindow *ttip_window;
-#endif /* USE_GTK_TOOLTIP */
-
#endif /* USE_GTK */
/* 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);
FRAME_X_WINDOW (f))
#else
#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
#define DEFAULT_GDK_DISPLAY() \
--
2.21.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-09 17:28 ` Alex
@ 2019-04-09 18:21 ` Eli Zaretskii
2019-04-10 3:14 ` Alex
0 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-09 18:21 UTC (permalink / raw)
To: Alex; +Cc: eggert, monnier, emacs-devel
> From: Alex <agrambot@gmail.com>
> Date: Tue, 09 Apr 2019 11:28:41 -0600
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
>
> If there are no objections I'll push the revised patch in a few days.
To allow proper review, please make the log message more detailed. In
particular, stuff you remove that is not under an explicit GTK version
condition should have a minimal explanation for why it is TRT to
remove it. (The rationale doesn't have to be in the log message,
although it would be nice to have it there; it could be just in the
email that accompanies the patch.)
Please also tell with which GTK versions did you try building with to
verify the correctness of the changes.
> Subject: [PATCH] Bump minimum GTK versions to 2.24 and 3.10
Not sure we discussed 3.10 as the minimum GTK3 version, we only talked
about 2.x AFAIR. What is the situation with GTK3 versions in the
current distributions of GNU/Linux?
> -/* 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)))
Is it really a good idea to remove this macro? We'll probably have to
reintroduce it right away.
Thanks.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-09 18:21 ` Eli Zaretskii
@ 2019-04-10 3:14 ` Alex
2019-04-10 15:57 ` Eli Zaretskii
0 siblings, 1 reply; 29+ messages in thread
From: Alex @ 2019-04-10 3:14 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: eggert, monnier, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 3355 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Alex <agrambot@gmail.com>
>> Date: Tue, 09 Apr 2019 11:28:41 -0600
>> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
>>
>> If there are no objections I'll push the revised patch in a few days.
>
> To allow proper review, please make the log message more detailed. In
> particular, stuff you remove that is not under an explicit GTK version
> condition should have a minimal explanation for why it is TRT to
> remove it. (The rationale doesn't have to be in the log message,
> although it would be nice to have it there; it could be just in the
> email that accompanies the patch.)
Here's a brief overview of the changes outside of explicit checks:
* HAVE_GTK_* function checks in configure.ac
These check for functions available in later GTK 2 versions. These
checks and the blocks that use them 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.
* USE_GTK_TOOLTIP
This is defined when CHECK_GTK_VERSION (2, 14, 0), so all instances can
be removed.
* Old file selection dialog
This is only optionally used in GTK 2, but the old dialog is long
deprecated in GTK 2 (removed in GTK 3), so I figured that this is a good
time to remove it and simplify the existing code.
The first 2 of the above are covered by "now unused conditional blocks",
so I didn't think I should include them in the commit message. I added
in a reason for removing the file selection dialog.
> Please also tell with which GTK versions did you try building with to
> verify the correctness of the changes.
I tested with GTK 2.24.32 and GTK 3.24.7. I didn't see a need to test
with an older GTK 3 version since the GTK 3 part of the change involves
simplifying version checks 3 <= version <= 3.10 (and
USE_NEW_GTK_FONT_CHOOSER) to HAVE_GTK3 checks.
>> Subject: [PATCH] Bump minimum GTK versions to 2.24 and 3.10
>
> Not sure we discussed 3.10 as the minimum GTK3 version, we only talked
> about 2.x AFAIR. What is the situation with GTK3 versions in the
> current distributions of GNU/Linux?
My messages briefly discussed the minimum of 3.10 and how Debian Jessie
(oldstable -- soon to be oldoldstable), and Ubuntu 14.04LTS have GTK 3.10.
RHEL doesn't even support GTK 3 until RHEL 7, which has 3.22.
So I think bumping to 3.10 doesn't hurt, especially since there's still
GTK 2 support. Though I admit that bumping the GTK 3 version doesn't
help a whole lot, and it doesn't look like it will until 3.22 (2016)
becomes the minimum.
>> -/* 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)))
>
> Is it really a good idea to remove this macro? We'll probably have to
> reintroduce it right away.
The #ifdef USE_GTK block was dead code, since GTK always defines this
macro[1] (at least as far back as I checked -- much before even the
current minimum of 2.10). Now only a stub is defined in the case of not
using GTK.
I've attached the patch with a slightly revised commit message.
[1]
https://developer.gnome.org/gtk3/stable/gtk3-Feature-Test-Macros.html#GTK-CHECK-VERSION:CAPS
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Bump GTK versions --]
[-- Type: text/x-patch, Size: 34997 bytes --]
From b4e8e03db77dd6ac013fa4e66eca32230178650a Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sun, 7 Apr 2019 19:02:03 -0600
Subject: [PATCH] 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.
* 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.
* src/gtkutil.c: Remove old file selection dialog that is deprecated
in GTK 2 and removed in GTK 3. Simplify the remaining file chooser
code.
* lisp/term/x-win.el: Obsolete old file selection dialog interface.
* lisp/subr.el: Move GTK obsolete variable declaration to
lisp/term/x-win.el.
---
configure.ac | 46 ++------
etc/NEWS | 4 +
lisp/subr.el | 2 -
lisp/term/x-win.el | 5 +
src/gtkutil.c | 264 ++++++++-------------------------------------
src/xfns.c | 53 ++++-----
src/xterm.c | 2 +-
src/xterm.h | 33 +-----
8 files changed, 83 insertions(+), 326 deletions(-)
diff --git a/configure.ac b/configure.ac
index c93cfbbb59..3c5b9a0fb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2671,8 +2671,8 @@ AC_DEFUN
gtk3_pkg_errors=
if test "${opsys}" != "mingw32"; then
if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
- GLIB_REQUIRED=2.28
- GTK_REQUIRED=3.0
+ GLIB_REQUIRED=2.37.5
+ GTK_REQUIRED=3.10
GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries.
@@ -2699,8 +2699,8 @@ AC_DEFUN
fi
if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
- GLIB_REQUIRED=2.10
- GTK_REQUIRED=2.10
+ GLIB_REQUIRED=2.28
+ GTK_REQUIRED=2.24
GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries.
@@ -2775,42 +2775,8 @@ AC_DEFUN
with_toolkit_scroll_bars=yes
fi
- dnl Check if we have the old file selection dialog declared and
- dnl in the link library. In 2.x it may be in the library,
- dnl but not declared if deprecated featured has been selected out.
- dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
- HAVE_GTK_FILE_SELECTION=no
- AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
- HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
-#include <gtk/gtk.h>])
- if test "$HAVE_GTK_FILE_SELECTION" = yes; then
- AC_CHECK_FUNCS(gtk_file_selection_new)
- fi
-
- dnl Same as above for gtk_handle_box.
- HAVE_GTK_HANDLE_BOX=no
- 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)
+ dnl This procedure causes a bug on certain Ubuntu GTK+2 builds
+ AC_CHECK_FUNCS(gtk_window_set_has_resize_grip)
term_header=gtkutil.h
fi
diff --git a/etc/NEWS b/etc/NEWS
index 620d88c32a..18da0f580b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -84,6 +84,10 @@ The new command-line argument '--dump-file=FILE' allows to specify a
non-default '.pdmp' file to load the state from; see the node "Initial
Options" in the Emacs manual for more information.
+---
+** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3
+builds respectively.
+
\f
* Startup Changes in Emacs 27.1
diff --git a/lisp/subr.el b/lisp/subr.el
index bdf98979c4..3f17b4774b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1557,8 +1557,6 @@ log10
;; but Stefan insists to mark it so.
(make-obsolete-variable 'translation-table-for-input nil "23.1")
-(make-obsolete-variable 'x-gtk-use-window-move nil "26.1")
-
(defvaralias 'messages-buffer-max-lines 'message-log-max)
(define-obsolete-variable-alias 'inhibit-null-byte-detection
'inhibit-nul-byte-detection "27.1")
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 56061371fe..0f0c3f163f 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1486,6 +1486,11 @@ x-gtk-map-stock
(global-set-key [XF86WakeUp] 'ignore)
+;;; Obsolete definitions
+(make-obsolete-variable 'x-gtk-use-window-move nil "26.1")
+(make-obsolete 'x-uses-old-gtk-dialog nil "27.1")
+(make-obsolete-variable 'x-gtk-use-old-file-dialog nil "27.1")
+
(provide 'x-win)
(provide 'term/x-win)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index b130692c87..9894e02065 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -52,48 +52,19 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <X11/extensions/Xdbe.h>
#endif
-#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW
-#define gtk_widget_set_has_window(w, b) \
- (gtk_fixed_set_has_window (GTK_FIXED (w), b))
-#endif
-#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA
-#define gtk_dialog_get_action_area(w) ((w)->action_area)
-#define gtk_dialog_get_content_area(w) ((w)->vbox)
-#endif
-#ifndef HAVE_GTK_WIDGET_GET_SENSITIVE
-#define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w))
-#endif
-#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
-#define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s))
-#define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s))
-#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_CHECK_VERSION (2, 12, 0)
-#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
+#ifdef HAVE_GTK3
+#define XG_TEXT_CANCEL "Cancel"
+#define XG_TEXT_OK "OK"
+#define XG_TEXT_OPEN "Open"
#else
-#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
+#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
+#define XG_TEXT_OK GTK_STOCK_OK
+#define XG_TEXT_OPEN GTK_STOCK_OPEN
#endif
-#if ! GTK_CHECK_VERSION (2, 14, 0)
-#define gtk_adjustment_configure(adj, xvalue, xlower, \
- xupper, xstep_increment, \
- xpage_increment, xpagesize) \
- do { \
- adj->lower = xlower; \
- adj->upper = xupper; \
- adj->page_size = xpagesize; \
- gtk_adjustment_set_value (adj, xvalue); \
- adj->page_increment = xpage_increment; \
- adj->step_increment = xstep_increment; \
- } while (0)
-#endif /* < Gtk+ 2.14 */
+#ifndef HAVE_GTK3
#ifdef HAVE_FREETYPE
-#if GTK_CHECK_VERSION (3, 2, 0)
-#define USE_NEW_GTK_FONT_CHOOSER 1
-#else
-#define USE_NEW_GTK_FONT_CHOOSER 0
#define gtk_font_chooser_dialog_new(x, y) \
gtk_font_selection_dialog_new (x)
#undef GTK_FONT_CHOOSER
@@ -101,35 +72,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#define gtk_font_chooser_set_font(x, y) \
gtk_font_selection_dialog_set_font_name (x, y)
#endif
-#endif /* HAVE_FREETYPE */
-#if GTK_CHECK_VERSION (3, 10, 0)
-#define XG_TEXT_CANCEL "Cancel"
-#define XG_TEXT_OK "OK"
-#define XG_TEXT_OPEN "Open"
-#else
-#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
-#define XG_TEXT_OK GTK_STOCK_OK
-#define XG_TEXT_OPEN GTK_STOCK_OPEN
-#endif
-
-#ifndef HAVE_GTK3
-#ifdef USE_GTK_TOOLTIP
-#define gdk_window_get_screen(w) gdk_drawable_get_screen (w)
-#endif
#define gdk_window_get_geometry(w, a, b, c, d) \
gdk_window_get_geometry (w, a, b, c, d, 0)
-#define gdk_x11_window_lookup_for_display(d, w) \
- gdk_xid_table_lookup_for_display (d, w)
#define gtk_box_new(ori, spacing) \
((ori) == GTK_ORIENTATION_HORIZONTAL \
? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing)))
#define gtk_scrollbar_new(ori, spacing) \
((ori) == GTK_ORIENTATION_HORIZONTAL \
? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing)))
-#ifndef GDK_KEY_g
-#define GDK_KEY_g GDK_g
-#endif
#endif /* HAVE_GTK3 */
#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x))
@@ -227,7 +178,7 @@ xg_get_gdk_scale (void)
int
xg_get_scale (struct frame *f)
{
-#if GTK_CHECK_VERSION (3, 10, 0)
+#ifdef HAVE_GTK3
if (FRAME_GTK_WIDGET (f))
return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f));
#endif
@@ -261,15 +212,7 @@ xg_display_close (Display *dpy)
gdpy_def = gdpy_new;
}
-#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
- <https://gitlab.gnome.org/GNOME/gtk/issues/221>. This way we
- can continue running, but there will be memory leaks. */
- g_object_run_dispose (G_OBJECT (gdpy));
-#else
- /* This seems to be fixed in GTK 2.10. */
gdk_display_close (gdpy);
-#endif
}
\f
@@ -368,7 +311,7 @@ xg_get_image_for_pixmap (struct frame *f,
GtkWidget *widget,
GtkImage *old_widget)
{
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
cairo_surface_t *surface;
#else
GdkPixbuf *icon_buf;
@@ -400,7 +343,7 @@ xg_get_image_for_pixmap (struct frame *f,
on a monochrome display, and sometimes bad on all displays with
certain themes. */
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
surface = img->cr_data;
if (surface)
@@ -643,8 +586,6 @@ xg_check_special_colors (struct frame *f,
We use that to pop down the tooltip. This happens if Gtk+ for some
reason wants to change or hide the tooltip. */
-#ifdef USE_GTK_TOOLTIP
-
static void
hierarchy_ch_cb (GtkWidget *widget,
GtkWidget *previous_toplevel,
@@ -711,8 +652,6 @@ qttip_cb (GtkWidget *widget,
return FALSE;
}
-#endif /* USE_GTK_TOOLTIP */
-
/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT.
Return true if a system tooltip is available. */
@@ -722,9 +661,6 @@ xg_prepare_tooltip (struct frame *f,
int *width,
int *height)
{
-#ifndef USE_GTK_TOOLTIP
- return 0;
-#else
struct x_output *x = f->output_data.x;
GtkWidget *widget;
GdkWindow *gwin;
@@ -768,7 +704,6 @@ xg_prepare_tooltip (struct frame *f,
unblock_input ();
return TRUE;
-#endif /* USE_GTK_TOOLTIP */
}
/* Show the tooltip at ROOT_X and ROOT_Y.
@@ -777,7 +712,6 @@ xg_prepare_tooltip (struct frame *f,
void
xg_show_tooltip (struct frame *f, int root_x, int root_y)
{
-#ifdef USE_GTK_TOOLTIP
struct x_output *x = f->output_data.x;
if (x->ttip_window)
{
@@ -787,7 +721,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
gtk_widget_show (GTK_WIDGET (x->ttip_window));
unblock_input ();
}
-#endif
}
@@ -797,7 +730,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
bool
xg_hide_tooltip (struct frame *f)
{
-#ifdef USE_GTK_TOOLTIP
if (f->output_data.x->ttip_window)
{
GtkWindow *win = f->output_data.x->ttip_window;
@@ -816,7 +748,6 @@ xg_hide_tooltip (struct frame *f)
return TRUE;
}
-#endif
return FALSE;
}
@@ -1193,7 +1124,7 @@ xg_create_frame_widgets (struct frame *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_CHECK_VERSION (3, 0, 0) \
+#if (! defined HAVE_GTK3 \
&& defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP)
gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE);
#endif
@@ -1328,14 +1259,12 @@ xg_create_frame_widgets (struct frame *f)
gdk_window_set_override_redirect (gwin, TRUE);
}
-#ifdef USE_GTK_TOOLTIP
/* Steal a tool tip window we can move ourselves. */
f->output_data.x->ttip_widget = 0;
f->output_data.x->ttip_lbl = 0;
f->output_data.x->ttip_window = 0;
gtk_widget_set_tooltip_text (wtop, "Dummy text");
g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
-#endif
{
GdkScreen *screen = gtk_widget_get_screen (wtop);
@@ -1363,9 +1292,7 @@ xg_free_frame_widgets (struct frame *f)
{
if (FRAME_GTK_OUTER_WIDGET (f))
{
-#ifdef USE_GTK_TOOLTIP
struct x_output *x = f->output_data.x;
-#endif
struct xg_frame_tb_info *tbinfo
= g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
TB_INFO_KEY);
@@ -1378,12 +1305,10 @@ xg_free_frame_widgets (struct frame *f)
FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */
FRAME_X_RAW_DRAWABLE (f) = 0;
FRAME_GTK_OUTER_WIDGET (f) = 0;
-#ifdef USE_GTK_TOOLTIP
if (x->ttip_lbl)
gtk_widget_destroy (x->ttip_lbl);
if (x->ttip_widget)
g_object_unref (G_OBJECT (x->ttip_widget));
-#endif
}
}
@@ -1561,7 +1486,6 @@ xg_set_undecorated (struct frame *f, Lisp_Object undecorated)
void
xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
{
-#if GTK_CHECK_VERSION (2, 18, 0)
block_input ();
if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2))
{
@@ -1576,7 +1500,6 @@ xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
x_sync (f1);
}
unblock_input ();
-#endif
}
@@ -1937,29 +1860,6 @@ xg_dialog_run (struct frame *f, GtkWidget *w)
/***********************************************************************
File dialog functions
***********************************************************************/
-/* Return true if the old file selection dialog is being used. */
-
-bool
-xg_uses_old_file_dialog (void)
-{
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
- return x_gtk_use_old_file_dialog;
-#else
- return 0;
-#endif
-}
-
-
-typedef char * (*xg_get_file_func) (GtkWidget *);
-
-/* Return the selected file for file chooser dialog W.
- The returned string must be free:d. */
-
-static char *
-xg_get_file_name_from_chooser (GtkWidget *w)
-{
- return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
-}
/* Callback called when the "Show hidden files" toggle is pressed.
WIDGET is the toggle widget, DATA is the file chooser dialog. */
@@ -2017,8 +1917,7 @@ static GtkWidget *
xg_get_file_with_chooser (struct frame *f,
char *prompt,
char *default_filename,
- bool mustmatch_p, bool only_dir_p,
- xg_get_file_func *func)
+ bool mustmatch_p, bool only_dir_p)
{
char msgbuf[1024];
@@ -2036,7 +1935,7 @@ xg_get_file_with_chooser (struct frame *f,
XG_TEXT_CANCEL, GTK_RESPONSE_CANCEL,
(mustmatch_p || only_dir_p ?
XG_TEXT_OPEN : XG_TEXT_OK),
- GTK_RESPONSE_OK,
+ GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE);
@@ -2059,9 +1958,7 @@ xg_get_file_with_chooser (struct frame *f,
if (x_gtk_file_dialog_help_text)
{
char *z = msgbuf;
- /* Gtk+ 2.10 has the file name text entry box integrated in the dialog.
- Show the C-l help text only for versions < 2.10. */
- if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (action != GTK_FILE_CHOOSER_ACTION_SAVE)
z = stpcpy (z, "\nType C-l to display a file name text entry box.\n");
strcpy (z, "\nIf you don't like this file selector, use the "
"corresponding\nkey binding or customize "
@@ -2106,60 +2003,8 @@ xg_get_file_with_chooser (struct frame *f,
}
}
- *func = xg_get_file_name_from_chooser;
- return filewin;
-}
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-
-/* Return the selected file for file selector dialog W.
- The returned string must be free:d. */
-
-static char *
-xg_get_file_name_from_selector (GtkWidget *w)
-{
- GtkFileSelection *filesel = GTK_FILE_SELECTION (w);
- return xstrdup (gtk_file_selection_get_filename (filesel));
-}
-
-/* Create a file selection dialog.
- F is the current frame.
- PROMPT is a prompt to show to the user. May not be NULL.
- DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
- If MUSTMATCH_P, the returned file name must be an existing
- file. *FUNC is set to a function that can be used to retrieve the
- selected file name from the returned widget.
-
- Returns the created widget. */
-
-static GtkWidget *
-xg_get_file_with_selection (struct frame *f,
- char *prompt,
- char *default_filename,
- bool mustmatch_p, bool only_dir_p,
- xg_get_file_func *func)
-{
- GtkWidget *filewin;
- GtkFileSelection *filesel;
-
- filewin = gtk_file_selection_new (prompt);
- filesel = GTK_FILE_SELECTION (filewin);
-
- if (default_filename)
- gtk_file_selection_set_filename (filesel, default_filename);
-
- if (mustmatch_p)
- {
- /* The selection_entry part of filesel is not documented. */
- gtk_widget_set_sensitive (filesel->selection_entry, FALSE);
- gtk_file_selection_hide_fileop_buttons (filesel);
- }
-
- *func = xg_get_file_name_from_selector;
-
return filewin;
}
-#endif /* HAVE_GTK_FILE_SELECTION_NEW */
/* Read a file name from the user using a file dialog, either the old
file selection dialog, or the new file chooser dialog. Which to use
@@ -2181,33 +2026,21 @@ xg_get_file_name (struct frame *f,
bool mustmatch_p,
bool only_dir_p)
{
- GtkWidget *w = 0;
- char *fn = 0;
- int filesel_done = 0;
- xg_get_file_func func;
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-
- if (xg_uses_old_file_dialog ())
- w = xg_get_file_with_selection (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
- else
- w = xg_get_file_with_chooser (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
+ GtkWidget *w;
+ char *name = NULL;
+ int filesel_done;
-#else /* not HAVE_GTK_FILE_SELECTION_NEW */
w = xg_get_file_with_chooser (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
-#endif /* not HAVE_GTK_FILE_SELECTION_NEW */
+ mustmatch_p, only_dir_p);
gtk_widget_set_name (w, "emacs-filedialog");
filesel_done = xg_dialog_run (f, w);
- if (filesel_done == GTK_RESPONSE_OK)
- fn = (*func) (w);
+ if (filesel_done == GTK_RESPONSE_ACCEPT)
+ name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
gtk_widget_destroy (w);
- return fn;
+ return name;
}
/***********************************************************************
@@ -2216,7 +2049,7 @@ xg_get_file_name (struct frame *f,
#ifdef HAVE_FREETYPE
-#if USE_NEW_GTK_FONT_CHOOSER
+#ifdef HAVE_GTK3
#define XG_WEIGHT_TO_SYMBOL(w) \
(w <= PANGO_WEIGHT_THIN ? Qextra_light \
@@ -2233,7 +2066,7 @@ xg_get_file_name (struct frame *f,
: s == PANGO_STYLE_ITALIC ? Qitalic \
: Qnormal)
-#endif /* USE_NEW_GTK_FONT_CHOOSER */
+#endif /* HAVE_GTK3 */
static char *x_last_font_name;
@@ -2280,7 +2113,7 @@ xg_get_font (struct frame *f, const char *default_name)
done = xg_dialog_run (f, w);
if (done == GTK_RESPONSE_OK)
{
-#if USE_NEW_GTK_FONT_CHOOSER
+#ifdef HAVE_GTK3
/* Use the GTK3 font chooser. */
PangoFontDescription *desc
= gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w));
@@ -2320,7 +2153,7 @@ xg_get_font (struct frame *f, const char *default_name)
g_free (x_last_font_name);
x_last_font_name = font_name;
}
-#endif /* USE_NEW_GTK_FONT_CHOOSER */
+#endif /* HAVE_GTK3 */
}
gtk_widget_destroy (w);
@@ -3041,9 +2874,7 @@ xg_update_menubar (GtkWidget *menubar,
bridge that might be loaded) that the item's label has
changed. */
gtk_label_set_text (wlabel, utf8_label);
-#if GTK_CHECK_VERSION (2, 16, 0)
g_object_notify (G_OBJECT (witem), "label");
-#endif
if (utf8_label) g_free (utf8_label);
iter = g_list_next (iter);
val = val->next;
@@ -3222,10 +3053,8 @@ xg_update_menu_item (widget_value *val,
}
}
-#if GTK_CHECK_VERSION (2, 16, 0)
if (label_changed) /* See comment in xg_update_menubar. */
g_object_notify (G_OBJECT (w), "label");
-#endif
}
/* Update the toggle menu item W so it corresponds to VAL. */
@@ -3324,7 +3153,7 @@ xg_update_submenu (GtkWidget *submenu,
{
/* Not a submenu anymore. */
g_object_ref (G_OBJECT (sub));
- remove_submenu (witem);
+ gtk_menu_item_set_submenu (witem, NULL);
gtk_widget_destroy (sub);
}
else if (cur->contents)
@@ -4492,14 +4321,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
}
#endif
-#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
-#define toolbar_set_orientation(w, o) \
- gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o)
-#else
-#define toolbar_set_orientation(w, o) \
- gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
-#endif
-
/* Attach a tool bar to frame F. */
static void
@@ -4509,10 +4330,10 @@ xg_pack_tool_bar (struct frame *f, Lisp_Object pos)
bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
GtkWidget *top_widget = x->toolbar_widget;
- toolbar_set_orientation (x->toolbar_widget,
- into_hbox
- ? GTK_ORIENTATION_VERTICAL
- : GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
+ into_hbox
+ ? GTK_ORIENTATION_VERTICAL
+ : GTK_ORIENTATION_HORIZONTAL);
if (into_hbox)
{
@@ -4565,7 +4386,7 @@ static void
xg_create_tool_bar (struct frame *f)
{
struct x_output *x = f->output_data.x;
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
GtkStyleContext *gsty;
#endif
struct xg_frame_tb_info *tbinfo
@@ -4589,10 +4410,11 @@ xg_create_tool_bar (struct frame *f)
gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
- toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
+ GTK_ORIENTATION_HORIZONTAL);
g_signal_connect (x->toolbar_widget, "size-allocate",
G_CALLBACK (tb_size_cb), f);
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
gsty = gtk_widget_get_style_context (x->toolbar_widget);
gtk_style_context_add_class (gsty, "primary-toolbar");
#endif
@@ -4645,7 +4467,7 @@ xg_make_tool_item (struct frame *f,
GtkWidget *wb = gtk_button_new ();
/* The eventbox is here so we can have tooltips on disabled items. */
GtkWidget *weventbox = gtk_event_box_new ();
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
GtkCssProvider *css_prov = gtk_css_provider_new ();
GtkStyleContext *gsty;
@@ -4777,7 +4599,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
{
gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
XG_TOOL_BAR_IMAGE_DATA);
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
void *old_img = (void *) gold_img;
if (old_img != img->cr_data)
return 1;
@@ -4850,7 +4672,7 @@ find_icon_from_name (char *name,
GtkIconTheme *icon_theme,
char **icon_name)
{
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
GtkStockItem stock_item;
#endif
@@ -4863,7 +4685,7 @@ find_icon_from_name (char *name,
*icon_name = NULL;
}
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
else if (gtk_stock_lookup (name, &stock_item))
*icon_name = NULL;
#endif
@@ -5078,7 +4900,7 @@ update_frame_tool_bar (struct frame *f)
prepare_image_for_display (f, img);
if (img->load_failed_p
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
|| img->cr_data == NULL
#else
|| img->pixmap == None
@@ -5113,7 +4935,7 @@ update_frame_tool_bar (struct frame *f)
else if (stock_name)
{
-#if GTK_CHECK_VERSION (3, 10, 0)
+#ifdef HAVE_GTK3
w = gtk_image_new_from_icon_name (stock_name, icon_size);
#else
w = gtk_image_new_from_stock (stock_name, icon_size);
@@ -5133,7 +4955,7 @@ update_frame_tool_bar (struct frame *f)
{
w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
(gpointer)img->cr_data
#else
(gpointer)img->pixmap
@@ -5309,7 +5131,7 @@ xg_initialize (void)
settings = gtk_settings_get_for_screen (gdk_display_get_default_screen
(gdk_display_get_default ()));
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
/* Remove F10 as a menu accelerator, it does not mix well with Emacs key
bindings. It doesn't seem to be any way to remove properties,
so we set it to "" which in means "no key". */
diff --git a/src/xfns.c b/src/xfns.c
index 13f66f0718..2d445ad6fb 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4496,7 +4496,7 @@ On MS Windows, this just returns nil. */)
Return false if and only if the workarea information cannot be
obtained via the _NET_WORKAREA root window property. */
-#if ! GTK_CHECK_VERSION (3, 4, 0)
+#ifndef HAVE_GTK3
static bool
x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
{
@@ -4906,9 +4906,9 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
Lisp_Object attributes_list = Qnil;
#ifdef USE_GTK
- double mm_width_per_pixel, mm_height_per_pixel;
GdkDisplay *gdpy;
#if ! GTK_CHECK_VERSION (3, 22, 0)
+ double mm_width_per_pixel, mm_height_per_pixel;
GdkScreen *gscreen;
#endif
gint primary_monitor = 0, n_monitors, i;
@@ -4917,19 +4917,18 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
struct MonitorInfo *monitors;
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);
#if GTK_CHECK_VERSION (3, 22, 0)
n_monitors = gdk_display_get_n_monitors (gdpy);
#else
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);
+ 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
monitor_frames = make_nil_vector (n_monitors);
monitors = xzalloc (n_monitors * sizeof *monitors);
@@ -4958,7 +4957,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
for (i = 0; i < n_monitors; ++i)
{
- gint width_mm = -1, height_mm = -1;
+ gint width_mm, height_mm;
GdkRectangle rec, work;
struct MonitorInfo *mi = &monitors[i];
int scale = 1;
@@ -4975,18 +4974,17 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
width_mm = gdk_monitor_get_width_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);
height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
-#endif
if (width_mm < 0)
width_mm = rec.width * mm_width_per_pixel + 0.5;
if (height_mm < 0)
height_mm = rec.height * mm_height_per_pixel + 0.5;
-
+#endif
#if GTK_CHECK_VERSION (3, 22, 0)
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);
#else
/* Emulate the behavior of GTK+ 3.4. */
@@ -5010,7 +5008,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
/* GTK returns scaled sizes for the workareas. */
#if GTK_CHECK_VERSION (3, 22, 0)
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);
#endif
rec.width *= scale;
@@ -5031,7 +5029,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
mi->name = xstrdup (gdk_monitor_get_model (monitor));
-#elif GTK_CHECK_VERSION (2, 14, 0)
+#else
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
#endif
}
@@ -5041,11 +5039,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
primary_monitor,
monitor_frames,
source);
-#if GTK_CHECK_VERSION (2, 14, 0)
free_monitors (monitors, n_monitors);
-#else
- xfree (monitors);
-#endif
unblock_input ();
#else /* not USE_GTK */
@@ -5380,7 +5374,7 @@ Frames are listed from topmost (first) to bottommost (last). */)
static void
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 ();
xg_frame_restack (f1, f2, above_flag);
unblock_input ();
@@ -7003,19 +6997,15 @@ DEFUN ("x-double-buffered-p", Fx_double_buffered_p, Sx_double_buffered_p,
File selection dialog
***********************************************************************/
+/* Obsoleted in 27.1. */
DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog,
Sx_uses_old_gtk_dialog,
0, 0, 0,
- doc: /* Return t if the old Gtk+ file selection dialog is used. */)
+ doc: /* Return t if the old Gtk+ file selection dialog is used.
+Note that since version 27.1 the old Gtk+ file selection dialog is
+never used. */)
(void)
{
-#ifdef USE_GTK
- if (use_dialog_box
- && use_file_dialog
- && window_system_available (SELECTED_FRAME ())
- && xg_uses_old_file_dialog ())
- return Qt;
-#endif
return Qnil;
}
@@ -7812,11 +7802,12 @@ such a font. This is especially effective for large fonts such as
Chinese, Japanese, and Korean. */);
Vx_pixel_size_width_font_regexp = Qnil;
+/* Obsoleted in 27.1. */
/* This is not ifdef:ed, so other builds than GTK can customize it. */
DEFVAR_BOOL ("x-gtk-use-old-file-dialog", x_gtk_use_old_file_dialog,
doc: /* Non-nil means prompt with the old GTK file selection dialog.
-If nil or if the file selection dialog is not available, the new GTK file
-chooser is used instead. To turn off all file dialogs set the
+Since 27.1 Emacs ignores the value of this variable and uses the
+new GTK file chooser. To turn off all file dialogs set the
variable `use-file-dialog'. */);
x_gtk_use_old_file_dialog = false;
diff --git a/src/xterm.c b/src/xterm.c
index 5aa3e3ff25..c711950a5a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -12513,7 +12513,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
dpy = DEFAULT_GDK_DISPLAY ();
-#if ! GTK_CHECK_VERSION (2, 90, 0)
+#ifndef HAVE_GTK3
/* Load our own gtkrc if it exists. */
{
const char *file = "~/.emacs.d/gtkrc";
diff --git a/src/xterm.h b/src/xterm.h
index c5ad38650c..bb7631a3f4 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -50,17 +50,8 @@ typedef Widget xt_or_gtk_widget;
#include <gdk/gdkx.h>
#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) false
-# endif
+#ifndef USE_GTK
+#define GTK_CHECK_VERSION(i, j, k) false
#endif
#ifdef USE_GTK
@@ -76,11 +67,6 @@ typedef GtkWidget *xt_or_gtk_widget;
#endif
#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
#include <cairo-xlib.h>
#ifdef CAIRO_HAS_PDF_SURFACE
@@ -594,12 +580,9 @@ struct x_output
GdkGeometry size_hints;
long hint_flags;
-#ifdef USE_GTK_TOOLTIP
GtkTooltip *ttip_widget;
GtkWidget *ttip_lbl;
GtkWindow *ttip_window;
-#endif /* USE_GTK_TOOLTIP */
-
#endif /* USE_GTK */
/* 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);
FRAME_X_WINDOW (f))
#else
#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
#define DEFAULT_GDK_DISPLAY() \
--
2.21.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-10 3:14 ` Alex
@ 2019-04-10 15:57 ` Eli Zaretskii
2019-04-10 16:20 ` Stefan Monnier
2019-04-11 0:35 ` Alex
0 siblings, 2 replies; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-10 15:57 UTC (permalink / raw)
To: Alex; +Cc: eggert, monnier, emacs-devel
> From: Alex <agrambot@gmail.com>
> Cc: eggert@cs.ucla.edu, monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Tue, 09 Apr 2019 21:14:02 -0600
>
> > To allow proper review, please make the log message more detailed. In
> > particular, stuff you remove that is not under an explicit GTK version
> > condition should have a minimal explanation for why it is TRT to
> > remove it. (The rationale doesn't have to be in the log message,
> > although it would be nice to have it there; it could be just in the
> > email that accompanies the patch.)
>
> Here's a brief overview of the changes outside of explicit checks:
Thanks, I think most of this text should be in the commit log. It's
not too long for that, and provides useful information.
> * Old file selection dialog
> This is only optionally used in GTK 2, but the old dialog is long
> deprecated in GTK 2 (removed in GTK 3), so I figured that this is a good
> time to remove it and simplify the existing code.
I think this should be left alone. It's a separate issue anyway, and
should be submitted separately. It would be good to try to establish
whether this feature is turned on by someone, but given that it's only
for GTK2, I tend to think we should simply let it die a natural death
together with GTK2.
> > Please also tell with which GTK versions did you try building with to
> > verify the correctness of the changes.
>
> I tested with GTK 2.24.32 and GTK 3.24.7. I didn't see a need to test
> with an older GTK 3 version since the GTK 3 part of the change involves
> simplifying version checks 3 <= version <= 3.10 (and
> USE_NEW_GTK_FONT_CHOOSER) to HAVE_GTK3 checks.
I think it would be good to see if the changes compile with 3.10
nonetheless. Can someone please try that?
> > Not sure we discussed 3.10 as the minimum GTK3 version, we only talked
> > about 2.x AFAIR. What is the situation with GTK3 versions in the
> > current distributions of GNU/Linux?
>
> My messages briefly discussed the minimum of 3.10 and how Debian Jessie
> (oldstable -- soon to be oldoldstable), and Ubuntu 14.04LTS have GTK 3.10.
What about others, like RH?
> RHEL doesn't even support GTK 3 until RHEL 7, which has 3.22.
AFAIK, Red Hat is not limited to RHEL, and then there are derivatives,
like CentOS. (I'm not saying those others come with older GTK3, I'm
just saying we should check.)
> So I think bumping to 3.10 doesn't hurt, especially since there's still
> GTK 2 support.
It sounds to me a bit drastic to tell people to downgrade to GTK2
because we don't support old enough GTK3.
Thanks.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-10 15:57 ` Eli Zaretskii
@ 2019-04-10 16:20 ` Stefan Monnier
2019-04-10 16:43 ` Eli Zaretskii
2019-04-11 0:35 ` Alex
1 sibling, 1 reply; 29+ messages in thread
From: Stefan Monnier @ 2019-04-10 16:20 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: eggert, Alex, emacs-devel
> It sounds to me a bit drastic to tell people to downgrade to GTK2
> because we don't support old enough GTK3.
Other than the file-dialog, what concrete changes does this entail for
Emacs users (I know I should know since I use the Gtk build on several
of my machines, but I must admit I don't even know whether those builds
use Gtk2 or Gtk3 (I assume it's Gtk3) and I can't remember noticing
a change when we went from 2 to 3)?
Stefan
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-10 16:20 ` Stefan Monnier
@ 2019-04-10 16:43 ` Eli Zaretskii
0 siblings, 0 replies; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-10 16:43 UTC (permalink / raw)
To: Stefan Monnier; +Cc: eggert, agrambot, emacs-devel
> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: Alex <agrambot@gmail.com>, eggert@cs.ucla.edu, emacs-devel@gnu.org
> Date: Wed, 10 Apr 2019 12:20:22 -0400
>
> > It sounds to me a bit drastic to tell people to downgrade to GTK2
> > because we don't support old enough GTK3.
>
> Other than the file-dialog, what concrete changes does this entail for
> Emacs users
I don't know, I never use GTK.
Maybe someone else will know.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-10 15:57 ` Eli Zaretskii
2019-04-10 16:20 ` Stefan Monnier
@ 2019-04-11 0:35 ` Alex
2019-04-11 1:26 ` Alex Branham
2019-04-12 18:49 ` Eli Zaretskii
1 sibling, 2 replies; 29+ messages in thread
From: Alex @ 2019-04-11 0:35 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: monnier, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> * Old file selection dialog
>> This is only optionally used in GTK 2, but the old dialog is long
>> deprecated in GTK 2 (removed in GTK 3), so I figured that this is a good
>> time to remove it and simplify the existing code.
>
> I think this should be left alone. It's a separate issue anyway, and
> should be submitted separately. It would be good to try to establish
> whether this feature is turned on by someone, but given that it's only
> for GTK2, I tend to think we should simply let it die a natural death
> together with GTK2.
Okay, done.
>> > Please also tell with which GTK versions did you try building with to
>> > verify the correctness of the changes.
>>
>> I tested with GTK 2.24.32 and GTK 3.24.7. I didn't see a need to test
>> with an older GTK 3 version since the GTK 3 part of the change involves
>> simplifying version checks 3 <= version <= 3.10 (and
>> USE_NEW_GTK_FONT_CHOOSER) to HAVE_GTK3 checks.
>
> I think it would be good to see if the changes compile with 3.10
> nonetheless. Can someone please try that?
Okay, I tried GTK 3.10.9 and it was fine.
>> > Not sure we discussed 3.10 as the minimum GTK3 version, we only talked
>> > about 2.x AFAIR. What is the situation with GTK3 versions in the
>> > current distributions of GNU/Linux?
>>
>> My messages briefly discussed the minimum of 3.10 and how Debian Jessie
>> (oldstable -- soon to be oldoldstable), and Ubuntu 14.04LTS have GTK 3.10.
>
> What about others, like RH?
I'm not sure what distro you mean here.
>> RHEL doesn't even support GTK 3 until RHEL 7, which has 3.22.
>
> AFAIK, Red Hat is not limited to RHEL, and then there are derivatives,
> like CentOS. (I'm not saying those others come with older GTK3, I'm
> just saying we should check.)
Right, but it's my understanding that RHEL usually/always contains older
packages than other Red Hat affiliated/derivative distros.
In any case, CentOS 7 (first to contain GTK 3) has GTK 3.22. As does
Fedora 27.
OpenSUSE 42.3 has GTK 3.20. Mageia 5.1 has GTK 3.14.
>> So I think bumping to 3.10 doesn't hurt, especially since there's still
>> GTK 2 support.
>
> It sounds to me a bit drastic to tell people to downgrade to GTK2
> because we don't support old enough GTK3.
At this point GTK 3.10 is widely enough supported that I don't really
think anyone will be put into that situation.
I've attached an updated patch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Bump GTK versions v3 --]
[-- Type: text/x-patch, Size: 34428 bytes --]
From 612a2ab0d605798d192440bc6e6f3fda7ac1eb94 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sun, 7 Apr 2019 19:02:03 -0600
Subject: [PATCH] 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.
* src/gtkutil.c: Simplify file selection code.
* lisp/term/x-win.el: Obsolete old file selection dialog interface.
* lisp/subr.el: Move GTK obsolete variable declaration to
lisp/term/x-win.el.
---
configure.ac | 46 ++-------
etc/NEWS | 4 +
lisp/subr.el | 2 -
lisp/term/x-win.el | 5 +
src/gtkutil.c | 238 +++++++++++----------------------------------
src/gtkutil.h | 2 -
src/xfns.c | 42 ++++----
src/xterm.c | 2 +-
src/xterm.h | 33 +------
9 files changed, 93 insertions(+), 281 deletions(-)
diff --git a/configure.ac b/configure.ac
index c93cfbbb59..3c5b9a0fb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2671,8 +2671,8 @@ AC_DEFUN
gtk3_pkg_errors=
if test "${opsys}" != "mingw32"; then
if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
- GLIB_REQUIRED=2.28
- GTK_REQUIRED=3.0
+ GLIB_REQUIRED=2.37.5
+ GTK_REQUIRED=3.10
GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries.
@@ -2699,8 +2699,8 @@ AC_DEFUN
fi
if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
- GLIB_REQUIRED=2.10
- GTK_REQUIRED=2.10
+ GLIB_REQUIRED=2.28
+ GTK_REQUIRED=2.24
GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Checks for libraries.
@@ -2775,42 +2775,8 @@ AC_DEFUN
with_toolkit_scroll_bars=yes
fi
- dnl Check if we have the old file selection dialog declared and
- dnl in the link library. In 2.x it may be in the library,
- dnl but not declared if deprecated featured has been selected out.
- dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
- HAVE_GTK_FILE_SELECTION=no
- AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
- HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
-#include <gtk/gtk.h>])
- if test "$HAVE_GTK_FILE_SELECTION" = yes; then
- AC_CHECK_FUNCS(gtk_file_selection_new)
- fi
-
- dnl Same as above for gtk_handle_box.
- HAVE_GTK_HANDLE_BOX=no
- 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)
+ dnl This procedure causes a bug on certain Ubuntu GTK+2 builds
+ AC_CHECK_FUNCS(gtk_window_set_has_resize_grip)
term_header=gtkutil.h
fi
diff --git a/etc/NEWS b/etc/NEWS
index fbde6e0b66..303bf972c1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -84,6 +84,10 @@ The new command-line argument '--dump-file=FILE' allows to specify a
non-default '.pdmp' file to load the state from; see the node "Initial
Options" in the Emacs manual for more information.
+---
+** Emacs now requires GTK 2.24 and GTK 3.10 for the GTK 2 and GTK 3
+builds respectively.
+
\f
* Startup Changes in Emacs 27.1
diff --git a/lisp/subr.el b/lisp/subr.el
index bdf98979c4..3f17b4774b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1557,8 +1557,6 @@ log10
;; but Stefan insists to mark it so.
(make-obsolete-variable 'translation-table-for-input nil "23.1")
-(make-obsolete-variable 'x-gtk-use-window-move nil "26.1")
-
(defvaralias 'messages-buffer-max-lines 'message-log-max)
(define-obsolete-variable-alias 'inhibit-null-byte-detection
'inhibit-nul-byte-detection "27.1")
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 56061371fe..0f0c3f163f 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1486,6 +1486,11 @@ x-gtk-map-stock
(global-set-key [XF86WakeUp] 'ignore)
+;;; Obsolete definitions
+(make-obsolete-variable 'x-gtk-use-window-move nil "26.1")
+(make-obsolete 'x-uses-old-gtk-dialog nil "27.1")
+(make-obsolete-variable 'x-gtk-use-old-file-dialog nil "27.1")
+
(provide 'x-win)
(provide 'term/x-win)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index b130692c87..0e87d34bdc 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -52,48 +52,19 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <X11/extensions/Xdbe.h>
#endif
-#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW
-#define gtk_widget_set_has_window(w, b) \
- (gtk_fixed_set_has_window (GTK_FIXED (w), b))
-#endif
-#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA
-#define gtk_dialog_get_action_area(w) ((w)->action_area)
-#define gtk_dialog_get_content_area(w) ((w)->vbox)
-#endif
-#ifndef HAVE_GTK_WIDGET_GET_SENSITIVE
-#define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w))
-#endif
-#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
-#define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s))
-#define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s))
-#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_CHECK_VERSION (2, 12, 0)
-#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
+#ifdef HAVE_GTK3
+#define XG_TEXT_CANCEL "Cancel"
+#define XG_TEXT_OK "OK"
+#define XG_TEXT_OPEN "Open"
#else
-#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
+#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
+#define XG_TEXT_OK GTK_STOCK_OK
+#define XG_TEXT_OPEN GTK_STOCK_OPEN
#endif
-#if ! GTK_CHECK_VERSION (2, 14, 0)
-#define gtk_adjustment_configure(adj, xvalue, xlower, \
- xupper, xstep_increment, \
- xpage_increment, xpagesize) \
- do { \
- adj->lower = xlower; \
- adj->upper = xupper; \
- adj->page_size = xpagesize; \
- gtk_adjustment_set_value (adj, xvalue); \
- adj->page_increment = xpage_increment; \
- adj->step_increment = xstep_increment; \
- } while (0)
-#endif /* < Gtk+ 2.14 */
+#ifndef HAVE_GTK3
#ifdef HAVE_FREETYPE
-#if GTK_CHECK_VERSION (3, 2, 0)
-#define USE_NEW_GTK_FONT_CHOOSER 1
-#else
-#define USE_NEW_GTK_FONT_CHOOSER 0
#define gtk_font_chooser_dialog_new(x, y) \
gtk_font_selection_dialog_new (x)
#undef GTK_FONT_CHOOSER
@@ -101,35 +72,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#define gtk_font_chooser_set_font(x, y) \
gtk_font_selection_dialog_set_font_name (x, y)
#endif
-#endif /* HAVE_FREETYPE */
-
-#if GTK_CHECK_VERSION (3, 10, 0)
-#define XG_TEXT_CANCEL "Cancel"
-#define XG_TEXT_OK "OK"
-#define XG_TEXT_OPEN "Open"
-#else
-#define XG_TEXT_CANCEL GTK_STOCK_CANCEL
-#define XG_TEXT_OK GTK_STOCK_OK
-#define XG_TEXT_OPEN GTK_STOCK_OPEN
-#endif
-#ifndef HAVE_GTK3
-#ifdef USE_GTK_TOOLTIP
-#define gdk_window_get_screen(w) gdk_drawable_get_screen (w)
-#endif
#define gdk_window_get_geometry(w, a, b, c, d) \
gdk_window_get_geometry (w, a, b, c, d, 0)
-#define gdk_x11_window_lookup_for_display(d, w) \
- gdk_xid_table_lookup_for_display (d, w)
#define gtk_box_new(ori, spacing) \
((ori) == GTK_ORIENTATION_HORIZONTAL \
? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing)))
#define gtk_scrollbar_new(ori, spacing) \
((ori) == GTK_ORIENTATION_HORIZONTAL \
? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing)))
-#ifndef GDK_KEY_g
-#define GDK_KEY_g GDK_g
-#endif
#endif /* HAVE_GTK3 */
#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x))
@@ -227,7 +178,7 @@ xg_get_gdk_scale (void)
int
xg_get_scale (struct frame *f)
{
-#if GTK_CHECK_VERSION (3, 10, 0)
+#ifdef HAVE_GTK3
if (FRAME_GTK_WIDGET (f))
return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f));
#endif
@@ -261,15 +212,7 @@ xg_display_close (Display *dpy)
gdpy_def = gdpy_new;
}
-#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
- <https://gitlab.gnome.org/GNOME/gtk/issues/221>. This way we
- can continue running, but there will be memory leaks. */
- g_object_run_dispose (G_OBJECT (gdpy));
-#else
- /* This seems to be fixed in GTK 2.10. */
gdk_display_close (gdpy);
-#endif
}
\f
@@ -368,7 +311,7 @@ xg_get_image_for_pixmap (struct frame *f,
GtkWidget *widget,
GtkImage *old_widget)
{
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
cairo_surface_t *surface;
#else
GdkPixbuf *icon_buf;
@@ -400,7 +343,7 @@ xg_get_image_for_pixmap (struct frame *f,
on a monochrome display, and sometimes bad on all displays with
certain themes. */
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
surface = img->cr_data;
if (surface)
@@ -643,8 +586,6 @@ xg_check_special_colors (struct frame *f,
We use that to pop down the tooltip. This happens if Gtk+ for some
reason wants to change or hide the tooltip. */
-#ifdef USE_GTK_TOOLTIP
-
static void
hierarchy_ch_cb (GtkWidget *widget,
GtkWidget *previous_toplevel,
@@ -711,8 +652,6 @@ qttip_cb (GtkWidget *widget,
return FALSE;
}
-#endif /* USE_GTK_TOOLTIP */
-
/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT.
Return true if a system tooltip is available. */
@@ -722,9 +661,6 @@ xg_prepare_tooltip (struct frame *f,
int *width,
int *height)
{
-#ifndef USE_GTK_TOOLTIP
- return 0;
-#else
struct x_output *x = f->output_data.x;
GtkWidget *widget;
GdkWindow *gwin;
@@ -768,7 +704,6 @@ xg_prepare_tooltip (struct frame *f,
unblock_input ();
return TRUE;
-#endif /* USE_GTK_TOOLTIP */
}
/* Show the tooltip at ROOT_X and ROOT_Y.
@@ -777,7 +712,6 @@ xg_prepare_tooltip (struct frame *f,
void
xg_show_tooltip (struct frame *f, int root_x, int root_y)
{
-#ifdef USE_GTK_TOOLTIP
struct x_output *x = f->output_data.x;
if (x->ttip_window)
{
@@ -787,7 +721,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
gtk_widget_show (GTK_WIDGET (x->ttip_window));
unblock_input ();
}
-#endif
}
@@ -797,7 +730,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
bool
xg_hide_tooltip (struct frame *f)
{
-#ifdef USE_GTK_TOOLTIP
if (f->output_data.x->ttip_window)
{
GtkWindow *win = f->output_data.x->ttip_window;
@@ -816,7 +748,6 @@ xg_hide_tooltip (struct frame *f)
return TRUE;
}
-#endif
return FALSE;
}
@@ -1193,7 +1124,7 @@ xg_create_frame_widgets (struct frame *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_CHECK_VERSION (3, 0, 0) \
+#if (! defined HAVE_GTK3 \
&& defined HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP)
gtk_window_set_has_resize_grip (GTK_WINDOW (wtop), FALSE);
#endif
@@ -1328,14 +1259,12 @@ xg_create_frame_widgets (struct frame *f)
gdk_window_set_override_redirect (gwin, TRUE);
}
-#ifdef USE_GTK_TOOLTIP
/* Steal a tool tip window we can move ourselves. */
f->output_data.x->ttip_widget = 0;
f->output_data.x->ttip_lbl = 0;
f->output_data.x->ttip_window = 0;
gtk_widget_set_tooltip_text (wtop, "Dummy text");
g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
-#endif
{
GdkScreen *screen = gtk_widget_get_screen (wtop);
@@ -1363,9 +1292,7 @@ xg_free_frame_widgets (struct frame *f)
{
if (FRAME_GTK_OUTER_WIDGET (f))
{
-#ifdef USE_GTK_TOOLTIP
struct x_output *x = f->output_data.x;
-#endif
struct xg_frame_tb_info *tbinfo
= g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),
TB_INFO_KEY);
@@ -1378,12 +1305,10 @@ xg_free_frame_widgets (struct frame *f)
FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */
FRAME_X_RAW_DRAWABLE (f) = 0;
FRAME_GTK_OUTER_WIDGET (f) = 0;
-#ifdef USE_GTK_TOOLTIP
if (x->ttip_lbl)
gtk_widget_destroy (x->ttip_lbl);
if (x->ttip_widget)
g_object_unref (G_OBJECT (x->ttip_widget));
-#endif
}
}
@@ -1561,7 +1486,6 @@ xg_set_undecorated (struct frame *f, Lisp_Object undecorated)
void
xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
{
-#if GTK_CHECK_VERSION (2, 18, 0)
block_input ();
if (FRAME_GTK_OUTER_WIDGET (f1) && FRAME_GTK_OUTER_WIDGET (f2))
{
@@ -1576,7 +1500,6 @@ xg_frame_restack (struct frame *f1, struct frame *f2, bool above_flag)
x_sync (f1);
}
unblock_input ();
-#endif
}
@@ -1937,29 +1860,6 @@ xg_dialog_run (struct frame *f, GtkWidget *w)
/***********************************************************************
File dialog functions
***********************************************************************/
-/* Return true if the old file selection dialog is being used. */
-
-bool
-xg_uses_old_file_dialog (void)
-{
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
- return x_gtk_use_old_file_dialog;
-#else
- return 0;
-#endif
-}
-
-
-typedef char * (*xg_get_file_func) (GtkWidget *);
-
-/* Return the selected file for file chooser dialog W.
- The returned string must be free:d. */
-
-static char *
-xg_get_file_name_from_chooser (GtkWidget *w)
-{
- return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
-}
/* Callback called when the "Show hidden files" toggle is pressed.
WIDGET is the toggle widget, DATA is the file chooser dialog. */
@@ -2017,8 +1917,7 @@ static GtkWidget *
xg_get_file_with_chooser (struct frame *f,
char *prompt,
char *default_filename,
- bool mustmatch_p, bool only_dir_p,
- xg_get_file_func *func)
+ bool mustmatch_p, bool only_dir_p)
{
char msgbuf[1024];
@@ -2059,9 +1958,7 @@ xg_get_file_with_chooser (struct frame *f,
if (x_gtk_file_dialog_help_text)
{
char *z = msgbuf;
- /* Gtk+ 2.10 has the file name text entry box integrated in the dialog.
- Show the C-l help text only for versions < 2.10. */
- if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (action != GTK_FILE_CHOOSER_ACTION_SAVE)
z = stpcpy (z, "\nType C-l to display a file name text entry box.\n");
strcpy (z, "\nIf you don't like this file selector, use the "
"corresponding\nkey binding or customize "
@@ -2106,21 +2003,10 @@ xg_get_file_with_chooser (struct frame *f,
}
}
- *func = xg_get_file_name_from_chooser;
return filewin;
}
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-
-/* Return the selected file for file selector dialog W.
- The returned string must be free:d. */
-
-static char *
-xg_get_file_name_from_selector (GtkWidget *w)
-{
- GtkFileSelection *filesel = GTK_FILE_SELECTION (w);
- return xstrdup (gtk_file_selection_get_filename (filesel));
-}
+#ifndef HAVE_GTK3
/* Create a file selection dialog.
F is the current frame.
@@ -2136,8 +2022,7 @@ static GtkWidget *
xg_get_file_with_selection (struct frame *f,
char *prompt,
char *default_filename,
- bool mustmatch_p, bool only_dir_p,
- xg_get_file_func *func)
+ bool mustmatch_p, bool only_dir_p)
{
GtkWidget *filewin;
GtkFileSelection *filesel;
@@ -2155,11 +2040,9 @@ xg_get_file_with_selection (struct frame *f,
gtk_file_selection_hide_fileop_buttons (filesel);
}
- *func = xg_get_file_name_from_selector;
-
return filewin;
}
-#endif /* HAVE_GTK_FILE_SELECTION_NEW */
+#endif /* HAVE_GTK3 */
/* Read a file name from the user using a file dialog, either the old
file selection dialog, or the new file chooser dialog. Which to use
@@ -2181,33 +2064,35 @@ xg_get_file_name (struct frame *f,
bool mustmatch_p,
bool only_dir_p)
{
- GtkWidget *w = 0;
- char *fn = 0;
- int filesel_done = 0;
- xg_get_file_func func;
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
+ GtkWidget *w;
+ char *name = NULL;
+ int filesel_done;
- if (xg_uses_old_file_dialog ())
+#ifndef HAVE_GTK3
+ if (x_gtk_use_old_file_dialog)
w = xg_get_file_with_selection (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
+ mustmatch_p, only_dir_p);
else
- w = xg_get_file_with_chooser (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
-
-#else /* not HAVE_GTK_FILE_SELECTION_NEW */
+#endif
w = xg_get_file_with_chooser (f, prompt, default_filename,
- mustmatch_p, only_dir_p, &func);
-#endif /* not HAVE_GTK_FILE_SELECTION_NEW */
+ mustmatch_p, only_dir_p);
gtk_widget_set_name (w, "emacs-filedialog");
filesel_done = xg_dialog_run (f, w);
if (filesel_done == GTK_RESPONSE_OK)
- fn = (*func) (w);
+ {
+#ifndef HAVE_GTK3
+ if (x_gtk_use_old_file_dialog)
+ name = xstrdup (gtk_file_selection_get_filename
+ (GTK_FILE_SELECTION (w)));
+ else
+#endif
+ name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
+ }
gtk_widget_destroy (w);
- return fn;
+ return name;
}
/***********************************************************************
@@ -2216,7 +2101,7 @@ xg_get_file_name (struct frame *f,
#ifdef HAVE_FREETYPE
-#if USE_NEW_GTK_FONT_CHOOSER
+#ifdef HAVE_GTK3
#define XG_WEIGHT_TO_SYMBOL(w) \
(w <= PANGO_WEIGHT_THIN ? Qextra_light \
@@ -2233,7 +2118,7 @@ xg_get_file_name (struct frame *f,
: s == PANGO_STYLE_ITALIC ? Qitalic \
: Qnormal)
-#endif /* USE_NEW_GTK_FONT_CHOOSER */
+#endif /* HAVE_GTK3 */
static char *x_last_font_name;
@@ -2280,7 +2165,7 @@ xg_get_font (struct frame *f, const char *default_name)
done = xg_dialog_run (f, w);
if (done == GTK_RESPONSE_OK)
{
-#if USE_NEW_GTK_FONT_CHOOSER
+#ifdef HAVE_GTK3
/* Use the GTK3 font chooser. */
PangoFontDescription *desc
= gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (w));
@@ -2320,7 +2205,7 @@ xg_get_font (struct frame *f, const char *default_name)
g_free (x_last_font_name);
x_last_font_name = font_name;
}
-#endif /* USE_NEW_GTK_FONT_CHOOSER */
+#endif /* HAVE_GTK3 */
}
gtk_widget_destroy (w);
@@ -3041,9 +2926,7 @@ xg_update_menubar (GtkWidget *menubar,
bridge that might be loaded) that the item's label has
changed. */
gtk_label_set_text (wlabel, utf8_label);
-#if GTK_CHECK_VERSION (2, 16, 0)
g_object_notify (G_OBJECT (witem), "label");
-#endif
if (utf8_label) g_free (utf8_label);
iter = g_list_next (iter);
val = val->next;
@@ -3222,10 +3105,8 @@ xg_update_menu_item (widget_value *val,
}
}
-#if GTK_CHECK_VERSION (2, 16, 0)
if (label_changed) /* See comment in xg_update_menubar. */
g_object_notify (G_OBJECT (w), "label");
-#endif
}
/* Update the toggle menu item W so it corresponds to VAL. */
@@ -3324,7 +3205,7 @@ xg_update_submenu (GtkWidget *submenu,
{
/* Not a submenu anymore. */
g_object_ref (G_OBJECT (sub));
- remove_submenu (witem);
+ gtk_menu_item_set_submenu (witem, NULL);
gtk_widget_destroy (sub);
}
else if (cur->contents)
@@ -4492,14 +4373,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
}
#endif
-#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
-#define toolbar_set_orientation(w, o) \
- gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o)
-#else
-#define toolbar_set_orientation(w, o) \
- gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
-#endif
-
/* Attach a tool bar to frame F. */
static void
@@ -4509,10 +4382,10 @@ xg_pack_tool_bar (struct frame *f, Lisp_Object pos)
bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
GtkWidget *top_widget = x->toolbar_widget;
- toolbar_set_orientation (x->toolbar_widget,
- into_hbox
- ? GTK_ORIENTATION_VERTICAL
- : GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
+ into_hbox
+ ? GTK_ORIENTATION_VERTICAL
+ : GTK_ORIENTATION_HORIZONTAL);
if (into_hbox)
{
@@ -4565,7 +4438,7 @@ static void
xg_create_tool_bar (struct frame *f)
{
struct x_output *x = f->output_data.x;
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
GtkStyleContext *gsty;
#endif
struct xg_frame_tb_info *tbinfo
@@ -4589,10 +4462,11 @@ xg_create_tool_bar (struct frame *f)
gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
- toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (x->toolbar_widget),
+ GTK_ORIENTATION_HORIZONTAL);
g_signal_connect (x->toolbar_widget, "size-allocate",
G_CALLBACK (tb_size_cb), f);
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
gsty = gtk_widget_get_style_context (x->toolbar_widget);
gtk_style_context_add_class (gsty, "primary-toolbar");
#endif
@@ -4645,7 +4519,7 @@ xg_make_tool_item (struct frame *f,
GtkWidget *wb = gtk_button_new ();
/* The eventbox is here so we can have tooltips on disabled items. */
GtkWidget *weventbox = gtk_event_box_new ();
-#if GTK_CHECK_VERSION (3, 3, 6)
+#ifdef HAVE_GTK3
GtkCssProvider *css_prov = gtk_css_provider_new ();
GtkStyleContext *gsty;
@@ -4777,7 +4651,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
{
gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
XG_TOOL_BAR_IMAGE_DATA);
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
void *old_img = (void *) gold_img;
if (old_img != img->cr_data)
return 1;
@@ -4850,7 +4724,7 @@ find_icon_from_name (char *name,
GtkIconTheme *icon_theme,
char **icon_name)
{
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
GtkStockItem stock_item;
#endif
@@ -4863,7 +4737,7 @@ find_icon_from_name (char *name,
*icon_name = NULL;
}
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
else if (gtk_stock_lookup (name, &stock_item))
*icon_name = NULL;
#endif
@@ -5078,7 +4952,7 @@ update_frame_tool_bar (struct frame *f)
prepare_image_for_display (f, img);
if (img->load_failed_p
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
|| img->cr_data == NULL
#else
|| img->pixmap == None
@@ -5113,7 +4987,7 @@ update_frame_tool_bar (struct frame *f)
else if (stock_name)
{
-#if GTK_CHECK_VERSION (3, 10, 0)
+#ifdef HAVE_GTK3
w = gtk_image_new_from_icon_name (stock_name, icon_size);
#else
w = gtk_image_new_from_stock (stock_name, icon_size);
@@ -5133,7 +5007,7 @@ update_frame_tool_bar (struct frame *f)
{
w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
-#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+#if defined USE_CAIRO && defined HAVE_GTK3
(gpointer)img->cr_data
#else
(gpointer)img->pixmap
@@ -5309,7 +5183,7 @@ xg_initialize (void)
settings = gtk_settings_get_for_screen (gdk_display_get_default_screen
(gdk_display_get_default ()));
-#if ! GTK_CHECK_VERSION (3, 10, 0)
+#ifndef HAVE_GTK3
/* Remove F10 as a menu accelerator, it does not mix well with Emacs key
bindings. It doesn't seem to be any way to remove properties,
so we set it to "" which in means "no key". */
diff --git a/src/gtkutil.h b/src/gtkutil.h
index ec899781ca..475a7fc903 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -77,8 +77,6 @@ typedef struct xg_menu_item_cb_data_
} xg_menu_item_cb_data;
-extern bool xg_uses_old_file_dialog (void);
-
extern char *xg_get_file_name (struct frame *f,
char *prompt,
char *default_filename,
diff --git a/src/xfns.c b/src/xfns.c
index 13f66f0718..87b9dd936c 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4496,7 +4496,7 @@ On MS Windows, this just returns nil. */)
Return false if and only if the workarea information cannot be
obtained via the _NET_WORKAREA root window property. */
-#if ! GTK_CHECK_VERSION (3, 4, 0)
+#ifndef HAVE_GTK3
static bool
x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
{
@@ -4906,9 +4906,9 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
Lisp_Object attributes_list = Qnil;
#ifdef USE_GTK
- double mm_width_per_pixel, mm_height_per_pixel;
GdkDisplay *gdpy;
#if ! GTK_CHECK_VERSION (3, 22, 0)
+ double mm_width_per_pixel, mm_height_per_pixel;
GdkScreen *gscreen;
#endif
gint primary_monitor = 0, n_monitors, i;
@@ -4917,19 +4917,18 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
struct MonitorInfo *monitors;
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);
#if GTK_CHECK_VERSION (3, 22, 0)
n_monitors = gdk_display_get_n_monitors (gdpy);
#else
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);
+ 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
monitor_frames = make_nil_vector (n_monitors);
monitors = xzalloc (n_monitors * sizeof *monitors);
@@ -4958,7 +4957,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
for (i = 0; i < n_monitors; ++i)
{
- gint width_mm = -1, height_mm = -1;
+ gint width_mm, height_mm;
GdkRectangle rec, work;
struct MonitorInfo *mi = &monitors[i];
int scale = 1;
@@ -4975,18 +4974,17 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
width_mm = gdk_monitor_get_width_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);
height_mm = gdk_screen_get_monitor_height_mm (gscreen, i);
-#endif
if (width_mm < 0)
width_mm = rec.width * mm_width_per_pixel + 0.5;
if (height_mm < 0)
height_mm = rec.height * mm_height_per_pixel + 0.5;
-
+#endif
#if GTK_CHECK_VERSION (3, 22, 0)
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);
#else
/* Emulate the behavior of GTK+ 3.4. */
@@ -5010,7 +5008,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
/* GTK returns scaled sizes for the workareas. */
#if GTK_CHECK_VERSION (3, 22, 0)
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);
#endif
rec.width *= scale;
@@ -5031,7 +5029,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
#if GTK_CHECK_VERSION (3, 22, 0)
mi->name = xstrdup (gdk_monitor_get_model (monitor));
-#elif GTK_CHECK_VERSION (2, 14, 0)
+#else
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
#endif
}
@@ -5041,11 +5039,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
primary_monitor,
monitor_frames,
source);
-#if GTK_CHECK_VERSION (2, 14, 0)
free_monitors (monitors, n_monitors);
-#else
- xfree (monitors);
-#endif
unblock_input ();
#else /* not USE_GTK */
@@ -5380,7 +5374,7 @@ Frames are listed from topmost (first) to bottommost (last). */)
static void
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 ();
xg_frame_restack (f1, f2, above_flag);
unblock_input ();
@@ -7003,17 +6997,18 @@ DEFUN ("x-double-buffered-p", Fx_double_buffered_p, Sx_double_buffered_p,
File selection dialog
***********************************************************************/
+/* Obsoleted in 27.1. */
DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog,
Sx_uses_old_gtk_dialog,
0, 0, 0,
doc: /* Return t if the old Gtk+ file selection dialog is used. */)
(void)
{
-#ifdef USE_GTK
+#if defined USE_GTK && ! defined HAVE_GTK3
if (use_dialog_box
&& use_file_dialog
&& window_system_available (SELECTED_FRAME ())
- && xg_uses_old_file_dialog ())
+ && x_gtk_use_old_file_dialog)
return Qt;
#endif
return Qnil;
@@ -7812,6 +7807,7 @@ such a font. This is especially effective for large fonts such as
Chinese, Japanese, and Korean. */);
Vx_pixel_size_width_font_regexp = Qnil;
+/* Obsoleted in 27.1. */
/* This is not ifdef:ed, so other builds than GTK can customize it. */
DEFVAR_BOOL ("x-gtk-use-old-file-dialog", x_gtk_use_old_file_dialog,
doc: /* Non-nil means prompt with the old GTK file selection dialog.
diff --git a/src/xterm.c b/src/xterm.c
index 5aa3e3ff25..c711950a5a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -12513,7 +12513,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
dpy = DEFAULT_GDK_DISPLAY ();
-#if ! GTK_CHECK_VERSION (2, 90, 0)
+#ifndef HAVE_GTK3
/* Load our own gtkrc if it exists. */
{
const char *file = "~/.emacs.d/gtkrc";
diff --git a/src/xterm.h b/src/xterm.h
index c5ad38650c..bb7631a3f4 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -50,17 +50,8 @@ typedef Widget xt_or_gtk_widget;
#include <gdk/gdkx.h>
#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) false
-# endif
+#ifndef USE_GTK
+#define GTK_CHECK_VERSION(i, j, k) false
#endif
#ifdef USE_GTK
@@ -76,11 +67,6 @@ typedef GtkWidget *xt_or_gtk_widget;
#endif
#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
#include <cairo-xlib.h>
#ifdef CAIRO_HAS_PDF_SURFACE
@@ -594,12 +580,9 @@ struct x_output
GdkGeometry size_hints;
long hint_flags;
-#ifdef USE_GTK_TOOLTIP
GtkTooltip *ttip_widget;
GtkWidget *ttip_lbl;
GtkWindow *ttip_window;
-#endif /* USE_GTK_TOOLTIP */
-
#endif /* USE_GTK */
/* 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);
FRAME_X_WINDOW (f))
#else
#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
#define DEFAULT_GDK_DISPLAY() \
--
2.21.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-11 0:35 ` Alex
@ 2019-04-11 1:26 ` Alex Branham
2019-04-11 14:19 ` Eli Zaretskii
2019-04-12 18:49 ` Eli Zaretskii
1 sibling, 1 reply; 29+ messages in thread
From: Alex Branham @ 2019-04-11 1:26 UTC (permalink / raw)
To: Alex; +Cc: Eli Zaretskii, monnier, emacs-devel
On Wed 10 Apr 2019 at 18:35, Alex <agrambot@gmail.com> wrote:
> Eli Zaretskii <eliz@gnu.org> writes:
>> What about others, like RH?
FWIW for questions like this in the future, repology has this
information for a lot of distros. For example, for gtk3 you can check:
https://repology.org/project/gtk3/versions
Alex
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-11 1:26 ` Alex Branham
@ 2019-04-11 14:19 ` Eli Zaretskii
2019-04-11 14:26 ` Dmitry Gutov
2019-04-11 14:29 ` Alex
0 siblings, 2 replies; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-11 14:19 UTC (permalink / raw)
To: Alex Branham; +Cc: monnier, agrambot, emacs-devel
> From: Alex Branham <branham@utexas.edu>
> Cc: Eli Zaretskii <eliz@gnu.org>, monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Wed, 10 Apr 2019 20:26:31 -0500
>
> On Wed 10 Apr 2019 at 18:35, Alex <agrambot@gmail.com> wrote:
>
> > Eli Zaretskii <eliz@gnu.org> writes:
>
> >> What about others, like RH?
>
> FWIW for questions like this in the future, repology has this
> information for a lot of distros. For example, for gtk3 you can check:
>
> https://repology.org/project/gtk3/versions
Thanks. So do we care for the few distros which are listed there with
GTK3 below 3.10? Some versions of Ubuntu and Trisquel are among them.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-11 14:19 ` Eli Zaretskii
@ 2019-04-11 14:26 ` Dmitry Gutov
2019-04-11 14:29 ` Alex
1 sibling, 0 replies; 29+ messages in thread
From: Dmitry Gutov @ 2019-04-11 14:26 UTC (permalink / raw)
To: Eli Zaretskii, Alex Branham; +Cc: monnier, agrambot, emacs-devel
On 11.04.2019 17:19, Eli Zaretskii wrote:
> So do we care for the few distros which are listed there with
> GTK3 below 3.10? Some versions of Ubuntu and Trisquel are among them.
I'm fairly sure we don't. Like mentioned, Ubuntu 14.04 (which is the
oldest still-maintained LTS release now) has GTK3 3.10.8.
Trisquel I'm less familiar with, but 8.0 is an LTS, and it was released
a year ago. And Trisquel 6.0 was based on Ubuntu 12.04, so that's a good
reason to not support it anyway.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-11 14:19 ` Eli Zaretskii
2019-04-11 14:26 ` Dmitry Gutov
@ 2019-04-11 14:29 ` Alex
1 sibling, 0 replies; 29+ messages in thread
From: Alex @ 2019-04-11 14:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Alex Branham, monnier, emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Alex Branham <branham@utexas.edu>
>> Cc: Eli Zaretskii <eliz@gnu.org>, monnier@iro.umontreal.ca, emacs-devel@gnu.org
>> Date: Wed, 10 Apr 2019 20:26:31 -0500
>>
>> On Wed 10 Apr 2019 at 18:35, Alex <agrambot@gmail.com> wrote:
>>
>> > Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> What about others, like RH?
>>
>> FWIW for questions like this in the future, repology has this
>> information for a lot of distros. For example, for gtk3 you can check:
>>
>> https://repology.org/project/gtk3/versions
>
> Thanks. So do we care for the few distros which are listed there with
> GTK3 below 3.10? Some versions of Ubuntu and Trisquel are among them.
I'd say no, since those distros are retired now. Ubuntu 14.04LTS and
Trisquel 7 are minimum supported by their developers.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-11 0:35 ` Alex
2019-04-11 1:26 ` Alex Branham
@ 2019-04-12 18:49 ` Eli Zaretskii
2019-04-12 19:05 ` Alex Gramiak
1 sibling, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-12 18:49 UTC (permalink / raw)
To: Alex; +Cc: monnier, emacs-devel
> From: Alex <agrambot@gmail.com>
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Wed, 10 Apr 2019 18:35:12 -0600
>
> >> * Old file selection dialog
> >> This is only optionally used in GTK 2, but the old dialog is long
> >> deprecated in GTK 2 (removed in GTK 3), so I figured that this is a good
> >> time to remove it and simplify the existing code.
> >
> > I think this should be left alone. It's a separate issue anyway, and
> > should be submitted separately. It would be good to try to establish
> > whether this feature is turned on by someone, but given that it's only
> > for GTK2, I tend to think we should simply let it die a natural death
> > together with GTK2.
>
> Okay, done.
Are you sure? I still see the code related to this being removed.
> I've attached an updated patch.
Fine with me, modulo the file dialog stuff.
Thanks.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-12 18:49 ` Eli Zaretskii
@ 2019-04-12 19:05 ` Alex Gramiak
2019-04-12 19:14 ` Eli Zaretskii
0 siblings, 1 reply; 29+ messages in thread
From: Alex Gramiak @ 2019-04-12 19:05 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: monnier, emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Alex <agrambot@gmail.com>
>> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
>> Date: Wed, 10 Apr 2019 18:35:12 -0600
>>
>> >> * Old file selection dialog
>> >> This is only optionally used in GTK 2, but the old dialog is long
>> >> deprecated in GTK 2 (removed in GTK 3), so I figured that this is a good
>> >> time to remove it and simplify the existing code.
>> >
>> > I think this should be left alone. It's a separate issue anyway, and
>> > should be submitted separately. It would be good to try to establish
>> > whether this feature is turned on by someone, but given that it's only
>> > for GTK2, I tend to think we should simply let it die a natural death
>> > together with GTK2.
>>
>> Okay, done.
>
> Are you sure? I still see the code related to this being removed.
That's part of the simplification of the code. Before it uses a
predicate procedure to check the value of x_gtk_use_old_file_dialog,
which I removed in favour of checking the variable directly. It also
used function pointers to wrapper procedures to get the filename, which
I removed in favour of calling the gtk procedures directly. The actual
old file dialog (xg_get_file_with_selection) is, in this patch, still
present. I tested again with GTK 2.24 and GTK 3.10 and it worked as
expected.
Are you okay with this part of the change?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-12 19:05 ` Alex Gramiak
@ 2019-04-12 19:14 ` Eli Zaretskii
2019-04-12 19:33 ` Alex Gramiak
0 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-12 19:14 UTC (permalink / raw)
To: Alex Gramiak; +Cc: monnier, emacs-devel
> From: Alex Gramiak <agrambot@gmail.com>
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Fri, 12 Apr 2019 13:05:30 -0600
>
> > Are you sure? I still see the code related to this being removed.
>
> That's part of the simplification of the code. Before it uses a
> predicate procedure to check the value of x_gtk_use_old_file_dialog,
> which I removed in favour of checking the variable directly. It also
> used function pointers to wrapper procedures to get the filename, which
> I removed in favour of calling the gtk procedures directly. The actual
> old file dialog (xg_get_file_with_selection) is, in this patch, still
> present. I tested again with GTK 2.24 and GTK 3.10 and it worked as
> expected.
Please don't simplify that part, but instead leave it alone. And why
was the configure-time test related to that removed?
Please also don't obsolete the variable, I see no reason to do that.
In general, just leave that part out of the patch.
Thanks.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-12 19:14 ` Eli Zaretskii
@ 2019-04-12 19:33 ` Alex Gramiak
2019-04-12 19:45 ` Eli Zaretskii
0 siblings, 1 reply; 29+ messages in thread
From: Alex Gramiak @ 2019-04-12 19:33 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Alex Gramiak <agrambot@gmail.com>
>> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
>> Date: Fri, 12 Apr 2019 13:05:30 -0600
>>
>> > Are you sure? I still see the code related to this being removed.
>>
>> That's part of the simplification of the code. Before it uses a
>> predicate procedure to check the value of x_gtk_use_old_file_dialog,
>> which I removed in favour of checking the variable directly. It also
>> used function pointers to wrapper procedures to get the filename, which
>> I removed in favour of calling the gtk procedures directly. The actual
>> old file dialog (xg_get_file_with_selection) is, in this patch, still
>> present. I tested again with GTK 2.24 and GTK 3.10 and it worked as
>> expected.
>
> Please don't simplify that part, but instead leave it alone.
Why, especially since the reason for the complexity was because of
supporting an older (older than the current minimum) GTK version? I
don't believe that the code is so fragile that it has to be left alone.
> Why was the configure-time test related to that removed?
That test was for versions pre-2.4 that did not support the old file
dialog; there's no use for it now. See commit
572a3cc2664adea7b5a3303b04b57fe1ba5b4641 for the introduction of the
test.
> Please also don't obsolete the variable, I see no reason to do that.
Why not, since it's part of an obsolete (in GTK 2) and removed (in GTK
3) GTK interface? This seems like the time to obsolete such a variable.
IMO it would do well to obsolete it at least for (version<= "3"
gtk-version-string) since it does nothing there.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-12 19:33 ` Alex Gramiak
@ 2019-04-12 19:45 ` Eli Zaretskii
2019-04-12 20:04 ` Alex Gramiak
0 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-12 19:45 UTC (permalink / raw)
To: Alex Gramiak; +Cc: emacs-devel
> From: Alex Gramiak <agrambot@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 12 Apr 2019 13:33:31 -0600
>
> > Please don't simplify that part, but instead leave it alone.
>
> Why
Because I asked you to.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-12 19:45 ` Eli Zaretskii
@ 2019-04-12 20:04 ` Alex Gramiak
2019-04-12 20:17 ` Eli Zaretskii
0 siblings, 1 reply; 29+ messages in thread
From: Alex Gramiak @ 2019-04-12 20:04 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Alex Gramiak <agrambot@gmail.com>
>> Cc: emacs-devel@gnu.org
>> Date: Fri, 12 Apr 2019 13:33:31 -0600
>>
>> > Please don't simplify that part, but instead leave it alone.
>>
>> Why
>
> Because I asked you to.
I was hoping for a justification. Are you unwilling to provide one? It's
not an issue if so; in that case I'll remove the file dialog part and
leave the topic open for further discussion for another couple days.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Increase minimum required GTK versions?
2019-04-12 20:04 ` Alex Gramiak
@ 2019-04-12 20:17 ` Eli Zaretskii
0 siblings, 0 replies; 29+ messages in thread
From: Eli Zaretskii @ 2019-04-12 20:17 UTC (permalink / raw)
To: Alex Gramiak; +Cc: emacs-devel
> From: Alex Gramiak <agrambot@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 12 Apr 2019 14:04:21 -0600
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: Alex Gramiak <agrambot@gmail.com>
> >> Cc: emacs-devel@gnu.org
> >> Date: Fri, 12 Apr 2019 13:33:31 -0600
> >>
> >> > Please don't simplify that part, but instead leave it alone.
> >>
> >> Why
> >
> > Because I asked you to.
>
> I was hoping for a justification. Are you unwilling to provide one?
I already provided one: this part is unrelated to the rest of the
patch, so it should be left alone. You even agreed with that, AFAIU,
at least in your response. If you want to discuss some simplification
of this code, let's please do that separately, not as part of changes
related to GTK versions we support.
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2019-04-12 20:17 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-07 19:03 Increase minimum required GTK versions? Alex
2019-04-07 19:08 ` Eli Zaretskii
2019-04-07 19:25 ` Alex
2019-04-08 4:45 ` Paul Eggert
2019-04-08 15:03 ` Alex
2019-04-08 16:03 ` Kaushal Modi
2019-04-08 16:15 ` Glenn Morris
2019-04-08 23:58 ` Paul Eggert
2019-04-09 1:55 ` Stefan Monnier
2019-04-09 4:47 ` Paul Eggert
2019-04-09 17:28 ` Alex
2019-04-09 18:21 ` Eli Zaretskii
2019-04-10 3:14 ` Alex
2019-04-10 15:57 ` Eli Zaretskii
2019-04-10 16:20 ` Stefan Monnier
2019-04-10 16:43 ` Eli Zaretskii
2019-04-11 0:35 ` Alex
2019-04-11 1:26 ` Alex Branham
2019-04-11 14:19 ` Eli Zaretskii
2019-04-11 14:26 ` Dmitry Gutov
2019-04-11 14:29 ` Alex
2019-04-12 18:49 ` Eli Zaretskii
2019-04-12 19:05 ` Alex Gramiak
2019-04-12 19:14 ` Eli Zaretskii
2019-04-12 19:33 ` Alex Gramiak
2019-04-12 19:45 ` Eli Zaretskii
2019-04-12 20:04 ` Alex Gramiak
2019-04-12 20:17 ` Eli Zaretskii
2019-04-09 5:00 ` Van L
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).