Merge branch 'x11_selection_timeout' of https://github.com/martinetd/kitty
Fixes #1042
This commit is contained in:
commit
928167c0b2
1 changed files with 10 additions and 2 deletions
12
glfw/x11_window.c
vendored
12
glfw/x11_window.c
vendored
|
|
@ -873,6 +873,7 @@ static const char* getSelectionString(Atom selection)
|
|||
Atom actualType;
|
||||
int actualFormat;
|
||||
unsigned long itemCount, bytesAfter;
|
||||
double start = glfwGetTime();
|
||||
XEvent notification, dummy;
|
||||
|
||||
XConvertSelection(_glfw.x11.display,
|
||||
|
|
@ -887,7 +888,10 @@ static const char* getSelectionString(Atom selection)
|
|||
SelectionNotify,
|
||||
¬ification))
|
||||
{
|
||||
waitForX11Event(-1);
|
||||
double time = glfwGetTime();
|
||||
if (time - start > 2)
|
||||
return "";
|
||||
waitForX11Event(2.0 - (time - start));
|
||||
}
|
||||
|
||||
if (notification.xselection.property == None)
|
||||
|
|
@ -918,12 +922,16 @@ static const char* getSelectionString(Atom selection)
|
|||
|
||||
for (;;)
|
||||
{
|
||||
start = glfwGetTime();
|
||||
while (!XCheckIfEvent(_glfw.x11.display,
|
||||
&dummy,
|
||||
isSelPropNewValueNotify,
|
||||
(XPointer) ¬ification))
|
||||
{
|
||||
waitForX11Event(-1);
|
||||
double time = glfwGetTime();
|
||||
if (time - start > 2)
|
||||
return "";
|
||||
waitForX11Event(2.0 - (time - start));
|
||||
}
|
||||
|
||||
XFree(data);
|
||||
|
|
|
|||
Loading…
Reference in a new issue