Commit 68125b06 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Clipboard.c: Use Find*Index helpers at more locations

parent feedae86
...@@ -770,8 +770,9 @@ void nxagentRequestSelection(XEvent *X) ...@@ -770,8 +770,9 @@ void nxagentRequestSelection(XEvent *X)
} }
/* the selection in this request is none we own. */ /* the selection in this request is none we own. */
if ((X->xselectionrequest.selection != lastSelectionOwner[nxagentPrimarySelection].selection) && {
(X->xselectionrequest.selection != lastSelectionOwner[nxagentClipboardSelection].selection)) int i = nxagentFindLastSelectionOwnerIndex(X->xselectionrequest.selection);
if (i == nxagentMaxSelections)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: not owning selection [%ld] - denying request.\n", __func__, X->xselectionrequest.selection); fprintf(stderr, "%s: not owning selection [%ld] - denying request.\n", __func__, X->xselectionrequest.selection);
...@@ -780,6 +781,7 @@ void nxagentRequestSelection(XEvent *X) ...@@ -780,6 +781,7 @@ void nxagentRequestSelection(XEvent *X)
nxagentReplyRequestSelection(X, False); nxagentReplyRequestSelection(X, False);
return; return;
} }
}
/* this is a special request like TARGETS or TIMESTAMP */ /* this is a special request like TARGETS or TIMESTAMP */
if (!nxagentValidServerTargets(X->xselectionrequest.target)) if (!nxagentValidServerTargets(X->xselectionrequest.target))
...@@ -1724,17 +1726,14 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1724,17 +1726,14 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
return 0; return 0;
} }
for (int i = 0; i < nxagentMaxSelections; i++) int i = nxagentFindCurrentSelectionIndex(selection);
{ if (i < NumCurrentSelections && IS_INTERNAL_OWNER(i))
if (selection == CurrentSelections[i].selection &&
IS_INTERNAL_OWNER(i))
{ {
/* /*
* There is a client owner on the agent side, let normal dix stuff happen. * There is a client owner on the agent side, let normal dix stuff happen.
*/ */
return 0; return 0;
} }
}
/* /*
* if lastClientWindowPtr is set we are waiting for an answer from * if lastClientWindowPtr is set we are waiting for an answer from
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment