patch 9.1.1904: Code still supports GTK2 versions older than 2.4
Commit:
https://github.com/vim/vim/commit/1b92b278ba10816e625ac02e2c470157de365f21
Author: Drew Vogel <dvogel@github>
Date: Mon Nov 10 20:04:37 2025 +0000
patch 9.1.1904: Code still supports GTK2 versions older than 2.4
Problem: Code still supports GTK2 versions older than 2.4.
Solution: Drop support for GTK2 < 2.4 (Drew Vogel)
closes: #18708
Signed-off-by: Drew Vogel <dvogel@github>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 7c3139edc..e770321ea 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -6831,7 +6831,7 @@ f_has(typval_T *argvars, typval_T *rettv)
{"builtin_terms", 1},
{"all_builtin_terms", 1},
{"browsefilter",
-#if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \
+#if defined(FEAT_BROWSE) && (defined(FEAT_GUI_GTK) \
|| defined(FEAT_GUI_MSWIN) \
|| defined(FEAT_GUI_MOTIF))
1
diff --git a/src/gui.c b/src/gui.c
index 8c37d8740..401f8ef83 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1081,7 +1081,7 @@ gui_get_wide_font(void)
#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN)
/*
* Set list of ascii characters that combined can create ligature.
- * Store them in char map for quick access from gui_gtk2_draw_string.
+ * Store them in char map for quick access from gui_gtk_draw_string.
*/
void
gui_set_ligatures(void)
@@ -2533,7 +2533,7 @@ gui_outstr_nowrap(
*/
#ifdef FEAT_GUI_GTK
// The value returned is the length in display cells
- len = gui_gtk2_draw_string(gui.row, col, s, len, draw_flags);
+ len = gui_gtk_draw_string(gui.row, col, s, len, draw_flags);
#else
if (enc_utf8)
{
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index 593215306..305e761a5 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -1190,47 +1190,6 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb)
* Implementation of the file selector related stuff
*/
-#ifndef USE_FILE_CHOOSER
- static void
-browse_ok_cb(GtkWidget *widget UNUSED, gpointer cbdata)
-{
- gui_T *vw = (gui_T *)cbdata;
-
- if (vw->browse_fname != NULL)
- g_free(vw->browse_fname);
-
- vw->browse_fname = (char_u *)g_strdup(gtk_file_selection_get_filename(
- GTK_FILE_SELECTION(vw->filedlg)));
- gtk_widget_hide(vw->filedlg);
-}
-
- static void
-browse_cancel_cb(GtkWidget *widget UNUSED, gpointer cbdata)
-{
- gui_T *vw = (gui_T *)cbdata;
-
- if (vw->browse_fname != NULL)
- {
- g_free(vw->browse_fname);
- vw->browse_fname = NULL;
- }
- gtk_widget_hide(vw->filedlg);
-}
-
- static gboolean
-browse_destroy_cb(GtkWidget *widget UNUSED)
-{
- if (gui.browse_fname != NULL)
- {
- g_free(gui.browse_fname);
- gui.browse_fname = NULL;
- }
- gui.filedlg = NULL;
- gtk_main_quit();
- return FALSE;
-}
-#endif
-
/*
* Put up a file requester.
* Returns the selected name in allocated memory, or NULL for Cancel.
@@ -1249,13 +1208,11 @@ gui_mch_browse(int saving,
char_u *initdir,
char_u *filter)
{
-#ifdef USE_FILE_CHOOSER
# if GTK_CHECK_VERSION(3,20,0)
GtkFileChooserNative *fc;
# else
GtkWidget *fc;
# endif
-#endif
char_u dirbuf[MAXPATHL];
guint log_handler;
const gchar *domain = "Gtk";
@@ -1278,7 +1235,6 @@ gui_mch_browse(int saving,
log_handler = g_log_set_handler(domain, G_LOG_LEVEL_WARNING,
recent_func_log_func, NULL);
-#ifdef USE_FILE_CHOOSER
// We create the dialog each time, so that the button text can be "Open"
// or "Save" according to the action.
# if GTK_CHECK_VERSION(3,20,0)
@@ -1352,7 +1308,7 @@ gui_mch_browse(int saving,
if (gtk_native_dialog_run(GTK_NATIVE_DIALOG(fc)) == GTK_RESPONSE_ACCEPT)
# else
if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT)
-#endif
+# endif
{
char *filename;
@@ -1366,43 +1322,6 @@ gui_mch_browse(int saving,
gtk_widget_destroy(GTK_WIDGET(fc));
# endif
-#else // !USE_FILE_CHOOSER
-
- if (gui.filedlg == NULL)
- {
- GtkFileSelection *fs; // shortcut
-
- gui.filedlg = gtk_file_selection_new((const gchar *)title);
- gtk_window_set_modal(GTK_WINDOW(gui.filedlg), TRUE);
- gtk_window_set_transient_for(GTK_WINDOW(gui.filedlg),
- GTK_WINDOW(gui.mainwin));
- fs = GTK_FILE_SELECTION(gui.filedlg);
-
- gtk_container_border_width(GTK_CONTAINER(fs), 4);
-
- gtk_signal_connect(GTK_OBJECT(fs->ok_button),
- "clicked", GTK_SIGNAL_FUNC(browse_ok_cb), &gui);
- gtk_signal_connect(GTK_OBJECT(fs->cancel_button),
- "clicked", GTK_SIGNAL_FUNC(browse_cancel_cb), &gui);
- // gtk_signal_connect() doesn't work for destroy, it causes a hang
- gtk_signal_connect_object(GTK_OBJECT(gui.filedlg),
- "destroy", GTK_SIGNAL_FUNC(browse_destroy_cb),
- GTK_OBJECT(gui.filedlg));
- }
- else
- gtk_window_set_title(GTK_WINDOW(gui.filedlg), (const gchar *)title);
-
- // Concatenate "initdir" and "dflt".
- if (dflt != NULL && *dflt != NUL
- && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL)
- STRCAT(dirbuf, dflt);
-
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(gui.filedlg),
- (const gchar *)dirbuf);
-
- gtk_widget_show(gui.filedlg);
- gtk_main();
-#endif // !USE_FILE_CHOOSER
g_log_remove_handler(domain, log_handler);
CONVERT_TO_UTF8_FREE(title);
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 4b586c947..e588c935d 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -6063,7 +6063,7 @@ gui_gtk_draw_string(int row, int col, char_u *s, int len,
int flags)
*(cs + slen) = NUL;
}
len_sum += gui_gtk_draw_string_ext(row, col + len_sum, cs, slen, flags,
- needs_pango);
+ needs_pango);
if (slen < len)
*(cs + slen) = backup_ch;
cs += slen;
diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro
index 37ae5ec5a..5a5724013 100644
--- a/src/proto/gui_gtk_x11.pro
+++ b/src/proto/gui_gtk_x11.pro
@@ -45,8 +45,8 @@ guicolor_T gui_mch_get_rgb_color(int r, int g, int b);
void gui_mch_set_fg_color(guicolor_T color);
void gui_mch_set_bg_color(guicolor_T color);
void gui_mch_set_sp_color(guicolor_T color);
-int gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags);
-int gui_gtk2_draw_string_ext(int row, int col, char_u *s, int len, int flags,
int force_pango);
+int gui_gtk_draw_string(int row, int col, char_u *s, int len, int flags);
+int gui_gtk_draw_string_ext(int row, int col, char_u *s, int len, int flags,
int force_pango);
int gui_mch_haskey(char_u *name);
int gui_get_x11_windis(Window *win, Display **dis);
Display *gui_mch_get_display(void);
diff --git a/src/version.c b/src/version.c
index ec5a646aa..2acdf2a23 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1904,
/**/
1903,
/**/
diff --git a/src/vim.h b/src/vim.h
index 1ca6112e6..58823ec78 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2678,12 +2678,6 @@ typedef int (*opt_expand_cb_T)(optexpand_T *args, int
*numMatches, char_u ***mat
# endif
#endif
-#if defined(FEAT_BROWSE) && defined(GTK_CHECK_VERSION)
-# if GTK_CHECK_VERSION(2,4,0)
-# define USE_FILE_CHOOSER
-# endif
-#endif
-
#ifdef FEAT_GUI_GTK
# if !GTK_CHECK_VERSION(2,14,0)
# define gtk_widget_get_window(wid) ((wid)->window)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vJWPC-001DGc-Qt%40256bit.org.