Skip to content

Commit 1b92b27

Browse files
Drew Vogelchrisbra
authored andcommitted
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]>
1 parent d32a265 commit 1b92b27

7 files changed

Lines changed: 9 additions & 94 deletions

File tree

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6831,7 +6831,7 @@ f_has(typval_T *argvars, typval_T *rettv)
68316831
{"builtin_terms", 1},
68326832
{"all_builtin_terms", 1},
68336833
{"browsefilter",
6834-
#if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \
6834+
#if defined(FEAT_BROWSE) && (defined(FEAT_GUI_GTK) \
68356835
|| defined(FEAT_GUI_MSWIN) \
68366836
|| defined(FEAT_GUI_MOTIF))
68376837
1

src/gui.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ gui_get_wide_font(void)
10811081
#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN)
10821082
/*
10831083
* Set list of ascii characters that combined can create ligature.
1084-
* Store them in char map for quick access from gui_gtk2_draw_string.
1084+
* Store them in char map for quick access from gui_gtk_draw_string.
10851085
*/
10861086
void
10871087
gui_set_ligatures(void)
@@ -2533,7 +2533,7 @@ gui_outstr_nowrap(
25332533
*/
25342534
#ifdef FEAT_GUI_GTK
25352535
// The value returned is the length in display cells
2536-
len = gui_gtk2_draw_string(gui.row, col, s, len, draw_flags);
2536+
len = gui_gtk_draw_string(gui.row, col, s, len, draw_flags);
25372537
#else
25382538
if (enc_utf8)
25392539
{

src/gui_gtk.c

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,47 +1190,6 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb)
11901190
* Implementation of the file selector related stuff
11911191
*/
11921192

1193-
#ifndef USE_FILE_CHOOSER
1194-
static void
1195-
browse_ok_cb(GtkWidget *widget UNUSED, gpointer cbdata)
1196-
{
1197-
gui_T *vw = (gui_T *)cbdata;
1198-
1199-
if (vw->browse_fname != NULL)
1200-
g_free(vw->browse_fname);
1201-
1202-
vw->browse_fname = (char_u *)g_strdup(gtk_file_selection_get_filename(
1203-
GTK_FILE_SELECTION(vw->filedlg)));
1204-
gtk_widget_hide(vw->filedlg);
1205-
}
1206-
1207-
static void
1208-
browse_cancel_cb(GtkWidget *widget UNUSED, gpointer cbdata)
1209-
{
1210-
gui_T *vw = (gui_T *)cbdata;
1211-
1212-
if (vw->browse_fname != NULL)
1213-
{
1214-
g_free(vw->browse_fname);
1215-
vw->browse_fname = NULL;
1216-
}
1217-
gtk_widget_hide(vw->filedlg);
1218-
}
1219-
1220-
static gboolean
1221-
browse_destroy_cb(GtkWidget *widget UNUSED)
1222-
{
1223-
if (gui.browse_fname != NULL)
1224-
{
1225-
g_free(gui.browse_fname);
1226-
gui.browse_fname = NULL;
1227-
}
1228-
gui.filedlg = NULL;
1229-
gtk_main_quit();
1230-
return FALSE;
1231-
}
1232-
#endif
1233-
12341193
/*
12351194
* Put up a file requester.
12361195
* Returns the selected name in allocated memory, or NULL for Cancel.
@@ -1249,13 +1208,11 @@ gui_mch_browse(int saving,
12491208
char_u *initdir,
12501209
char_u *filter)
12511210
{
1252-
#ifdef USE_FILE_CHOOSER
12531211
# if GTK_CHECK_VERSION(3,20,0)
12541212
GtkFileChooserNative *fc;
12551213
# else
12561214
GtkWidget *fc;
12571215
# endif
1258-
#endif
12591216
char_u dirbuf[MAXPATHL];
12601217
guint log_handler;
12611218
const gchar *domain = "Gtk";
@@ -1278,7 +1235,6 @@ gui_mch_browse(int saving,
12781235
log_handler = g_log_set_handler(domain, G_LOG_LEVEL_WARNING,
12791236
recent_func_log_func, NULL);
12801237

1281-
#ifdef USE_FILE_CHOOSER
12821238
// We create the dialog each time, so that the button text can be "Open"
12831239
// or "Save" according to the action.
12841240
# if GTK_CHECK_VERSION(3,20,0)
@@ -1352,7 +1308,7 @@ gui_mch_browse(int saving,
13521308
if (gtk_native_dialog_run(GTK_NATIVE_DIALOG(fc)) == GTK_RESPONSE_ACCEPT)
13531309
# else
13541310
if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT)
1355-
#endif
1311+
# endif
13561312
{
13571313
char *filename;
13581314

@@ -1366,43 +1322,6 @@ gui_mch_browse(int saving,
13661322
gtk_widget_destroy(GTK_WIDGET(fc));
13671323
# endif
13681324

1369-
#else // !USE_FILE_CHOOSER
1370-
1371-
if (gui.filedlg == NULL)
1372-
{
1373-
GtkFileSelection *fs; // shortcut
1374-
1375-
gui.filedlg = gtk_file_selection_new((const gchar *)title);
1376-
gtk_window_set_modal(GTK_WINDOW(gui.filedlg), TRUE);
1377-
gtk_window_set_transient_for(GTK_WINDOW(gui.filedlg),
1378-
GTK_WINDOW(gui.mainwin));
1379-
fs = GTK_FILE_SELECTION(gui.filedlg);
1380-
1381-
gtk_container_border_width(GTK_CONTAINER(fs), 4);
1382-
1383-
gtk_signal_connect(GTK_OBJECT(fs->ok_button),
1384-
"clicked", GTK_SIGNAL_FUNC(browse_ok_cb), &gui);
1385-
gtk_signal_connect(GTK_OBJECT(fs->cancel_button),
1386-
"clicked", GTK_SIGNAL_FUNC(browse_cancel_cb), &gui);
1387-
// gtk_signal_connect() doesn't work for destroy, it causes a hang
1388-
gtk_signal_connect_object(GTK_OBJECT(gui.filedlg),
1389-
"destroy", GTK_SIGNAL_FUNC(browse_destroy_cb),
1390-
GTK_OBJECT(gui.filedlg));
1391-
}
1392-
else
1393-
gtk_window_set_title(GTK_WINDOW(gui.filedlg), (const gchar *)title);
1394-
1395-
// Concatenate "initdir" and "dflt".
1396-
if (dflt != NULL && *dflt != NUL
1397-
&& STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL)
1398-
STRCAT(dirbuf, dflt);
1399-
1400-
gtk_file_selection_set_filename(GTK_FILE_SELECTION(gui.filedlg),
1401-
(const gchar *)dirbuf);
1402-
1403-
gtk_widget_show(gui.filedlg);
1404-
gtk_main();
1405-
#endif // !USE_FILE_CHOOSER
14061325
g_log_remove_handler(domain, log_handler);
14071326

14081327
CONVERT_TO_UTF8_FREE(title);

src/gui_gtk_x11.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6063,7 +6063,7 @@ gui_gtk_draw_string(int row, int col, char_u *s, int len, int flags)
60636063
*(cs + slen) = NUL;
60646064
}
60656065
len_sum += gui_gtk_draw_string_ext(row, col + len_sum, cs, slen, flags,
6066-
needs_pango);
6066+
needs_pango);
60676067
if (slen < len)
60686068
*(cs + slen) = backup_ch;
60696069
cs += slen;

src/proto/gui_gtk_x11.pro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ guicolor_T gui_mch_get_rgb_color(int r, int g, int b);
4545
void gui_mch_set_fg_color(guicolor_T color);
4646
void gui_mch_set_bg_color(guicolor_T color);
4747
void gui_mch_set_sp_color(guicolor_T color);
48-
int gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags);
49-
int gui_gtk2_draw_string_ext(int row, int col, char_u *s, int len, int flags, int force_pango);
48+
int gui_gtk_draw_string(int row, int col, char_u *s, int len, int flags);
49+
int gui_gtk_draw_string_ext(int row, int col, char_u *s, int len, int flags, int force_pango);
5050
int gui_mch_haskey(char_u *name);
5151
int gui_get_x11_windis(Window *win, Display **dis);
5252
Display *gui_mch_get_display(void);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ static char *(features[]) =
729729

730730
static int included_patches[] =
731731
{ /* Add new patch number below this line */
732+
/**/
733+
1904,
732734
/**/
733735
1903,
734736
/**/

src/vim.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,12 +2678,6 @@ typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char_u ***mat
26782678
# endif
26792679
#endif
26802680

2681-
#if defined(FEAT_BROWSE) && defined(GTK_CHECK_VERSION)
2682-
# if GTK_CHECK_VERSION(2,4,0)
2683-
# define USE_FILE_CHOOSER
2684-
# endif
2685-
#endif
2686-
26872681
#ifdef FEAT_GUI_GTK
26882682
# if !GTK_CHECK_VERSION(2,14,0)
26892683
# define gtk_widget_get_window(wid) ((wid)->window)

0 commit comments

Comments
 (0)