Mercurial > vim
comparison src/gui.c @ 14428:aab5947be7c5 v8.1.0228
patch 8.1.0228: dropping files is ignored while Vim is busy
commit https://github.com/vim/vim/commit/92d147be959e689f8f58fd5d138a31835e160289
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 29 17:35:23 2018 +0200
patch 8.1.0228: dropping files is ignored while Vim is busy
Problem: Dropping files is ignored while Vim is busy.
Solution: Postpone the effect of dropping files until it's safe.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 29 Jul 2018 17:45:05 +0200 |
parents | 0a69e6e708f9 |
children | 27b9a84395b5 |
comparison
equal
deleted
inserted
replaced
14427:a6055273c735 | 14428:aab5947be7c5 |
---|---|
5381 return (ga.ga_len > 0); | 5381 return (ga.ga_len > 0); |
5382 } | 5382 } |
5383 | 5383 |
5384 #endif | 5384 #endif |
5385 | 5385 |
5386 #if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \ | 5386 #if defined(HAVE_DROP_FILE) || defined(PROTO) |
5387 || defined(FEAT_GUI_MSWIN) \ | |
5388 || defined(FEAT_GUI_MAC) \ | |
5389 || defined(PROTO) | |
5390 | 5387 |
5391 static void gui_wingoto_xy(int x, int y); | 5388 static void gui_wingoto_xy(int x, int y); |
5392 | 5389 |
5393 /* | 5390 /* |
5394 * Jump to the window at specified point (x, y). | 5391 * Jump to the window at specified point (x, y). |
5404 { | 5401 { |
5405 wp = mouse_find_win(&row, &col); | 5402 wp = mouse_find_win(&row, &col); |
5406 if (wp != NULL && wp != curwin) | 5403 if (wp != NULL && wp != curwin) |
5407 win_goto(wp); | 5404 win_goto(wp); |
5408 } | 5405 } |
5406 } | |
5407 | |
5408 /* | |
5409 * Function passed to handle_drop() for the actions to be done after the | |
5410 * argument list has been updated. | |
5411 */ | |
5412 static void | |
5413 drop_callback(void *cookie) | |
5414 { | |
5415 char_u *p = cookie; | |
5416 | |
5417 /* If Shift held down, change to first file's directory. If the first | |
5418 * item is a directory, change to that directory (and let the explorer | |
5419 * plugin show the contents). */ | |
5420 if (p != NULL) | |
5421 { | |
5422 if (mch_isdir(p)) | |
5423 { | |
5424 if (mch_chdir((char *)p) == 0) | |
5425 shorten_fnames(TRUE); | |
5426 } | |
5427 else if (vim_chdirfile(p, "drop") == OK) | |
5428 shorten_fnames(TRUE); | |
5429 vim_free(p); | |
5430 } | |
5431 | |
5432 /* Update the screen display */ | |
5433 update_screen(NOT_VALID); | |
5434 # ifdef FEAT_MENU | |
5435 gui_update_menus(0); | |
5436 # endif | |
5437 #ifdef FEAT_TITLE | |
5438 maketitle(); | |
5439 #endif | |
5440 setcursor(); | |
5441 out_flush_cursor(FALSE, FALSE); | |
5409 } | 5442 } |
5410 | 5443 |
5411 /* | 5444 /* |
5412 * Process file drop. Mouse cursor position, key modifiers, name of files | 5445 * Process file drop. Mouse cursor position, key modifiers, name of files |
5413 * and count of files are given. Argument "fnames[count]" has full pathnames | 5446 * and count of files are given. Argument "fnames[count]" has full pathnames |
5486 { | 5519 { |
5487 vim_free(fnames[0]); | 5520 vim_free(fnames[0]); |
5488 vim_free(fnames); | 5521 vim_free(fnames); |
5489 } | 5522 } |
5490 else | 5523 else |
5491 handle_drop(count, fnames, (modifiers & MOUSE_CTRL) != 0); | 5524 handle_drop(count, fnames, (modifiers & MOUSE_CTRL) != 0, |
5492 | 5525 drop_callback, (void *)p); |
5493 /* If Shift held down, change to first file's directory. If the first | |
5494 * item is a directory, change to that directory (and let the explorer | |
5495 * plugin show the contents). */ | |
5496 if (p != NULL) | |
5497 { | |
5498 if (mch_isdir(p)) | |
5499 { | |
5500 if (mch_chdir((char *)p) == 0) | |
5501 shorten_fnames(TRUE); | |
5502 } | |
5503 else if (vim_chdirfile(p, "drop") == OK) | |
5504 shorten_fnames(TRUE); | |
5505 vim_free(p); | |
5506 } | |
5507 | |
5508 /* Update the screen display */ | |
5509 update_screen(NOT_VALID); | |
5510 # ifdef FEAT_MENU | |
5511 gui_update_menus(0); | |
5512 # endif | |
5513 #ifdef FEAT_TITLE | |
5514 maketitle(); | |
5515 #endif | |
5516 setcursor(); | |
5517 out_flush_cursor(FALSE, FALSE); | |
5518 } | 5526 } |
5519 | 5527 |
5520 entered = FALSE; | 5528 entered = FALSE; |
5521 } | 5529 } |
5522 #endif | 5530 #endif |