summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-11 19:01:06 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-11 19:01:06 +0200
commita3f41662865d5a0582c4ccd22a38317907b59154 (patch)
tree3960311239d33ba11640a1b99576a8b9deffe6d6
parentcabf20199ae4c645c07d7f2a765b3b13b66d56a8 (diff)
downloadvim-git-a3f41662865d5a0582c4ccd22a38317907b59154.tar.gz
Avoid use of the GTK mail_loop() so that the GtkFileChooser can be used.
(James Vega)
-rw-r--r--runtime/doc/options.txt2
-rw-r--r--runtime/doc/tags32
-rw-r--r--runtime/doc/todo.txt1
-rw-r--r--runtime/doc/usr_41.txt42
-rw-r--r--src/gui_gtk.c29
-rw-r--r--src/gui_gtk_x11.c62
6 files changed, 67 insertions, 101 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index ca34f7c4d..cf3738763 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4919,7 +4919,7 @@ A jump table for the options with a short description can be found at |Q_op|.
respectively; see |CTRL-A| for more info on these commands.
alpha If included, single alphabetical characters will be
incremented or decremented. This is useful for a list with a
- letter index a), b), etc. *octal*
+ letter index a), b), etc. *octal-number*
octal If included, numbers that start with a zero will be considered
to be octal. Example: Using CTRL-A on "007" results in "010".
hex If included, numbers starting with "0x" or "0X" will be
diff --git a/runtime/doc/tags b/runtime/doc/tags
index fe515e22f..c105b967a 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -4193,6 +4193,7 @@ E83 message.txt /*E83*
E830 undo.txt /*E830*
E831 editing.txt /*E831*
E832 undo.txt /*E832*
+E833 editing.txt /*E833*
E84 windows.txt /*E84*
E85 options.txt /*E85*
E86 windows.txt /*E86*
@@ -4651,6 +4652,7 @@ aquote motion.txt /*aquote*
arabic.txt arabic.txt /*arabic.txt*
arabicfonts arabic.txt /*arabicfonts*
arabickeymap arabic.txt /*arabickeymap*
+arg-functions usr_41.txt /*arg-functions*
argc() eval.txt /*argc()*
argidx() eval.txt /*argidx()*
arglist editing.txt /*arglist*
@@ -4758,6 +4760,7 @@ browse() eval.txt /*browse()*
browsedir() eval.txt /*browsedir()*
browsefilter editing.txt /*browsefilter*
bufexists() eval.txt /*bufexists()*
+buffer-functions usr_41.txt /*buffer-functions*
buffer-hidden windows.txt /*buffer-hidden*
buffer-list windows.txt /*buffer-list*
buffer-variable eval.txt /*buffer-variable*
@@ -4935,6 +4938,7 @@ collapse tips.txt /*collapse*
color-xterm syntax.txt /*color-xterm*
coloring syntax.txt /*coloring*
colortest.vim syntax.txt /*colortest.vim*
+command-line-functions usr_41.txt /*command-line-functions*
command-line-window cmdline.txt /*command-line-window*
command-mode intro.txt /*command-mode*
compatible-default starting.txt /*compatible-default*
@@ -4972,6 +4976,7 @@ complete_CTRL-E insert.txt /*complete_CTRL-E*
complete_CTRL-Y insert.txt /*complete_CTRL-Y*
complete_add() eval.txt /*complete_add()*
complete_check() eval.txt /*complete_check()*
+completion-functions usr_41.txt /*completion-functions*
complex-change change.txt /*complex-change*
complex-repeat repeat.txt /*complex-repeat*
compress pi_gzip.txt /*compress*
@@ -5100,6 +5105,7 @@ current_compiler quickfix.txt /*current_compiler*
cursor() eval.txt /*cursor()*
cursor-blinking options.txt /*cursor-blinking*
cursor-down intro.txt /*cursor-down*
+cursor-functions usr_41.txt /*cursor-functions*
cursor-left intro.txt /*cursor-left*
cursor-motions motion.txt /*cursor-motions*
cursor-position pattern.txt /*cursor-position*
@@ -5118,6 +5124,7 @@ daW motion.txt /*daW*
dab motion.txt /*dab*
dap motion.txt /*dap*
das motion.txt /*das*
+date-functions usr_41.txt /*date-functions*
dav pi_netrw.txt /*dav*
davs pi_netrw.txt /*davs*
daw motion.txt /*daw*
@@ -5170,6 +5177,7 @@ diW motion.txt /*diW*
dialog gui_w32.txt /*dialog*
dialogs-added version5.txt /*dialogs-added*
dib motion.txt /*dib*
+dict-functions usr_41.txt /*dict-functions*
dict-identity eval.txt /*dict-identity*
dict-modification eval.txt /*dict-modification*
did_filetype() eval.txt /*did_filetype()*
@@ -5394,6 +5402,7 @@ feedkeys() eval.txt /*feedkeys()*
fetch pi_netrw.txt /*fetch*
file-browser-5.2 version5.txt /*file-browser-5.2*
file-formats editing.txt /*file-formats*
+file-functions usr_41.txt /*file-functions*
file-pattern autocmd.txt /*file-pattern*
file-read insert.txt /*file-read*
file-searching editing.txt /*file-searching*
@@ -5437,6 +5446,7 @@ fixed-7.2 version7.txt /*fixed-7.2*
fixed-7.3 version7.txt /*fixed-7.3*
flexwiki.vim syntax.txt /*flexwiki.vim*
float-e eval.txt /*float-e*
+float-functions usr_41.txt /*float-functions*
float-pi eval.txt /*float-pi*
float2nr() eval.txt /*float2nr()*
floating-point-format eval.txt /*floating-point-format*
@@ -5472,6 +5482,7 @@ foldclosedend() eval.txt /*foldclosedend()*
folddashes-variable eval.txt /*folddashes-variable*
foldend-variable eval.txt /*foldend-variable*
folding fold.txt /*folding*
+folding-functions usr_41.txt /*folding-functions*
foldlevel() eval.txt /*foldlevel()*
foldlevel-variable eval.txt /*foldlevel-variable*
folds fold.txt /*folds*
@@ -5915,6 +5926,7 @@ gui-colors syntax.txt /*gui-colors*
gui-extras gui.txt /*gui-extras*
gui-footer debugger.txt /*gui-footer*
gui-fork gui_x11.txt /*gui-fork*
+gui-functions usr_41.txt /*gui-functions*
gui-gnome gui_x11.txt /*gui-gnome*
gui-gnome-session gui_x11.txt /*gui-gnome-session*
gui-gtk gui_x11.txt /*gui-gtk*
@@ -6028,12 +6040,14 @@ highlight-stop syntax.txt /*highlight-stop*
highlight-term syntax.txt /*highlight-term*
highlightID() eval.txt /*highlightID()*
highlight_exists() eval.txt /*highlight_exists()*
+highlighting-functions usr_41.txt /*highlighting-functions*
hist-names eval.txt /*hist-names*
histadd() eval.txt /*histadd()*
histdel() eval.txt /*histdel()*
histget() eval.txt /*histget()*
histnr() eval.txt /*histnr()*
history cmdline.txt /*history*
+history-functions usr_41.txt /*history-functions*
hit-enter message.txt /*hit-enter*
hit-enter-prompt message.txt /*hit-enter-prompt*
hit-return message.txt /*hit-return*
@@ -6294,6 +6308,7 @@ install-home usr_90.txt /*install-home*
install-registry gui_w32.txt /*install-registry*
intel-itanium syntax.txt /*intel-itanium*
intellimouse-wheel-problems gui_w32.txt /*intellimouse-wheel-problems*
+interactive-functions usr_41.txt /*interactive-functions*
interfaces-5.2 version5.txt /*interfaces-5.2*
internal-variables eval.txt /*internal-variables*
internal-wordlist spell.txt /*internal-wordlist*
@@ -6316,6 +6331,8 @@ j motion.txt /*j*
java-cinoptions indent.txt /*java-cinoptions*
java-indenting indent.txt /*java-indenting*
java.vim syntax.txt /*java.vim*
+javascript-cinoptions indent.txt /*javascript-cinoptions*
+javascript-indenting indent.txt /*javascript-indenting*
join() eval.txt /*join()*
jsbterm-mouse options.txt /*jsbterm-mouse*
jtags tagsrch.txt /*jtags*
@@ -6379,6 +6396,7 @@ linewise-register change.txt /*linewise-register*
linewise-visual visual.txt /*linewise-visual*
lisp.vim syntax.txt /*lisp.vim*
lispindent() eval.txt /*lispindent()*
+list-functions usr_41.txt /*list-functions*
list-identity eval.txt /*list-identity*
list-index eval.txt /*list-index*
list-modification eval.txt /*list-modification*
@@ -6464,6 +6482,7 @@ mapmode-v map.txt /*mapmode-v*
mapmode-x map.txt /*mapmode-x*
mapping map.txt /*mapping*
mark motion.txt /*mark*
+mark-functions usr_41.txt /*mark-functions*
mark-motions motion.txt /*mark-motions*
markfilelist pi_netrw.txt /*markfilelist*
masm.vim syntax.txt /*masm.vim*
@@ -6876,6 +6895,7 @@ objects index.txt /*objects*
obtaining-exted netbeans.txt /*obtaining-exted*
ocaml.vim syntax.txt /*ocaml.vim*
octal eval.txt /*octal*
+octal-number options.txt /*octal-number*
oldfiles-variable eval.txt /*oldfiles-variable*
ole-activation if_ole.txt /*ole-activation*
ole-eval if_ole.txt /*ole-eval*
@@ -7073,6 +7093,7 @@ quickfix quickfix.txt /*quickfix*
quickfix-6 version6.txt /*quickfix-6*
quickfix-directory-stack quickfix.txt /*quickfix-directory-stack*
quickfix-error-lists quickfix.txt /*quickfix-error-lists*
+quickfix-functions usr_41.txt /*quickfix-functions*
quickfix-gcc quickfix.txt /*quickfix-gcc*
quickfix-manx quickfix.txt /*quickfix-manx*
quickfix-perl quickfix.txt /*quickfix-perl*
@@ -7279,6 +7300,7 @@ send-money sponsor.txt /*send-money*
send-to-menu gui_w32.txt /*send-to-menu*
sendto gui_w32.txt /*sendto*
sentence motion.txt /*sentence*
+server-functions usr_41.txt /*server-functions*
server2client() eval.txt /*server2client()*
serverlist() eval.txt /*serverlist()*
servername-variable eval.txt /*servername-variable*
@@ -7422,6 +7444,7 @@ spell-compound spell.txt /*spell-compound*
spell-dic-format spell.txt /*spell-dic-format*
spell-double-scoring spell.txt /*spell-double-scoring*
spell-file-format spell.txt /*spell-file-format*
+spell-functions usr_41.txt /*spell-functions*
spell-german spell.txt /*spell-german*
spell-load spell.txt /*spell-load*
spell-midword spell.txt /*spell-midword*
@@ -7502,6 +7525,7 @@ strcspn() eval.txt /*strcspn()*
strftime() eval.txt /*strftime()*
stridx() eval.txt /*stridx()*
string() eval.txt /*string()*
+string-functions usr_41.txt /*string-functions*
string-match eval.txt /*string-match*
strlen() eval.txt /*strlen()*
strpart() eval.txt /*strpart()*
@@ -7551,6 +7575,7 @@ synload-5 syntax.txt /*synload-5*
synload-6 syntax.txt /*synload-6*
synstack() eval.txt /*synstack()*
syntax syntax.txt /*syntax*
+syntax-functions usr_41.txt /*syntax-functions*
syntax-highlighting syntax.txt /*syntax-highlighting*
syntax-loading syntax.txt /*syntax-loading*
syntax-printing usr_06.txt /*syntax-printing*
@@ -7559,6 +7584,7 @@ syntax_cmd syntax.txt /*syntax_cmd*
sys-file-list help.txt /*sys-file-list*
sysmouse term.txt /*sysmouse*
system() eval.txt /*system()*
+system-functions usr_41.txt /*system-functions*
system-vimrc starting.txt /*system-vimrc*
s~ change.txt /*s~*
t motion.txt /*t*
@@ -7839,6 +7865,7 @@ tex-runon syntax.txt /*tex-runon*
tex-slow syntax.txt /*tex-slow*
tex-style syntax.txt /*tex-style*
tex.vim syntax.txt /*tex.vim*
+text-functions usr_41.txt /*text-functions*
text-objects motion.txt /*text-objects*
text-objects-changed version5.txt /*text-objects-changed*
textlock eval.txt /*textlock*
@@ -7849,6 +7876,7 @@ throw-expression eval.txt /*throw-expression*
throw-from-catch eval.txt /*throw-from-catch*
throw-variables eval.txt /*throw-variables*
throwpoint-variable eval.txt /*throwpoint-variable*
+time-functions usr_41.txt /*time-functions*
timestamp editing.txt /*timestamp*
timestamps editing.txt /*timestamps*
tips tips.txt /*tips*
@@ -8110,9 +8138,11 @@ v_~ change.txt /*v_~*
val-variable eval.txt /*val-variable*
valgrind debug.txt /*valgrind*
values() eval.txt /*values()*
+var-functions usr_41.txt /*var-functions*
variables eval.txt /*variables*
various various.txt /*various*
various-cmds various.txt /*various-cmds*
+various-functions usr_41.txt /*various-functions*
various-motions motion.txt /*various-motions*
various.txt various.txt /*various.txt*
vb.vim syntax.txt /*vb.vim*
@@ -8267,10 +8297,12 @@ wincol() eval.txt /*wincol()*
window windows.txt /*window*
window-contents intro.txt /*window-contents*
window-exit editing.txt /*window-exit*
+window-functions usr_41.txt /*window-functions*
window-move-cursor windows.txt /*window-move-cursor*
window-moving windows.txt /*window-moving*
window-resize windows.txt /*window-resize*
window-size term.txt /*window-size*
+window-size-functions usr_41.txt /*window-size-functions*
window-tag windows.txt /*window-tag*
window-variable eval.txt /*window-variable*
windows windows.txt /*windows*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 6edd6b0e9..24799a36c 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1136,6 +1136,7 @@ Patches to possibly include:
10.4.
- Patch for adding "J" flag to 'cinoptions': placement of jump label. (Manuel
Konig, 2010 Feb 19) Update by Lech Lorens, Feb 22.
+ Need another name, "J" is now used for Javascript.
- Add Lua interface? (Wolfgang Oertl) patch by Luis Carvalho, 2008 Sep 5
Patch for Make_ming.mak from Paul Moore (2008 Sep 1)
http://code.google.com/p/vim-iflua/ Download vim72-lua-0.7.patch.gz
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 4344fc11f..382999044 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -576,7 +576,7 @@ There are many functions. We will mention them here, grouped by what they are
used for. You can find an alphabetical list here: |functions|. Use CTRL-] on
the function name to jump to detailed help on it.
-String manipulation:
+String manipulation: *string-functions*
nr2char() get a character by its ASCII value
char2nr() get ASCII value of a character
str2nr() convert a string to a Number
@@ -605,7 +605,7 @@ String manipulation:
repeat() repeat a string multiple times
eval() evaluate a string expression
-List manipulation:
+List manipulation: *list-functions*
get() get an item without error for wrong index
len() number of items in a List
empty() check if List is empty
@@ -630,7 +630,7 @@ List manipulation:
count() count number of times a value appears in a List
repeat() repeat a List multiple times
-Dictionary manipulation:
+Dictionary manipulation: *dict-functions*
get() get an entry without an error for a wrong key
len() number of entries in a Dictionary
has_key() check whether a key appears in a Dictionary
@@ -649,7 +649,7 @@ Dictionary manipulation:
min() minimum value in a Dictionary
count() count number of times a value appears
-Floating point computation:
+Floating point computation: *float-functions*
float2nr() convert Float to Number
abs() absolute value (also works for Number)
round() round off
@@ -663,7 +663,7 @@ Floating point computation:
cos() cosine
atan() arc tangent
-Variables:
+Variables: *var-functions*
type() type of a variable
islocked() check if a variable is locked
function() get a Funcref for a function name
@@ -677,7 +677,7 @@ Variables:
settabwinvar() set a variable in a specific window & tab page
garbagecollect() possibly free memory
-Cursor and mark position:
+Cursor and mark position: *cursor-functions* *mark-functions*
col() column number of the cursor or a mark
virtcol() screen column of the cursor or a mark
line() line number of the cursor or mark
@@ -690,7 +690,7 @@ Cursor and mark position:
line2byte() byte count at a specific line
diff_filler() get the number of filler lines above a line
-Working with text in the current buffer:
+Working with text in the current buffer: *text-functions*
getline() get a line or list of lines from the buffer
setline() replace a line in the buffer
append() append line or list of lines in the buffer
@@ -705,6 +705,7 @@ Working with text in the current buffer:
searchpairpos() find the other end of a start/skip/end
searchdecl() search for the declaration of a name
+ *system-functions* *file-functions*
System functions and manipulation of files:
glob() expand wildcards
globpath() expand wildcards in a number of directories
@@ -732,13 +733,14 @@ System functions and manipulation of files:
readfile() read a file into a List of lines
writefile() write a List of lines into a file
-Date and Time:
+Date and Time: *date-functions* *time-functions*
getftime() get last modification time of a file
localtime() get current time in seconds
strftime() convert time to a string
reltime() get the current or elapsed time accurately
reltimestr() convert reltime() result to a string
+ *buffer-functions* *window-functions* *arg-functions*
Buffers, windows and the argument list:
argc() number of entries in the argument list
argidx() current position in the argument list
@@ -756,32 +758,32 @@ Buffers, windows and the argument list:
winbufnr() get the buffer number of a specific window
getbufline() get a list of lines from the specified buffer
-Command line:
+Command line: *command-line-functions*
getcmdline() get the current command line
getcmdpos() get position of the cursor in the command line
setcmdpos() set position of the cursor in the command line
getcmdtype() return the current command-line type
-Quickfix and location lists:
+Quickfix and location lists: *quickfix-functions*
getqflist() list of quickfix errors
setqflist() modify a quickfix list
getloclist() list of location list items
setloclist() modify a location list
-Insert mode completion:
+Insert mode completion: *completion-functions*
complete() set found matches
complete_add() add to found matches
complete_check() check if completion should be aborted
pumvisible() check if the popup menu is displayed
-Folding:
+Folding: *folding-functions*
foldclosed() check for a closed fold at a specific line
foldclosedend() like foldclosed() but return the last line
foldlevel() check for the fold level at a specific line
foldtext() generate the line displayed for a closed fold
foldtextresult() get the text displayed for a closed fold
-Syntax and highlighting:
+Syntax and highlighting: *syntax-functions* *highlighting-functions*
clearmatches() clear all matches defined by |matchadd()| and
the |:match| commands
getmatches() get all matches defined by |matchadd()| and
@@ -799,18 +801,18 @@ Syntax and highlighting:
setmatches() restore a list of matches saved by
|getmatches()|
-Spelling:
+Spelling: *spell-functions*
spellbadword() locate badly spelled word at or after cursor
spellsuggest() return suggested spelling corrections
soundfold() return the sound-a-like equivalent of a word
-History:
+History: *history-functions*
histadd() add an item to a history
histdel() delete an item from a history
histget() get an item from a history
histnr() get highest index of a history list
-Interactive:
+Interactive: *interactive-functions*
browse() put up a file requester
browsedir() put up a directory requester
confirm() let the user make a choice
@@ -824,12 +826,12 @@ Interactive:
inputsave() save and clear typeahead
inputrestore() restore typeahead
-GUI:
+GUI: *gui-functions*
getfontname() get name of current font being used
getwinposx() X position of the GUI Vim window
getwinposy() Y position of the GUI Vim window
-Vim server:
+Vim server: *server-functions*
serverlist() return the list of server names
remote_send() send command characters to a Vim server
remote_expr() evaluate an expression in a Vim server
@@ -839,14 +841,14 @@ Vim server:
foreground() move the Vim window to the foreground
remote_foreground() move the Vim server window to the foreground
-Window size and position:
+Window size and position: *window-size-functions*
winheight() get height of a specific window
winwidth() get width of a specific window
winrestcmd() return command to restore window sizes
winsaveview() get view of current window
winrestview() restore saved view of current window
-Various:
+Various: *various-functions*
mode() get current editing mode
visualmode() last visual mode used
hasmapto() check if a mapping exists
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index 52d75e4a2..1533c647c 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -420,10 +420,6 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
menu_item_activate(GtkWidget *widget UNUSED, gpointer data)
{
gui_menu_cb((vimmenu_T *)data);
-
- /* make sure the menu action is taken immediately */
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
void
@@ -731,9 +727,6 @@ adjustment_value_changed(GtkAdjustment *adjustment, gpointer data)
}
gui_drag_scrollbar(sb, value, dragging);
-
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
/* SBAR_VERT or SBAR_HORIZ */
@@ -780,10 +773,7 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb)
* Implementation of the file selector related stuff
*/
#if GTK_CHECK_VERSION(2,4,0)
-/* This has been disabled, because the GTK library rewrites
- * ~/.recently-used.xbel every time the main loop is quit. For Vim that means
- * on just about any event. */
-/* # define USE_FILE_CHOOSER */
+# define USE_FILE_CHOOSER
#endif
#ifndef USE_FILE_CHOOSER
@@ -798,8 +788,6 @@ browse_ok_cb(GtkWidget *widget UNUSED, gpointer cbdata)
vw->browse_fname = (char_u *)g_strdup(gtk_file_selection_get_filename(
GTK_FILE_SELECTION(vw->filedlg)));
gtk_widget_hide(vw->filedlg);
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
static void
@@ -813,8 +801,6 @@ browse_cancel_cb(GtkWidget *widget UNUSED, gpointer cbdata)
vw->browse_fname = NULL;
}
gtk_widget_hide(vw->filedlg);
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
static gboolean
@@ -826,10 +812,7 @@ browse_destroy_cb(GtkWidget *widget UNUSED)
gui.browse_fname = NULL;
}
gui.filedlg = NULL;
-
- if (gtk_main_level() > 0)
- gtk_main_quit();
-
+ gtk_main_quit();
return FALSE;
}
#endif
@@ -882,6 +865,8 @@ gui_mch_browse(int saving UNUSED,
NULL);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc),
(const gchar *)dirbuf);
+ if (saving && dflt != NULL && *dflt != NUL)
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), (char *)dflt);
gui.browse_fname = NULL;
if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT)
@@ -929,8 +914,7 @@ gui_mch_browse(int saving UNUSED,
(const gchar *)dirbuf);
gtk_widget_show(gui.filedlg);
- while (gui.filedlg && GTK_WIDGET_DRAWABLE(gui.filedlg))
- gtk_main_iteration_do(TRUE);
+ gtk_main();
#endif
CONVERT_TO_UTF8_FREE(title);
@@ -1840,9 +1824,6 @@ find_replace_cb(GtkWidget *widget UNUSED, gpointer data)
rc = gui_do_findrepl(flags, find_text, repl_text, direction_down);
CONVERT_FROM_UTF8_FREE(repl_text);
CONVERT_FROM_UTF8_FREE(find_text);
-
- if (rc && gtk_main_level() > 0)
- gtk_main_quit(); /* make sure cmd will be handled immediately */
}
/* our usual callback function */
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 84aa710c0..05cbe0b4d 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -652,9 +652,6 @@ property_event(GtkWidget *widget,
xev.xproperty.window = commWindow;
xev.xproperty.state = PropertyNewValue;
serverEventProc(GDK_WINDOW_XDISPLAY(widget->window), &xev);
-
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
return FALSE;
}
@@ -788,10 +785,6 @@ focus_in_event(GtkWidget *widget,
if (widget != gui.drawarea)
gtk_widget_grab_focus(gui.drawarea);
- /* make sure the input buffer is read */
- if (gtk_main_level() > 0)
- gtk_main_quit();
-
return TRUE;
}
@@ -805,10 +798,6 @@ focus_out_event(GtkWidget *widget UNUSED,
if (blink_state != BLINK_NONE)
gui_mch_stop_blink();
- /* make sure the input buffer is read */
- if (gtk_main_level() > 0)
- gtk_main_quit();
-
return TRUE;
}
@@ -1130,9 +1119,6 @@ key_press_event(GtkWidget *widget UNUSED,
if (p_mh)
gui_mch_mousehide(TRUE);
- if (gtk_main_level() > 0)
- gtk_main_quit();
-
return TRUE;
}
@@ -1167,9 +1153,6 @@ selection_clear_event(GtkWidget *widget UNUSED,
else
clip_lose_selection(&clip_star);
- if (gtk_main_level() > 0)
- gtk_main_quit();
-
return TRUE;
}
@@ -1205,9 +1188,6 @@ selection_received_cb(GtkWidget *widget UNUSED,
received_selection = RS_FAIL;
/* clip_free_selection(cbd); ??? */
- if (gtk_main_level() > 0)
- gtk_main_quit();
-
return;
}
@@ -1287,9 +1267,6 @@ selection_received_cb(GtkWidget *widget UNUSED,
received_selection = RS_OK;
vim_free(tmpbuf);
g_free(tmpbuf_utf8);
-
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
/*
@@ -1515,9 +1492,6 @@ process_motion_notify(int x, int y, GdkModifierType state)
/* inform the editor engine about the occurrence of this event */
gui_send_mouse_event(button, x, y, FALSE, vim_modifiers);
- if (gtk_main_level() > 0)
- gtk_main_quit();
-
/*
* Auto repeat timer handling.
*/
@@ -1700,8 +1674,6 @@ button_press_event(GtkWidget *widget,
vim_modifiers = modifiers_gdk2mouse(event->state);
gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers);
- if (gtk_main_level() > 0)
- gtk_main_quit(); /* make sure the above will be handled immediately */
return TRUE;
}
@@ -1743,9 +1715,6 @@ scroll_event(GtkWidget *widget,
gui_send_mouse_event(button, (int)event->x, (int)event->y,
FALSE, vim_modifiers);
- if (gtk_main_level() > 0)
- gtk_main_quit(); /* make sure the above will be handled immediately */
-
return TRUE;
}
@@ -1775,8 +1744,6 @@ button_release_event(GtkWidget *widget UNUSED,
vim_modifiers = modifiers_gdk2mouse(event->state);
gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, vim_modifiers);
- if (gtk_main_level() > 0)
- gtk_main_quit(); /* make sure it will be handled immediately */
return TRUE;
}
@@ -1930,9 +1897,6 @@ drag_handle_text(GdkDragContext *context,
add_to_input_buf(dropkey, (int)sizeof(dropkey));
else
add_to_input_buf(dropkey + 3, (int)(sizeof(dropkey) - 3));
-
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
/*
@@ -2846,9 +2810,6 @@ tabline_menu_handler(GtkMenuItem *item UNUSED, gpointer user_data)
{
/* Add the string cmd into input buffer */
send_tabline_menu_event(clicked_page, (int)(long)user_data);
-
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
static void
@@ -2924,8 +2885,7 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
{
/* Click after all tabs moves to next tab page. When "x" is
* small guess it's the left button. */
- if (send_tabline_event(x < 50 ? -1 : 0) && gtk_main_level() > 0)
- gtk_main_quit();
+ send_tabline_event(x < 50 ? -1 : 0);
}
}
}
@@ -2946,8 +2906,7 @@ on_select_tab(
{
if (!ignore_tabline_evt)
{
- if (send_tabline_event(idx + 1) && gtk_main_level() > 0)
- gtk_main_quit();
+ send_tabline_event(idx + 1);
}
}
@@ -3855,9 +3814,6 @@ gui_mch_exit(int rc UNUSED)
{
if (gui.mainwin != NULL)
gtk_widget_destroy(gui.mainwin);
-
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
/*
@@ -5407,8 +5363,8 @@ gui_mch_draw_part_cursor(int w, int h, guicolor_T color)
void
gui_mch_update(void)
{
- while (gtk_events_pending() && !vim_is_input_buf_full())
- gtk_main_iteration_do(FALSE);
+ while (g_main_context_pending(NULL) && !vim_is_input_buf_full())
+ g_main_context_iteration(NULL, TRUE);
}
static gint
@@ -5419,9 +5375,6 @@ input_timer_cb(gpointer data)
/* Just inform the caller about the occurrence of it */
*timed_out = TRUE;
- if (gtk_main_level() > 0)
- gtk_main_quit();
-
return FALSE; /* don't happen again */
}
@@ -5438,9 +5391,6 @@ sniff_request_cb(
static char_u bytes[3] = {CSI, (int)KS_EXTRA, (int)KE_SNIFF};
add_to_input_buf(bytes, 3);
-
- if (gtk_main_level() > 0)
- gtk_main_quit();
}
#endif
@@ -5515,7 +5465,7 @@ gui_mch_wait_for_chars(long wtime)
* situations, sort of race condition).
*/
if (!input_available())
- gtk_main();
+ g_main_context_iteration(NULL, TRUE);
/* Got char, return immediately */
if (input_available())
@@ -5707,7 +5657,7 @@ clip_mch_request_selection(VimClipboard *cbd)
* during the FocusGained event. */
start = time(NULL);
while (received_selection == RS_NONE && time(NULL) < start + 3)
- gtk_main(); /* wait for selection_received_cb */
+ g_main_context_iteration(NULL, TRUE); /* wait for selection_received_cb */
if (received_selection != RS_FAIL)
return;