]> git.mdlowis.com Git - projs/tide.git/commitdiff
Don't bother setting the callback if there is no selection owner
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 2 Feb 2017 17:40:00 +0000 (12:40 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 2 Feb 2017 17:40:00 +0000 (12:40 -0500)
lib/x11.c

index 63df6570e19221b1af84f9d5dfb12c03a59f18cf..b0b20f04a3c6a5d7bb2055354af02d4645417df2 100644 (file)
--- 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);