mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
updated for version 7.2-013
This commit is contained in:
32
src/ui.c
32
src/ui.c
@@ -2110,6 +2110,8 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
|||||||
int i;
|
int i;
|
||||||
int nbytes = 0;
|
int nbytes = 0;
|
||||||
char_u *buffer;
|
char_u *buffer;
|
||||||
|
time_t start_time;
|
||||||
|
int timed_out = FALSE;
|
||||||
|
|
||||||
for (i =
|
for (i =
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
@@ -2129,6 +2131,7 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
|||||||
case 3: type = text_atom; break;
|
case 3: type = text_atom; break;
|
||||||
default: type = XA_STRING;
|
default: type = XA_STRING;
|
||||||
}
|
}
|
||||||
|
success = FALSE;
|
||||||
XtGetSelectionValue(myShell, cbd->sel_atom, type,
|
XtGetSelectionValue(myShell, cbd->sel_atom, type,
|
||||||
clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
|
clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
|
||||||
|
|
||||||
@@ -2141,27 +2144,46 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
|||||||
* characters, then they will appear before the one that requested the
|
* characters, then they will appear before the one that requested the
|
||||||
* paste! Don't worry, we will catch up with any other events later.
|
* paste! Don't worry, we will catch up with any other events later.
|
||||||
*/
|
*/
|
||||||
|
start_time = time(NULL);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (XCheckTypedEvent(dpy, SelectionNotify, &event))
|
if (XCheckTypedEvent(dpy, SelectionNotify, &event))
|
||||||
|
{
|
||||||
|
/* this is where clip_x11_request_selection_cb() is actually
|
||||||
|
* called */
|
||||||
|
XtDispatchEvent(&event);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (XCheckTypedEvent(dpy, SelectionRequest, &event))
|
if (XCheckTypedEvent(dpy, SelectionRequest, &event))
|
||||||
/* We may get a SelectionRequest here and if we don't handle
|
/* We may get a SelectionRequest here and if we don't handle
|
||||||
* it we hang. KDE klipper does this, for example. */
|
* it we hang. KDE klipper does this, for example. */
|
||||||
XtDispatchEvent(&event);
|
XtDispatchEvent(&event);
|
||||||
|
|
||||||
|
/* Time out after 2 to 3 seconds to avoid that we hang when the
|
||||||
|
* other process doesn't respond. Note that the SelectionNotify
|
||||||
|
* event may still come later when the selection owner comes back
|
||||||
|
* to life and the text gets inserted unexpectedly (by xterm).
|
||||||
|
* Don't know how to avoid that :-(. */
|
||||||
|
if (time(NULL) > start_time + 2)
|
||||||
|
{
|
||||||
|
timed_out = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Do we need this? Probably not. */
|
/* Do we need this? Probably not. */
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
/* Bernhard Walle solved a slow paste response in an X terminal by
|
/* Wait for 1 msec to avoid that we eat up all CPU time. */
|
||||||
* adding: usleep(10000); here. */
|
ui_delay(1L, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this is where clip_x11_request_selection_cb() is actually called */
|
|
||||||
XtDispatchEvent(&event);
|
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* don't do a retry with another type after timing out, otherwise we
|
||||||
|
* hang for 15 seconds. */
|
||||||
|
if (timed_out)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Final fallback position - use the X CUT_BUFFER0 store */
|
/* Final fallback position - use the X CUT_BUFFER0 store */
|
||||||
|
@@ -676,6 +676,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
13,
|
||||||
/**/
|
/**/
|
||||||
12,
|
12,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user