mirror of
https://github.com/vim/vim.git
synced 2025-11-13 22:54:27 -05:00
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 <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
d32a26550b
commit
1b92b278ba
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1904,
|
||||
/**/
|
||||
1903,
|
||||
/**/
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user