actually fix clipboard
This commit is contained in:
parent
3089b684a2
commit
5a647e49d9
14
platform.d
14
platform.d
@ -874,8 +874,6 @@ ClipboardText(PlatformWindow* w, ClipboardMode mode)
|
|||||||
|
|
||||||
Lock(&w.cb_mut);
|
Lock(&w.cb_mut);
|
||||||
|
|
||||||
scope(exit) Unlock(&w.cb_mut);
|
|
||||||
|
|
||||||
Selection* sel = &w.selections[mode];
|
Selection* sel = &w.selections[mode];
|
||||||
|
|
||||||
if(sel.owned)
|
if(sel.owned)
|
||||||
@ -892,14 +890,17 @@ ClipboardText(PlatformWindow* w, ClipboardMode mode)
|
|||||||
FreeArray(sel.data);
|
FreeArray(sel.data);
|
||||||
sel.data = [];
|
sel.data = [];
|
||||||
|
|
||||||
|
Unlock(&w.cb_mut);
|
||||||
|
|
||||||
|
u64 ticket = w.cb_mut.next_ticket;
|
||||||
|
|
||||||
sel.target = w.atoms[Atoms.Utf8String];
|
sel.target = w.atoms[Atoms.Utf8String];
|
||||||
xcb_convert_selection(w.conn, w.window, sel.xmode, sel.target, sel.xmode, XCB_CURRENT_TIME);
|
xcb_convert_selection(w.conn, w.window, sel.xmode, sel.target, sel.xmode, XCB_CURRENT_TIME);
|
||||||
xcb_flush(w.conn);
|
xcb_flush(w.conn);
|
||||||
|
|
||||||
while(!w.cb_msg_mut.locked) {}
|
while(ticket == w.cb_mut.next_ticket) {}
|
||||||
while(w.cb_msg_mut.locked) {}
|
|
||||||
|
|
||||||
GetClipboardSelection(w, sel);
|
buf = GetClipboardSelection(w, sel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1272,9 +1273,7 @@ HandleEvents(void* window_ptr)
|
|||||||
} break;
|
} break;
|
||||||
case XCB_SELECTION_NOTIFY:
|
case XCB_SELECTION_NOTIFY:
|
||||||
{
|
{
|
||||||
TryLock(&w.cb_msg_mut);
|
|
||||||
RetrieveSelection(w, cast(xcb_selection_notify_event_t*)e);
|
RetrieveSelection(w, cast(xcb_selection_notify_event_t*)e);
|
||||||
Unlock(&w.cb_msg_mut);
|
|
||||||
} break;
|
} break;
|
||||||
case XCB_SELECTION_REQUEST:
|
case XCB_SELECTION_REQUEST:
|
||||||
{
|
{
|
||||||
@ -1828,3 +1827,4 @@ unittest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user