Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2018-09-18 19:45:10 -07:00
13 changed files with 339 additions and 865 deletions
+1
View File
@@ -141,6 +141,7 @@ SRC_ALL = \
src/testdir/if_ver*.vim \
src/testdir/color_ramp.vim \
src/proto.h \
src/protodef.h \
src/proto/arabic.pro \
src/proto/beval.pro \
src/proto/blowfish.pro \
+24 -8
View File
@@ -3,7 +3,7 @@ INSTALLpc.txt - Installation of Vim on PC
This file contains instructions for compiling Vim. If you already have an
executable version of Vim, you don't need this.
You can find the lastest here: https://github.com/vim/vim-win32-installer
You can find the latest here: https://github.com/vim/vim-win32-installer
This page also has links to install support for interfaces such as Perl,
Python, Lua, etc.
@@ -164,6 +164,11 @@ options:
msvc2015
For x64 builds run this with the "x86_amd64" option:
msvc2015 x86_amd64
This enables x86_x64 cross compiler. This works on any editions including
Express edition.
If you use Community (or Professional) edition, you can enable the x64 native
compiler by using the "x64" option:
msvc2015 x64
The following Visual C++ team blog can serve as a reference page:
http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx
@@ -182,7 +187,7 @@ Visual C++ Toolkit 2003 *msvc-2003-toolkit*
You could download the Microsoft Visual C++ Toolkit 2003 from
http://msdn.microsoft.com/visualc/vctoolkit2003/
Unfortunately this URL is no longer valid. Inofficial downloads appear to be
Unfortunately this URL is no longer valid. Unofficial downloads appear to be
available from links mentioned on these pages (use at your own risk):
http://www.filewatcher.com/m/VCToolkitSetup.exe.32952488.0.0.html
http://feargame.net/wiki/index.php?title=Building_Source_with_the_VC2003_Toolkit
@@ -276,12 +281,12 @@ Download an installer:
Execute the installer and follow the instructions to update basic packages.
At the end keep the checkbox checked to run msys2 now. If needed, you can
open the window from the start menu, MSYS2 64 bit / MSYS2 MSYS
open the window from the start menu, MSYS2 64 bit / MSYS2 MSYS.
Execute:
$ pacman -Syu
And restart MSYS2 window (select "MSYS2 MSYS" icon from the Start Menu).
And restart MSYS2 console (select "MSYS2 MSYS" icon from the Start Menu).
Then execute:
$ pacman -Su
@@ -297,6 +302,7 @@ The following package groups are required for building Vim:
* mingw-w64-i686-toolchain (for building 32-bit Vim)
* mingw-w64-x86_64-toolchain (for building 64-bit Vim)
(These groups also include some useful packages which are not used by Vim.)
Use the following command to install them:
$ pacman -S base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
@@ -305,8 +311,18 @@ Or you can use the `pacboy` command to avoid long package names:
$ pacboy -S base-devel: toolchain:m
The suffix ":" means that it disables the package name translation.
The suffix ":m" means both i686 and x86_64. You can also use the ":i" suffix
to install only i686, and the ":x" suffix to install only x86_64.
(See `pacboy help` for the help.)
See also the pacman page in ArchWiki for the general usage of pacman:
https://wiki.archlinux.org/index.php/pacman
MSYS2 has its own git package, and you can also install it via pacman:
$ pacman -S git
2.3. Keep the build environment up-to-date
@@ -316,7 +332,7 @@ In that case, you just need to execute the command:
$ pacman -Syu
# Build Vim
2.4. Build Vim
Select one of the following icon from the Start Menu:
@@ -329,12 +345,12 @@ Go to the source directory of Vim, then execute the make command. E.g.:
make -f Make_ming.mak GUI=no
make -f Make_ming.mak GUI=no DEBUG=yes
NOTE: you can't execute the vim.exe in the MSYS console, open a normal Windows
NOTE: you can't execute vim.exe in the MSYS2 console, open a normal Windows
console for that. You need to set $PATH to be able to build there, e.g.:
set PATH=c:\msys64\mingw32\bin;c:\msys64\usr\bin;%PATH%
This command is in msys32.bat. Or or the 64 bit compiler use msys64.bat:
This command is in msys32.bat. Or for the 64 bit compiler use msys64.bat:
set PATH=c:\msys64\mingw64\bin;c:\msys64\usr\bin;%PATH%
+25 -14
View File
@@ -295,7 +295,7 @@ diff_mark_adjust_tp(
if (diff_internal())
{
// Will udpate diffs before redrawing. Set _invalid to update the
// Will update diffs before redrawing. Set _invalid to update the
// diffs themselves, set _update to also update folds properly just
// before redrawing.
tp->tp_diff_invalid = TRUE;
@@ -908,6 +908,7 @@ ex_diffupdate(exarg_T *eap) // "eap" can be NULL
int idx_orig;
int idx_new;
diffio_T diffio;
int had_diffs = curtab->tp_first_diff != NULL;
if (diff_busy)
{
@@ -924,14 +925,14 @@ ex_diffupdate(exarg_T *eap) // "eap" can be NULL
if (curtab->tp_diffbuf[idx_orig] != NULL)
break;
if (idx_orig == DB_COUNT)
return;
goto theend;
// Only need to do something when there is another buffer.
for (idx_new = idx_orig + 1; idx_new < DB_COUNT; ++idx_new)
if (curtab->tp_diffbuf[idx_new] != NULL)
break;
if (idx_new == DB_COUNT)
return;
goto theend;
// Only use the internal method if it did not fail for one of the buffers.
vim_memset(&diffio, 0, sizeof(diffio));
@@ -948,9 +949,14 @@ ex_diffupdate(exarg_T *eap) // "eap" can be NULL
// force updating cursor position on screen
curwin->w_valid_cursor.lnum = 0;
diff_redraw(TRUE);
apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
theend:
// A redraw is needed if there were diffs and they were cleared, or there
// are diffs now, which means they got updated.
if (had_diffs || curtab->tp_first_diff != NULL)
{
diff_redraw(TRUE);
apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
}
}
/*
@@ -2272,7 +2278,8 @@ diffopt_changed(void)
if ((diff_flags_new & DIFF_HORIZONTAL) && (diff_flags_new & DIFF_VERTICAL))
return FAIL;
/* If "icase" or "iwhite" was added or removed, need to update the diff. */
// If flags were added or removed, or the algorithm was changed, need to
// update the diff.
if (diff_flags != diff_flags_new || diff_algorithm != diff_algorithm_new)
FOR_ALL_TABPAGES(tp)
tp->tp_diff_invalid = TRUE;
@@ -2845,14 +2852,18 @@ theend:
diff_need_update = FALSE;
ex_diffupdate(NULL);
}
else
{
// Check that the cursor is on a valid character and update it's
// position. When there were filler lines the topline has become
// invalid.
check_cursor();
changed_line_abv_curs();
/* Check that the cursor is on a valid character and update it's position.
* When there were filler lines the topline has become invalid. */
check_cursor();
changed_line_abv_curs();
/* Also need to redraw the other buffers. */
diff_redraw(FALSE);
// Also need to redraw the other buffers.
diff_redraw(FALSE);
apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
}
}
#ifdef FEAT_FOLDING
-44
View File
@@ -244,16 +244,9 @@ addEventHandler(GtkWidget *target, BalloonEval *beval)
* This allows us to catch events independently of the signal handlers
* in gui_gtk_x11.c.
*/
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(target), "event",
G_CALLBACK(target_event_cb),
beval);
# else
/* Should use GTK_OBJECT() here, but that causes a lint warning... */
gtk_signal_connect((GtkObject*)(target), "event",
GTK_SIGNAL_FUNC(target_event_cb),
beval);
# endif
/*
* Nasty: Key press events go to the main window thus the drawing area
* will never see them. This means we have to connect to the main window
@@ -262,45 +255,25 @@ addEventHandler(GtkWidget *target, BalloonEval *beval)
if (gtk_socket_id == 0 && gui.mainwin != NULL
&& gtk_widget_is_ancestor(target, gui.mainwin))
{
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.mainwin), "event",
G_CALLBACK(mainwin_event_cb),
beval);
# else
gtk_signal_connect((GtkObject*)(gui.mainwin), "event",
GTK_SIGNAL_FUNC(mainwin_event_cb),
beval);
# endif
}
}
static void
removeEventHandler(BalloonEval *beval)
{
/* LINTED: avoid warning: dubious operation on enum */
# if GTK_CHECK_VERSION(3,0,0)
g_signal_handlers_disconnect_by_func(G_OBJECT(beval->target),
FUNC2GENERIC(target_event_cb),
beval);
# else
gtk_signal_disconnect_by_func((GtkObject*)(beval->target),
GTK_SIGNAL_FUNC(target_event_cb),
beval);
# endif
if (gtk_socket_id == 0 && gui.mainwin != NULL
&& gtk_widget_is_ancestor(beval->target, gui.mainwin))
{
/* LINTED: avoid warning: dubious operation on enum */
# if GTK_CHECK_VERSION(3,0,0)
g_signal_handlers_disconnect_by_func(G_OBJECT(gui.mainwin),
FUNC2GENERIC(mainwin_event_cb),
beval);
# else
gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin),
GTK_SIGNAL_FUNC(mainwin_event_cb),
beval);
# endif
}
}
@@ -433,13 +406,8 @@ pointer_event(BalloonEval *beval, int x, int y, unsigned state)
}
else
{
# if GTK_CHECK_VERSION(3,0,0)
beval->timerID = g_timeout_add((guint)p_bdlay,
&timeout_cb, beval);
# else
beval->timerID = gtk_timeout_add((guint32)p_bdlay,
&timeout_cb, beval);
# endif
}
}
}
@@ -1039,11 +1007,7 @@ cancelBalloon(BalloonEval *beval)
if (beval->timerID != 0)
{
# if GTK_CHECK_VERSION(3,0,0)
g_source_remove(beval->timerID);
# else
gtk_timeout_remove(beval->timerID);
# endif
beval->timerID = 0;
}
beval->showState = ShS_NEUTRAL;
@@ -1055,17 +1019,9 @@ createBalloonEvalWindow(BalloonEval *beval)
beval->balloonShell = gtk_window_new(GTK_WINDOW_POPUP);
gtk_widget_set_app_paintable(beval->balloonShell, TRUE);
# if GTK_CHECK_VERSION(3,0,0)
gtk_window_set_resizable(GTK_WINDOW(beval->balloonShell), FALSE);
# else
gtk_window_set_policy(GTK_WINDOW(beval->balloonShell), FALSE, FALSE, TRUE);
# endif
gtk_widget_set_name(beval->balloonShell, "gtk-tooltips");
# if GTK_CHECK_VERSION(3,0,0)
gtk_container_set_border_width(GTK_CONTAINER(beval->balloonShell), 4);
# else
gtk_container_border_width(GTK_CONTAINER(beval->balloonShell), 4);
# endif
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(beval->balloonShell), "draw",
+2 -178
View File
@@ -756,13 +756,8 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
# endif
if (gtk_socket_id != 0)
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(menu->id), "focus-in-event",
G_CALLBACK(toolbar_button_focus_in_event), NULL);
# else
gtk_signal_connect(GTK_OBJECT(menu->id), "focus_in_event",
GTK_SIGNAL_FUNC(toolbar_button_focus_in_event), NULL);
# endif
CONVERT_TO_UTF8_FREE(text);
CONVERT_TO_UTF8_FREE(tooltip);
@@ -792,12 +787,8 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
gtk_widget_set_sensitive(menu->id, FALSE);
# endif
gtk_widget_show(menu->id);
# if GTK_CHECK_VERSION(3,0,0)
gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id),
menu->id, idx);
# else
gtk_menu_insert(GTK_MENU(parent->submenu_id), menu->id, idx);
# endif
return;
}
@@ -805,21 +796,12 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
/* Add textual menu item. */
menu_item_new(menu, parent->submenu_id);
gtk_widget_show(menu->id);
# if GTK_CHECK_VERSION(3,0,0)
gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id),
menu->id, idx);
# else
gtk_menu_insert(GTK_MENU(parent->submenu_id), menu->id, idx);
# endif
if (menu->id != NULL)
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(menu->id), "activate",
G_CALLBACK(menu_item_activate), menu);
# else
gtk_signal_connect(GTK_OBJECT(menu->id), "activate",
GTK_SIGNAL_FUNC(menu_item_activate), menu);
# endif
}
}
#endif /* FEAT_MENU */
@@ -1000,7 +982,6 @@ gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)
adjustment = gtk_range_get_adjustment(GTK_RANGE(sb->id));
#if GTK_CHECK_VERSION(3,0,0)
gtk_adjustment_set_lower(adjustment, 0.0);
gtk_adjustment_set_value(adjustment, val);
gtk_adjustment_set_upper(adjustment, max + 1);
@@ -1008,34 +989,15 @@ gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)
gtk_adjustment_set_page_increment(adjustment,
size < 3L ? 1L : size - 2L);
gtk_adjustment_set_step_increment(adjustment, 1.0);
#else
adjustment->lower = 0.0;
adjustment->value = val;
adjustment->upper = max + 1;
adjustment->page_size = size;
adjustment->page_increment = size < 3L ? 1L : size - 2L;
adjustment->step_increment = 1.0;
#endif
#if GTK_CHECK_VERSION(3,0,0)
g_signal_handler_block(G_OBJECT(adjustment),
(gulong)sb->handler_id);
#else
g_signal_handler_block(GTK_OBJECT(adjustment),
(gulong)sb->handler_id);
#endif
g_signal_handler_block(G_OBJECT(adjustment), (gulong)sb->handler_id);
#if !GTK_CHECK_VERSION(3,18,0)
gtk_adjustment_changed(adjustment);
#endif
#if GTK_CHECK_VERSION(3,0,0)
g_signal_handler_unblock(G_OBJECT(adjustment),
(gulong)sb->handler_id);
#else
g_signal_handler_unblock(GTK_OBJECT(adjustment),
(gulong)sb->handler_id);
#endif
}
}
@@ -1063,11 +1025,7 @@ adjustment_value_changed(GtkAdjustment *adjustment, gpointer data)
#endif
sb = gui_find_scrollbar((long)data);
#if GTK_CHECK_VERSION(3,0,0)
value = gtk_adjustment_get_value(adjustment);
#else
value = (long)adjustment->value;
#endif
#if !GTK_CHECK_VERSION(3,0,0)
/*
* The dragging argument must be right for the scrollbar to work with
@@ -1136,26 +1094,15 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
{
GtkAdjustment *adjustment;
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_can_focus(sb->id, FALSE);
#else
GTK_WIDGET_UNSET_FLAGS(sb->id, GTK_CAN_FOCUS);
#endif
gtk_form_put(GTK_FORM(gui.formwin), sb->id, 0, 0);
adjustment = gtk_range_get_adjustment(GTK_RANGE(sb->id));
#if GTK_CHECK_VERSION(3,0,0)
sb->handler_id = g_signal_connect(
G_OBJECT(adjustment), "value-changed",
G_CALLBACK(adjustment_value_changed),
GINT_TO_POINTER(sb->ident));
#else
sb->handler_id = gtk_signal_connect(
GTK_OBJECT(adjustment), "value_changed",
GTK_SIGNAL_FUNC(adjustment_value_changed),
GINT_TO_POINTER(sb->ident));
#endif
gui_mch_update();
}
}
@@ -1803,7 +1750,7 @@ gui_mch_dialog(int type, /* type of dialog */
/* Allow activation of mnemonic accelerators without pressing <Alt> when
* there is no textfield. Handle pressing Esc. */
g_signal_connect(G_OBJECT(dialog), "key_press_event",
g_signal_connect(G_OBJECT(dialog), "key-press-event",
G_CALLBACK(&dialog_key_press_event_cb), &dialoginfo);
if (def_but > 0)
@@ -2203,17 +2150,10 @@ find_replace_dialog_create(char_u *arg, int do_replace)
if (entry_text != NULL)
{
gtk_entry_set_text(GTK_ENTRY(frdp->what), (char *)entry_text);
#if GTK_CHECK_VERSION(3,0,0)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->wword),
(gboolean)wword);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase),
(gboolean)mcase);
#else
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->wword),
(gboolean)wword);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->mcase),
(gboolean)mcase);
#endif
}
gtk_window_present(GTK_WINDOW(frdp->dialog));
@@ -2278,11 +2218,7 @@ find_replace_dialog_create(char_u *arg, int do_replace)
table = gtk_table_new(1024, 3, FALSE);
#endif
gtk_box_pack_start(GTK_BOX(hbox), table, TRUE, TRUE, 0);
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_set_border_width(GTK_CONTAINER(table), 4);
#else
gtk_container_border_width(GTK_CONTAINER(table), 4);
#endif
tmp = gtk_label_new(CONV(_("Find what:")));
#if GTK_CHECK_VERSION(3,16,0)
@@ -2315,19 +2251,11 @@ find_replace_dialog_create(char_u *arg, int do_replace)
sensitive = (entry_text != NULL && entry_text[0] != NUL);
if (entry_text != NULL)
gtk_entry_set_text(GTK_ENTRY(frdp->what), (char *)entry_text);
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(frdp->what), "changed",
G_CALLBACK(entry_changed_cb), frdp->dialog);
g_signal_connect_after(G_OBJECT(frdp->what), "key-press-event",
G_CALLBACK(find_key_press_event),
(gpointer) frdp);
#else
gtk_signal_connect(GTK_OBJECT(frdp->what), "changed",
GTK_SIGNAL_FUNC(entry_changed_cb), frdp->dialog);
gtk_signal_connect_after(GTK_OBJECT(frdp->what), "key_press_event",
GTK_SIGNAL_FUNC(find_key_press_event),
(gpointer) frdp);
#endif
#if GTK_CHECK_VERSION(3,4,0)
gtk_grid_attach(GTK_GRID(table), frdp->what, 2, 0, 5, 1);
#else
@@ -2365,21 +2293,12 @@ find_replace_dialog_create(char_u *arg, int do_replace)
GTK_FILL, GTK_EXPAND, 2, 2);
#endif
frdp->with = gtk_entry_new();
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(frdp->with), "activate",
G_CALLBACK(find_replace_cb),
GINT_TO_POINTER(FRD_R_FINDNEXT));
g_signal_connect_after(G_OBJECT(frdp->with), "key-press-event",
G_CALLBACK(find_key_press_event),
(gpointer) frdp);
#else
gtk_signal_connect(GTK_OBJECT(frdp->with), "activate",
GTK_SIGNAL_FUNC(find_replace_cb),
GINT_TO_POINTER(FRD_R_FINDNEXT));
gtk_signal_connect_after(GTK_OBJECT(frdp->with), "key_press_event",
GTK_SIGNAL_FUNC(find_key_press_event),
(gpointer) frdp);
#endif
#if GTK_CHECK_VERSION(3,4,0)
gtk_grid_attach(GTK_GRID(table), frdp->with, 2, 1, 5, 1);
#else
@@ -2391,39 +2310,23 @@ find_replace_dialog_create(char_u *arg, int do_replace)
* Make the entry activation only change the input focus onto the
* with item.
*/
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(frdp->what), "activate",
G_CALLBACK(entry_activate_cb), frdp->with);
#else
gtk_signal_connect(GTK_OBJECT(frdp->what), "activate",
GTK_SIGNAL_FUNC(entry_activate_cb), frdp->with);
#endif
}
else
{
/*
* Make the entry activation do the search.
*/
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(frdp->what), "activate",
G_CALLBACK(find_replace_cb),
GINT_TO_POINTER(FRD_FINDNEXT));
#else
gtk_signal_connect(GTK_OBJECT(frdp->what), "activate",
GTK_SIGNAL_FUNC(find_replace_cb),
GINT_TO_POINTER(FRD_FINDNEXT));
#endif
}
/* whole word only button */
frdp->wword = gtk_check_button_new_with_label(CONV(_("Match whole word only")));
#if GTK_CHECK_VERSION(3,0,0)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->wword),
(gboolean)wword);
#else
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->wword),
(gboolean)wword);
#endif
if (do_replace)
#if GTK_CHECK_VERSION(3,4,0)
gtk_grid_attach(GTK_GRID(table), frdp->wword, 0, 2, 5, 1);
@@ -2441,13 +2344,8 @@ find_replace_dialog_create(char_u *arg, int do_replace)
/* match case button */
frdp->mcase = gtk_check_button_new_with_label(CONV(_("Match case")));
#if GTK_CHECK_VERSION(3,0,0)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase),
(gboolean)mcase);
#else
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->mcase),
(gboolean)mcase);
#endif
if (do_replace)
#if GTK_CHECK_VERSION(3,4,0)
gtk_grid_attach(GTK_GRID(table), frdp->mcase, 0, 3, 5, 1);
@@ -2484,30 +2382,16 @@ find_replace_dialog_create(char_u *arg, int do_replace)
#else
vbox = gtk_vbox_new(FALSE, 0);
#endif
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
#else
gtk_container_border_width(GTK_CONTAINER(vbox), 0);
#endif
gtk_container_add(GTK_CONTAINER(tmp), vbox);
/* 'Up' and 'Down' buttons */
frdp->up = gtk_radio_button_new_with_label(NULL, CONV(_("Up")));
gtk_box_pack_start(GTK_BOX(vbox), frdp->up, TRUE, TRUE, 0);
#if GTK_CHECK_VERSION(3,0,0)
frdp->down = gtk_radio_button_new_with_label(
gtk_radio_button_get_group(GTK_RADIO_BUTTON(frdp->up)),
CONV(_("Down")));
#else
frdp->down = gtk_radio_button_new_with_label(
gtk_radio_button_group(GTK_RADIO_BUTTON(frdp->up)),
CONV(_("Down")));
#endif
#if GTK_CHECK_VERSION(3,0,0)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->down), TRUE);
#else
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->down), TRUE);
#endif
gtk_container_set_border_width(GTK_CONTAINER(vbox), 2);
gtk_box_pack_start(GTK_BOX(vbox), frdp->down, TRUE, TRUE, 0);
@@ -2517,11 +2401,7 @@ find_replace_dialog_create(char_u *arg, int do_replace)
#else
actionarea = gtk_vbutton_box_new();
#endif
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_set_border_width(GTK_CONTAINER(actionarea), 2);
#else
gtk_container_border_width(GTK_CONTAINER(actionarea), 2);
#endif
gtk_box_pack_end(GTK_BOX(hbox), actionarea, FALSE, FALSE, 0);
/* 'Find Next' button */
@@ -2532,23 +2412,12 @@ find_replace_dialog_create(char_u *arg, int do_replace)
#endif
gtk_widget_set_sensitive(frdp->find, sensitive);
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(frdp->find), "clicked",
G_CALLBACK(find_replace_cb),
(do_replace) ? GINT_TO_POINTER(FRD_R_FINDNEXT)
: GINT_TO_POINTER(FRD_FINDNEXT));
#else
gtk_signal_connect(GTK_OBJECT(frdp->find), "clicked",
GTK_SIGNAL_FUNC(find_replace_cb),
(do_replace) ? GINT_TO_POINTER(FRD_R_FINDNEXT)
: GINT_TO_POINTER(FRD_FINDNEXT));
#endif
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_can_default(frdp->find, TRUE);
#else
GTK_WIDGET_SET_FLAGS(frdp->find, GTK_CAN_DEFAULT);
#endif
gtk_box_pack_start(GTK_BOX(actionarea), frdp->find, FALSE, FALSE, 0);
gtk_widget_grab_default(frdp->find);
@@ -2561,21 +2430,11 @@ find_replace_dialog_create(char_u *arg, int do_replace)
frdp->replace = create_image_button(GTK_STOCK_CONVERT, _("Replace"));
#endif
gtk_widget_set_sensitive(frdp->replace, sensitive);
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_can_default(frdp->find, TRUE);
#else
GTK_WIDGET_SET_FLAGS(frdp->replace, GTK_CAN_DEFAULT);
#endif
gtk_box_pack_start(GTK_BOX(actionarea), frdp->replace, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(frdp->replace), "clicked",
G_CALLBACK(find_replace_cb),
GINT_TO_POINTER(FRD_REPLACE));
#else
gtk_signal_connect(GTK_OBJECT(frdp->replace), "clicked",
GTK_SIGNAL_FUNC(find_replace_cb),
GINT_TO_POINTER(FRD_REPLACE));
#endif
/* 'Replace All' button */
#if GTK_CHECK_VERSION(3,10,0)
@@ -2584,21 +2443,11 @@ find_replace_dialog_create(char_u *arg, int do_replace)
frdp->all = create_image_button(GTK_STOCK_CONVERT, _("Replace All"));
#endif
gtk_widget_set_sensitive(frdp->all, sensitive);
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_can_default(frdp->all, TRUE);
#else
GTK_WIDGET_SET_FLAGS(frdp->all, GTK_CAN_DEFAULT);
#endif
gtk_box_pack_start(GTK_BOX(actionarea), frdp->all, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(frdp->all), "clicked",
G_CALLBACK(find_replace_cb),
GINT_TO_POINTER(FRD_REPLACEALL));
#else
gtk_signal_connect(GTK_OBJECT(frdp->all), "clicked",
GTK_SIGNAL_FUNC(find_replace_cb),
GINT_TO_POINTER(FRD_REPLACEALL));
#endif
}
/* 'Cancel' button */
@@ -2607,27 +2456,14 @@ find_replace_dialog_create(char_u *arg, int do_replace)
#else
tmp = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
#endif
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_can_default(tmp, TRUE);
#else
GTK_WIDGET_SET_FLAGS(tmp, GTK_CAN_DEFAULT);
#endif
gtk_box_pack_end(GTK_BOX(actionarea), tmp, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect_swapped(G_OBJECT(tmp),
"clicked", G_CALLBACK(gtk_widget_hide),
G_OBJECT(frdp->dialog));
g_signal_connect_swapped(G_OBJECT(frdp->dialog),
"delete-event", G_CALLBACK(gtk_widget_hide_on_delete),
G_OBJECT(frdp->dialog));
#else
gtk_signal_connect_object(GTK_OBJECT(tmp),
"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),
GTK_OBJECT(frdp->dialog));
gtk_signal_connect_object(GTK_OBJECT(frdp->dialog),
"delete_event", GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
GTK_OBJECT(frdp->dialog));
#endif
#if GTK_CHECK_VERSION(3,2,0)
tmp = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
@@ -2693,23 +2529,11 @@ find_replace_cb(GtkWidget *widget UNUSED, gpointer data)
}
find_text = (char_u *)gtk_entry_get_text(GTK_ENTRY(sfr->what));
#if GTK_CHECK_VERSION(3,0,0)
direction_down = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sfr->down));
#else
direction_down = GTK_TOGGLE_BUTTON(sfr->down)->active;
#endif
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sfr->wword)))
#else
if (GTK_TOGGLE_BUTTON(sfr->wword)->active)
#endif
flags |= FRD_WHOLE_WORD;
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sfr->mcase)))
#else
if (GTK_TOGGLE_BUTTON(sfr->mcase)->active)
#endif
flags |= FRD_MATCH_CASE;
repl_text = CONVERT_FROM_UTF8(repl_text);
+23 -157
View File
@@ -150,21 +150,13 @@ gtk_form_put(GtkForm *form,
* that gtk_widget_set_parent() realizes the widget if it's visible
* and its parent is mapped.
*/
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_realized(GTK_WIDGET(form)))
#else
if (GTK_WIDGET_REALIZED(form))
#endif
gtk_form_attach_child_window(form, child);
gtk_widget_set_parent(child_widget, GTK_WIDGET(form));
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_realized(GTK_WIDGET(form))
&& !gtk_widget_get_realized(child_widget))
#else
if (GTK_WIDGET_REALIZED(form) && !GTK_WIDGET_REALIZED(child_widget))
#endif
gtk_form_realize_child(form, child);
gtk_form_position_child(form, child, TRUE);
@@ -300,32 +292,19 @@ gtk_form_realize(GtkWidget *widget)
GtkForm *form;
GdkWindowAttr attributes;
gint attributes_mask;
GtkAllocation allocation;
g_return_if_fail(GTK_IS_FORM(widget));
form = GTK_FORM(widget);
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_realized(widget, TRUE);
#else
GTK_WIDGET_SET_FLAGS(form, GTK_REALIZED);
#endif
gtk_widget_get_allocation(widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
#if GTK_CHECK_VERSION(3,0,0)
{
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
}
#else
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
#endif
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual(widget);
#if GTK_CHECK_VERSION(3,0,0)
@@ -341,14 +320,9 @@ gtk_form_realize(GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
#endif
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_window(widget,
gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask));
#else
widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask);
#endif
gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
attributes.x = 0;
@@ -382,11 +356,7 @@ gtk_form_realize(GtkWidget *widget)
gtk_form_attach_child_window(form, child);
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_visible(child->widget))
#else
if (GTK_WIDGET_VISIBLE(child->widget))
#endif
gtk_form_realize_child(form, child);
}
}
@@ -410,11 +380,7 @@ gtk_form_map(GtkWidget *widget)
form = GTK_FORM(widget);
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_mapped(widget, TRUE);
#else
GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED);
#endif
gdk_window_show(gtk_widget_get_window(widget));
gdk_window_show(form->bin_window);
@@ -423,13 +389,8 @@ gtk_form_map(GtkWidget *widget)
{
GtkFormChild *child = tmp_list->data;
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_visible(child->widget)
&& !gtk_widget_get_mapped(child->widget))
#else
if (GTK_WIDGET_VISIBLE(child->widget)
&& !GTK_WIDGET_MAPPED(child->widget))
#endif
gtk_widget_map(child->widget);
}
}
@@ -456,21 +417,12 @@ gtk_form_unrealize(GtkWidget *widget)
if (child->window != NULL)
{
#if GTK_CHECK_VERSION(3,0,0)
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
FUNC2GENERIC(gtk_form_child_map),
child);
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
FUNC2GENERIC(gtk_form_child_unmap),
child);
#else
gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
GTK_SIGNAL_FUNC(gtk_form_child_map),
child);
gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
GTK_SIGNAL_FUNC(gtk_form_child_unmap),
child);
#endif
gdk_window_set_user_data(child->window, NULL);
gdk_window_destroy(child->window);
@@ -534,34 +486,20 @@ gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
GList *tmp_list;
GtkForm *form;
gboolean need_reposition;
#if GTK_CHECK_VERSION(3,0,0)
GtkAllocation cur_alloc;
#endif
g_return_if_fail(GTK_IS_FORM(widget));
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_allocation(widget, &cur_alloc);
if (cur_alloc.x == allocation->x
&& cur_alloc.y == allocation->y
&& cur_alloc.width == allocation->width
&& cur_alloc.height == allocation->height)
#else
if (widget->allocation.x == allocation->x
&& widget->allocation.y == allocation->y
&& widget->allocation.width == allocation->width
&& widget->allocation.height == allocation->height)
#endif
return;
#if GTK_CHECK_VERSION(3,0,0)
need_reposition = cur_alloc.width != allocation->width
|| cur_alloc.height != allocation->height;
#else
need_reposition = widget->allocation.width != allocation->width
|| widget->allocation.height != allocation->height;
#endif
form = GTK_FORM(widget);
if (need_reposition)
@@ -577,11 +515,7 @@ gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
}
}
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_realized(widget))
#else
if (GTK_WIDGET_REALIZED(widget))
#endif
{
gdk_window_move_resize(gtk_widget_get_window(widget),
allocation->x, allocation->y,
@@ -590,11 +524,7 @@ gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
0, 0,
allocation->width, allocation->height);
}
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_allocation(widget, allocation);
#else
widget->allocation = *allocation;
#endif
if (need_reposition)
gtk_form_send_configure(form);
}
@@ -697,17 +627,10 @@ gtk_form_remove(GtkContainer *container, GtkWidget *widget)
#endif
if (child->window)
{
#if GTK_CHECK_VERSION(3,0,0)
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
FUNC2GENERIC(&gtk_form_child_map), child);
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
FUNC2GENERIC(&gtk_form_child_unmap), child);
#else
gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
GTK_SIGNAL_FUNC(&gtk_form_child_map), child);
gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
GTK_SIGNAL_FUNC(&gtk_form_child_unmap), child);
#endif
/* FIXME: This will cause problems for reparenting NO_WINDOW
* widgets out of a GtkForm
@@ -760,34 +683,25 @@ gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child)
if (child->window != NULL)
return; /* been there, done that */
#if GTK_CHECK_VERSION(3,0,0)
if (!gtk_widget_get_has_window(child->widget))
#else
if (GTK_WIDGET_NO_WINDOW(child->widget))
#endif
{
GtkWidget *widget;
GdkWindowAttr attributes;
gint attributes_mask;
GtkRequisition requisition;
widget = GTK_WIDGET(form);
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(child->widget, &requisition, NULL);
#else
requisition = child->widget->requisition;
#endif
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = child->x;
attributes.y = child->y;
#if GTK_CHECK_VERSION(3,0,0)
{
GtkRequisition requisition;
gtk_widget_get_preferred_size(child->widget, &requisition, NULL);
attributes.width = requisition.width;
attributes.height = requisition.height;
}
#else
attributes.width = child->widget->requisition.width;
attributes.height = child->widget->requisition.height;
#endif
attributes.width = requisition.width;
attributes.height = requisition.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual(widget);
#if !GTK_CHECK_VERSION(3,0,0)
@@ -824,23 +738,12 @@ gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child)
* Install signal handlers to map/unmap child->window
* alongside with the actual widget.
*/
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(child->widget), "map",
G_CALLBACK(&gtk_form_child_map), child);
g_signal_connect(G_OBJECT(child->widget), "unmap",
G_CALLBACK(&gtk_form_child_unmap), child);
#else
gtk_signal_connect(GTK_OBJECT(child->widget), "map",
GTK_SIGNAL_FUNC(&gtk_form_child_map), child);
gtk_signal_connect(GTK_OBJECT(child->widget), "unmap",
GTK_SIGNAL_FUNC(&gtk_form_child_unmap), child);
#endif
}
#if GTK_CHECK_VERSION(3,0,0)
else if (!gtk_widget_get_realized(child->widget))
#else
else if (!GTK_WIDGET_REALIZED(child->widget))
#endif
{
gtk_widget_set_parent_window(child->widget, form->bin_window);
}
@@ -868,18 +771,10 @@ gtk_form_position_child(GtkForm *form, GtkFormChild *child,
{
if (!child->mapped)
{
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_mapped(GTK_WIDGET(form))
&& gtk_widget_get_visible(child->widget))
#else
if (GTK_WIDGET_MAPPED(form) && GTK_WIDGET_VISIBLE(child->widget))
#endif
{
#if GTK_CHECK_VERSION(3,0,0)
if (!gtk_widget_get_mapped(child->widget))
#else
if (!GTK_WIDGET_MAPPED(child->widget))
#endif
gtk_widget_map(child->widget);
child->mapped = TRUE;
@@ -890,31 +785,22 @@ gtk_form_position_child(GtkForm *form, GtkFormChild *child,
if (force_allocate)
{
GtkAllocation allocation;
#if GTK_CHECK_VERSION(3,0,0)
GtkRequisition requisition;
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(child->widget, &requisition, NULL);
#else
requisition = child->widget->requisition;
#endif
#if GTK_CHECK_VERSION(3,0,0)
if (!gtk_widget_get_has_window(child->widget))
#else
if (GTK_WIDGET_NO_WINDOW(child->widget))
#endif
{
if (child->window)
{
#if GTK_CHECK_VERSION(3,0,0)
gdk_window_move_resize(child->window,
x, y,
requisition.width,
requisition.height);
#else
gdk_window_move_resize(child->window,
x, y,
child->widget->requisition.width,
child->widget->requisition.height);
#endif
}
allocation.x = 0;
@@ -926,13 +812,8 @@ gtk_form_position_child(GtkForm *form, GtkFormChild *child,
allocation.y = y;
}
#if GTK_CHECK_VERSION(3,0,0)
allocation.width = requisition.width;
allocation.height = requisition.height;
#else
allocation.width = child->widget->requisition.width;
allocation.height = child->widget->requisition.height;
#endif
gtk_widget_size_allocate(child->widget, &allocation);
}
@@ -943,11 +824,7 @@ gtk_form_position_child(GtkForm *form, GtkFormChild *child,
{
child->mapped = FALSE;
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_mapped(child->widget))
#else
if (GTK_WIDGET_MAPPED(child->widget))
#endif
gtk_widget_unmap(child->widget);
}
}
@@ -981,28 +858,17 @@ gtk_form_send_configure(GtkForm *form)
{
GtkWidget *widget;
GdkEventConfigure event;
GtkAllocation allocation;
widget = GTK_WIDGET(form);
gtk_widget_get_allocation(widget, &allocation);
event.type = GDK_CONFIGURE;
#if GTK_CHECK_VERSION(3,0,0)
event.window = gtk_widget_get_window(widget);
{
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
event.x = allocation.x;
event.y = allocation.y;
event.width = allocation.width;
event.height = allocation.height;
}
#else
event.window = widget->window;
event.x = widget->allocation.x;
event.y = widget->allocation.y;
event.width = widget->allocation.width;
event.height = widget->allocation.height;
#endif
event.x = allocation.x;
event.y = allocation.y;
event.width = allocation.width;
event.height = allocation.height;
gtk_main_do_event((GdkEvent*)&event);
}
+13 -347
View File
@@ -804,11 +804,7 @@ gtk_settings_xft_dpi_changed_cb(GtkSettings *gtk_settings UNUSED,
}
}
#if GTK_CHECK_VERSION(3,0,0)
typedef gboolean timeout_cb_type;
#else
typedef gint timeout_cb_type;
#endif
/*
* Start a timer that will invoke the specified callback.
@@ -817,21 +813,13 @@ typedef gint timeout_cb_type;
static guint
timeout_add(int time, timeout_cb_type (*callback)(gpointer), int *flagp)
{
#if GTK_CHECK_VERSION(3,0,0)
return g_timeout_add((guint)time, (GSourceFunc)callback, flagp);
#else
return gtk_timeout_add((guint32)time, (GtkFunction)callback, flagp);
#endif
}
static void
timeout_remove(guint timer)
{
#if GTK_CHECK_VERSION(3,0,0)
g_source_remove(timer);
#else
gtk_timeout_remove(timer);
#endif
}
@@ -974,11 +962,7 @@ enter_notify_event(GtkWidget *widget UNUSED,
gui_mch_start_blink();
/* make sure keyboard input goes there */
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_socket_id == 0 || !gtk_widget_has_focus(gui.drawarea))
#else
if (gtk_socket_id == 0 || !GTK_WIDGET_HAS_FOCUS(gui.drawarea))
#endif
gtk_widget_grab_focus(gui.drawarea);
return FALSE;
@@ -1418,22 +1402,13 @@ selection_received_cb(GtkWidget *widget UNUSED,
int len;
int motion_type = MAUTO;
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_selection_data_get_selection(data) == clip_plus.gtk_sel_atom)
#else
if (data->selection == clip_plus.gtk_sel_atom)
#endif
cbd = &clip_plus;
else
cbd = &clip_star;
#if GTK_CHECK_VERSION(3,0,0)
text = (char_u *)gtk_selection_data_get_data(data);
len = gtk_selection_data_get_length(data);
#else
text = (char_u *)data->data;
len = data->length;
#endif
if (text == NULL || len <= 0)
{
@@ -1443,20 +1418,12 @@ selection_received_cb(GtkWidget *widget UNUSED,
return;
}
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_selection_data_get_data_type(data) == vim_atom)
#else
if (data->type == vim_atom)
#endif
{
motion_type = *text++;
--len;
}
#if GTK_CHECK_VERSION(3,0,0)
else if (gtk_selection_data_get_data_type(data) == vimenc_atom)
#else
else if (data->type == vimenc_atom)
#endif
{
char_u *enc;
vimconv_T conv;
@@ -1547,12 +1514,8 @@ selection_get_cb(GtkWidget *widget UNUSED,
GdkAtom type;
VimClipboard *cbd;
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_selection_data_get_selection(selection_data)
== clip_plus.gtk_sel_atom)
#else
if (selection_data->selection == clip_plus.gtk_sel_atom)
#endif
cbd = &clip_plus;
else
cbd = &clip_star;
@@ -1785,9 +1748,7 @@ process_motion_notify(int x, int y, GdkModifierType state)
{
int button;
int_u vim_modifiers;
#if GTK_CHECK_VERSION(3,0,0)
GtkAllocation allocation;
#endif
button = (state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK |
GDK_BUTTON3_MASK | GDK_BUTTON4_MASK |
@@ -1814,17 +1775,11 @@ process_motion_notify(int x, int y, GdkModifierType state)
/*
* Auto repeat timer handling.
*/
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_allocation(gui.drawarea, &allocation);
if (x < 0 || y < 0
|| x >= allocation.width
|| y >= allocation.height)
#else
if (x < 0 || y < 0
|| x >= gui.drawarea->allocation.width
|| y >= gui.drawarea->allocation.height)
#endif
{
int dx;
@@ -1835,13 +1790,8 @@ process_motion_notify(int x, int y, GdkModifierType state)
/* Calculate the maximal distance of the cursor from the drawing area.
* (offshoot can't become negative here!).
*/
#if GTK_CHECK_VERSION(3,0,0)
dx = x < 0 ? -x : x - allocation.width;
dy = y < 0 ? -y : y - allocation.height;
#else
dx = x < 0 ? -x : x - gui.drawarea->allocation.width;
dy = y < 0 ? -y : y - gui.drawarea->allocation.height;
#endif
offshoot = dx > dy ? dx : dy;
@@ -1907,6 +1857,10 @@ gui_gtk_window_at_position(GtkWidget *widget,
return gdk_device_get_window_at_position(dev, x, y);
}
# endif
#else /* !GTK_CHECK_VERSION(3,0,0) */
# define gui_gtk_get_pointer(wid, x, y, s) \
gdk_window_get_pointer((wid)->window, x, y, s)
# define gui_gtk_window_at_position(wid, x, y) gdk_window_at_pointer(x, y)
#endif
/*
@@ -1919,11 +1873,7 @@ motion_repeat_timer_cb(gpointer data UNUSED)
int y;
GdkModifierType state;
#if GTK_CHECK_VERSION(3,0,0)
gui_gtk_get_pointer(gui.drawarea, &x, &y, &state);
#else
gdk_window_get_pointer(gui.drawarea->window, &x, &y, &state);
#endif
if (!(state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK |
GDK_BUTTON3_MASK | GDK_BUTTON4_MASK |
@@ -1968,11 +1918,7 @@ motion_notify_event(GtkWidget *widget,
int y;
GdkModifierType state;
#if GTK_CHECK_VERSION(3,0,0)
gui_gtk_get_pointer(widget, &x, &y, &state);
#else
gdk_window_get_pointer(widget->window, &x, &y, &state);
#endif
process_motion_notify(x, y, state);
}
else
@@ -2003,11 +1949,7 @@ button_press_event(GtkWidget *widget,
gui.event_time = event->time;
/* Make sure we have focus now we've been selected */
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_socket_id != 0 && !gtk_widget_has_focus(widget))
#else
if (gtk_socket_id != 0 && !GTK_WIDGET_HAS_FOCUS(widget))
#endif
gtk_widget_grab_focus(widget);
/*
@@ -2069,11 +2011,7 @@ scroll_event(GtkWidget *widget,
int button;
int_u vim_modifiers;
#if GTK_CHECK_VERSION(3,0,0)
if (gtk_socket_id != 0 && !gtk_widget_has_focus(widget))
#else
if (gtk_socket_id != 0 && !GTK_WIDGET_HAS_FOCUS(widget))
#endif
gtk_widget_grab_focus(widget);
switch (event->direction)
@@ -2239,13 +2177,9 @@ drag_handle_uri_list(GdkDragContext *context,
char_u **fnames;
int nfiles = 0;
# if GTK_CHECK_VERSION(3,0,0)
fnames = parse_uri_list(&nfiles,
(char_u *)gtk_selection_data_get_data(data),
gtk_selection_data_get_length(data));
# else
fnames = parse_uri_list(&nfiles, data->data, data->length);
# endif
if (fnames != NULL && nfiles > 0)
{
@@ -2272,19 +2206,10 @@ drag_handle_text(GdkDragContext *context,
int len;
char_u *tmpbuf = NULL;
# if GTK_CHECK_VERSION(3,0,0)
text = (char_u *)gtk_selection_data_get_data(data);
len = gtk_selection_data_get_length(data);
# else
text = data->data;
len = data->length;
# endif
# if GTK_CHECK_VERSION(3,0,0)
if (gtk_selection_data_get_data_type(data) == utf8_string_atom)
# else
if (data->type == utf8_string_atom)
# endif
{
if (input_conv.vc_type != CONV_NONE)
tmpbuf = string_convert(&input_conv, text, &len);
@@ -2320,7 +2245,6 @@ drag_data_received_cb(GtkWidget *widget,
GdkModifierType state;
/* Guard against trash */
# if GTK_CHECK_VERSION(3,0,0)
const guchar * const data_data = gtk_selection_data_get_data(data);
const gint data_length = gtk_selection_data_get_length(data);
const gint data_format = gtk_selection_data_get_format(data);
@@ -2329,12 +2253,6 @@ drag_data_received_cb(GtkWidget *widget,
|| data_length <= 0
|| data_format != 8
|| data_data[data_length] != '\0')
# else
if (data->data == NULL
|| data->length <= 0
|| data->format != 8
|| data->data[data->length] != '\0')
# endif
{
gtk_drag_finish(context, FALSE, FALSE, time_);
return;
@@ -2342,11 +2260,7 @@ drag_data_received_cb(GtkWidget *widget,
/* Get the current modifier state for proper distinguishment between
* different operations later. */
#if GTK_CHECK_VERSION(3,0,0)
gui_gtk_get_pointer(widget, NULL, NULL, &state);
# else
gdk_window_get_pointer(widget->window, NULL, NULL, &state);
# endif
/* Not sure about the role of "text/plain" here... */
if (info == (guint)TARGET_TEXT_URI_LIST)
@@ -2810,13 +2724,8 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
GDK_WINDOW_XID(mainwin_win));
}
gtk_widget_add_events(gui.mainwin, GDK_PROPERTY_CHANGE_MASK);
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.mainwin), "property-notify-event",
G_CALLBACK(property_event), NULL);
# else
gtk_signal_connect(GTK_OBJECT(gui.mainwin), "property_notify_event",
GTK_SIGNAL_FUNC(property_event), NULL);
# endif
#endif
}
@@ -2935,9 +2844,7 @@ mainwin_screen_changed_cb(GtkWidget *widget,
drawarea_realize_cb(GtkWidget *widget, gpointer data UNUSED)
{
GtkWidget *sbar;
#if GTK_CHECK_VERSION(3,0,0)
GtkAllocation allocation;
#endif
#ifdef FEAT_XIM
xim_init();
@@ -2962,23 +2869,13 @@ drawarea_realize_cb(GtkWidget *widget, gpointer data UNUSED)
if (!sbar || (!gui.which_scrollbars[SBAR_LEFT]
&& firstwin->w_scrollbars[SBAR_RIGHT].id))
sbar = firstwin->w_scrollbars[SBAR_RIGHT].id;
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_allocation(sbar, &allocation);
if (sbar && gtk_widget_get_realized(sbar) && allocation.width)
gui.scrollbar_width = allocation.width;
#else
if (sbar && GTK_WIDGET_REALIZED(sbar) && sbar->allocation.width)
gui.scrollbar_width = sbar->allocation.width;
#endif
sbar = gui.bottom_sbar.id;
#if GTK_CHECK_VERSION(3,0,0)
if (sbar && gtk_widget_get_realized(sbar) && allocation.height)
gui.scrollbar_height = allocation.height;
#else
if (sbar && GTK_WIDGET_REALIZED(sbar) && sbar->allocation.height)
gui.scrollbar_height = sbar->allocation.height;
#endif
}
/*
@@ -3142,32 +3039,21 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
# define item_orientation GTK_ORIENTATION_HORIZONTAL
# endif
# if GTK_CHECK_VERSION(3,0,0)
if (widget != NULL
&& item_orientation == orientation
&& gtk_widget_get_realized(widget)
&& gtk_widget_get_visible(widget))
# else
if (widget != NULL
&& item_orientation == orientation
&& GTK_WIDGET_REALIZED(widget)
&& GTK_WIDGET_VISIBLE(widget))
# endif
{
# if GTK_CHECK_VERSION(3,0,0)
# if GTK_CHECK_VERSION(3,0,0) || !defined(FEAT_GUI_GNOME)
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
return allocation.height;
# else
# ifdef FEAT_GUI_GNOME
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return widget->allocation.height;
else
return widget->allocation.width;
# else
return widget->allocation.height;
# endif
# endif
}
return 0;
@@ -3438,15 +3324,9 @@ add_tabline_menu_item(GtkWidget *menu, char_u *text, int resp)
CONVERT_TO_UTF8_FREE(utf_text);
gtk_container_add(GTK_CONTAINER(menu), item);
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(item), "activate",
G_CALLBACK(tabline_menu_handler),
GINT_TO_POINTER(resp));
# else
gtk_signal_connect(GTK_OBJECT(item), "activate",
GTK_SIGNAL_FUNC(tabline_menu_handler),
(gpointer)(long)resp);
# endif
}
/*
@@ -3488,20 +3368,11 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
)
return TRUE;
# if GTK_CHECK_VERSION(3,0,0)
tabwin = gui_gtk_window_at_position(gui.mainwin, &x, &y);
# else
tabwin = gdk_window_at_pointer(&x, &y);
# endif
gdk_window_get_user_data(tabwin, (gpointer)&tabwidget);
# if GTK_CHECK_VERSION(3,0,0)
clicked_page = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tabwidget),
"tab_num"));
# else
clicked_page = (int)(long)gtk_object_get_user_data(
GTK_OBJECT(tabwidget));
# endif
/* If the event was generated for 3rd button popup the menu. */
if (bevent->button == 3)
@@ -3536,11 +3407,7 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
static void
on_select_tab(
GtkNotebook *notebook UNUSED,
# if GTK_CHECK_VERSION(3,0,0)
gpointer *page UNUSED,
# else
GtkNotebookPage *page UNUSED,
# endif
gint idx,
gpointer data UNUSED)
{
@@ -3554,11 +3421,7 @@ on_select_tab(
static void
on_tab_reordered(
GtkNotebook *notebook UNUSED,
# if GTK_CHECK_VERSION(3,0,0)
gpointer *page UNUSED,
# else
GtkNotebookPage *page UNUSED,
# endif
gint idx,
gpointer data UNUSED)
{
@@ -3586,11 +3449,7 @@ gui_mch_show_tabline(int showit)
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), showit);
update_window_manager_hints(0, 0);
if (showit)
# if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_can_focus(GTK_WIDGET(gui.tabline), FALSE);
# else
GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(gui.tabline), GTK_CAN_FOCUS);
# endif
}
gui_mch_update();
@@ -3663,18 +3522,9 @@ gui_mch_update_tabline(void)
}
event_box = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui.tabline), page);
# if GTK_CHECK_VERSION(3,0,0)
g_object_set_data(G_OBJECT(event_box), "tab_num",
GINT_TO_POINTER(tab_num));
# else
gtk_object_set_user_data(GTK_OBJECT(event_box),
(gpointer)(long)tab_num);
# endif
# if GTK_CHECK_VERSION(3,0,0)
label = gtk_bin_get_child(GTK_BIN(event_box));
# else
label = GTK_BIN(event_box)->child;
# endif
get_tabline_label(tp, FALSE);
labeltext = CONVERT_TO_UTF8(NameBuff);
gtk_label_set_text(GTK_LABEL(label), (const char *)labeltext);
@@ -3695,13 +3545,8 @@ gui_mch_update_tabline(void)
while (gtk_notebook_get_nth_page(GTK_NOTEBOOK(gui.tabline), nr) != NULL)
gtk_notebook_remove_page(GTK_NOTEBOOK(gui.tabline), nr);
# if GTK_CHECK_VERSION(3,0,0)
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(gui.tabline)) != curtabidx)
gtk_notebook_set_current_page(GTK_NOTEBOOK(gui.tabline), curtabidx);
# else
if (gtk_notebook_current_page(GTK_NOTEBOOK(gui.tabline)) != curtabidx)
gtk_notebook_set_page(GTK_NOTEBOOK(gui.tabline), curtabidx);
# endif
/* Make sure everything is in place before drawing text. */
gui_mch_update();
@@ -3719,13 +3564,8 @@ gui_mch_set_curtab(int nr)
return;
ignore_tabline_evt = TRUE;
# if GTK_CHECK_VERSION(3,0,0)
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(gui.tabline)) != nr - 1)
gtk_notebook_set_current_page(GTK_NOTEBOOK(gui.tabline), nr - 1);
# else
if (gtk_notebook_current_page(GTK_NOTEBOOK(gui.tabline)) != nr - 1)
gtk_notebook_set_page(GTK_NOTEBOOK(gui.tabline), nr - 1);
# endif
ignore_tabline_evt = FALSE;
}
@@ -3872,11 +3712,7 @@ gui_mch_init(void)
/* Use GtkSocket from another app. */
plug = gtk_plug_new_for_display(gdk_display_get_default(),
gtk_socket_id);
#if GTK_CHECK_VERSION(3,0,0)
if (plug != NULL && gtk_plug_get_socket_window(GTK_PLUG(plug)) != NULL)
#else
if (plug != NULL && GTK_PLUG(plug)->socket_window != NULL)
#endif
{
gui.mainwin = plug;
}
@@ -3911,26 +3747,14 @@ gui_mch_init(void)
gui.text_context = gtk_widget_create_pango_context(gui.mainwin);
pango_context_set_base_dir(gui.text_context, PANGO_DIRECTION_LTR);
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_set_border_width(GTK_CONTAINER(gui.mainwin), 0);
#else
gtk_container_border_width(GTK_CONTAINER(gui.mainwin), 0);
#endif
gtk_widget_add_events(gui.mainwin, GDK_VISIBILITY_NOTIFY_MASK);
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.mainwin), "delete-event",
G_CALLBACK(&delete_event_cb), NULL);
g_signal_connect(G_OBJECT(gui.mainwin), "realize",
G_CALLBACK(&mainwin_realize), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.mainwin), "delete_event",
GTK_SIGNAL_FUNC(&delete_event_cb), NULL);
gtk_signal_connect(GTK_OBJECT(gui.mainwin), "realize",
GTK_SIGNAL_FUNC(&mainwin_realize), NULL);
#endif
g_signal_connect(G_OBJECT(gui.mainwin), "screen-changed",
G_CALLBACK(&mainwin_screen_changed_cb), NULL);
@@ -4084,11 +3908,7 @@ gui_mch_init(void)
gtk_widget_show(label);
event_box = gtk_event_box_new();
gtk_widget_show(event_box);
# if GTK_CHECK_VERSION(3,0,0)
g_object_set_data(G_OBJECT(event_box), "tab_num", GINT_TO_POINTER(1L));
# else
gtk_object_set_user_data(GTK_OBJECT(event_box), (gpointer)1L);
# endif
# if !GTK_CHECK_VERSION(3,14,0)
gtk_misc_set_padding(GTK_MISC(label), 2, 2);
# endif
@@ -4097,35 +3917,19 @@ gui_mch_init(void)
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), page, TRUE);
}
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.tabline), "switch-page",
G_CALLBACK(on_select_tab), NULL);
g_signal_connect(G_OBJECT(gui.tabline), "page-reordered",
G_CALLBACK(on_tab_reordered), NULL);
# else
gtk_signal_connect(GTK_OBJECT(gui.tabline), "switch_page",
GTK_SIGNAL_FUNC(on_select_tab), NULL);
gtk_signal_connect(GTK_OBJECT(gui.tabline), "page-reordered",
GTK_SIGNAL_FUNC(on_tab_reordered), NULL);
# endif
/* Create a popup menu for the tab line and connect it. */
tabline_menu = create_tabline_menu();
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect_swapped(G_OBJECT(gui.tabline), "button-press-event",
G_CALLBACK(on_tabline_menu), G_OBJECT(tabline_menu));
# else
gtk_signal_connect_object(GTK_OBJECT(gui.tabline), "button_press_event",
GTK_SIGNAL_FUNC(on_tabline_menu), GTK_OBJECT(tabline_menu));
# endif
#endif /* FEAT_GUI_TABLINE */
gui.formwin = gtk_form_new();
#if GTK_CHECK_VERSION(3,0,0)
gtk_container_set_border_width(GTK_CONTAINER(gui.formwin), 0);
#else
gtk_container_border_width(GTK_CONTAINER(gui.formwin), 0);
#endif
#if !GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_events(gui.formwin, GDK_EXPOSURE_MASK);
#endif
@@ -4159,17 +3963,10 @@ gui_mch_init(void)
/* For GtkSockets, key-presses must go to the focus widget (drawarea)
* and not the window. */
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect((gtk_socket_id == 0) ? G_OBJECT(gui.mainwin)
: G_OBJECT(gui.drawarea),
"key-press-event",
G_CALLBACK(key_press_event), NULL);
#else
gtk_signal_connect((gtk_socket_id == 0) ? GTK_OBJECT(gui.mainwin)
: GTK_OBJECT(gui.drawarea),
"key_press_event",
GTK_SIGNAL_FUNC(key_press_event), NULL);
#endif
#if defined(FEAT_XIM) || GTK_CHECK_VERSION(3,0,0)
/* Also forward key release events for the benefit of GTK+ 2 input
* modules. Try CTRL-SHIFT-xdigits to enter a Unicode code point. */
@@ -4178,28 +3975,20 @@ gui_mch_init(void)
"key-release-event",
G_CALLBACK(&key_release_event), NULL);
#endif
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.drawarea), "realize",
G_CALLBACK(drawarea_realize_cb), NULL);
g_signal_connect(G_OBJECT(gui.drawarea), "unrealize",
G_CALLBACK(drawarea_unrealize_cb), NULL);
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.drawarea), "configure-event",
G_CALLBACK(drawarea_configure_event_cb), NULL);
# if GTK_CHECK_VERSION(3,22,2)
#endif
#if GTK_CHECK_VERSION(3,22,2)
g_signal_connect_after(G_OBJECT(gui.drawarea), "style-updated",
G_CALLBACK(&drawarea_style_updated_cb), NULL);
# else
#else
g_signal_connect_after(G_OBJECT(gui.drawarea), "style-set",
G_CALLBACK(&drawarea_style_set_cb), NULL);
# endif
#else
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "realize",
GTK_SIGNAL_FUNC(drawarea_realize_cb), NULL);
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "unrealize",
GTK_SIGNAL_FUNC(drawarea_unrealize_cb), NULL);
gtk_signal_connect_after(GTK_OBJECT(gui.drawarea), "style_set",
GTK_SIGNAL_FUNC(&drawarea_style_set_cb), NULL);
#endif
#if !GTK_CHECK_VERSION(3,0,0)
@@ -4213,11 +4002,7 @@ gui_mch_init(void)
if (gtk_socket_id != 0)
/* make sure keyboard input can go to the drawarea */
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_can_focus(gui.drawarea, TRUE);
#else
GTK_WIDGET_SET_FLAGS(gui.drawarea, GTK_CAN_FOCUS);
#endif
/*
* Set clipboard specific atoms
@@ -4248,17 +4033,10 @@ gui_mch_init(void)
*/
if (vim_strchr(p_go, GO_POINTER) != NULL)
{
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.drawarea), "leave-notify-event",
G_CALLBACK(leave_notify_event), NULL);
g_signal_connect(G_OBJECT(gui.drawarea), "enter-notify-event",
G_CALLBACK(enter_notify_event), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "leave_notify_event",
GTK_SIGNAL_FUNC(leave_notify_event), NULL);
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "enter_notify_event",
GTK_SIGNAL_FUNC(enter_notify_event), NULL);
#endif
}
/* Real windows can get focus ... GtkPlug, being a mere container can't,
@@ -4267,47 +4045,25 @@ gui_mch_init(void)
*/
if (gtk_socket_id == 0)
{
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.mainwin), "focus-out-event",
G_CALLBACK(focus_out_event), NULL);
g_signal_connect(G_OBJECT(gui.mainwin), "focus-in-event",
G_CALLBACK(focus_in_event), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_out_event",
GTK_SIGNAL_FUNC(focus_out_event), NULL);
gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_in_event",
GTK_SIGNAL_FUNC(focus_in_event), NULL);
#endif
}
else
{
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.drawarea), "focus-out-event",
G_CALLBACK(focus_out_event), NULL);
g_signal_connect(G_OBJECT(gui.drawarea), "focus-in-event",
G_CALLBACK(focus_in_event), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "focus_out_event",
GTK_SIGNAL_FUNC(focus_out_event), NULL);
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "focus_in_event",
GTK_SIGNAL_FUNC(focus_in_event), NULL);
#endif
#ifdef FEAT_GUI_TABLINE
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.tabline), "focus-out-event",
G_CALLBACK(focus_out_event), NULL);
g_signal_connect(G_OBJECT(gui.tabline), "focus-in-event",
G_CALLBACK(focus_in_event), NULL);
# else
gtk_signal_connect(GTK_OBJECT(gui.tabline), "focus_out_event",
GTK_SIGNAL_FUNC(focus_out_event), NULL);
gtk_signal_connect(GTK_OBJECT(gui.tabline), "focus_in_event",
GTK_SIGNAL_FUNC(focus_in_event), NULL);
# endif
#endif /* FEAT_GUI_TABLINE */
}
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.drawarea), "motion-notify-event",
G_CALLBACK(motion_notify_event), NULL);
g_signal_connect(G_OBJECT(gui.drawarea), "button-press-event",
@@ -4316,41 +4072,19 @@ gui_mch_init(void)
G_CALLBACK(button_release_event), NULL);
g_signal_connect(G_OBJECT(gui.drawarea), "scroll-event",
G_CALLBACK(&scroll_event), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "motion_notify_event",
GTK_SIGNAL_FUNC(motion_notify_event), NULL);
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "button_press_event",
GTK_SIGNAL_FUNC(button_press_event), NULL);
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "button_release_event",
GTK_SIGNAL_FUNC(button_release_event), NULL);
g_signal_connect(G_OBJECT(gui.drawarea), "scroll_event",
G_CALLBACK(&scroll_event), NULL);
#endif
/*
* Add selection handler functions.
*/
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.drawarea), "selection-clear-event",
G_CALLBACK(selection_clear_event), NULL);
g_signal_connect(G_OBJECT(gui.drawarea), "selection-received",
G_CALLBACK(selection_received_cb), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_clear_event",
GTK_SIGNAL_FUNC(selection_clear_event), NULL);
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_received",
GTK_SIGNAL_FUNC(selection_received_cb), NULL);
#endif
gui_gtk_set_selection_targets();
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.drawarea), "selection-get",
G_CALLBACK(selection_get_cb), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "selection_get",
GTK_SIGNAL_FUNC(selection_get_cb), NULL);
#endif
/* Pretend we don't have input focus, we will get an event if we do. */
gui.in_focus = FALSE;
@@ -4415,16 +4149,12 @@ set_cairo_source_rgba_from_color(cairo_t *cr, guicolor_T color)
void
gui_mch_new_colors(void)
{
#if GTK_CHECK_VERSION(3,0,0)
# if !GTK_CHECK_VERSION(3,22,2)
GdkWindow * const da_win = gtk_widget_get_window(gui.drawarea);
# endif
if (gui.drawarea != NULL && gtk_widget_get_window(gui.drawarea) != NULL)
#else
if (gui.drawarea != NULL && gui.drawarea->window != NULL)
#endif
{
#if !GTK_CHECK_VERSION(3,22,2)
GdkWindow * const da_win = gtk_widget_get_window(gui.drawarea);
#endif
#if GTK_CHECK_VERSION(3,22,2)
GtkStyleContext * const context
= gtk_widget_get_style_context(gui.drawarea);
@@ -4462,11 +4192,7 @@ gui_mch_new_colors(void)
GdkColor color = { 0, 0, 0, 0 };
color.pixel = gui.back_pixel;
# if GTK_CHECK_VERSION(3,0,0)
gdk_window_set_background(da_win, &color);
# else
gdk_window_set_background(gui.drawarea->window, &color);
# endif
#endif /* !GTK_CHECK_VERSION(3,22,2) */
}
}
@@ -4524,13 +4250,8 @@ form_configure_event(GtkWidget *widget UNUSED,
* We can't do much more here than to trying to preserve what had been done,
* since the window is already inevitably going away.
*/
#if GTK_CHECK_VERSION(3,0,0)
static void
mainwin_destroy_cb(GObject *object UNUSED, gpointer data UNUSED)
#else
static void
mainwin_destroy_cb(GtkObject *object UNUSED, gpointer data UNUSED)
#endif
{
/* Don't write messages to the GUI anymore */
full_screen = FALSE;
@@ -4709,13 +4430,8 @@ gui_mch_open(void)
* changed them). */
highlight_gui_started(); /* re-init colors and fonts */
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.mainwin), "destroy",
G_CALLBACK(mainwin_destroy_cb), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.mainwin), "destroy",
GTK_SIGNAL_FUNC(mainwin_destroy_cb), NULL);
#endif
#ifdef FEAT_HANGULIN
hangul_keyboard_set();
@@ -4731,25 +4447,15 @@ gui_mch_open(void)
* manager upon us and should not interfere with what VIM is requesting
* upon startup.
*/
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.formwin), "configure-event",
G_CALLBACK(form_configure_event), NULL);
#else
gtk_signal_connect(GTK_OBJECT(gui.formwin), "configure_event",
GTK_SIGNAL_FUNC(form_configure_event), NULL);
#endif
#ifdef FEAT_DND
/* Set up for receiving DND items. */
gui_gtk_set_dnd_targets();
# if GTK_CHECK_VERSION(3,0,0)
g_signal_connect(G_OBJECT(gui.drawarea), "drag-data-received",
G_CALLBACK(drag_data_received_cb), NULL);
# else
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "drag_data_received",
GTK_SIGNAL_FUNC(drag_data_received_cb), NULL);
# endif
#endif
/* With GTK+ 2, we need to iconify the window before calling show()
@@ -5036,11 +4742,7 @@ gui_mch_enable_menu(int showit)
widget = gui.menubar;
/* Do not disable the menu while starting up, otherwise F10 doesn't work. */
# if GTK_CHECK_VERSION(3,0,0)
if (!showit != !gtk_widget_get_visible(widget) && !gui.starting)
# else
if (!showit != !GTK_WIDGET_VISIBLE(widget) && !gui.starting)
# endif
{
if (showit)
gtk_widget_show(widget);
@@ -5071,11 +4773,7 @@ gui_mch_show_toolbar(int showit)
if (showit)
set_toolbar_style(GTK_TOOLBAR(gui.toolbar));
# if GTK_CHECK_VERSION(3,0,0)
if (!showit != !gtk_widget_get_visible(widget))
# else
if (!showit != !GTK_WIDGET_VISIBLE(widget))
# endif
{
if (showit)
gtk_widget_show(widget);
@@ -6336,11 +6034,7 @@ gui_mch_beep(void)
{
GdkDisplay *display;
#if GTK_CHECK_VERSION(3,0,0)
if (gui.mainwin != NULL && gtk_widget_get_realized(gui.mainwin))
#else
if (gui.mainwin != NULL && GTK_WIDGET_REALIZED(gui.mainwin))
#endif
display = gtk_widget_get_display(gui.mainwin);
else
display = gdk_display_get_default();
@@ -6700,11 +6394,7 @@ theend:
void
gui_mch_flush(void)
{
#if GTK_CHECK_VERSION(3,0,0)
if (gui.mainwin != NULL && gtk_widget_get_realized(gui.mainwin))
#else
if (gui.mainwin != NULL && GTK_WIDGET_REALIZED(gui.mainwin))
#endif
gdk_display_flush(gtk_widget_get_display(gui.mainwin));
}
@@ -7060,11 +6750,7 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey)
gui_mch_menu_hidden(menu, FALSE);
/* Be clever about bitfields versus true booleans here! */
# if GTK_CHECK_VERSION(3,0,0)
if (!gtk_widget_get_sensitive(menu->id) == !grey)
# else
if (!GTK_WIDGET_SENSITIVE(menu->id) == !grey)
# endif
{
gtk_widget_set_sensitive(menu->id, !grey);
gui_mch_update();
@@ -7082,11 +6768,7 @@ gui_mch_menu_hidden(vimmenu_T *menu, int hidden)
if (hidden)
{
# if GTK_CHECK_VERSION(3,0,0)
if (gtk_widget_get_visible(menu->id))
# else
if (GTK_WIDGET_VISIBLE(menu->id))
# endif
{
gtk_widget_hide(menu->id);
gui_mch_update();
@@ -7094,11 +6776,7 @@ gui_mch_menu_hidden(vimmenu_T *menu, int hidden)
}
else
{
# if GTK_CHECK_VERSION(3,0,0)
if (!gtk_widget_get_visible(menu->id))
# else
if (!GTK_WIDGET_VISIBLE(menu->id))
# endif
{
gtk_widget_show(menu->id);
gui_mch_update();
@@ -7126,15 +6804,7 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
if (sb->id == NULL)
return;
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_visible(sb->id, flag);
#else
if (flag)
gtk_widget_show(sb->id);
else
gtk_widget_hide(sb->id);
#endif
update_window_manager_hints(0, 0);
}
@@ -7166,11 +6836,7 @@ gui_mch_get_rgb(guicolor_T pixel)
void
gui_mch_getmouse(int *x, int *y)
{
#if GTK_CHECK_VERSION(3,0,0)
gui_gtk_get_pointer(gui.drawarea, x, y, NULL);
#else
gdk_window_get_pointer(gui.drawarea->window, x, y, NULL);
#endif
}
void
+5 -1
View File
@@ -7,6 +7,10 @@ rem For x86 builds run this without options:
rem msvc2015
rem For x64 builds run this with "x86_amd64" option:
rem msvc2015 x86_amd64
rem This works on any editions including Express edition.
rem If you use Community (or Professional) edition, you can also use "x64"
rem option:
rem msvc2015 x64
@echo on
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %*
@@ -23,7 +27,7 @@ if not exist "%WinSdk71%" (
)
set INCLUDE=%WinSdk71%\Include;%INCLUDE%
if "%Platform%"=="x64" (
if /i "%Platform%"=="x64" (
set "LIB=%WinSdk71%\Lib\x64;%LIB%"
set SUBSYSTEM_VER=5.02
) else (
+111 -114
View File
@@ -136,18 +136,17 @@ static efm_T *fmt_start = NULL; /* cached across qf_parse_line() calls */
static void qf_new_list(qf_info_T *qi, char_u *qf_title);
static int qf_add_entry(qf_info_T *qi, int qf_idx, char_u *dir, char_u *fname, char_u *module, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid);
static void qf_free(qf_info_T *qi, int idx);
static void qf_free(qf_list_T *qfl);
static char_u *qf_types(int, int);
static int qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *, char_u *);
static char_u *qf_push_dir(char_u *, struct dir_stack_T **, int is_file_stack);
static char_u *qf_pop_dir(struct dir_stack_T **);
static char_u *qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *);
static char_u *qf_guess_filepath(qf_list_T *qfl, char_u *);
static void qf_fmt_text(char_u *text, char_u *buf, int bufsize);
static int qf_win_pos_update(qf_info_T *qi, int old_qf_index);
static win_T *qf_find_win(qf_info_T *qi);
static buf_T *qf_find_buf(qf_info_T *qi);
static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last);
static void qf_set_title_var(qf_info_T *qi);
static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last);
static char_u *get_mef_name(void);
static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir);
@@ -1757,7 +1756,7 @@ error2:
if (!adding)
{
/* Error when creating a new list. Free the new list */
qf_free(qi, qi->qf_curlist);
qf_free(&qi->qf_lists[qi->qf_curlist]);
qi->qf_listcount--;
if (qi->qf_curlist > 0)
--qi->qf_curlist;
@@ -1802,15 +1801,15 @@ qf_init(win_T *wp,
* Prepends ':' to the title.
*/
static void
qf_store_title(qf_info_T *qi, int qf_idx, char_u *title)
qf_store_title(qf_list_T *qfl, char_u *title)
{
VIM_CLEAR(qi->qf_lists[qf_idx].qf_title);
VIM_CLEAR(qfl->qf_title);
if (title != NULL)
{
char_u *p = alloc((int)STRLEN(title) + 2);
qi->qf_lists[qf_idx].qf_title = p;
qfl->qf_title = p;
if (p != NULL)
STRCPY(p, title);
}
@@ -1847,7 +1846,7 @@ qf_new_list(qf_info_T *qi, char_u *qf_title)
* way with ":grep'.
*/
while (qi->qf_listcount > qi->qf_curlist + 1)
qf_free(qi, --qi->qf_listcount);
qf_free(&qi->qf_lists[--qi->qf_listcount]);
/*
* When the stack is full, remove to oldest entry
@@ -1855,7 +1854,7 @@ qf_new_list(qf_info_T *qi, char_u *qf_title)
*/
if (qi->qf_listcount == LISTCOUNT)
{
qf_free(qi, 0);
qf_free(&qi->qf_lists[0]);
for (i = 1; i < LISTCOUNT; ++i)
qi->qf_lists[i - 1] = qi->qf_lists[i];
qi->qf_curlist = LISTCOUNT - 1;
@@ -1863,12 +1862,12 @@ qf_new_list(qf_info_T *qi, char_u *qf_title)
else
qi->qf_curlist = qi->qf_listcount++;
vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T)));
qf_store_title(qi, qi->qf_curlist, qf_title);
qf_store_title(&qi->qf_lists[qi->qf_curlist], qf_title);
qi->qf_lists[qi->qf_curlist].qf_id = ++last_qf_id;
}
/*
* Free a location list
* Free a location list stack
*/
static void
ll_free_all(qf_info_T **pqi)
@@ -1886,7 +1885,7 @@ ll_free_all(qf_info_T **pqi)
{
/* No references to this location list */
for (i = 0; i < qi->qf_listcount; ++i)
qf_free(qi, i);
qf_free(&qi->qf_lists[i]);
vim_free(qi);
}
}
@@ -1909,7 +1908,7 @@ qf_free_all(win_T *wp)
else
/* quickfix list */
for (i = 0; i < qi->qf_listcount; ++i)
qf_free(qi, i);
qf_free(&qi->qf_lists[i]);
}
/*
@@ -1933,6 +1932,7 @@ qf_add_entry(
int type, /* type character */
int valid) /* valid entry */
{
qf_list_T *qfl = &qi->qf_lists[qf_idx];
qfline_T *qfp;
qfline_T **lastp; /* pointer to qf_last or NULL */
@@ -1980,12 +1980,12 @@ qf_add_entry(
qfp->qf_type = type;
qfp->qf_valid = valid;
lastp = &qi->qf_lists[qf_idx].qf_last;
lastp = &qfl->qf_last;
if (qf_list_empty(qi, qf_idx)) /* first element in the list */
{
qi->qf_lists[qf_idx].qf_start = qfp;
qi->qf_lists[qf_idx].qf_ptr = qfp;
qi->qf_lists[qf_idx].qf_index = 0;
qfl->qf_start = qfp;
qfl->qf_ptr = qfp;
qfl->qf_index = 0;
qfp->qf_prev = NULL;
}
else
@@ -1996,20 +1996,19 @@ qf_add_entry(
qfp->qf_next = NULL;
qfp->qf_cleared = FALSE;
*lastp = qfp;
++qi->qf_lists[qf_idx].qf_count;
if (qi->qf_lists[qf_idx].qf_index == 0 && qfp->qf_valid)
++qfl->qf_count;
if (qfl->qf_index == 0 && qfp->qf_valid)
/* first valid entry */
{
qi->qf_lists[qf_idx].qf_index =
qi->qf_lists[qf_idx].qf_count;
qi->qf_lists[qf_idx].qf_ptr = qfp;
qfl->qf_index = qfl->qf_count;
qfl->qf_ptr = qfp;
}
return OK;
}
/*
* Allocate a new location list
* Allocate a new location list stack
*/
static qf_info_T *
ll_new_list(void)
@@ -2023,8 +2022,8 @@ ll_new_list(void)
}
/*
* Return the location list for window 'wp'.
* If not present, allocate a location list
* Return the location list stack for window 'wp'.
* If not present, allocate a location list stack
*/
static qf_info_T *
ll_get_or_alloc_list(win_T *wp)
@@ -2197,7 +2196,7 @@ qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *directory, char_u *fname)
if (mch_getperm(ptr) < 0)
{
vim_free(ptr);
directory = qf_guess_filepath(qi, qf_idx, fname);
directory = qf_guess_filepath(&qi->qf_lists[qf_idx], fname);
if (directory)
ptr = concat_fnames(directory, fname, TRUE);
else
@@ -2365,12 +2364,11 @@ qf_clean_dir_stack(struct dir_stack_T **stackptr)
* qf_guess_filepath will return NULL.
*/
static char_u *
qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *filename)
qf_guess_filepath(qf_list_T *qfl, char_u *filename)
{
struct dir_stack_T *ds_ptr;
struct dir_stack_T *ds_tmp;
char_u *fullname;
qf_list_T *qfl = &qi->qf_lists[qf_idx];
/* no dirs on the stack - there's nothing we can do */
if (qfl->qf_dir_stack == NULL)
@@ -2436,14 +2434,11 @@ qflist_valid (win_T *wp, int_u qf_id)
* Similar to location list.
*/
static int
is_qf_entry_present(qf_info_T *qi, qfline_T *qf_ptr)
is_qf_entry_present(qf_list_T *qfl, qfline_T *qf_ptr)
{
qf_list_T *qfl;
qfline_T *qfp;
int i;
qfl = &qi->qf_lists[qi->qf_curlist];
/* Search for the entry in the current list */
for (i = 0, qfp = qfl->qf_start; i < qfl->qf_count;
++i, qfp = qfp->qf_next)
@@ -2462,7 +2457,7 @@ is_qf_entry_present(qf_info_T *qi, qfline_T *qf_ptr)
*/
static qfline_T *
get_next_valid_entry(
qf_info_T *qi,
qf_list_T *qfl,
qfline_T *qf_ptr,
int *qf_index,
int dir)
@@ -2475,13 +2470,11 @@ get_next_valid_entry(
do
{
if (idx == qi->qf_lists[qi->qf_curlist].qf_count
|| qf_ptr->qf_next == NULL)
if (idx == qfl->qf_count || qf_ptr->qf_next == NULL)
return NULL;
++idx;
qf_ptr = qf_ptr->qf_next;
} while ((!qi->qf_lists[qi->qf_curlist].qf_nonevalid
&& !qf_ptr->qf_valid)
} while ((!qfl->qf_nonevalid && !qf_ptr->qf_valid)
|| (dir == FORWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum));
*qf_index = idx;
@@ -2494,7 +2487,7 @@ get_next_valid_entry(
*/
static qfline_T *
get_prev_valid_entry(
qf_info_T *qi,
qf_list_T *qfl,
qfline_T *qf_ptr,
int *qf_index,
int dir)
@@ -2511,8 +2504,7 @@ get_prev_valid_entry(
return NULL;
--idx;
qf_ptr = qf_ptr->qf_prev;
} while ((!qi->qf_lists[qi->qf_curlist].qf_nonevalid
&& !qf_ptr->qf_valid)
} while ((!qfl->qf_nonevalid && !qf_ptr->qf_valid)
|| (dir == BACKWARD_FILE && qf_ptr->qf_fnum == old_qf_fnum));
*qf_index = idx;
@@ -2527,7 +2519,7 @@ get_prev_valid_entry(
*/
static qfline_T *
get_nth_valid_entry(
qf_info_T *qi,
qf_list_T *qfl,
int errornr,
qfline_T *qf_ptr,
int *qf_index,
@@ -2544,9 +2536,9 @@ get_nth_valid_entry(
prev_index = *qf_index;
if (dir == FORWARD || dir == FORWARD_FILE)
qf_ptr = get_next_valid_entry(qi, qf_ptr, qf_index, dir);
qf_ptr = get_next_valid_entry(qfl, qf_ptr, qf_index, dir);
else
qf_ptr = get_prev_valid_entry(qi, qf_ptr, qf_index, dir);
qf_ptr = get_prev_valid_entry(qfl, qf_ptr, qf_index, dir);
if (qf_ptr == NULL)
{
qf_ptr = prev_qf_ptr;
@@ -2570,7 +2562,7 @@ get_nth_valid_entry(
*/
static qfline_T *
get_nth_entry(
qf_info_T *qi,
qf_list_T *qfl,
int errornr,
qfline_T *qf_ptr,
int *cur_qfidx)
@@ -2584,9 +2576,8 @@ get_nth_entry(
qf_ptr = qf_ptr->qf_prev;
}
/* New error number is greater than the current error number */
while (errornr > qf_idx &&
qf_idx < qi->qf_lists[qi->qf_curlist].qf_count &&
qf_ptr->qf_next != NULL)
while (errornr > qf_idx && qf_idx < qfl->qf_count &&
qf_ptr->qf_next != NULL)
{
++qf_idx;
qf_ptr = qf_ptr->qf_next;
@@ -2784,9 +2775,10 @@ qf_goto_win_with_ll_file(win_T *use_win, int qf_fnum, qf_info_T *ll_ref)
}
/*
* Go to a window that shows the specified file. If a window is not found, go
* to the window just above the quickfix window. This is used for opening a
* file from a quickfix window and not from a location window.
* Go to a window that contains the specified buffer 'qf_fnum'. If a window is
* not found, then go to the window just above the quickfix window. This is
* used for opening a file from a quickfix window and not from a location
* window.
*/
static void
qf_goto_win_with_qfl_file(int qf_fnum)
@@ -2899,6 +2891,7 @@ qf_jump_edit_buffer(
int *opened_window,
int *abort)
{
qf_list_T *qfl = &qi->qf_lists[qi->qf_curlist];
int retval = OK;
if (qf_ptr->qf_type == 1)
@@ -2918,7 +2911,7 @@ qf_jump_edit_buffer(
else
{
int old_qf_curlist = qi->qf_curlist;
int save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
int save_qfid = qfl->qf_id;
retval = buflist_getfile(qf_ptr->qf_fnum,
(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
@@ -2942,7 +2935,7 @@ qf_jump_edit_buffer(
}
}
else if (old_qf_curlist != qi->qf_curlist
|| !is_qf_entry_present(qi, qf_ptr))
|| !is_qf_entry_present(qfl, qf_ptr))
{
if (IS_QF_STACK(qi))
EMSG(_("E925: Current quickfix was changed"));
@@ -3087,6 +3080,7 @@ qf_jump(qf_info_T *qi,
int errornr,
int forceit)
{
qf_list_T *qfl;
qfline_T *qf_ptr;
qfline_T *old_qf_ptr;
int qf_index;
@@ -3113,13 +3107,15 @@ qf_jump(qf_info_T *qi,
return;
}
qf_ptr = qi->qf_lists[qi->qf_curlist].qf_ptr;
qfl = &qi->qf_lists[qi->qf_curlist];
qf_ptr = qfl->qf_ptr;
old_qf_ptr = qf_ptr;
qf_index = qi->qf_lists[qi->qf_curlist].qf_index;
qf_index = qfl->qf_index;
old_qf_index = qf_index;
if (dir != 0) /* next/prev valid entry */
{
qf_ptr = get_nth_valid_entry(qi, errornr, qf_ptr, &qf_index, dir);
qf_ptr = get_nth_valid_entry(qfl, errornr, qf_ptr, &qf_index, dir);
if (qf_ptr == NULL)
{
qf_ptr = old_qf_ptr;
@@ -3128,9 +3124,9 @@ qf_jump(qf_info_T *qi,
}
}
else if (errornr != 0) /* go to specified number */
qf_ptr = get_nth_entry(qi, errornr, qf_ptr, &qf_index);
qf_ptr = get_nth_entry(qfl, errornr, qf_ptr, &qf_index);
qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
qfl->qf_index = qf_index;
if (qf_win_pos_update(qi, old_qf_index))
/* No need to print the error message if it's visible in the error
* window */
@@ -3215,8 +3211,8 @@ failed:
theend:
if (qi != NULL)
{
qi->qf_lists[qi->qf_curlist].qf_ptr = qf_ptr;
qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
qfl->qf_ptr = qf_ptr;
qfl->qf_index = qf_index;
}
if (p_swb != old_swb && opened_window)
{
@@ -3242,9 +3238,11 @@ static int qfLineAttr;
/*
* Display information about a single entry from the quickfix/location list.
* Used by ":clist/:llist" commands.
* 'cursel' will be set to TRUE for the currently selected entry in the
* quickfix list.
*/
static void
qf_list_entry(qf_info_T *qi, qfline_T *qfp, int qf_idx)
qf_list_entry(qfline_T *qfp, int qf_idx, int cursel)
{
char_u *fname;
buf_T *buf;
@@ -3285,8 +3283,7 @@ qf_list_entry(qf_info_T *qi, qfline_T *qfp, int qf_idx)
return;
msg_putchar('\n');
msg_outtrans_attr(IObuff, qf_idx == qi->qf_lists[qi->qf_curlist].qf_index
? HL_ATTR(HLF_QFL) : qfFileAttr);
msg_outtrans_attr(IObuff, cursel ? HL_ATTR(HLF_QFL) : qfFileAttr);
if (qfp->qf_lnum != 0)
msg_puts_attr((char_u *)":", qfSepAttr);
@@ -3326,6 +3323,7 @@ qf_list_entry(qf_info_T *qi, qfline_T *qfp, int qf_idx)
void
qf_list(exarg_T *eap)
{
qf_list_T *qfl;
qfline_T *qfp;
int i;
int idx1 = 1;
@@ -3362,15 +3360,16 @@ qf_list(exarg_T *eap)
EMSG(_(e_trailing));
return;
}
qfl = &qi->qf_lists[qi->qf_curlist];
if (plus)
{
i = qi->qf_lists[qi->qf_curlist].qf_index;
i = qfl->qf_index;
idx2 = i + idx1;
idx1 = i;
}
else
{
i = qi->qf_lists[qi->qf_curlist].qf_count;
i = qfl->qf_count;
if (idx1 < 0)
idx1 = (-idx1 > i) ? 0 : idx1 + i + 1;
if (idx2 < 0)
@@ -3394,17 +3393,17 @@ qf_list(exarg_T *eap)
if (qfLineAttr == 0)
qfLineAttr = HL_ATTR(HLF_N);
if (qi->qf_lists[qi->qf_curlist].qf_nonevalid)
if (qfl->qf_nonevalid)
all = TRUE;
qfp = qi->qf_lists[qi->qf_curlist].qf_start;
for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; )
qfp = qfl->qf_start;
for (i = 1; !got_int && i <= qfl->qf_count; )
{
if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
{
if (got_int)
break;
qf_list_entry(qi, qfp, i);
qf_list_entry(qfp, i, i == qfl->qf_index);
}
qfp = qfp->qf_next;
@@ -3547,12 +3546,11 @@ qf_history(exarg_T *eap)
* associated with the list like context and title are not freed.
*/
static void
qf_free_items(qf_info_T *qi, int idx)
qf_free_items(qf_list_T *qfl)
{
qfline_T *qfp;
qfline_T *qfpnext;
int stop = FALSE;
qf_list_T *qfl = &qi->qf_lists[idx];
while (qfl->qf_count && qfl->qf_start != NULL)
{
@@ -3595,11 +3593,9 @@ qf_free_items(qf_info_T *qi, int idx)
* associated context information and the title.
*/
static void
qf_free(qf_info_T *qi, int idx)
qf_free(qf_list_T *qfl)
{
qf_list_T *qfl = &qi->qf_lists[idx];
qf_free_items(qi, idx);
qf_free_items(qfl);
VIM_CLEAR(qfl->qf_title);
free_tv(qfl->qf_ctx);
@@ -3800,6 +3796,16 @@ ex_cclose(exarg_T *eap)
win_close(win, FALSE);
}
/*
* Set "w:quickfix_title" if "qi" has a title.
*/
static void
qf_set_title_var(qf_list_T *qfl)
{
if (qfl->qf_title != NULL)
set_internal_string_var((char_u *)"w:quickfix_title", qfl->qf_title);
}
/*
* ":copen": open a window that shows the list of errors.
* ":lopen": open a window that shows the location list.
@@ -3919,7 +3925,7 @@ ex_copen(exarg_T *eap)
prevwin = win;
}
qf_set_title_var(qi);
qf_set_title_var(&qi->qf_lists[qi->qf_curlist]);
/*
* Fill the buffer with the quickfix list.
@@ -4033,7 +4039,7 @@ qf_win_pos_update(
/*
* Check whether the given window is displaying the specified quickfix/location
* list buffer
* stack.
*/
static int
is_qf_win(win_T *win, qf_info_T *qi)
@@ -4053,7 +4059,7 @@ is_qf_win(win_T *win, qf_info_T *qi)
}
/*
* Find a window displaying the quickfix/location list 'qi'
* Find a window displaying the quickfix/location stack 'qi'
* Only searches in the current tabpage.
*/
static win_T *
@@ -4097,7 +4103,7 @@ qf_update_win_titlevar(qf_info_T *qi)
{
curwin_save = curwin;
curwin = win;
qf_set_title_var(qi);
qf_set_title_var(&qi->qf_lists[qi->qf_curlist]);
curwin = curwin_save;
}
}
@@ -4142,17 +4148,6 @@ qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
}
}
/*
* Set "w:quickfix_title" if "qi" has a title.
*/
static void
qf_set_title_var(qf_info_T *qi)
{
if (qi->qf_lists[qi->qf_curlist].qf_title != NULL)
set_internal_string_var((char_u *)"w:quickfix_title",
qi->qf_lists[qi->qf_curlist].qf_title);
}
/*
* Add an error line to the quickfix buffer.
*/
@@ -4679,9 +4674,8 @@ qf_get_cur_valid_idx(exarg_T *eap)
* For :cfdo and :lfdo returns the 'n'th valid file entry.
*/
static int
qf_get_nth_valid_entry(qf_info_T *qi, int n, int fdo)
qf_get_nth_valid_entry(qf_list_T *qfl, int n, int fdo)
{
qf_list_T *qfl = &qi->qf_lists[qi->qf_curlist];
qfline_T *qfp = qfl->qf_start;
int i, eidx;
int prev_fnum = 0;
@@ -4762,7 +4756,7 @@ ex_cc(exarg_T *eap)
*/
if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo
|| eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo)
errornr = qf_get_nth_valid_entry(qi,
errornr = qf_get_nth_valid_entry(&qi->qf_lists[qi->qf_curlist],
eap->addr_count > 0 ? (int)eap->line1 : 1,
eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo);
@@ -5712,7 +5706,7 @@ qf_get_list_from_lines(dict_T *what, dictitem_T *di, dict_T *retdict)
TRUE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0)
{
(void)get_errorlist(qi, NULL, 0, l);
qf_free(qi, 0);
qf_free(&qi->qf_lists[0]);
}
free(qi);
}
@@ -5983,6 +5977,7 @@ qf_getprop_idx(qf_info_T *qi, int qf_idx, dict_T *retdict)
qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict)
{
qf_info_T *qi = &ql_info;
qf_list_T *qfl;
int status = OK;
int qf_idx;
dictitem_T *di;
@@ -6003,6 +5998,8 @@ qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict)
if (qi == NULL || qi->qf_listcount == 0 || qf_idx == INVALID_QFIDX)
return qf_getprop_defaults(qi, flags, retdict);
qfl = &qi->qf_lists[qf_idx];
if (flags & QF_GETLIST_TITLE)
status = qf_getprop_title(qi, qf_idx, retdict);
if ((status == OK) && (flags & QF_GETLIST_NR))
@@ -6014,15 +6011,13 @@ qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict)
if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
status = qf_getprop_ctx(qi, qf_idx, retdict);
if ((status == OK) && (flags & QF_GETLIST_ID))
status = dict_add_number(retdict, "id", qi->qf_lists[qf_idx].qf_id);
status = dict_add_number(retdict, "id", qfl->qf_id);
if ((status == OK) && (flags & QF_GETLIST_IDX))
status = qf_getprop_idx(qi, qf_idx, retdict);
if ((status == OK) && (flags & QF_GETLIST_SIZE))
status = dict_add_number(retdict, "size",
qi->qf_lists[qf_idx].qf_count);
status = dict_add_number(retdict, "size", qfl->qf_count);
if ((status == OK) && (flags & QF_GETLIST_TICK))
status = dict_add_number(retdict, "changedtick",
qi->qf_lists[qf_idx].qf_changedtick);
status = dict_add_number(retdict, "changedtick", qfl->qf_changedtick);
if ((status == OK) && (wp != NULL) && (flags & QF_GETLIST_FILEWINID))
status = qf_getprop_filewinid(wp, qi, retdict);
@@ -6118,6 +6113,7 @@ qf_add_entries(
char_u *title,
int action)
{
qf_list_T *qfl = &qi->qf_lists[qf_idx];
listitem_T *li;
dict_T *d;
qfline_T *old_last = NULL;
@@ -6128,14 +6124,15 @@ qf_add_entries(
/* make place for a new list */
qf_new_list(qi, title);
qf_idx = qi->qf_curlist;
qfl = &qi->qf_lists[qf_idx];
}
else if (action == 'a' && !qf_list_empty(qi, qf_idx))
/* Adding to existing list, use last entry. */
old_last = qi->qf_lists[qf_idx].qf_last;
old_last = qfl->qf_last;
else if (action == 'r')
{
qf_free_items(qi, qf_idx);
qf_store_title(qi, qf_idx, title);
qf_free_items(qfl);
qf_store_title(qfl, title);
}
for (li = list->lv_first; li != NULL; li = li->li_next)
@@ -6152,17 +6149,16 @@ qf_add_entries(
break;
}
if (qi->qf_lists[qf_idx].qf_index == 0)
if (qfl->qf_index == 0)
/* no valid entry */
qi->qf_lists[qf_idx].qf_nonevalid = TRUE;
qfl->qf_nonevalid = TRUE;
else
qi->qf_lists[qf_idx].qf_nonevalid = FALSE;
qfl->qf_nonevalid = FALSE;
if (action != 'a')
{
qi->qf_lists[qf_idx].qf_ptr =
qi->qf_lists[qf_idx].qf_start;
qfl->qf_ptr = qfl->qf_start;
if (!qf_list_empty(qi, qf_idx))
qi->qf_lists[qf_idx].qf_index = 1;
qfl->qf_index = 1;
}
/* Don't update the cursor in quickfix window when appending entries */
@@ -6302,7 +6298,7 @@ qf_setprop_items_from_lines(
return FAIL;
if (action == 'r')
qf_free_items(qi, qf_idx);
qf_free_items(&qi->qf_lists[qf_idx]);
if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat,
FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0)
retval = OK;
@@ -6314,15 +6310,15 @@ qf_setprop_items_from_lines(
* Set quickfix list context.
*/
static int
qf_setprop_context(qf_info_T *qi, int qf_idx, dictitem_T *di)
qf_setprop_context(qf_list_T *qfl, dictitem_T *di)
{
typval_T *ctx;
free_tv(qi->qf_lists[qf_idx].qf_ctx);
free_tv(qfl->qf_ctx);
ctx = alloc_tv();
if (ctx != NULL)
copy_tv(&di->di_tv, ctx);
qi->qf_lists[qf_idx].qf_ctx = ctx;
qfl->qf_ctx = ctx;
return OK;
}
@@ -6361,7 +6357,7 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action, char_u *title)
if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL)
retval = qf_setprop_items_from_lines(qi, qf_idx, what, di, action);
if ((di = dict_find(what, (char_u *)"context", -1)) != NULL)
retval = qf_setprop_context(qi, qf_idx, di);
retval = qf_setprop_context(&qi->qf_lists[qf_idx], di);
if (retval == OK)
qf_list_changed(qi, qf_idx);
@@ -6370,7 +6366,8 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action, char_u *title)
}
/*
* Find the non-location list window with the specified location list.
* Find the non-location list window with the specified location list in the
* current tabpage.
*/
static win_T *
find_win_with_ll(qf_info_T *qi)
@@ -6399,7 +6396,7 @@ qf_free_stack(win_T *wp, qf_info_T *qi)
{
/* If the quickfix/location list window is open, then clear it */
if (qi->qf_curlist < qi->qf_listcount)
qf_free(qi, qi->qf_curlist);
qf_free(&qi->qf_lists[qi->qf_curlist]);
qf_update_buffer(qi, NULL);
}
+7
View File
@@ -411,3 +411,10 @@ func Test_arg_all_expand()
call assert_equal('notexist Xx\ x runtest.vim', expand('##'))
call delete('Xx x')
endfunc
func Test_large_arg()
" Argument longer or equal to the number of columns used to cause
" access to invalid memory.
exe 'argadd ' .repeat('x', &columns)
args
endfunc
+64 -1
View File
@@ -199,7 +199,7 @@ func Test_o_arg()
" - both windows should have the same height
" - window height (+ 2 for the statusline and Ex command) should be equal
" to the number of lines
" - buffer of both windowns should have no name
" - buffer of both windows should have no name
let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
call assert_equal('2', wn)
call assert_inrange(0, 1, ww1 - ww2)
@@ -225,6 +225,69 @@ func Test_o_arg()
call delete('Xtestout')
endfunc
" Test the -p[N] argument to open N tabpages.
func Test_p_arg()
let after = [
\ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")',
\ 'qall',
\ ]
if RunVim([], after, '-p2')
let lines = readfile('Xtestout')
call assert_equal(4, len(lines))
call assert_equal('Tab page 1', lines[0])
call assert_equal('> [No Name]', lines[1])
call assert_equal('Tab page 2', lines[2])
call assert_equal(' [No Name]', lines[3])
endif
if RunVim([], after, '-p foo bar')
let lines = readfile('Xtestout')
call assert_equal(4, len(lines))
call assert_equal('Tab page 1', lines[0])
call assert_equal('> foo', lines[1])
call assert_equal('Tab page 2', lines[2])
call assert_equal(' bar', lines[3])
endif
call delete('Xtestout')
endfunc
" Test the -V[N] argument to set the 'version' option to [N]
func Test_V_arg()
let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq')
call assert_equal(" verbose=0\n", out)
let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq')
call assert_match("^sourcing \"$VIMRUNTIME/defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n verbose=2\n$", out)
let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq')
call assert_match("\+*\nsourcing \"$VIMRUNTIME/defaults\.vim\"\r\nline 1: \" The default vimrc file\..*\n verbose=15\n\+*", out)
endfunc
" Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes).
func Test_A_F_H_arg()
let after = [
\ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")',
\ 'qall',
\ ]
if has('arabic') && RunVim([], after, '-A')
let lines = readfile('Xtestout')
call assert_equal(['1', '1', '0', '0'], lines)
endif
if has('farsi') && RunVim([], after, '-F')
let lines = readfile('Xtestout')
call assert_equal(['1', '0', '1', '0'], lines)
endif
if has('rightleft') && RunVim([], after, '-H')
let lines = readfile('Xtestout')
call assert_equal(['1', '0', '0', '1'], lines)
endif
call delete('Xtestout')
endfunc
func Test_file_args()
let after = [
\ 'call writefile(argv(), "Xtestout")',
+15 -1
View File
@@ -809,6 +809,20 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
408,
/**/
407,
/**/
406,
/**/
405,
/**/
404,
/**/
403,
/**/
402,
/**/
401,
/**/
@@ -1736,7 +1750,7 @@ list_in_columns(char_u **items, int size, int current)
if (Columns < width)
{
/* Not enough screen columns - show one per line */
for (i = 0; items[i] != NULL; ++i)
for (i = 0; i < item_count; ++i)
{
version_msg_wrap(items[i], i == current);
if (msg_col > 0)
+49
View File
@@ -2332,6 +2332,55 @@ typedef enum {
#ifdef FEAT_GUI_GTK
# if !GTK_CHECK_VERSION(2,14,0)
# define gtk_widget_get_window(wid) ((wid)->window)
# define gtk_plug_get_socket_window(wid) ((wid)->socket_window)
# define gtk_selection_data_get_data(sel) ((sel)->data)
# define gtk_selection_data_get_data_type(sel) ((sel)->type)
# define gtk_selection_data_get_format(sel) ((sel)->format)
# define gtk_selection_data_get_length(sel) ((sel)->length)
# define gtk_adjustment_set_lower(adj, low) \
do { (adj)->lower = low; } while (0)
# define gtk_adjustment_set_upper(adj, up) \
do { (adj)->upper = up; } while (0)
# define gtk_adjustment_set_page_size(adj, size) \
do { (adj)->page_size = size; } while (0)
# define gtk_adjustment_set_page_increment(adj, inc) \
do { (adj)->page_increment = inc; } while (0)
# define gtk_adjustment_set_step_increment(adj, inc) \
do { (adj)->step_increment = inc; } while (0)
# endif
# if !GTK_CHECK_VERSION(2,16,0)
# define gtk_selection_data_get_selection(sel) ((sel)->selection)
# endif
# if !GTK_CHECK_VERSION(2,18,0)
# define gtk_widget_get_allocation(wid, alloc) \
do { *(alloc) = (wid)->allocation; } while (0)
# define gtk_widget_set_allocation(wid, alloc) \
do { (wid)->allocation = *(alloc); } while (0)
# define gtk_widget_get_has_window(wid) !GTK_WIDGET_NO_WINDOW(wid)
# define gtk_widget_get_sensitive(wid) GTK_WIDGET_SENSITIVE(wid)
# define gtk_widget_get_visible(wid) GTK_WIDGET_VISIBLE(wid)
# define gtk_widget_has_focus(wid) GTK_WIDGET_HAS_FOCUS(wid)
# define gtk_widget_set_window(wid, win) \
do { (wid)->window = (win); } while (0)
# define gtk_widget_set_can_default(wid, can) \
do { if (can) { GTK_WIDGET_SET_FLAGS(wid, GTK_CAN_DEFAULT); } \
else { GTK_WIDGET_UNSET_FLAGS(wid, GTK_CAN_DEFAULT); } } while (0)
# define gtk_widget_set_can_focus(wid, can) \
do { if (can) { GTK_WIDGET_SET_FLAGS(wid, GTK_CAN_FOCUS); } \
else { GTK_WIDGET_UNSET_FLAGS(wid, GTK_CAN_FOCUS); } } while (0)
# define gtk_widget_set_visible(wid, vis) \
do { if (vis) { gtk_widget_show(wid); } \
else { gtk_widget_hide(wid); } } while (0)
# endif
# if !GTK_CHECK_VERSION(2,20,0)
# define gtk_widget_get_mapped(wid) GTK_WIDGET_MAPPED(wid)
# define gtk_widget_get_realized(wid) GTK_WIDGET_REALIZED(wid)
# define gtk_widget_set_mapped(wid, map) \
do { if (map) { GTK_WIDGET_SET_FLAGS(wid, GTK_MAPPED); } \
else { GTK_WIDGET_UNSET_FLAGS(wid, GTK_MAPPED); } } while (0)
# define gtk_widget_set_realized(wid, rea) \
do { if (rea) { GTK_WIDGET_SET_FLAGS(wid, GTK_REALIZED); } \
else { GTK_WIDGET_UNSET_FLAGS(wid, GTK_REALIZED); } } while (0)
# endif
#endif