diff options
author | Adam Jackson <ajax@redhat.com> | 2010-03-10 15:32:12 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2010-03-10 15:32:12 -0500 |
commit | bb5de8d32514cf4f76a4a4b04ae6b645af59f61b (patch) | |
tree | 54bf2b0a8131c73b535ff7e1151a016cd742a0fe | |
parent | bbae92795c7eab062e6722c42fa7915e0cee5d69 (diff) |
fixes: Add atomic query requests.fixes-atomic-requests
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | include/protocol-versions.h | 2 | ||||
-rw-r--r-- | xfixes/Makefile.am | 1 | ||||
-rw-r--r-- | xfixes/query.c | 143 | ||||
-rw-r--r-- | xfixes/xfixes.c | 12 | ||||
-rw-r--r-- | xfixes/xfixesint.h | 15 |
5 files changed, 168 insertions, 5 deletions
diff --git a/include/protocol-versions.h b/include/protocol-versions.h index c74b7faf0..4950bfaf8 100644 --- a/include/protocol-versions.h +++ b/include/protocol-versions.h @@ -126,7 +126,7 @@ #define SERVER_XF86VIDMODE_MINOR_VERSION 2 /* Fixes */ -#define SERVER_XFIXES_MAJOR_VERSION 4 +#define SERVER_XFIXES_MAJOR_VERSION 5 #define SERVER_XFIXES_MINOR_VERSION 0 /* X Input */ diff --git a/xfixes/Makefile.am b/xfixes/Makefile.am index a8425e8ea..19c0d4bcd 100644 --- a/xfixes/Makefile.am +++ b/xfixes/Makefile.am @@ -8,6 +8,7 @@ endif libxfixes_la_SOURCES = \ cursor.c \ + query.c \ region.c \ saveset.c \ select.c \ diff --git a/xfixes/query.c b/xfixes/query.c new file mode 100644 index 000000000..f38849725 --- /dev/null +++ b/xfixes/query.c @@ -0,0 +1,143 @@ +/* + * Copyright 2010 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software") + * to deal in the software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * them Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "dix-config.h" +#include "xfixesint.h" + +/* + * we already track this in the sprite trace! how cool is that. + */ +int +ProcXFixesQueryPointer (ClientPtr client) +{ + CursorPtr pCursor; + xXFixesQueryPointerReply rep; + xXFixesPointerWindow w; + DeviceIntPtr mouse, keyboard; + WindowPtr *spriteTrace; + int i, nwin, rc; + + REQUEST(xXFixesQueryPointerReq); + REQUEST_SIZE_MATCH(xXFixesQueryPointerReq); + + mouse = PickPointer(client); + rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); + if (rc != Success && rc != BadAccess) + return rc; + + keyboard = GetPairedDevice(mouse); + + if (mouse->valuator->motionHintWindow) + MaybeStopHint(mouse, client); + + memset(&reply, 0, sizeof(reply)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.numWindows = nwin = mouse->spriteInfo->sprite->spriteTraceGood; + rep.length = 2 * nwin; + + rep.mask = mouse->button ? mouse->button->state : 0; + rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state); + + if (client->swapped) { + int n; + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swaps(&rep.mask, n); + swapl(&rep.numWindows, n); + } + WriteReplyToClient(client, sizeof(xXFixesGetCursorNameReply), &reply); + + spriteTrace = mouse->spriteInfo->sprite->spriteTrace; + for (i = 0; i < nwin; i++) { + xXFixesPointerWindow w; + WindowPtr win = mouse->spriteInfo->spriteTrace[i]; + w.window = win->id; + w.x = mouse->spriteInfo->sprite->hot.x - win->drawable.x; + w.y = mouse->spriteInfo->sprite->hot.y - win->drawable.y; + if (client->swapped) { + int n; + swapl(w.window, n); + swaps(w.x, n); + swaps(w.y, n); + } + WriteToClient(client, sizeof(w), w); + } + + return client->noClientException; +} + +int +ProcXFixesQueryTree (ClientPtr client) +{ + CursorPtr pCursor; + xXFixesQueryTree *reply; + DeviceIntPtr mouse, keyboard; + int i, nwin, rc; + + REQUEST(xXFixesQueryTreeReq); + REQUEST_SIZE_MATCH(xXFixesQueryTreeReq); + + rc = dixLookupWindow(&pWin, stuff->window, client, DixListAccess); + if (rc != Success) + return rc; + + /* stuff */ + + rep->type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.mask = mouse->button ? mouse->button->state : 0; + rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state); + + if (client->swapped) + { + int n; + swaps (&reply.sequenceNumber, n); + swapl (&reply.length, n); + swaps (&reply.mask, n); + } + WriteReplyToClient(client, sizeof(xXFixesGetCursorNameReply), &reply); + WriteToClient(client, len, str); + + return client->noClientException; +} + +int +SProcXFixesQueryPointer (ClientPtr client) +{ + int n; + REQUEST(xXFixesQueryPointerReq); + + swaps (&stuff->length, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +SProcXFixesQueryTree (ClientPtr client) +{ + int n; + REQUEST(xXFixesQueryTreeReq); + + swaps (&stuff->length, n); + swapl (&stuff->window, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c index 5163dc11e..6ba4a19f1 100644 --- a/xfixes/xfixes.c +++ b/xfixes/xfixes.c @@ -1,5 +1,6 @@ /* * Copyright © 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright © 2010 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -47,10 +48,6 @@ #include "xfixesint.h" #include "protocol-versions.h" -/* - * Must use these instead of the constants from xfixeswire.h. They advertise - * what we implement, not what the protocol headers define. - */ static unsigned char XFixesReqCode; int XFixesEventBase; @@ -102,6 +99,7 @@ static const int version_requests[] = { X_XFixesChangeCursorByName, /* Version 2 */ X_XFixesExpandRegion, /* Version 3 */ X_XFixesShowCursor, /* Version 4 */ + X_XFixesQueryTree, /* Version 5 */ }; #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) @@ -142,6 +140,9 @@ int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { /*************** Version 4 ****************/ ProcXFixesHideCursor, ProcXFixesShowCursor, +/*************** Version 5 ****************/ + ProcXFixesQueryPointer, + ProcXFixesQueryTree, }; static int @@ -205,6 +206,9 @@ static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { /*************** Version 4 ****************/ SProcXFixesHideCursor, SProcXFixesShowCursor, +/*************** Version 5 ****************/ + SProcXFixesQueryPointer, + SProcXFixesQueryTree, }; static int diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h index f3d53614f..273034303 100644 --- a/xfixes/xfixesint.h +++ b/xfixes/xfixesint.h @@ -1,5 +1,6 @@ /* * Copyright © 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright © 2010 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -269,4 +270,18 @@ ProcXFixesShowCursor (ClientPtr client); int SProcXFixesShowCursor (ClientPtr client); +/* Atomic queries (Version 5) */ + +int +ProcXFixesQueryPointer (ClientPtr client); + +int +SProcXFixesQueryPointer (ClientPtr client); + +int +ProcXFixesQueryTree (ClientPtr client); + +int +SProcXFixesQueryTree (ClientPtr client); + #endif /* _XFIXESINT_H_ */ |