From: Michael D. Lowis Date: Thu, 2 Feb 2017 17:40:00 +0000 (-0500) Subject: Don't bother setting the callback if there is no selection owner X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=e9edf1650b64da02612719735b250b3a4f49b40c;p=projs%2Ftide.git Don't bother setting the callback if there is no selection owner --- diff --git a/lib/x11.c b/lib/x11.c index 63df657..b0b20f0 100644 --- a/lib/x11.c +++ b/lib/x11.c @@ -573,6 +573,8 @@ static void selrequest(XEvent* evnt) { bool x11_getsel(int selid, void(*cbfn)(char*)) { struct XSel* sel = &(Selections[selid]); if (sel->callback) return false; + if (XGetSelectionOwner(X.display, sel->atom) == None) + return true; sel->callback = cbfn; XConvertSelection(X.display, sel->atom, SelTarget, sel->atom, X.window, CurrentTime); XFlush(X.display);