xace: Bug fixes, name changes to selection access hooks and fields.

This commit is contained in:
Eamon Walsh 2007-10-19 18:43:38 -04:00 committed by Eamon Walsh
parent 55a96aa6b0
commit 12e889d202
2 changed files with 14 additions and 15 deletions

View File

@ -1024,7 +1024,7 @@ ProcSetSelectionOwner(ClientPtr client)
return Success; return Success;
rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection, rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection,
CurrentSelections[i], DixSetAttrAccess); CurrentSelections + i, DixSetAttrAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
@ -1058,17 +1058,15 @@ ProcSetSelectionOwner(ClientPtr client)
CurrentSelections = newsels; CurrentSelections = newsels;
CurrentSelections[i].selection = stuff->selection; CurrentSelections[i].selection = stuff->selection;
CurrentSelections[i].devPrivates = NULL; CurrentSelections[i].devPrivates = NULL;
rc = XaceHook(XACE_SELECTION_ACCESS, stuff->selection, rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection,
CurrentSelections[i], DixSetAttrAccess); CurrentSelections + i, DixSetAttrAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
} }
CurrentSelections[i].lastTimeChanged = time; CurrentSelections[i].lastTimeChanged = time;
CurrentSelections[i].window = stuff->window; CurrentSelections[i].window = stuff->window;
CurrentSelections[i].destwindow = stuff->window;
CurrentSelections[i].pWin = pWin; CurrentSelections[i].pWin = pWin;
CurrentSelections[i].client = (pWin ? client : NullClient); CurrentSelections[i].client = (pWin ? client : NullClient);
CurrentSelections[i].destclient = (pWin ? client : NullClient);
if (SelectionCallback) if (SelectionCallback)
{ {
SelectionInfoRec info; SelectionInfoRec info;
@ -1100,19 +1098,20 @@ ProcGetSelectionOwner(ClientPtr client)
i = 0; i = 0;
while ((i < NumCurrentSelections) && while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != stuff->id) i++; CurrentSelections[i].selection != stuff->id) i++;
rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->id,
CurrentSelections + i, DixGetAttrAccess);
if (rc != Success)
return rc;
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
if (i < NumCurrentSelections) if (i < NumCurrentSelections)
reply.owner = CurrentSelections[i].destwindow; reply.owner = CurrentSelections[i].window;
else else
reply.owner = None; reply.owner = None;
rc = XaceHook(XACE_SELECTION_ACCESS, client, stuff->id, NULL,
DixGetAttrAccess);
if (rc != Success)
return rc;
WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply);
return(client->noClientException); return(client->noClientException);
} }
@ -1150,7 +1149,7 @@ ProcConvertSelection(ClientPtr client)
if ((i < NumCurrentSelections) && if ((i < NumCurrentSelections) &&
(CurrentSelections[i].window != None) && (CurrentSelections[i].window != None) &&
XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection, XaceHook(XACE_SELECTION_ACCESS, client, stuff->selection,
&CurrentSelections[i], DixReadAccess) == Success) CurrentSelections + i, DixReadAccess) == Success)
{ {
event.u.u.type = SelectionRequest; event.u.u.type = SelectionRequest;
event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.time = stuff->time;
@ -1160,7 +1159,7 @@ ProcConvertSelection(ClientPtr client)
event.u.selectionRequest.target = stuff->target; event.u.selectionRequest.target = stuff->target;
event.u.selectionRequest.property = stuff->property; event.u.selectionRequest.property = stuff->property;
if (TryClientEvents( if (TryClientEvents(
CurrentSelections[i].destclient, &event, 1, NoEventMask, CurrentSelections[i].client, &event, 1, NoEventMask,
NoEventMask /* CantBeFiltered */, NullGrab)) NoEventMask /* CantBeFiltered */, NullGrab))
return (client->noClientException); return (client->noClientException);
} }

View File

@ -62,8 +62,8 @@ typedef struct _Selection {
Window window; Window window;
WindowPtr pWin; WindowPtr pWin;
ClientPtr client; ClientPtr client;
ClientPtr destclient; /* support for redirection */ ClientPtr alt_client; /* support for redirection */
Window destwindow; /* support for redirection */ Window alt_window; /* support for redirection */
PrivateRec *devPrivates; PrivateRec *devPrivates;
} Selection; } Selection;