mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-09 13:08:12 +02:00
dix: Add dixSetSelectionOwner()
To implement selection bridges, we need to be able to set the SelectionOwner from the Xserver code. Rather than duplicating the dix code for ProcSetSelectionOwner(), move the code to its own dixSetSelectionOwner() function, and hook that from the existing ProcSetSelectionOwner(). With that, a DDX can set the selection owner as intended. This is preparation work for the following commits, no functional change intended. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2139>
This commit is contained in:
parent
f6de3eca01
commit
d53a61a14d
2 changed files with 24 additions and 14 deletions
|
|
@ -154,38 +154,33 @@ DeleteClientFromAnySelections(ClientPtr client)
|
|||
}
|
||||
|
||||
int
|
||||
ProcSetSelectionOwner(ClientPtr client)
|
||||
dixSetSelectionOwner(ClientPtr client, Atom selection,
|
||||
Window window, TimeStamp time)
|
||||
{
|
||||
WindowPtr pWin = NULL;
|
||||
TimeStamp time;
|
||||
Selection *pSel;
|
||||
int rc;
|
||||
|
||||
REQUEST(xSetSelectionOwnerReq);
|
||||
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
|
||||
|
||||
UpdateCurrentTime();
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
|
||||
/* If the client's time stamp is in the future relative to the server's
|
||||
time stamp, do not set the selection, just return success. */
|
||||
if (CompareTimeStamps(time, currentTime) == LATER)
|
||||
return Success;
|
||||
|
||||
if (stuff->window != None) {
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
|
||||
if (window != None) {
|
||||
rc = dixLookupWindow(&pWin, window, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
if (!ValidAtom(stuff->selection)) {
|
||||
client->errorValue = stuff->selection;
|
||||
|
||||
if (!ValidAtom(selection)) {
|
||||
client->errorValue = selection;
|
||||
return BadAtom;
|
||||
}
|
||||
|
||||
/*
|
||||
* First, see if the selection is already set...
|
||||
*/
|
||||
rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess);
|
||||
rc = dixLookupSelection(&pSel, selection, client, DixSetAttrAccess);
|
||||
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
|
@ -207,7 +202,7 @@ ProcSetSelectionOwner(ClientPtr client)
|
|||
}
|
||||
|
||||
pSel->lastTimeChanged = time;
|
||||
pSel->window = stuff->window;
|
||||
pSel->window = window;
|
||||
pSel->pWin = pWin;
|
||||
pSel->client = (pWin ? client : NullClient);
|
||||
|
||||
|
|
@ -215,6 +210,18 @@ ProcSetSelectionOwner(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
int
|
||||
ProcSetSelectionOwner(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSetSelectionOwnerReq);
|
||||
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
|
||||
|
||||
UpdateCurrentTime();
|
||||
|
||||
return dixSetSelectionOwner(client, stuff->selection, stuff->window,
|
||||
ClientTimeToServerTime(stuff->time));
|
||||
}
|
||||
|
||||
int
|
||||
ProcGetSelectionOwner(ClientPtr client)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ typedef struct _Selection {
|
|||
extern _X_EXPORT int dixLookupSelection(Selection ** result, Atom name,
|
||||
ClientPtr client, Mask access_mode);
|
||||
|
||||
extern _X_EXPORT int dixSetSelectionOwner(ClientPtr client, Atom selection,
|
||||
Window window, TimeStamp time);
|
||||
|
||||
extern _X_EXPORT Selection *CurrentSelections;
|
||||
|
||||
extern _X_EXPORT CallbackListPtr SelectionCallback;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue