aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xfixes
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /xorg-server/xfixes
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/xfixes')
-rw-r--r--xorg-server/xfixes/cursor.c1165
-rw-r--r--xorg-server/xfixes/region.c758
-rw-r--r--xorg-server/xfixes/saveset.c32
-rw-r--r--xorg-server/xfixes/select.c302
-rw-r--r--xorg-server/xfixes/xfixes.c260
-rw-r--r--xorg-server/xfixes/xfixes.h17
6 files changed, 1243 insertions, 1291 deletions
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c
index 686ed4949..1f1b0c209 100644
--- a/xorg-server/xfixes/cursor.c
+++ b/xorg-server/xfixes/cursor.c
@@ -59,16 +59,17 @@
#include "xace.h"
#include "list.h"
-static RESTYPE CursorClientType;
-static RESTYPE CursorHideCountType;
-static RESTYPE CursorWindowType;
-RESTYPE PointerBarrierType;
-static CursorPtr CursorCurrent[MAXDEVICES];
+static RESTYPE CursorClientType;
+static RESTYPE CursorHideCountType;
+static RESTYPE CursorWindowType;
+RESTYPE PointerBarrierType;
+static CursorPtr CursorCurrent[MAXDEVICES];
static DevPrivateKeyRec CursorScreenPrivateKeyRec;
+
#define CursorScreenPrivateKey (&CursorScreenPrivateKeyRec)
-static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
+static void deleteCursorHideCountsForScreen(ScreenPtr pScreen);
#define VERIFY_CURSOR(pCursor, cursor, client, access) \
do { \
@@ -88,14 +89,14 @@ static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
typedef struct _CursorEvent *CursorEventPtr;
typedef struct _CursorEvent {
- CursorEventPtr next;
- CARD32 eventMask;
- ClientPtr pClient;
- WindowPtr pWindow;
- XID clientResource;
+ CursorEventPtr next;
+ CARD32 eventMask;
+ ClientPtr pClient;
+ WindowPtr pWindow;
+ XID clientResource;
} CursorEventRec;
-static CursorEventPtr cursorEvents;
+static CursorEventPtr cursorEvents;
/*
* Each screen has a list of clients which have requested
@@ -106,11 +107,11 @@ static CursorEventPtr cursorEvents;
typedef struct _CursorHideCountRec *CursorHideCountPtr;
typedef struct _CursorHideCountRec {
- CursorHideCountPtr pNext;
- ClientPtr pClient;
- ScreenPtr pScreen;
- int hideCount;
- XID resource;
+ CursorHideCountPtr pNext;
+ ClientPtr pClient;
+ ScreenPtr pScreen;
+ int hideCount;
+ XID resource;
} CursorHideCountRec;
typedef struct PointerBarrierClient *PointerBarrierClientPtr;
@@ -126,11 +127,11 @@ struct PointerBarrierClient {
*/
typedef struct _CursorScreen {
- DisplayCursorProcPtr DisplayCursor;
- CloseScreenProcPtr CloseScreen;
+ DisplayCursorProcPtr DisplayCursor;
+ CloseScreenProcPtr CloseScreen;
ConstrainCursorHarderProcPtr ConstrainCursorHarder;
- CursorHideCountPtr pCursorHideCounts;
- struct xorg_list barriers;
+ CursorHideCountPtr pCursorHideCounts;
+ struct xorg_list barriers;
} CursorScreenRec, *CursorScreenPtr;
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
@@ -145,66 +146,63 @@ static Bool CursorVisible = FALSE;
Bool EnableCursor = TRUE;
static Bool
-CursorDisplayCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
- Bool ret;
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
+ Bool ret;
DisplayCursorProcPtr backupProc;
- Unwrap (cs, pScreen, DisplayCursor, backupProc);
+ Unwrap(cs, pScreen, DisplayCursor, backupProc);
/*
* Have to check ConnectionInfo to distinguish client requests from
* initial root window setup. Not a great way to do it, I admit.
*/
if (ConnectionInfo)
- CursorVisible = EnableCursor;
+ CursorVisible = EnableCursor;
if (cs->pCursorHideCounts != NULL || !CursorVisible) {
- ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor);
- } else {
- ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
+ ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor);
+ }
+ else {
+ ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
}
- if (pCursor != CursorCurrent[pDev->id])
- {
- CursorEventPtr e;
-
- CursorCurrent[pDev->id] = pCursor;
- for (e = cursorEvents; e; e = e->next)
- {
- if ((e->eventMask & XFixesDisplayCursorNotifyMask))
- {
- xXFixesCursorNotifyEvent ev;
- ev.type = XFixesEventBase + XFixesCursorNotify;
- ev.subtype = XFixesDisplayCursorNotify;
- ev.window = e->pWindow->drawable.id;
- ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
- ev.timestamp = currentTime.milliseconds;
- ev.name = pCursor ? pCursor->name : None;
- WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
- }
- }
+ if (pCursor != CursorCurrent[pDev->id]) {
+ CursorEventPtr e;
+
+ CursorCurrent[pDev->id] = pCursor;
+ for (e = cursorEvents; e; e = e->next) {
+ if ((e->eventMask & XFixesDisplayCursorNotifyMask)) {
+ xXFixesCursorNotifyEvent ev;
+
+ ev.type = XFixesEventBase + XFixesCursorNotify;
+ ev.subtype = XFixesDisplayCursorNotify;
+ ev.window = e->pWindow->drawable.id;
+ ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
+ ev.timestamp = currentTime.milliseconds;
+ ev.name = pCursor ? pCursor->name : None;
+ WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
+ }
+ }
}
- Wrap (cs, pScreen, DisplayCursor, backupProc);
+ Wrap(cs, pScreen, DisplayCursor, backupProc);
return ret;
}
static Bool
-CursorCloseScreen (int index, ScreenPtr pScreen)
+CursorCloseScreen(int index, ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen (pScreen);
- Bool ret;
- _X_UNUSED CloseScreenProcPtr close_proc;
- _X_UNUSED DisplayCursorProcPtr display_proc;
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
+ Bool ret;
+ _X_UNUSED CloseScreenProcPtr close_proc;
+ _X_UNUSED DisplayCursorProcPtr display_proc;
ConstrainCursorHarderProcPtr constrain_proc;
- Unwrap (cs, pScreen, CloseScreen, close_proc);
- Unwrap (cs, pScreen, DisplayCursor, display_proc);
- Unwrap (cs, pScreen, ConstrainCursorHarder, constrain_proc);
+ Unwrap(cs, pScreen, CloseScreen, close_proc);
+ Unwrap(cs, pScreen, DisplayCursor, display_proc);
+ Unwrap(cs, pScreen, ConstrainCursorHarder, constrain_proc);
deleteCursorHideCountsForScreen(pScreen);
ret = (*pScreen->CloseScreen) (index, pScreen);
free(cs);
@@ -214,102 +212,92 @@ CursorCloseScreen (int index, ScreenPtr pScreen)
#define CursorAllEvents (XFixesDisplayCursorNotifyMask)
static int
-XFixesSelectCursorInput (ClientPtr pClient,
- WindowPtr pWindow,
- CARD32 eventMask)
+XFixesSelectCursorInput(ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask)
{
- CursorEventPtr *prev, e;
+ CursorEventPtr *prev, e;
pointer val;
int rc;
- for (prev = &cursorEvents; (e = *prev); prev = &e->next)
- {
- if (e->pClient == pClient &&
- e->pWindow == pWindow)
- {
- break;
- }
+ for (prev = &cursorEvents; (e = *prev); prev = &e->next) {
+ if (e->pClient == pClient && e->pWindow == pWindow) {
+ break;
+ }
}
- if (!eventMask)
- {
- if (e)
- {
- FreeResource (e->clientResource, 0);
- }
- return Success;
+ if (!eventMask) {
+ if (e) {
+ FreeResource(e->clientResource, 0);
+ }
+ return Success;
}
- if (!e)
- {
- e = (CursorEventPtr) malloc(sizeof (CursorEventRec));
- if (!e)
- return BadAlloc;
-
- e->next = 0;
- e->pClient = pClient;
- e->pWindow = pWindow;
- e->clientResource = FakeClientID(pClient->index);
-
- /*
- * Add a resource hanging from the window to
- * catch window destroy
- */
- rc = dixLookupResourceByType( &val, pWindow->drawable.id,
- CursorWindowType, serverClient,
- DixGetAttrAccess);
- if (rc != Success)
- if (!AddResource (pWindow->drawable.id, CursorWindowType,
- (pointer) pWindow))
- {
- free(e);
- return BadAlloc;
- }
-
- if (!AddResource (e->clientResource, CursorClientType, (pointer) e))
- return BadAlloc;
-
- *prev = e;
+ if (!e) {
+ e = (CursorEventPtr) malloc(sizeof(CursorEventRec));
+ if (!e)
+ return BadAlloc;
+
+ e->next = 0;
+ e->pClient = pClient;
+ e->pWindow = pWindow;
+ e->clientResource = FakeClientID(pClient->index);
+
+ /*
+ * Add a resource hanging from the window to
+ * catch window destroy
+ */
+ rc = dixLookupResourceByType(&val, pWindow->drawable.id,
+ CursorWindowType, serverClient,
+ DixGetAttrAccess);
+ if (rc != Success)
+ if (!AddResource(pWindow->drawable.id, CursorWindowType,
+ (pointer) pWindow)) {
+ free(e);
+ return BadAlloc;
+ }
+
+ if (!AddResource(e->clientResource, CursorClientType, (pointer) e))
+ return BadAlloc;
+
+ *prev = e;
}
e->eventMask = eventMask;
return Success;
}
int
-ProcXFixesSelectCursorInput (ClientPtr client)
+ProcXFixesSelectCursorInput(ClientPtr client)
{
- REQUEST (xXFixesSelectCursorInputReq);
- WindowPtr pWin;
- int rc;
+ REQUEST(xXFixesSelectCursorInputReq);
+ WindowPtr pWin;
+ int rc;
- REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq);
+ REQUEST_SIZE_MATCH(xXFixesSelectCursorInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
- if (stuff->eventMask & ~CursorAllEvents)
- {
- client->errorValue = stuff->eventMask;
- return BadValue;
+ if (stuff->eventMask & ~CursorAllEvents) {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
}
- return XFixesSelectCursorInput (client, pWin, stuff->eventMask);
+ return XFixesSelectCursorInput(client, pWin, stuff->eventMask);
}
static int
-GetBit (unsigned char *line, int x)
+GetBit(unsigned char *line, int x)
{
- unsigned char mask;
-
+ unsigned char mask;
+
if (screenInfo.bitmapBitOrder == LSBFirst)
- mask = (1 << (x & 7));
+ mask = (1 << (x & 7));
else
- mask = (0x80 >> (x & 7));
+ mask = (0x80 >> (x & 7));
/* XXX assumes byte order is host byte order */
line += (x >> 3);
if (*line & mask)
- return 1;
+ return 1;
return 0;
}
int
-SProcXFixesSelectCursorInput (ClientPtr client)
+SProcXFixesSelectCursorInput(ClientPtr client)
{
REQUEST(xXFixesSelectCursorInputReq);
@@ -318,91 +306,85 @@ SProcXFixesSelectCursorInput (ClientPtr client)
swapl(&stuff->eventMask);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-
+
void
-SXFixesCursorNotifyEvent (xXFixesCursorNotifyEvent *from,
- xXFixesCursorNotifyEvent *to)
+SXFixesCursorNotifyEvent(xXFixesCursorNotifyEvent * from,
+ xXFixesCursorNotifyEvent * to)
{
to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->window, to->window);
- cpswapl (from->cursorSerial, to->cursorSerial);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->name, to->name);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->window, to->window);
+ cpswapl(from->cursorSerial, to->cursorSerial);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->name, to->name);
}
static void
-CopyCursorToImage (CursorPtr pCursor, CARD32 *image)
+CopyCursorToImage(CursorPtr pCursor, CARD32 *image)
{
int width = pCursor->bits->width;
int height = pCursor->bits->height;
int npixels = width * height;
-
+
#ifdef ARGB_CURSOR
if (pCursor->bits->argb)
- memcpy (image, pCursor->bits->argb, npixels * sizeof (CARD32));
+ memcpy(image, pCursor->bits->argb, npixels * sizeof(CARD32));
else
#endif
{
- unsigned char *srcLine = pCursor->bits->source;
- unsigned char *mskLine = pCursor->bits->mask;
- int stride = BitmapBytePad (width);
- int x, y;
- CARD32 fg, bg;
-
- fg = (0xff000000 |
- ((pCursor->foreRed & 0xff00) << 8) |
- (pCursor->foreGreen & 0xff00) |
- (pCursor->foreBlue >> 8));
- bg = (0xff000000 |
- ((pCursor->backRed & 0xff00) << 8) |
- (pCursor->backGreen & 0xff00) |
- (pCursor->backBlue >> 8));
- for (y = 0; y < height; y++)
- {
- for (x = 0; x < width; x++)
- {
- if (GetBit (mskLine, x))
- {
- if (GetBit (srcLine, x))
- *image++ = fg;
- else
- *image++ = bg;
- }
- else
- *image++ = 0;
- }
- srcLine += stride;
- mskLine += stride;
- }
+ unsigned char *srcLine = pCursor->bits->source;
+ unsigned char *mskLine = pCursor->bits->mask;
+ int stride = BitmapBytePad(width);
+ int x, y;
+ CARD32 fg, bg;
+
+ fg = (0xff000000 |
+ ((pCursor->foreRed & 0xff00) << 8) |
+ (pCursor->foreGreen & 0xff00) | (pCursor->foreBlue >> 8));
+ bg = (0xff000000 |
+ ((pCursor->backRed & 0xff00) << 8) |
+ (pCursor->backGreen & 0xff00) | (pCursor->backBlue >> 8));
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ if (GetBit(mskLine, x)) {
+ if (GetBit(srcLine, x))
+ *image++ = fg;
+ else
+ *image++ = bg;
+ }
+ else
+ *image++ = 0;
+ }
+ srcLine += stride;
+ mskLine += stride;
+ }
}
}
int
-ProcXFixesGetCursorImage (ClientPtr client)
+ProcXFixesGetCursorImage(ClientPtr client)
{
/* REQUEST(xXFixesGetCursorImageReq); */
- xXFixesGetCursorImageReply *rep;
- CursorPtr pCursor;
- CARD32 *image;
- int npixels, width, height, rc, x, y;
+ xXFixesGetCursorImageReply *rep;
+ CursorPtr pCursor;
+ CARD32 *image;
+ int npixels, width, height, rc, x, y;
REQUEST_SIZE_MATCH(xXFixesGetCursorImageReq);
pCursor = CursorCurrent[PickPointer(client)->id];
if (!pCursor)
- return BadCursor;
+ return BadCursor;
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
- pCursor, RT_NONE, NULL, DixReadAccess);
+ pCursor, RT_NONE, NULL, DixReadAccess);
if (rc != Success)
- return rc;
- GetSpritePosition (PickPointer(client), &x, &y);
+ return rc;
+ GetSpritePosition(PickPointer(client), &x, &y);
width = pCursor->bits->width;
height = pCursor->bits->height;
npixels = width * height;
- rep = malloc(sizeof (xXFixesGetCursorImageReply) +
- npixels * sizeof (CARD32));
+ rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32));
if (!rep)
- return BadAlloc;
+ return BadAlloc;
rep->type = X_Reply;
rep->sequenceNumber = client->sequence;
@@ -412,32 +394,31 @@ ProcXFixesGetCursorImage (ClientPtr client)
rep->x = x;
rep->y = y;
rep->xhot = pCursor->bits->xhot;
- rep->yhot = pCursor->bits->yhot;
+ rep->yhot = pCursor->bits->yhot;
rep->cursorSerial = pCursor->serialNumber;
image = (CARD32 *) (rep + 1);
- CopyCursorToImage (pCursor, image);
- if (client->swapped)
- {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->x);
- swaps(&rep->y);
- swaps(&rep->width);
- swaps(&rep->height);
- swaps(&rep->xhot);
- swaps(&rep->yhot);
- swapl(&rep->cursorSerial);
- SwapLongs (image, npixels);
+ CopyCursorToImage(pCursor, image);
+ if (client->swapped) {
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->x);
+ swaps(&rep->y);
+ swaps(&rep->width);
+ swaps(&rep->height);
+ swaps(&rep->xhot);
+ swaps(&rep->yhot);
+ swapl(&rep->cursorSerial);
+ SwapLongs(image, npixels);
}
- WriteToClient(client, sizeof (xXFixesGetCursorImageReply) +
- (npixels << 2), (char *) rep);
+ WriteToClient(client, sizeof(xXFixesGetCursorImageReply) +
+ (npixels << 2), (char *) rep);
free(rep);
return Success;
}
int
-SProcXFixesGetCursorImage (ClientPtr client)
+SProcXFixesGetCursorImage(ClientPtr client)
{
REQUEST(xXFixesGetCursorImageReq);
swaps(&stuff->length);
@@ -445,26 +426,27 @@ SProcXFixesGetCursorImage (ClientPtr client)
}
int
-ProcXFixesSetCursorName (ClientPtr client)
+ProcXFixesSetCursorName(ClientPtr client)
{
CursorPtr pCursor;
char *tchar;
+
REQUEST(xXFixesSetCursorNameReq);
Atom atom;
REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq);
VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess);
tchar = (char *) &stuff[1];
- atom = MakeAtom (tchar, stuff->nbytes, TRUE);
+ atom = MakeAtom(tchar, stuff->nbytes, TRUE);
if (atom == BAD_RESOURCE)
- return BadAlloc;
-
+ return BadAlloc;
+
pCursor->name = atom;
return Success;
}
int
-SProcXFixesSetCursorName (ClientPtr client)
+SProcXFixesSetCursorName(ClientPtr client)
{
REQUEST(xXFixesSetCursorNameReq);
@@ -476,10 +458,11 @@ SProcXFixesSetCursorName (ClientPtr client)
}
int
-ProcXFixesGetCursorName (ClientPtr client)
+ProcXFixesGetCursorName(ClientPtr client)
{
- CursorPtr pCursor;
- xXFixesGetCursorNameReply reply;
+ CursorPtr pCursor;
+ xXFixesGetCursorNameReply reply;
+
REQUEST(xXFixesGetCursorNameReq);
const char *str;
int len;
@@ -487,31 +470,30 @@ ProcXFixesGetCursorName (ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq);
VERIFY_CURSOR(pCursor, stuff->cursor, client, DixGetAttrAccess);
if (pCursor->name)
- str = NameForAtom (pCursor->name);
+ str = NameForAtom(pCursor->name);
else
- str = "";
- len = strlen (str);
-
+ str = "";
+ len = strlen(str);
+
reply.type = X_Reply;
reply.length = bytes_to_int32(len);
reply.sequenceNumber = client->sequence;
reply.atom = pCursor->name;
reply.nbytes = len;
- if (client->swapped)
- {
- swaps(&reply.sequenceNumber);
- swapl(&reply.length);
- swapl(&reply.atom);
- swaps(&reply.nbytes);
+ if (client->swapped) {
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swapl(&reply.atom);
+ swaps(&reply.nbytes);
}
WriteReplyToClient(client, sizeof(xXFixesGetCursorNameReply), &reply);
WriteToClient(client, len, str);
-
+
return Success;
}
int
-SProcXFixesGetCursorName (ClientPtr client)
+SProcXFixesGetCursorName(ClientPtr client)
{
REQUEST(xXFixesGetCursorNameReq);
@@ -522,37 +504,37 @@ SProcXFixesGetCursorName (ClientPtr client)
}
int
-ProcXFixesGetCursorImageAndName (ClientPtr client)
+ProcXFixesGetCursorImageAndName(ClientPtr client)
{
/* REQUEST(xXFixesGetCursorImageAndNameReq); */
- xXFixesGetCursorImageAndNameReply *rep;
- CursorPtr pCursor;
- CARD32 *image;
- int npixels;
- const char *name;
- int nbytes, nbytesRound;
- int width, height;
- int rc, x, y;
+ xXFixesGetCursorImageAndNameReply *rep;
+ CursorPtr pCursor;
+ CARD32 *image;
+ int npixels;
+ const char *name;
+ int nbytes, nbytesRound;
+ int width, height;
+ int rc, x, y;
REQUEST_SIZE_MATCH(xXFixesGetCursorImageAndNameReq);
pCursor = CursorCurrent[PickPointer(client)->id];
if (!pCursor)
- return BadCursor;
+ return BadCursor;
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
- pCursor, RT_NONE, NULL, DixReadAccess|DixGetAttrAccess);
+ pCursor, RT_NONE, NULL, DixReadAccess | DixGetAttrAccess);
if (rc != Success)
- return rc;
- GetSpritePosition (PickPointer(client), &x, &y);
+ return rc;
+ GetSpritePosition(PickPointer(client), &x, &y);
width = pCursor->bits->width;
height = pCursor->bits->height;
npixels = width * height;
- name = pCursor->name ? NameForAtom (pCursor->name) : "";
- nbytes = strlen (name);
+ name = pCursor->name ? NameForAtom(pCursor->name) : "";
+ nbytes = strlen(name);
nbytesRound = pad_to_int32(nbytes);
- rep = malloc(sizeof (xXFixesGetCursorImageAndNameReply) +
- npixels * sizeof (CARD32) + nbytesRound);
+ rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) +
+ npixels * sizeof(CARD32) + nbytesRound);
if (!rep)
- return BadAlloc;
+ return BadAlloc;
rep->type = X_Reply;
rep->sequenceNumber = client->sequence;
@@ -562,37 +544,36 @@ ProcXFixesGetCursorImageAndName (ClientPtr client)
rep->x = x;
rep->y = y;
rep->xhot = pCursor->bits->xhot;
- rep->yhot = pCursor->bits->yhot;
+ rep->yhot = pCursor->bits->yhot;
rep->cursorSerial = pCursor->serialNumber;
rep->cursorName = pCursor->name;
rep->nbytes = nbytes;
image = (CARD32 *) (rep + 1);
- CopyCursorToImage (pCursor, image);
- memcpy ((image + npixels), name, nbytes);
- if (client->swapped)
- {
- swaps(&rep->sequenceNumber);
- swapl(&rep->length);
- swaps(&rep->x);
- swaps(&rep->y);
- swaps(&rep->width);
- swaps(&rep->height);
- swaps(&rep->xhot);
- swaps(&rep->yhot);
- swapl(&rep->cursorSerial);
- swapl(&rep->cursorName);
- swaps(&rep->nbytes);
- SwapLongs (image, npixels);
+ CopyCursorToImage(pCursor, image);
+ memcpy((image + npixels), name, nbytes);
+ if (client->swapped) {
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->x);
+ swaps(&rep->y);
+ swaps(&rep->width);
+ swaps(&rep->height);
+ swaps(&rep->xhot);
+ swaps(&rep->yhot);
+ swapl(&rep->cursorSerial);
+ swapl(&rep->cursorName);
+ swaps(&rep->nbytes);
+ SwapLongs(image, npixels);
}
- WriteToClient(client, sizeof (xXFixesGetCursorImageAndNameReply) +
- (npixels << 2) + nbytesRound, (char *) rep);
+ WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply) +
+ (npixels << 2) + nbytesRound, (char *) rep);
free(rep);
return Success;
}
int
-SProcXFixesGetCursorImageAndName (ClientPtr client)
+SProcXFixesGetCursorImageAndName(ClientPtr client)
{
REQUEST(xXFixesGetCursorImageAndNameReq);
swaps(&stuff->length);
@@ -613,66 +594,61 @@ typedef struct {
pointer closure;
} ReplaceCursorLookupRec, *ReplaceCursorLookupPtr;
-static const RESTYPE CursorRestypes[] = {
+static const RESTYPE CursorRestypes[] = {
RT_WINDOW, RT_PASSIVEGRAB, RT_CURSOR
};
#define NUM_CURSOR_RESTYPES (sizeof (CursorRestypes) / sizeof (CursorRestypes[0]))
static Bool
-ReplaceCursorLookup (pointer value, XID id, pointer closure)
+ReplaceCursorLookup(pointer value, XID id, pointer closure)
{
- ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure;
- WindowPtr pWin;
- GrabPtr pGrab;
- CursorPtr pCursor = 0, *pCursorRef = 0;
- XID cursor = 0;
+ ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure;
+ WindowPtr pWin;
+ GrabPtr pGrab;
+ CursorPtr pCursor = 0, *pCursorRef = 0;
+ XID cursor = 0;
switch (rcl->type) {
case RT_WINDOW:
- pWin = (WindowPtr) value;
- if (pWin->optional)
- {
- pCursorRef = &pWin->optional->cursor;
- pCursor = *pCursorRef;
- }
- break;
+ pWin = (WindowPtr) value;
+ if (pWin->optional) {
+ pCursorRef = &pWin->optional->cursor;
+ pCursor = *pCursorRef;
+ }
+ break;
case RT_PASSIVEGRAB:
- pGrab = (GrabPtr) value;
- pCursorRef = &pGrab->cursor;
- pCursor = *pCursorRef;
- break;
+ pGrab = (GrabPtr) value;
+ pCursorRef = &pGrab->cursor;
+ pCursor = *pCursorRef;
+ break;
case RT_CURSOR:
- pCursorRef = 0;
- pCursor = (CursorPtr) value;
- cursor = id;
- break;
+ pCursorRef = 0;
+ pCursor = (CursorPtr) value;
+ cursor = id;
+ break;
}
- if (pCursor && pCursor != rcl->pNew)
- {
- if ((*rcl->testCursor) (pCursor, rcl->closure))
- {
- rcl->pNew->refcnt++;
- /* either redirect reference or update resource database */
- if (pCursorRef)
- *pCursorRef = rcl->pNew;
- else
- ChangeResourceValue (id, RT_CURSOR, rcl->pNew);
- FreeCursor (pCursor, cursor);
- }
+ if (pCursor && pCursor != rcl->pNew) {
+ if ((*rcl->testCursor) (pCursor, rcl->closure)) {
+ rcl->pNew->refcnt++;
+ /* either redirect reference or update resource database */
+ if (pCursorRef)
+ *pCursorRef = rcl->pNew;
+ else
+ ChangeResourceValue(id, RT_CURSOR, rcl->pNew);
+ FreeCursor(pCursor, cursor);
+ }
}
- return FALSE; /* keep walking */
+ return FALSE; /* keep walking */
}
static void
-ReplaceCursor (CursorPtr pCursor,
- TestCursorFunc testCursor,
- pointer closure)
+ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, pointer closure)
{
- int clientIndex;
+ int clientIndex;
int resIndex;
- ReplaceCursorLookupRec rcl;
-
+ ReplaceCursorLookupRec rcl;
+
/*
* Cursors exist only in the resource database, windows and grabs.
* All of these are always pointed at by the resource database. Walk
@@ -683,50 +659,48 @@ ReplaceCursor (CursorPtr pCursor,
rcl.closure = closure;
/* for each client */
- for (clientIndex = 0; clientIndex < currentMaxClients; clientIndex++)
- {
- if (!clients[clientIndex])
- continue;
- for (resIndex = 0; resIndex < NUM_CURSOR_RESTYPES; resIndex++)
- {
- rcl.type = CursorRestypes[resIndex];
- /*
- * This function walks the entire client resource database
- */
- LookupClientResourceComplex (clients[clientIndex],
- rcl.type,
- ReplaceCursorLookup,
- (pointer) &rcl);
- }
+ for (clientIndex = 0; clientIndex < currentMaxClients; clientIndex++) {
+ if (!clients[clientIndex])
+ continue;
+ for (resIndex = 0; resIndex < NUM_CURSOR_RESTYPES; resIndex++) {
+ rcl.type = CursorRestypes[resIndex];
+ /*
+ * This function walks the entire client resource database
+ */
+ LookupClientResourceComplex(clients[clientIndex],
+ rcl.type,
+ ReplaceCursorLookup, (pointer) &rcl);
+ }
}
/* this "knows" that WindowHasNewCursor doesn't depend on it's argument */
- WindowHasNewCursor (screenInfo.screens[0]->root);
+ WindowHasNewCursor(screenInfo.screens[0]->root);
}
-static Bool
-TestForCursor (CursorPtr pCursor, pointer closure)
+static Bool
+TestForCursor(CursorPtr pCursor, pointer closure)
{
return (pCursor == (CursorPtr) closure);
}
int
-ProcXFixesChangeCursor (ClientPtr client)
+ProcXFixesChangeCursor(ClientPtr client)
{
- CursorPtr pSource, pDestination;
+ CursorPtr pSource, pDestination;
+
REQUEST(xXFixesChangeCursorReq);
REQUEST_SIZE_MATCH(xXFixesChangeCursorReq);
- VERIFY_CURSOR (pSource, stuff->source, client,
- DixReadAccess|DixGetAttrAccess);
- VERIFY_CURSOR (pDestination, stuff->destination, client,
- DixWriteAccess|DixSetAttrAccess);
+ VERIFY_CURSOR(pSource, stuff->source, client,
+ DixReadAccess | DixGetAttrAccess);
+ VERIFY_CURSOR(pDestination, stuff->destination, client,
+ DixWriteAccess | DixSetAttrAccess);
- ReplaceCursor (pSource, TestForCursor, (pointer) pDestination);
+ ReplaceCursor(pSource, TestForCursor, (pointer) pDestination);
return Success;
}
int
-SProcXFixesChangeCursor (ClientPtr client)
+SProcXFixesChangeCursor(ClientPtr client)
{
REQUEST(xXFixesChangeCursorReq);
@@ -738,37 +712,39 @@ SProcXFixesChangeCursor (ClientPtr client)
}
static Bool
-TestForCursorName (CursorPtr pCursor, pointer closure)
+TestForCursorName(CursorPtr pCursor, pointer closure)
{
Atom *pName = closure;
+
return pCursor->name == *pName;
}
int
-ProcXFixesChangeCursorByName (ClientPtr client)
+ProcXFixesChangeCursorByName(ClientPtr client)
{
- CursorPtr pSource;
- Atom name;
- char *tchar;
+ CursorPtr pSource;
+ Atom name;
+ char *tchar;
+
REQUEST(xXFixesChangeCursorByNameReq);
REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes);
VERIFY_CURSOR(pSource, stuff->source, client,
- DixReadAccess|DixGetAttrAccess);
+ DixReadAccess | DixGetAttrAccess);
tchar = (char *) &stuff[1];
- name = MakeAtom (tchar, stuff->nbytes, FALSE);
+ name = MakeAtom(tchar, stuff->nbytes, FALSE);
if (name)
- ReplaceCursor (pSource, TestForCursorName, &name);
+ ReplaceCursor(pSource, TestForCursorName, &name);
return Success;
}
int
-SProcXFixesChangeCursorByName (ClientPtr client)
+SProcXFixesChangeCursorByName(ClientPtr client)
{
REQUEST(xXFixesChangeCursorByNameReq);
swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE (xXFixesChangeCursorByNameReq);
+ REQUEST_AT_LEAST_SIZE(xXFixesChangeCursorByNameReq);
swapl(&stuff->source);
swaps(&stuff->nbytes);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
@@ -782,29 +758,29 @@ SProcXFixesChangeCursorByName (ClientPtr client)
/* Return the screen's hide-counts list element for the given client */
static CursorHideCountPtr
-findCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
+findCursorHideCount(ClientPtr pClient, ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc;
for (pChc = cs->pCursorHideCounts; pChc != NULL; pChc = pChc->pNext) {
- if (pChc->pClient == pClient) {
- return pChc;
- }
+ if (pChc->pClient == pClient) {
+ return pChc;
+ }
}
- return NULL;
+ return NULL;
}
static int
-createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
+createCursorHideCount(ClientPtr pClient, ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc;
pChc = (CursorHideCountPtr) malloc(sizeof(CursorHideCountRec));
if (pChc == NULL) {
- return BadAlloc;
+ return BadAlloc;
}
pChc->pClient = pClient;
pChc->pScreen = pScreen;
@@ -812,15 +788,14 @@ createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
pChc->resource = FakeClientID(pClient->index);
pChc->pNext = cs->pCursorHideCounts;
cs->pCursorHideCounts = pChc;
-
+
/*
* Create a resource for this element so it can be deleted
* when the client goes away.
*/
- if (!AddResource (pChc->resource, CursorHideCountType,
- (pointer) pChc)) {
- free(pChc);
- return BadAlloc;
+ if (!AddResource(pChc->resource, CursorHideCountType, (pointer) pChc)) {
+ free(pChc);
+ return BadAlloc;
}
return Success;
@@ -830,26 +805,27 @@ createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
* Delete the given hide-counts list element from its screen list.
*/
static void
-deleteCursorHideCount (CursorHideCountPtr pChcToDel, ScreenPtr pScreen)
+deleteCursorHideCount(CursorHideCountPtr pChcToDel, ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc, pNext;
CursorHideCountPtr pChcLast = NULL;
pChc = cs->pCursorHideCounts;
while (pChc != NULL) {
- pNext = pChc->pNext;
- if (pChc == pChcToDel) {
- free(pChc);
- if (pChcLast == NULL) {
- cs->pCursorHideCounts = pNext;
- } else {
- pChcLast->pNext = pNext;
- }
- return;
- }
- pChcLast = pChc;
- pChc = pNext;
+ pNext = pChc->pNext;
+ if (pChc == pChcToDel) {
+ free(pChc);
+ if (pChcLast == NULL) {
+ cs->pCursorHideCounts = pNext;
+ }
+ else {
+ pChcLast->pNext = pNext;
+ }
+ return;
+ }
+ pChcLast = pChc;
+ pChc = pNext;
}
}
@@ -857,35 +833,36 @@ deleteCursorHideCount (CursorHideCountPtr pChcToDel, ScreenPtr pScreen)
* Delete all the hide-counts list elements for this screen.
*/
static void
-deleteCursorHideCountsForScreen (ScreenPtr pScreen)
+deleteCursorHideCountsForScreen(ScreenPtr pScreen)
{
- CursorScreenPtr cs = GetCursorScreen(pScreen);
+ CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc, pTmp;
pChc = cs->pCursorHideCounts;
while (pChc != NULL) {
- pTmp = pChc->pNext;
- FreeResource(pChc->resource, 0);
- pChc = pTmp;
+ pTmp = pChc->pNext;
+ FreeResource(pChc->resource, 0);
+ pChc = pTmp;
}
- cs->pCursorHideCounts = NULL;
+ cs->pCursorHideCounts = NULL;
}
-int
-ProcXFixesHideCursor (ClientPtr client)
+int
+ProcXFixesHideCursor(ClientPtr client)
{
WindowPtr pWin;
CursorHideCountPtr pChc;
+
REQUEST(xXFixesHideCursorReq);
int ret;
- REQUEST_SIZE_MATCH (xXFixesHideCursorReq);
+ REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
- ret = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
- client, DixGetAttrAccess);
+ ret = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+ client, DixGetAttrAccess);
if (ret != Success) {
- client->errorValue = stuff->window;
- return ret;
+ client->errorValue = stuff->window;
+ return ret;
}
/*
@@ -895,8 +872,8 @@ ProcXFixesHideCursor (ClientPtr client)
pChc = findCursorHideCount(client, pWin->drawable.pScreen);
if (pChc != NULL) {
- pChc->hideCount++;
- return Success;
+ pChc->hideCount++;
+ return Success;
}
/*
@@ -904,50 +881,52 @@ ProcXFixesHideCursor (ClientPtr client)
* for this screen.
*/
ret = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
- DixHideAccess);
+ DixHideAccess);
if (ret != Success)
- return ret;
+ return ret;
ret = createCursorHideCount(client, pWin->drawable.pScreen);
if (ret == Success) {
- DeviceIntPtr dev;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (IsMaster(dev) && IsPointerDevice(dev))
- CursorDisplayCursor(dev, pWin->drawable.pScreen, CursorCurrent[dev->id]);
- }
+ DeviceIntPtr dev;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (IsMaster(dev) && IsPointerDevice(dev))
+ CursorDisplayCursor(dev, pWin->drawable.pScreen,
+ CursorCurrent[dev->id]);
+ }
}
return ret;
}
-int
-SProcXFixesHideCursor (ClientPtr client)
+int
+SProcXFixesHideCursor(ClientPtr client)
{
REQUEST(xXFixesHideCursorReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesHideCursorReq);
+ REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-int
-ProcXFixesShowCursor (ClientPtr client)
+int
+ProcXFixesShowCursor(ClientPtr client)
{
WindowPtr pWin;
CursorHideCountPtr pChc;
int rc;
+
REQUEST(xXFixesShowCursorReq);
- REQUEST_SIZE_MATCH (xXFixesShowCursorReq);
+ REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
- client, DixGetAttrAccess);
+ rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+ client, DixGetAttrAccess);
if (rc != Success) {
- client->errorValue = stuff->window;
- return rc;
+ client->errorValue = stuff->window;
+ return rc;
}
/*
@@ -956,61 +935,58 @@ ProcXFixesShowCursor (ClientPtr client)
*/
pChc = findCursorHideCount(client, pWin->drawable.pScreen);
if (pChc == NULL) {
- return BadMatch;
+ return BadMatch;
}
rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
- DixShowAccess);
+ DixShowAccess);
if (rc != Success)
- return rc;
+ return rc;
pChc->hideCount--;
if (pChc->hideCount <= 0) {
- FreeResource(pChc->resource, 0);
+ FreeResource(pChc->resource, 0);
}
return Success;
}
-int
-SProcXFixesShowCursor (ClientPtr client)
+int
+SProcXFixesShowCursor(ClientPtr client)
{
REQUEST(xXFixesShowCursorReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesShowCursorReq);
+ REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
static int
-CursorFreeClient (pointer data, XID id)
+CursorFreeClient(pointer data, XID id)
{
- CursorEventPtr old = (CursorEventPtr) data;
- CursorEventPtr *prev, e;
-
- for (prev = &cursorEvents; (e = *prev); prev = &e->next)
- {
- if (e == old)
- {
- *prev = e->next;
- free(e);
- break;
- }
+ CursorEventPtr old = (CursorEventPtr) data;
+ CursorEventPtr *prev, e;
+
+ for (prev = &cursorEvents; (e = *prev); prev = &e->next) {
+ if (e == old) {
+ *prev = e->next;
+ free(e);
+ break;
+ }
}
return 1;
}
static int
-CursorFreeHideCount (pointer data, XID id)
+CursorFreeHideCount(pointer data, XID id)
{
CursorHideCountPtr pChc = (CursorHideCountPtr) data;
ScreenPtr pScreen = pChc->pScreen;
DeviceIntPtr dev;
deleteCursorHideCount(pChc, pChc->pScreen);
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (IsMaster(dev) && IsPointerDevice(dev))
CursorDisplayCursor(dev, pScreen, CursorCurrent[dev->id]);
}
@@ -1019,18 +995,16 @@ CursorFreeHideCount (pointer data, XID id)
}
static int
-CursorFreeWindow (pointer data, XID id)
+CursorFreeWindow(pointer data, XID id)
{
- WindowPtr pWindow = (WindowPtr) data;
- CursorEventPtr e, next;
+ WindowPtr pWindow = (WindowPtr) data;
+ CursorEventPtr e, next;
- for (e = cursorEvents; e; e = next)
- {
- next = e->next;
- if (e->pWindow == pWindow)
- {
- FreeResource (e->clientResource, 0);
- }
+ for (e = cursorEvents; e; e = next) {
+ next = e->next;
+ if (e->pWindow == pWindow) {
+ FreeResource(e->clientResource, 0);
+ }
}
return 1;
}
@@ -1058,13 +1032,13 @@ barrier_get_direction(int x1, int y1, int x2, int y2)
/* which way are we trying to go */
if (x2 > x1)
- direction |= BarrierPositiveX;
+ direction |= BarrierPositiveX;
if (x2 < x1)
- direction |= BarrierNegativeX;
+ direction |= BarrierNegativeX;
if (y2 > y1)
- direction |= BarrierPositiveY;
+ direction |= BarrierPositiveY;
if (y2 < y1)
- direction |= BarrierNegativeY;
+ direction |= BarrierNegativeY;
return direction;
}
@@ -1078,7 +1052,8 @@ barrier_get_direction(int x1, int y1, int x2, int y2)
* otherwise.
*/
BOOL
-barrier_is_blocking_direction(const struct PointerBarrier *barrier, int direction)
+barrier_is_blocking_direction(const struct PointerBarrier * barrier,
+ int direction)
{
/* Barriers define which way is ok, not which way is blocking */
return (barrier->directions & direction) != direction;
@@ -1098,9 +1073,8 @@ barrier_is_blocking_direction(const struct PointerBarrier *barrier, int directio
* @return TRUE if the barrier intersects with the given vector
*/
BOOL
-barrier_is_blocking(const struct PointerBarrier *barrier,
- int x1, int y1, int x2, int y2,
- double *distance)
+barrier_is_blocking(const struct PointerBarrier * barrier,
+ int x1, int y1, int x2, int y2, double *distance)
{
BOOL rc = FALSE;
float ua, ub, ud;
@@ -1109,48 +1083,49 @@ barrier_is_blocking(const struct PointerBarrier *barrier,
/* Algorithm below doesn't handle edge cases well, hence the extra
* checks. */
if (barrier_is_vertical(barrier)) {
- /* handle immediate barrier adjacency, moving away */
- if (dir & BarrierPositiveX && x1 == barrier->x1)
- return FALSE;
- if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
- return FALSE;
- /* startpoint adjacent to barrier, moving towards -> block */
- if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
- *distance = 0;
- return TRUE;
- }
- } else {
- /* handle immediate barrier adjacency, moving away */
- if (dir & BarrierPositiveY && y1 == barrier->y1)
- return FALSE;
- if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
- return FALSE;
- /* startpoint adjacent to barrier, moving towards -> block */
- if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
- *distance = 0;
- return TRUE;
+ /* handle immediate barrier adjacency, moving away */
+ if (dir & BarrierPositiveX && x1 == barrier->x1)
+ return FALSE;
+ if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
+ return FALSE;
+ /* startpoint adjacent to barrier, moving towards -> block */
+ if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
+ *distance = 0;
+ return TRUE;
+ }
+ }
+ else {
+ /* handle immediate barrier adjacency, moving away */
+ if (dir & BarrierPositiveY && y1 == barrier->y1)
+ return FALSE;
+ if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
+ return FALSE;
+ /* startpoint adjacent to barrier, moving towards -> block */
+ if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
+ *distance = 0;
+ return TRUE;
}
}
/* not an edge case, compute distance */
ua = 0;
- ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 - barrier->x1) * (y2 - y1);
+ ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 -
+ barrier->x1) * (y2 - y1);
if (ud != 0) {
- ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
- (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
- ub = ((x2 - x1) * (y1 - barrier->y1) -
- (y2 - y1) * (x1 - barrier->x1)) / ud;
- if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
- ua = 0;
+ ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
+ (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
+ ub = ((x2 - x1) * (y1 - barrier->y1) -
+ (y2 - y1) * (x1 - barrier->x1)) / ud;
+ if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
+ ua = 0;
}
- if (ua > 0 && ua <= 1)
- {
- double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
- double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
+ if (ua > 0 && ua <= 1) {
+ double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
+ double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
- *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
- rc = TRUE;
+ *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
+ rc = TRUE;
}
return rc;
@@ -1166,29 +1141,27 @@ barrier_is_blocking(const struct PointerBarrier *barrier,
* @param y2 Y end coordinate of movement vector
* @return The barrier nearest to the movement origin that blocks this movement.
*/
-static struct PointerBarrier*
+static struct PointerBarrier *
barrier_find_nearest(CursorScreenPtr cs, int dir,
- int x1, int y1, int x2, int y2)
+ int x1, int y1, int x2, int y2)
{
struct PointerBarrierClient *c = NULL;
struct PointerBarrier *nearest = NULL;
- double min_distance = INT_MAX; /* can't get higher than that in X anyway */
+ double min_distance = INT_MAX; /* can't get higher than that in X anyway */
xorg_list_for_each_entry(c, &cs->barriers, entry) {
- struct PointerBarrier *b = &c->barrier;
- double distance;
-
- if (!barrier_is_blocking_direction(b, dir))
- continue;
-
- if (barrier_is_blocking(b, x1, y1, x2, y2, &distance))
- {
- if (min_distance > distance)
- {
- min_distance = distance;
- nearest = b;
- }
- }
+ struct PointerBarrier *b = &c->barrier;
+ double distance;
+
+ if (!barrier_is_blocking_direction(b, dir))
+ continue;
+
+ if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) {
+ if (min_distance > distance) {
+ min_distance = distance;
+ nearest = b;
+ }
+ }
}
return nearest;
@@ -1203,117 +1176,120 @@ barrier_find_nearest(CursorScreenPtr cs, int dir,
* @param[out] y The clamped x coordinate.
*/
void
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y)
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
+ int *y)
{
- if (barrier_is_vertical(barrier))
- {
- if ((dir & BarrierNegativeX) & ~barrier->directions)
- *x = barrier->x1;
- if ((dir & BarrierPositiveX) & ~barrier->directions)
- *x = barrier->x1 - 1;
+ if (barrier_is_vertical(barrier)) {
+ if ((dir & BarrierNegativeX) & ~barrier->directions)
+ *x = barrier->x1;
+ if ((dir & BarrierPositiveX) & ~barrier->directions)
+ *x = barrier->x1 - 1;
}
- if (barrier_is_horizontal(barrier))
- {
- if ((dir & BarrierNegativeY) & ~barrier->directions)
- *y = barrier->y1;
- if ((dir & BarrierPositiveY) & ~barrier->directions)
- *y = barrier->y1 - 1;
+ if (barrier_is_horizontal(barrier)) {
+ if ((dir & BarrierNegativeY) & ~barrier->directions)
+ *y = barrier->y1;
+ if ((dir & BarrierPositiveY) & ~barrier->directions)
+ *y = barrier->y1 - 1;
}
}
static void
-CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y)
+CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
+ int *x, int *y)
{
CursorScreenPtr cs = GetCursorScreen(screen);
- if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) {
- int ox, oy;
- int dir;
- struct PointerBarrier *nearest = NULL;
-
- /* where are we coming from */
- miPointerGetPosition(dev, &ox, &oy);
-
- /* How this works:
- * Given the origin and the movement vector, get the nearest barrier
- * to the origin that is blocking the movement.
- * Clamp to that barrier.
- * Then, check from the clamped intersection to the original
- * destination, again finding the nearest barrier and clamping.
- */
- dir = barrier_get_direction(ox, oy, *x, *y);
-
- nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
- if (nearest) {
- barrier_clamp_to_barrier(nearest, dir, x, y);
-
- if (barrier_is_vertical(nearest)) {
- dir &= ~(BarrierNegativeX | BarrierPositiveX);
- ox = *x;
- } else if (barrier_is_horizontal(nearest)) {
- dir &= ~(BarrierNegativeY | BarrierPositiveY);
- oy = *y;
- }
-
- nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
- if (nearest) {
- barrier_clamp_to_barrier(nearest, dir, x, y);
- }
- }
+ if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) &&
+ mode == Relative) {
+ int ox, oy;
+ int dir;
+ struct PointerBarrier *nearest = NULL;
+
+ /* where are we coming from */
+ miPointerGetPosition(dev, &ox, &oy);
+
+ /* How this works:
+ * Given the origin and the movement vector, get the nearest barrier
+ * to the origin that is blocking the movement.
+ * Clamp to that barrier.
+ * Then, check from the clamped intersection to the original
+ * destination, again finding the nearest barrier and clamping.
+ */
+ dir = barrier_get_direction(ox, oy, *x, *y);
+
+ nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
+ if (nearest) {
+ barrier_clamp_to_barrier(nearest, dir, x, y);
+
+ if (barrier_is_vertical(nearest)) {
+ dir &= ~(BarrierNegativeX | BarrierPositiveX);
+ ox = *x;
+ }
+ else if (barrier_is_horizontal(nearest)) {
+ dir &= ~(BarrierNegativeY | BarrierPositiveY);
+ oy = *y;
+ }
+
+ nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
+ if (nearest) {
+ barrier_clamp_to_barrier(nearest, dir, x, y);
+ }
+ }
}
if (cs->ConstrainCursorHarder) {
- screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
- screen->ConstrainCursorHarder(dev, screen, mode, x, y);
- screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
+ screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
+ screen->ConstrainCursorHarder(dev, screen, mode, x, y);
+ screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
}
}
static struct PointerBarrierClient *
CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
- xXFixesCreatePointerBarrierReq *stuff)
+ xXFixesCreatePointerBarrierReq * stuff)
{
CursorScreenPtr cs = GetCursorScreen(screen);
struct PointerBarrierClient *ret = malloc(sizeof(*ret));
if (ret) {
- ret->screen = screen;
- ret->barrier.x1 = min(stuff->x1, stuff->x2);
- ret->barrier.x2 = max(stuff->x1, stuff->x2);
- ret->barrier.y1 = min(stuff->y1, stuff->y2);
- ret->barrier.y2 = max(stuff->y1, stuff->y2);
- ret->barrier.directions = stuff->directions & 0x0f;
- if (barrier_is_horizontal(&ret->barrier))
- ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
- if (barrier_is_vertical(&ret->barrier))
- ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
- xorg_list_add(&ret->entry, &cs->barriers);
+ ret->screen = screen;
+ ret->barrier.x1 = min(stuff->x1, stuff->x2);
+ ret->barrier.x2 = max(stuff->x1, stuff->x2);
+ ret->barrier.y1 = min(stuff->y1, stuff->y2);
+ ret->barrier.y2 = max(stuff->y1, stuff->y2);
+ ret->barrier.directions = stuff->directions & 0x0f;
+ if (barrier_is_horizontal(&ret->barrier))
+ ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
+ if (barrier_is_vertical(&ret->barrier))
+ ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
+ xorg_list_add(&ret->entry, &cs->barriers);
}
return ret;
}
int
-ProcXFixesCreatePointerBarrier (ClientPtr client)
+ProcXFixesCreatePointerBarrier(ClientPtr client)
{
int err;
WindowPtr pWin;
struct PointerBarrierClient *barrier;
struct PointerBarrier b;
- REQUEST (xXFixesCreatePointerBarrierReq);
+
+ REQUEST(xXFixesCreatePointerBarrierReq);
REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
LEGAL_NEW_RESOURCE(stuff->barrier, client);
err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
if (err != Success) {
- client->errorValue = stuff->window;
- return err;
+ client->errorValue = stuff->window;
+ return err;
}
/* This sure does need fixing. */
if (stuff->num_devices)
- return BadImplementation;
+ return BadImplementation;
b.x1 = stuff->x1;
b.x2 = stuff->x2;
@@ -1321,24 +1297,24 @@ ProcXFixesCreatePointerBarrier (ClientPtr client)
b.y2 = stuff->y2;
if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
- return BadValue;
+ return BadValue;
/* no 0-sized barriers */
if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
- return BadValue;
+ return BadValue;
if (!(barrier = CreatePointerBarrierClient(pWin->drawable.pScreen,
- client, stuff)))
- return BadAlloc;
+ client, stuff)))
+ return BadAlloc;
if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
int
-SProcXFixesCreatePointerBarrier (ClientPtr client)
+SProcXFixesCreatePointerBarrier(ClientPtr client)
{
REQUEST(xXFixesCreatePointerBarrierReq);
@@ -1351,7 +1327,7 @@ SProcXFixesCreatePointerBarrier (ClientPtr client)
swaps(&stuff->x2);
swaps(&stuff->y2);
swapl(&stuff->directions);
- return ProcXFixesVector[stuff->xfixesReqType](client);
+ return ProcXFixesVector[stuff->xfixesReqType] (client);
}
static int
@@ -1362,15 +1338,16 @@ CursorFreeBarrier(void *data, XID id)
CursorScreenPtr cs;
barrier = container_of(data, struct PointerBarrierClient, barrier);
+
screen = barrier->screen;
cs = GetCursorScreen(screen);
/* find and unlink from the screen private */
xorg_list_for_each_entry(b, &cs->barriers, entry) {
- if (b == barrier) {
- xorg_list_del(&b->entry);
- break;
- }
+ if (b == barrier) {
+ xorg_list_del(&b->entry);
+ break;
+ }
}
free(barrier);
@@ -1378,20 +1355,20 @@ CursorFreeBarrier(void *data, XID id)
}
int
-ProcXFixesDestroyPointerBarrier (ClientPtr client)
+ProcXFixesDestroyPointerBarrier(ClientPtr client)
{
int err;
void *barrier;
- REQUEST (xXFixesDestroyPointerBarrierReq);
+
+ REQUEST(xXFixesDestroyPointerBarrierReq);
REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
- err = dixLookupResourceByType((void **)&barrier, stuff->barrier,
- PointerBarrierType, client,
- DixDestroyAccess);
+ err = dixLookupResourceByType((void **) &barrier, stuff->barrier,
+ PointerBarrierType, client, DixDestroyAccess);
if (err != Success) {
- client->errorValue = stuff->barrier;
- return err;
+ client->errorValue = stuff->barrier;
+ return err;
}
FreeResource(stuff->barrier, RT_NONE);
@@ -1399,52 +1376,50 @@ ProcXFixesDestroyPointerBarrier (ClientPtr client)
}
int
-SProcXFixesDestroyPointerBarrier (ClientPtr client)
+SProcXFixesDestroyPointerBarrier(ClientPtr client)
{
REQUEST(xXFixesDestroyPointerBarrierReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
swapl(&stuff->barrier);
- return ProcXFixesVector[stuff->xfixesReqType](client);
+ return ProcXFixesVector[stuff->xfixesReqType] (client);
}
Bool
-XFixesCursorInit (void)
+XFixesCursorInit(void)
{
- int i;
+ int i;
if (party_like_its_1989)
- CursorVisible = EnableCursor;
-
- if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ CursorVisible = EnableCursor;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
- CursorScreenPtr cs;
-
- cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
- if (!cs)
- return FALSE;
- xorg_list_init(&cs->barriers);
- Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
- Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor);
- Wrap (cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
- cs->pCursorHideCounts = NULL;
- SetCursorScreen (pScreen, cs);
+ if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ CursorScreenPtr cs;
+
+ cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec));
+ if (!cs)
+ return FALSE;
+ xorg_list_init(&cs->barriers);
+ Wrap(cs, pScreen, CloseScreen, CursorCloseScreen);
+ Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
+ Wrap(cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
+ cs->pCursorHideCounts = NULL;
+ SetCursorScreen(pScreen, cs);
}
CursorClientType = CreateNewResourceType(CursorFreeClient,
- "XFixesCursorClient");
+ "XFixesCursorClient");
CursorHideCountType = CreateNewResourceType(CursorFreeHideCount,
- "XFixesCursorHideCount");
+ "XFixesCursorHideCount");
CursorWindowType = CreateNewResourceType(CursorFreeWindow,
- "XFixesCursorWindow");
+ "XFixesCursorWindow");
PointerBarrierType = CreateNewResourceType(CursorFreeBarrier,
- "XFixesPointerBarrier");
+ "XFixesPointerBarrier");
return CursorClientType && CursorHideCountType && CursorWindowType &&
- PointerBarrierType;
+ PointerBarrierType;
}
-
diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c
index 4c2263702..624109de1 100644
--- a/xorg-server/xfixes/region.c
+++ b/xorg-server/xfixes/region.c
@@ -28,6 +28,7 @@
#include "scrnintstr.h"
#include <picturestr.h>
extern int RenderErrBase;
+
#include <regionstr.h>
#include <gcstruct.h>
#include <window.h>
@@ -35,31 +36,31 @@ extern int RenderErrBase;
RESTYPE RegionResType;
static int
-RegionResFree (pointer data, XID id)
+RegionResFree(pointer data, XID id)
{
- RegionPtr pRegion = (RegionPtr) data;
+ RegionPtr pRegion = (RegionPtr) data;
RegionDestroy(pRegion);
return Success;
}
RegionPtr
-XFixesRegionCopy (RegionPtr pRegion)
+XFixesRegionCopy(RegionPtr pRegion)
{
- RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
- RegionNumRects(pRegion));
+ RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
+ RegionNumRects(pRegion));
+
if (!pNew)
- return 0;
- if (!RegionCopy(pNew, pRegion))
- {
- RegionDestroy(pNew);
- return 0;
+ return 0;
+ if (!RegionCopy(pNew, pRegion)) {
+ RegionDestroy(pNew);
+ return 0;
}
return pNew;
}
Bool
-XFixesRegionInit (void)
+XFixesRegionInit(void)
{
RegionResType = CreateNewResourceType(RegionResFree, "XFixesRegion");
@@ -67,34 +68,35 @@ XFixesRegionInit (void)
}
int
-ProcXFixesCreateRegion (ClientPtr client)
+ProcXFixesCreateRegion(ClientPtr client)
{
- int things;
- RegionPtr pRegion;
- REQUEST (xXFixesCreateRegionReq);
-
+ int things;
+ RegionPtr pRegion;
+
+ REQUEST(xXFixesCreateRegionReq);
+
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
-
- things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+
+ things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pRegion)
- return BadAlloc;
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegion (ClientPtr client)
+SProcXFixesCreateRegion(ClientPtr client)
{
REQUEST(xXFixesCreateRegionReq);
-
+
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
swapl(&stuff->region);
@@ -103,221 +105,221 @@ SProcXFixesCreateRegion (ClientPtr client)
}
int
-ProcXFixesCreateRegionFromBitmap (ClientPtr client)
+ProcXFixesCreateRegionFromBitmap(ClientPtr client)
{
- RegionPtr pRegion;
- PixmapPtr pPixmap;
+ RegionPtr pRegion;
+ PixmapPtr pPixmap;
int rc;
- REQUEST (xXFixesCreateRegionFromBitmapReq);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST(xXFixesCreateRegionFromBitmapReq);
- rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP,
- client, DixReadAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->bitmap;
- return rc;
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+
+ rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->bitmap, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->bitmap;
+ return rc;
}
if (pPixmap->drawable.depth != 1)
- return BadMatch;
+ return BadMatch;
pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap);
if (!pRegion)
- return BadAlloc;
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromBitmap (ClientPtr client)
+SProcXFixesCreateRegionFromBitmap(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromBitmapReq);
+ REQUEST(xXFixesCreateRegionFromBitmapReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
swapl(&stuff->region);
swapl(&stuff->bitmap);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromWindow (ClientPtr client)
+ProcXFixesCreateRegionFromWindow(ClientPtr client)
{
- RegionPtr pRegion;
- Bool copy = TRUE;
- WindowPtr pWin;
+ RegionPtr pRegion;
+ Bool copy = TRUE;
+ WindowPtr pWin;
int rc;
- REQUEST (xXFixesCreateRegionFromWindowReq);
-
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
- client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return rc;
+
+ REQUEST(xXFixesCreateRegionFromWindowReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
+ rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+ client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->window;
+ return rc;
}
switch (stuff->kind) {
case WindowRegionBounding:
- pRegion = wBoundingShape(pWin);
- if (!pRegion)
- {
- pRegion = CreateBoundingShape (pWin);
- copy = FALSE;
- }
- break;
+ pRegion = wBoundingShape(pWin);
+ if (!pRegion) {
+ pRegion = CreateBoundingShape(pWin);
+ copy = FALSE;
+ }
+ break;
case WindowRegionClip:
- pRegion = wClipShape(pWin);
- if (!pRegion)
- {
- pRegion = CreateClipShape (pWin);
- copy = FALSE;
- }
- break;
+ pRegion = wClipShape(pWin);
+ if (!pRegion) {
+ pRegion = CreateClipShape(pWin);
+ copy = FALSE;
+ }
+ break;
default:
- client->errorValue = stuff->kind;
- return BadValue;
+ client->errorValue = stuff->kind;
+ return BadValue;
}
if (copy && pRegion)
- pRegion = XFixesRegionCopy (pRegion);
+ pRegion = XFixesRegionCopy(pRegion);
if (!pRegion)
- return BadAlloc;
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+ return BadAlloc;
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromWindow (ClientPtr client)
+SProcXFixesCreateRegionFromWindow(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromWindowReq);
+ REQUEST(xXFixesCreateRegionFromWindowReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
swapl(&stuff->region);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromGC (ClientPtr client)
+ProcXFixesCreateRegionFromGC(ClientPtr client)
{
- RegionPtr pRegion, pClip;
- GCPtr pGC;
- int rc;
- REQUEST (xXFixesCreateRegionFromGCReq);
+ RegionPtr pRegion, pClip;
+ GCPtr pGC;
+ int rc;
+
+ REQUEST(xXFixesCreateRegionFromGCReq);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
-
+ return rc;
+
switch (pGC->clientClipType) {
case CT_PIXMAP:
- pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
case CT_REGION:
- pClip = (RegionPtr) pGC->clientClip;
- pRegion = XFixesRegionCopy (pClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pClip = (RegionPtr) pGC->clientClip;
+ pRegion = XFixesRegionCopy(pClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
default:
- return BadImplementation; /* assume sane server bits */
+ return BadImplementation; /* assume sane server bits */
}
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromGC (ClientPtr client)
+SProcXFixesCreateRegionFromGC(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromGCReq);
+ REQUEST(xXFixesCreateRegionFromGCReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
swapl(&stuff->region);
swapl(&stuff->gc);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesCreateRegionFromPicture (ClientPtr client)
+ProcXFixesCreateRegionFromPicture(ClientPtr client)
{
- RegionPtr pRegion;
- PicturePtr pPicture;
- REQUEST (xXFixesCreateRegionFromPictureReq);
+ RegionPtr pRegion;
+ PicturePtr pPicture;
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
- LEGAL_NEW_RESOURCE (stuff->region, client);
+ REQUEST(xXFixesCreateRegionFromPictureReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
+ LEGAL_NEW_RESOURCE(stuff->region, client);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
-
+
switch (pPicture->clientClipType) {
case CT_PIXMAP:
- pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
- (PixmapPtr) pPicture->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
+ (PixmapPtr) pPicture->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
case CT_REGION:
- pRegion = XFixesRegionCopy ((RegionPtr) pPicture->clientClip);
- if (!pRegion)
- return BadAlloc;
- break;
+ pRegion = XFixesRegionCopy((RegionPtr) pPicture->clientClip);
+ if (!pRegion)
+ return BadAlloc;
+ break;
default:
- return BadImplementation; /* assume sane server bits */
+ return BadImplementation; /* assume sane server bits */
}
-
- if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
- return BadAlloc;
-
+
+ if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+ return BadAlloc;
+
return Success;
}
int
-SProcXFixesCreateRegionFromPicture (ClientPtr client)
+SProcXFixesCreateRegionFromPicture(ClientPtr client)
{
- REQUEST (xXFixesCreateRegionFromPictureReq);
+ REQUEST(xXFixesCreateRegionFromPictureReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
+ REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
swapl(&stuff->region);
swapl(&stuff->picture);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
-ProcXFixesDestroyRegion (ClientPtr client)
+ProcXFixesDestroyRegion(ClientPtr client)
{
- REQUEST (xXFixesDestroyRegionReq);
- RegionPtr pRegion;
+ REQUEST(xXFixesDestroyRegionReq);
+ RegionPtr pRegion;
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
- FreeResource (stuff->region, RT_NONE);
+ FreeResource(stuff->region, RT_NONE);
return Success;
}
int
-SProcXFixesDestroyRegion (ClientPtr client)
+SProcXFixesDestroyRegion(ClientPtr client)
{
- REQUEST (xXFixesDestroyRegionReq);
+ REQUEST(xXFixesDestroyRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
@@ -326,36 +328,36 @@ SProcXFixesDestroyRegion (ClientPtr client)
}
int
-ProcXFixesSetRegion (ClientPtr client)
+ProcXFixesSetRegion(ClientPtr client)
{
- int things;
- RegionPtr pRegion, pNew;
- REQUEST (xXFixesSetRegionReq);
+ int things;
+ RegionPtr pRegion, pNew;
+
+ REQUEST(xXFixesSetRegionReq);
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
-
- things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);
+
+ things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pNew)
- return BadAlloc;
- if (!RegionCopy(pRegion, pNew))
- {
- RegionDestroy(pNew);
- return BadAlloc;
+ return BadAlloc;
+ if (!RegionCopy(pRegion, pNew)) {
+ RegionDestroy(pNew);
+ return BadAlloc;
}
RegionDestroy(pNew);
return Success;
}
int
-SProcXFixesSetRegion (ClientPtr client)
+SProcXFixesSetRegion(ClientPtr client)
{
- REQUEST (xXFixesSetRegionReq);
+ REQUEST(xXFixesSetRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
@@ -365,24 +367,25 @@ SProcXFixesSetRegion (ClientPtr client)
}
int
-ProcXFixesCopyRegion (ClientPtr client)
+ProcXFixesCopyRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- REQUEST (xXFixesCopyRegionReq);
-
+ RegionPtr pSource, pDestination;
+
+ REQUEST(xXFixesCopyRegionReq);
+
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
if (!RegionCopy(pDestination, pSource))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
int
-SProcXFixesCopyRegion (ClientPtr client)
+SProcXFixesCopyRegion(ClientPtr client)
{
- REQUEST (xXFixesCopyRegionReq);
+ REQUEST(xXFixesCopyRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq);
@@ -392,41 +395,42 @@ SProcXFixesCopyRegion (ClientPtr client)
}
int
-ProcXFixesCombineRegion (ClientPtr client)
+ProcXFixesCombineRegion(ClientPtr client)
{
- RegionPtr pSource1, pSource2, pDestination;
- REQUEST (xXFixesCombineRegionReq);
+ RegionPtr pSource1, pSource2, pDestination;
- REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
+ REQUEST(xXFixesCombineRegionReq);
+
+ REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess);
VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
switch (stuff->xfixesReqType) {
case X_XFixesUnionRegion:
- if (!RegionUnion(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionUnion(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
case X_XFixesIntersectRegion:
- if (!RegionIntersect(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionIntersect(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
case X_XFixesSubtractRegion:
- if (!RegionSubtract(pDestination, pSource1, pSource2))
- return BadAlloc;
- break;
+ if (!RegionSubtract(pDestination, pSource1, pSource2))
+ return BadAlloc;
+ break;
}
-
+
return Success;
}
int
-SProcXFixesCombineRegion (ClientPtr client)
+SProcXFixesCombineRegion(ClientPtr client)
{
- REQUEST (xXFixesCombineRegionReq);
+ REQUEST(xXFixesCombineRegionReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
swapl(&stuff->source1);
swapl(&stuff->source2);
swapl(&stuff->destination);
@@ -434,10 +438,11 @@ SProcXFixesCombineRegion (ClientPtr client)
}
int
-ProcXFixesInvertRegion (ClientPtr client)
+ProcXFixesInvertRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- BoxRec bounds;
+ RegionPtr pSource, pDestination;
+ BoxRec bounds;
+
REQUEST(xXFixesInvertRegionReq);
REQUEST_SIZE_MATCH(xXFixesInvertRegionReq);
@@ -448,23 +453,23 @@ ProcXFixesInvertRegion (ClientPtr client)
bounds.x1 = stuff->x;
bounds.y1 = stuff->y;
if ((int) stuff->x + (int) stuff->width > MAXSHORT)
- bounds.x2 = MAXSHORT;
+ bounds.x2 = MAXSHORT;
else
- bounds.x2 = stuff->x + stuff->width;
-
+ bounds.x2 = stuff->x + stuff->width;
+
if ((int) stuff->y + (int) stuff->height > MAXSHORT)
- bounds.y2 = MAXSHORT;
+ bounds.y2 = MAXSHORT;
else
- bounds.y2 = stuff->y + stuff->height;
+ bounds.y2 = stuff->y + stuff->height;
if (!RegionInverse(pDestination, pSource, &bounds))
- return BadAlloc;
+ return BadAlloc;
return Success;
}
int
-SProcXFixesInvertRegion (ClientPtr client)
+SProcXFixesInvertRegion(ClientPtr client)
{
REQUEST(xXFixesInvertRegionReq);
@@ -480,9 +485,10 @@ SProcXFixesInvertRegion (ClientPtr client)
}
int
-ProcXFixesTranslateRegion (ClientPtr client)
+ProcXFixesTranslateRegion(ClientPtr client)
{
- RegionPtr pRegion;
+ RegionPtr pRegion;
+
REQUEST(xXFixesTranslateRegionReq);
REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
@@ -493,7 +499,7 @@ ProcXFixesTranslateRegion (ClientPtr client)
}
int
-SProcXFixesTranslateRegion (ClientPtr client)
+SProcXFixesTranslateRegion(ClientPtr client)
{
REQUEST(xXFixesTranslateRegionReq);
@@ -506,9 +512,10 @@ SProcXFixesTranslateRegion (ClientPtr client)
}
int
-ProcXFixesRegionExtents (ClientPtr client)
+ProcXFixesRegionExtents(ClientPtr client)
{
- RegionPtr pSource, pDestination;
+ RegionPtr pSource, pDestination;
+
REQUEST(xXFixesRegionExtentsReq);
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
@@ -521,10 +528,10 @@ ProcXFixesRegionExtents (ClientPtr client)
}
int
-SProcXFixesRegionExtents (ClientPtr client)
+SProcXFixesRegionExtents(ClientPtr client)
{
REQUEST(xXFixesRegionExtentsReq);
-
+
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
swapl(&stuff->source);
@@ -533,27 +540,27 @@ SProcXFixesRegionExtents (ClientPtr client)
}
int
-ProcXFixesFetchRegion (ClientPtr client)
+ProcXFixesFetchRegion(ClientPtr client)
{
- RegionPtr pRegion;
+ RegionPtr pRegion;
xXFixesFetchRegionReply *reply;
- xRectangle *pRect;
- BoxPtr pExtent;
- BoxPtr pBox;
- int i, nBox;
+ xRectangle *pRect;
+ BoxPtr pExtent;
+ BoxPtr pBox;
+ int i, nBox;
+
REQUEST(xXFixesFetchRegionReq);
REQUEST_SIZE_MATCH(xXFixesFetchRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);
pExtent = RegionExtents(pRegion);
- pBox = RegionRects (pRegion);
- nBox = RegionNumRects (pRegion);
-
- reply = malloc(sizeof (xXFixesFetchRegionReply) +
- nBox * sizeof (xRectangle));
+ pBox = RegionRects(pRegion);
+ nBox = RegionNumRects(pRegion);
+
+ reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle));
if (!reply)
- return BadAlloc;
+ return BadAlloc;
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = nBox << 1;
@@ -563,31 +570,29 @@ ProcXFixesFetchRegion (ClientPtr client)
reply->height = pExtent->y2 - pExtent->y1;
pRect = (xRectangle *) (reply + 1);
- for (i = 0; i < nBox; i++)
- {
- pRect[i].x = pBox[i].x1;
- pRect[i].y = pBox[i].y1;
- pRect[i].width = pBox[i].x2 - pBox[i].x1;
- pRect[i].height = pBox[i].y2 - pBox[i].y1;
+ for (i = 0; i < nBox; i++) {
+ pRect[i].x = pBox[i].x1;
+ pRect[i].y = pBox[i].y1;
+ pRect[i].width = pBox[i].x2 - pBox[i].x1;
+ pRect[i].height = pBox[i].y2 - pBox[i].y1;
}
- if (client->swapped)
- {
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swaps(&reply->x);
- swaps(&reply->y);
- swaps(&reply->width);
- swaps(&reply->height);
- SwapShorts ((INT16 *) pRect, nBox * 4);
+ if (client->swapped) {
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swaps(&reply->x);
+ swaps(&reply->y);
+ swaps(&reply->width);
+ swaps(&reply->height);
+ SwapShorts((INT16 *) pRect, nBox * 4);
}
- (void) WriteToClient(client, sizeof (xXFixesFetchRegionReply) +
- nBox * sizeof (xRectangle), (char *) reply);
+ (void) WriteToClient(client, sizeof(xXFixesFetchRegionReply) +
+ nBox * sizeof(xRectangle), (char *) reply);
free(reply);
return Success;
}
int
-SProcXFixesFetchRegion (ClientPtr client)
+SProcXFixesFetchRegion(ClientPtr client)
{
REQUEST(xXFixesFetchRegionReq);
@@ -598,38 +603,39 @@ SProcXFixesFetchRegion (ClientPtr client)
}
int
-ProcXFixesSetGCClipRegion (ClientPtr client)
+ProcXFixesSetGCClipRegion(ClientPtr client)
{
- GCPtr pGC;
- RegionPtr pRegion;
- ChangeGCVal vals[2];
- int rc;
+ GCPtr pGC;
+ RegionPtr pRegion;
+ ChangeGCVal vals[2];
+ int rc;
+
REQUEST(xXFixesSetGCClipRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess);
+ VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
- if (pRegion)
- {
- pRegion = XFixesRegionCopy (pRegion);
- if (!pRegion)
- return BadAlloc;
+ if (pRegion) {
+ pRegion = XFixesRegionCopy(pRegion);
+ if (!pRegion)
+ return BadAlloc;
}
-
+
vals[0].val = stuff->xOrigin;
vals[1].val = stuff->yOrigin;
- ChangeGC (NullClient, pGC, GCClipXOrigin|GCClipYOrigin, vals);
- (*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (pointer)pRegion, 0);
+ ChangeGC(NullClient, pGC, GCClipXOrigin | GCClipYOrigin, vals);
+ (*pGC->funcs->ChangeClip) (pGC, pRegion ? CT_REGION : CT_NONE,
+ (pointer) pRegion, 0);
return Success;
}
int
-SProcXFixesSetGCClipRegion (ClientPtr client)
+SProcXFixesSetGCClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetGCClipRegionReq);
@@ -642,87 +648,84 @@ SProcXFixesSetGCClipRegion (ClientPtr client)
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-typedef RegionPtr (*CreateDftPtr)(WindowPtr pWin);
+typedef RegionPtr (*CreateDftPtr) (WindowPtr pWin);
int
-ProcXFixesSetWindowShapeRegion (ClientPtr client)
+ProcXFixesSetWindowShapeRegion(ClientPtr client)
{
- WindowPtr pWin;
- RegionPtr pRegion;
- RegionPtr *pDestRegion;
+ WindowPtr pWin;
+ RegionPtr pRegion;
+ RegionPtr *pDestRegion;
int rc;
+
REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->dest, RT_WINDOW,
- client, DixSetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->dest;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &pWin, stuff->dest, RT_WINDOW,
+ client, DixSetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->dest;
+ return rc;
}
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess);
switch (stuff->destKind) {
case ShapeBounding:
case ShapeClip:
case ShapeInput:
- break;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
- if (pRegion)
- {
- pRegion = XFixesRegionCopy (pRegion);
- if (!pRegion)
- return BadAlloc;
- if (!pWin->optional)
- MakeWindowOptional (pWin);
- switch (stuff->destKind) {
- default:
- case ShapeBounding:
- pDestRegion = &pWin->optional->boundingShape;
- break;
- case ShapeClip:
- pDestRegion = &pWin->optional->clipShape;
- break;
- case ShapeInput:
- pDestRegion = &pWin->optional->inputShape;
- break;
- }
- if (stuff->xOff || stuff->yOff)
- RegionTranslate(pRegion, stuff->xOff, stuff->yOff);
+ if (pRegion) {
+ pRegion = XFixesRegionCopy(pRegion);
+ if (!pRegion)
+ return BadAlloc;
+ if (!pWin->optional)
+ MakeWindowOptional(pWin);
+ switch (stuff->destKind) {
+ default:
+ case ShapeBounding:
+ pDestRegion = &pWin->optional->boundingShape;
+ break;
+ case ShapeClip:
+ pDestRegion = &pWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ pDestRegion = &pWin->optional->inputShape;
+ break;
+ }
+ if (stuff->xOff || stuff->yOff)
+ RegionTranslate(pRegion, stuff->xOff, stuff->yOff);
}
- else
- {
- if (pWin->optional)
- {
- switch (stuff->destKind) {
- default:
- case ShapeBounding:
- pDestRegion = &pWin->optional->boundingShape;
- break;
- case ShapeClip:
- pDestRegion = &pWin->optional->clipShape;
- break;
- case ShapeInput:
- pDestRegion = &pWin->optional->inputShape;
- break;
- }
- }
- else
- pDestRegion = &pRegion; /* a NULL region pointer */
+ else {
+ if (pWin->optional) {
+ switch (stuff->destKind) {
+ default:
+ case ShapeBounding:
+ pDestRegion = &pWin->optional->boundingShape;
+ break;
+ case ShapeClip:
+ pDestRegion = &pWin->optional->clipShape;
+ break;
+ case ShapeInput:
+ pDestRegion = &pWin->optional->inputShape;
+ break;
+ }
+ }
+ else
+ pDestRegion = &pRegion; /* a NULL region pointer */
}
if (*pDestRegion)
- RegionDestroy(*pDestRegion);
+ RegionDestroy(*pDestRegion);
*pDestRegion = pRegion;
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
- SendShapeNotify (pWin, stuff->destKind);
+ SendShapeNotify(pWin, stuff->destKind);
return Success;
}
int
-SProcXFixesSetWindowShapeRegion (ClientPtr client)
+SProcXFixesSetWindowShapeRegion(ClientPtr client)
{
REQUEST(xXFixesSetWindowShapeRegionReq);
@@ -736,27 +739,28 @@ SProcXFixesSetWindowShapeRegion (ClientPtr client)
}
int
-ProcXFixesSetPictureClipRegion (ClientPtr client)
+ProcXFixesSetPictureClipRegion(ClientPtr client)
{
- PicturePtr pPicture;
- RegionPtr pRegion;
+ PicturePtr pPicture;
+ RegionPtr pRegion;
+
REQUEST(xXFixesSetPictureClipRegionReq);
-
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
-
- return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin,
- pRegion);
+
+ return SetPictureClipRegion(pPicture, stuff->xOrigin, stuff->yOrigin,
+ pRegion);
}
int
-SProcXFixesSetPictureClipRegion (ClientPtr client)
+SProcXFixesSetPictureClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetPictureClipRegionReq);
-
+
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
swapl(&stuff->picture);
swapl(&stuff->region);
swaps(&stuff->xOrigin);
@@ -765,52 +769,51 @@ SProcXFixesSetPictureClipRegion (ClientPtr client)
}
int
-ProcXFixesExpandRegion (ClientPtr client)
+ProcXFixesExpandRegion(ClientPtr client)
{
- RegionPtr pSource, pDestination;
- REQUEST (xXFixesExpandRegionReq);
- BoxPtr pTmp;
- BoxPtr pSrc;
- int nBoxes;
- int i;
+ RegionPtr pSource, pDestination;
+
+ REQUEST(xXFixesExpandRegionReq);
+ BoxPtr pTmp;
+ BoxPtr pSrc;
+ int nBoxes;
+ int i;
- REQUEST_SIZE_MATCH (xXFixesExpandRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
-
+
nBoxes = RegionNumRects(pSource);
pSrc = RegionRects(pSource);
- if (nBoxes)
- {
- pTmp = malloc(nBoxes * sizeof (BoxRec));
- if (!pTmp)
- return BadAlloc;
- for (i = 0; i < nBoxes; i++)
- {
- pTmp[i].x1 = pSrc[i].x1 - stuff->left;
- pTmp[i].x2 = pSrc[i].x2 + stuff->right;
- pTmp[i].y1 = pSrc[i].y1 - stuff->top;
- pTmp[i].y2 = pSrc[i].y2 + stuff->bottom;
- }
- RegionEmpty(pDestination);
- for (i = 0; i < nBoxes; i++)
- {
- RegionRec r;
- RegionInit(&r, &pTmp[i], 0);
- RegionUnion(pDestination, pDestination, &r);
- }
- free(pTmp);
+ if (nBoxes) {
+ pTmp = malloc(nBoxes * sizeof(BoxRec));
+ if (!pTmp)
+ return BadAlloc;
+ for (i = 0; i < nBoxes; i++) {
+ pTmp[i].x1 = pSrc[i].x1 - stuff->left;
+ pTmp[i].x2 = pSrc[i].x2 + stuff->right;
+ pTmp[i].y1 = pSrc[i].y1 - stuff->top;
+ pTmp[i].y2 = pSrc[i].y2 + stuff->bottom;
+ }
+ RegionEmpty(pDestination);
+ for (i = 0; i < nBoxes; i++) {
+ RegionRec r;
+
+ RegionInit(&r, &pTmp[i], 0);
+ RegionUnion(pDestination, pDestination, &r);
+ }
+ free(pTmp);
}
return Success;
}
int
-SProcXFixesExpandRegion (ClientPtr client)
+SProcXFixesExpandRegion(ClientPtr client)
{
- REQUEST (xXFixesExpandRegionReq);
+ REQUEST(xXFixesExpandRegionReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xXFixesExpandRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
swapl(&stuff->source);
swapl(&stuff->destination);
swaps(&stuff->left);
@@ -825,73 +828,80 @@ SProcXFixesExpandRegion (ClientPtr client)
#include "panoramiXsrv.h"
int
-PanoramiXFixesSetGCClipRegion (ClientPtr client)
+PanoramiXFixesSetGCClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetGCClipRegionReq);
- int result = Success, j;
- PanoramiXRes *gc;
+ int result = Success, j;
+ PanoramiXRes *gc;
+
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
- if ((result = dixLookupResourceByType((void **)&gc, stuff->gc, XRT_GC,
- client, DixWriteAccess))) {
- client->errorValue = stuff->gc;
- return result;
+ if ((result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
+ client, DixWriteAccess))) {
+ client->errorValue = stuff->gc;
+ return result;
}
FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id;
result = (*PanoramiXSaveXFixesVector[X_XFixesSetGCClipRegion]) (client);
- if(result != Success) break;
+ if (result != Success)
+ break;
}
return result;
}
int
-PanoramiXFixesSetWindowShapeRegion (ClientPtr client)
+PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
{
- int result = Success, j;
- PanoramiXRes *win;
+ int result = Success, j;
+ PanoramiXRes *win;
+
REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
- if ((result = dixLookupResourceByType((void **)&win, stuff->dest,
- XRT_WINDOW, client,
- DixWriteAccess))) {
- client->errorValue = stuff->dest;
- return result;
+ if ((result = dixLookupResourceByType((void **) &win, stuff->dest,
+ XRT_WINDOW, client,
+ DixWriteAccess))) {
+ client->errorValue = stuff->dest;
+ return result;
}
FOR_NSCREENS_FORWARD(j) {
- stuff->dest = win->info[j].id;
- result = (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
- if(result != Success) break;
+ stuff->dest = win->info[j].id;
+ result =
+ (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
+ if (result != Success)
+ break;
}
return result;
}
int
-PanoramiXFixesSetPictureClipRegion (ClientPtr client)
+PanoramiXFixesSetPictureClipRegion(ClientPtr client)
{
REQUEST(xXFixesSetPictureClipRegionReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
- REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
+ REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
- if ((result = dixLookupResourceByType((void **)&pict, stuff->picture,
- XRT_PICTURE, client,
- DixWriteAccess))) {
- client->errorValue = stuff->picture;
- return result;
+ if ((result = dixLookupResourceByType((void **) &pict, stuff->picture,
+ XRT_PICTURE, client,
+ DixWriteAccess))) {
+ client->errorValue = stuff->picture;
+ return result;
}
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
+ if (result != Success)
+ break;
}
return result;
diff --git a/xorg-server/xfixes/saveset.c b/xorg-server/xfixes/saveset.c
index ba959c22b..eb3f6589e 100644
--- a/xorg-server/xfixes/saveset.c
+++ b/xorg-server/xfixes/saveset.c
@@ -29,31 +29,29 @@
int
ProcXFixesChangeSaveSet(ClientPtr client)
{
- Bool toRoot, map;
- int result;
- WindowPtr pWin;
+ Bool toRoot, map;
+ int result;
+ WindowPtr pWin;
+
REQUEST(xXFixesChangeSaveSetReq);
-
+
REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq);
result = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (result != Success)
return result;
if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
return BadMatch;
- if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete))
- {
- client->errorValue = stuff->mode;
- return BadValue;
+ if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) {
+ client->errorValue = stuff->mode;
+ return BadValue;
}
- if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot))
- {
- client->errorValue = stuff->target;
- return BadValue;
+ if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot)) {
+ client->errorValue = stuff->target;
+ return BadValue;
}
- if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap))
- {
- client->errorValue = stuff->map;
- return BadValue;
+ if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap)) {
+ client->errorValue = stuff->map;
+ return BadValue;
}
toRoot = (stuff->target == SaveSetRoot);
map = (stuff->map == SaveSetMap);
@@ -67,5 +65,5 @@ SProcXFixesChangeSaveSet(ClientPtr client)
swaps(&stuff->length);
swapl(&stuff->window);
- return (*ProcXFixesVector[stuff->xfixesReqType])(client);
+ return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
diff --git a/xorg-server/xfixes/select.c b/xorg-server/xfixes/select.c
index 2bf13f3fd..a896846a7 100644
--- a/xorg-server/xfixes/select.c
+++ b/xorg-server/xfixes/select.c
@@ -27,8 +27,8 @@
#include "xfixesint.h"
#include "xace.h"
-static RESTYPE SelectionClientType, SelectionWindowType;
-static Bool SelectionCallbackRegistered = FALSE;
+static RESTYPE SelectionClientType, SelectionWindowType;
+static Bool SelectionCallbackRegistered = FALSE;
/*
* There is a global list of windows selecting for selection events
@@ -40,83 +40,76 @@ static Bool SelectionCallbackRegistered = FALSE;
typedef struct _SelectionEvent *SelectionEventPtr;
typedef struct _SelectionEvent {
- SelectionEventPtr next;
- Atom selection;
- CARD32 eventMask;
- ClientPtr pClient;
- WindowPtr pWindow;
- XID clientResource;
+ SelectionEventPtr next;
+ Atom selection;
+ CARD32 eventMask;
+ ClientPtr pClient;
+ WindowPtr pWindow;
+ XID clientResource;
} SelectionEventRec;
-static SelectionEventPtr selectionEvents;
+static SelectionEventPtr selectionEvents;
static void
-XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args)
+XFixesSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args)
{
- SelectionEventPtr e;
- SelectionInfoRec *info = (SelectionInfoRec *) args;
- Selection *selection = info->selection;
- int subtype;
- CARD32 eventMask;
-
+ SelectionEventPtr e;
+ SelectionInfoRec *info = (SelectionInfoRec *) args;
+ Selection *selection = info->selection;
+ int subtype;
+ CARD32 eventMask;
+
switch (info->kind) {
case SelectionSetOwner:
- subtype = XFixesSetSelectionOwnerNotify;
- eventMask = XFixesSetSelectionOwnerNotifyMask;
- break;
+ subtype = XFixesSetSelectionOwnerNotify;
+ eventMask = XFixesSetSelectionOwnerNotifyMask;
+ break;
case SelectionWindowDestroy:
- subtype = XFixesSelectionWindowDestroyNotify;
- eventMask = XFixesSelectionWindowDestroyNotifyMask;
- break;
+ subtype = XFixesSelectionWindowDestroyNotify;
+ eventMask = XFixesSelectionWindowDestroyNotifyMask;
+ break;
case SelectionClientClose:
- subtype = XFixesSelectionClientCloseNotify;
- eventMask = XFixesSelectionClientCloseNotifyMask;
- break;
+ subtype = XFixesSelectionClientCloseNotify;
+ eventMask = XFixesSelectionClientCloseNotifyMask;
+ break;
default:
- return;
+ return;
}
- for (e = selectionEvents; e; e = e->next)
- {
- if (e->selection == selection->selection &&
- (e->eventMask & eventMask))
- {
- xXFixesSelectionNotifyEvent ev;
+ for (e = selectionEvents; e; e = e->next) {
+ if (e->selection == selection->selection && (e->eventMask & eventMask)) {
+ xXFixesSelectionNotifyEvent ev;
- memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
- ev.type = XFixesEventBase + XFixesSelectionNotify;
- ev.subtype = subtype;
- ev.window = e->pWindow->drawable.id;
- if (subtype == XFixesSetSelectionOwnerNotify)
- ev.owner = selection->window;
- else
- ev.owner = 0;
- ev.selection = e->selection;
- ev.timestamp = currentTime.milliseconds;
- ev.selectionTimestamp = selection->lastTimeChanged.milliseconds;
- WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
- }
+ memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
+ ev.type = XFixesEventBase + XFixesSelectionNotify;
+ ev.subtype = subtype;
+ ev.window = e->pWindow->drawable.id;
+ if (subtype == XFixesSetSelectionOwnerNotify)
+ ev.owner = selection->window;
+ else
+ ev.owner = 0;
+ ev.selection = e->selection;
+ ev.timestamp = currentTime.milliseconds;
+ ev.selectionTimestamp = selection->lastTimeChanged.milliseconds;
+ WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
+ }
}
}
static Bool
-CheckSelectionCallback (void)
+CheckSelectionCallback(void)
{
- if (selectionEvents)
- {
- if (!SelectionCallbackRegistered)
- {
- if (!AddCallback (&SelectionCallback, XFixesSelectionCallback, NULL))
- return FALSE;
- SelectionCallbackRegistered = TRUE;
- }
+ if (selectionEvents) {
+ if (!SelectionCallbackRegistered) {
+ if (!AddCallback(&SelectionCallback, XFixesSelectionCallback, NULL))
+ return FALSE;
+ SelectionCallbackRegistered = TRUE;
+ }
}
- else
- {
- if (SelectionCallbackRegistered)
- {
- DeleteCallback (&SelectionCallback, XFixesSelectionCallback, NULL);
- SelectionCallbackRegistered = FALSE;
- }
+ else {
+ if (SelectionCallbackRegistered) {
+ DeleteCallback(&SelectionCallback, XFixesSelectionCallback, NULL);
+ SelectionCallbackRegistered = FALSE;
+ }
}
return TRUE;
}
@@ -126,99 +119,88 @@ CheckSelectionCallback (void)
XFixesSelectionClientCloseNotifyMask)
static int
-XFixesSelectSelectionInput (ClientPtr pClient,
- Atom selection,
- WindowPtr pWindow,
- CARD32 eventMask)
+XFixesSelectSelectionInput(ClientPtr pClient,
+ Atom selection, WindowPtr pWindow, CARD32 eventMask)
{
pointer val;
int rc;
- SelectionEventPtr *prev, e;
+ SelectionEventPtr *prev, e;
rc = XaceHook(XACE_SELECTION_ACCESS, pClient, selection, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
- for (prev = &selectionEvents; (e = *prev); prev = &e->next)
- {
- if (e->selection == selection &&
- e->pClient == pClient &&
- e->pWindow == pWindow)
- {
- break;
- }
+ for (prev = &selectionEvents; (e = *prev); prev = &e->next) {
+ if (e->selection == selection &&
+ e->pClient == pClient && e->pWindow == pWindow) {
+ break;
+ }
}
- if (!eventMask)
- {
- if (e)
- {
- FreeResource (e->clientResource, 0);
- }
- return Success;
+ if (!eventMask) {
+ if (e) {
+ FreeResource(e->clientResource, 0);
+ }
+ return Success;
}
- if (!e)
- {
- e = (SelectionEventPtr) malloc(sizeof (SelectionEventRec));
- if (!e)
- return BadAlloc;
+ if (!e) {
+ e = (SelectionEventPtr) malloc(sizeof(SelectionEventRec));
+ if (!e)
+ return BadAlloc;
- e->next = 0;
- e->selection = selection;
- e->pClient = pClient;
- e->pWindow = pWindow;
- e->clientResource = FakeClientID(pClient->index);
+ e->next = 0;
+ e->selection = selection;
+ e->pClient = pClient;
+ e->pWindow = pWindow;
+ e->clientResource = FakeClientID(pClient->index);
- /*
- * Add a resource hanging from the window to
- * catch window destroy
- */
- rc = dixLookupResourceByType (&val, pWindow->drawable.id,
- SelectionWindowType, serverClient,
- DixGetAttrAccess);
- if (rc != Success)
- if (!AddResource (pWindow->drawable.id, SelectionWindowType,
- (pointer) pWindow))
- {
- free(e);
- return BadAlloc;
- }
+ /*
+ * Add a resource hanging from the window to
+ * catch window destroy
+ */
+ rc = dixLookupResourceByType(&val, pWindow->drawable.id,
+ SelectionWindowType, serverClient,
+ DixGetAttrAccess);
+ if (rc != Success)
+ if (!AddResource(pWindow->drawable.id, SelectionWindowType,
+ (pointer) pWindow)) {
+ free(e);
+ return BadAlloc;
+ }
- if (!AddResource (e->clientResource, SelectionClientType, (pointer) e))
- return BadAlloc;
+ if (!AddResource(e->clientResource, SelectionClientType, (pointer) e))
+ return BadAlloc;
- *prev = e;
- if (!CheckSelectionCallback ())
- {
- FreeResource (e->clientResource, 0);
- return BadAlloc;
- }
+ *prev = e;
+ if (!CheckSelectionCallback()) {
+ FreeResource(e->clientResource, 0);
+ return BadAlloc;
+ }
}
e->eventMask = eventMask;
return Success;
}
int
-ProcXFixesSelectSelectionInput (ClientPtr client)
+ProcXFixesSelectSelectionInput(ClientPtr client)
{
- REQUEST (xXFixesSelectSelectionInputReq);
- WindowPtr pWin;
- int rc;
+ REQUEST(xXFixesSelectSelectionInputReq);
+ WindowPtr pWin;
+ int rc;
- REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq);
+ REQUEST_SIZE_MATCH(xXFixesSelectSelectionInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
- if (stuff->eventMask & ~SelectionAllEvents)
- {
- client->errorValue = stuff->eventMask;
- return BadValue;
+ if (stuff->eventMask & ~SelectionAllEvents) {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
}
- return XFixesSelectSelectionInput (client, stuff->selection,
- pWin, stuff->eventMask);
+ return XFixesSelectSelectionInput(client, stuff->selection,
+ pWin, stuff->eventMask);
}
int
-SProcXFixesSelectSelectionInput (ClientPtr client)
+SProcXFixesSelectSelectionInput(ClientPtr client)
{
REQUEST(xXFixesSelectSelectionInputReq);
@@ -226,64 +208,60 @@ SProcXFixesSelectSelectionInput (ClientPtr client)
swapl(&stuff->window);
swapl(&stuff->selection);
swapl(&stuff->eventMask);
- return (*ProcXFixesVector[stuff->xfixesReqType])(client);
+ return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-
+
void
-SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from,
- xXFixesSelectionNotifyEvent *to)
+SXFixesSelectionNotifyEvent(xXFixesSelectionNotifyEvent * from,
+ xXFixesSelectionNotifyEvent * to)
{
to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->window, to->window);
- cpswapl (from->owner, to->owner);
- cpswapl (from->selection, to->selection);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->selectionTimestamp, to->selectionTimestamp);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->window, to->window);
+ cpswapl(from->owner, to->owner);
+ cpswapl(from->selection, to->selection);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->selectionTimestamp, to->selectionTimestamp);
}
static int
-SelectionFreeClient (pointer data, XID id)
+SelectionFreeClient(pointer data, XID id)
{
- SelectionEventPtr old = (SelectionEventPtr) data;
- SelectionEventPtr *prev, e;
-
- for (prev = &selectionEvents; (e = *prev); prev = &e->next)
- {
- if (e == old)
- {
- *prev = e->next;
- free(e);
- CheckSelectionCallback ();
- break;
- }
+ SelectionEventPtr old = (SelectionEventPtr) data;
+ SelectionEventPtr *prev, e;
+
+ for (prev = &selectionEvents; (e = *prev); prev = &e->next) {
+ if (e == old) {
+ *prev = e->next;
+ free(e);
+ CheckSelectionCallback();
+ break;
+ }
}
return 1;
}
static int
-SelectionFreeWindow (pointer data, XID id)
+SelectionFreeWindow(pointer data, XID id)
{
- WindowPtr pWindow = (WindowPtr) data;
- SelectionEventPtr e, next;
+ WindowPtr pWindow = (WindowPtr) data;
+ SelectionEventPtr e, next;
- for (e = selectionEvents; e; e = next)
- {
- next = e->next;
- if (e->pWindow == pWindow)
- {
- FreeResource (e->clientResource, 0);
- }
+ for (e = selectionEvents; e; e = next) {
+ next = e->next;
+ if (e->pWindow == pWindow) {
+ FreeResource(e->clientResource, 0);
+ }
}
return 1;
}
Bool
-XFixesSelectionInit (void)
+XFixesSelectionInit(void)
{
SelectionClientType = CreateNewResourceType(SelectionFreeClient,
- "XFixesSelectionClient");
+ "XFixesSelectionClient");
SelectionWindowType = CreateNewResourceType(SelectionFreeWindow,
- "XFixesSelectionWindow");
+ "XFixesSelectionWindow");
return SelectionClientType && SelectionWindowType;
}
diff --git a/xorg-server/xfixes/xfixes.c b/xorg-server/xfixes/xfixes.c
index 96d33c00b..f80230fd3 100644
--- a/xorg-server/xfixes/xfixes.c
+++ b/xorg-server/xfixes/xfixes.c
@@ -49,18 +49,20 @@
#include "xfixesint.h"
#include "protocol-versions.h"
-static unsigned char XFixesReqCode;
-int XFixesEventBase;
-int XFixesErrorBase;
+static unsigned char XFixesReqCode;
+int XFixesEventBase;
+int XFixesErrorBase;
static DevPrivateKeyRec XFixesClientPrivateKeyRec;
+
#define XFixesClientPrivateKey (&XFixesClientPrivateKeyRec)
static int
ProcXFixesQueryVersion(ClientPtr client)
{
- XFixesClientPtr pXFixesClient = GetXFixesClient (client);
+ XFixesClientPtr pXFixesClient = GetXFixesClient(client);
xXFixesQueryVersionReply rep;
+
REQUEST(xXFixesQueryVersionReq);
REQUEST_SIZE_MATCH(xXFixesQueryVersionReq);
@@ -70,90 +72,86 @@ ProcXFixesQueryVersion(ClientPtr client)
rep.sequenceNumber = client->sequence;
if (version_compare(stuff->majorVersion, stuff->minorVersion,
- SERVER_XFIXES_MAJOR_VERSION, SERVER_XFIXES_MAJOR_VERSION) < 0)
- {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else {
- rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION;
+ SERVER_XFIXES_MAJOR_VERSION,
+ SERVER_XFIXES_MAJOR_VERSION) < 0) {
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+ else {
+ rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION;
rep.minorVersion = SERVER_XFIXES_MINOR_VERSION;
}
pXFixesClient->major_version = rep.majorVersion;
pXFixesClient->minor_version = rep.minorVersion;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *) &rep);
return Success;
}
/* Major version controls available requests */
static const int version_requests[] = {
- X_XFixesQueryVersion, /* before client sends QueryVersion */
- X_XFixesGetCursorImage, /* Version 1 */
- X_XFixesChangeCursorByName, /* Version 2 */
- X_XFixesExpandRegion, /* Version 3 */
- X_XFixesShowCursor, /* Version 4 */
- X_XFixesDestroyPointerBarrier, /* Version 5 */
+ X_XFixesQueryVersion, /* before client sends QueryVersion */
+ X_XFixesGetCursorImage, /* Version 1 */
+ X_XFixesChangeCursorByName, /* Version 2 */
+ X_XFixesExpandRegion, /* Version 3 */
+ X_XFixesShowCursor, /* Version 4 */
+ X_XFixesDestroyPointerBarrier, /* Version 5 */
};
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
-
-int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
+
+int (*ProcXFixesVector[XFixesNumberRequests]) (ClientPtr) = {
/*************** Version 1 ******************/
ProcXFixesQueryVersion,
- ProcXFixesChangeSaveSet,
- ProcXFixesSelectSelectionInput,
- ProcXFixesSelectCursorInput,
- ProcXFixesGetCursorImage,
+ ProcXFixesChangeSaveSet,
+ ProcXFixesSelectSelectionInput,
+ ProcXFixesSelectCursorInput, ProcXFixesGetCursorImage,
/*************** Version 2 ******************/
- ProcXFixesCreateRegion,
- ProcXFixesCreateRegionFromBitmap,
- ProcXFixesCreateRegionFromWindow,
- ProcXFixesCreateRegionFromGC,
- ProcXFixesCreateRegionFromPicture,
- ProcXFixesDestroyRegion,
- ProcXFixesSetRegion,
- ProcXFixesCopyRegion,
- ProcXFixesCombineRegion,
- ProcXFixesCombineRegion,
- ProcXFixesCombineRegion,
- ProcXFixesInvertRegion,
- ProcXFixesTranslateRegion,
- ProcXFixesRegionExtents,
- ProcXFixesFetchRegion,
- ProcXFixesSetGCClipRegion,
- ProcXFixesSetWindowShapeRegion,
- ProcXFixesSetPictureClipRegion,
- ProcXFixesSetCursorName,
- ProcXFixesGetCursorName,
- ProcXFixesGetCursorImageAndName,
- ProcXFixesChangeCursor,
- ProcXFixesChangeCursorByName,
+ ProcXFixesCreateRegion,
+ ProcXFixesCreateRegionFromBitmap,
+ ProcXFixesCreateRegionFromWindow,
+ ProcXFixesCreateRegionFromGC,
+ ProcXFixesCreateRegionFromPicture,
+ ProcXFixesDestroyRegion,
+ ProcXFixesSetRegion,
+ ProcXFixesCopyRegion,
+ ProcXFixesCombineRegion,
+ ProcXFixesCombineRegion,
+ ProcXFixesCombineRegion,
+ ProcXFixesInvertRegion,
+ ProcXFixesTranslateRegion,
+ ProcXFixesRegionExtents,
+ ProcXFixesFetchRegion,
+ ProcXFixesSetGCClipRegion,
+ ProcXFixesSetWindowShapeRegion,
+ ProcXFixesSetPictureClipRegion,
+ ProcXFixesSetCursorName,
+ ProcXFixesGetCursorName,
+ ProcXFixesGetCursorImageAndName,
+ ProcXFixesChangeCursor, ProcXFixesChangeCursorByName,
/*************** Version 3 ******************/
- ProcXFixesExpandRegion,
+ ProcXFixesExpandRegion,
/*************** Version 4 ****************/
- ProcXFixesHideCursor,
- ProcXFixesShowCursor,
+ ProcXFixesHideCursor, ProcXFixesShowCursor,
/*************** Version 5 ****************/
- ProcXFixesCreatePointerBarrier,
- ProcXFixesDestroyPointerBarrier,
-};
+ProcXFixesCreatePointerBarrier, ProcXFixesDestroyPointerBarrier,};
static int
-ProcXFixesDispatch (ClientPtr client)
+ProcXFixesDispatch(ClientPtr client)
{
REQUEST(xXFixesReq);
- XFixesClientPtr pXFixesClient = GetXFixesClient (client);
+ XFixesClientPtr pXFixesClient = GetXFixesClient(client);
if (pXFixesClient->major_version >= NUM_VERSION_REQUESTS)
- return BadRequest;
+ return BadRequest;
if (stuff->xfixesReqType > version_requests[pXFixesClient->major_version])
- return BadRequest;
+ return BadRequest;
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
@@ -168,74 +166,66 @@ SProcXFixesQueryVersion(ClientPtr client)
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
+static int (*SProcXFixesVector[XFixesNumberRequests]) (ClientPtr) = {
/*************** Version 1 ******************/
SProcXFixesQueryVersion,
- SProcXFixesChangeSaveSet,
- SProcXFixesSelectSelectionInput,
- SProcXFixesSelectCursorInput,
- SProcXFixesGetCursorImage,
+ SProcXFixesChangeSaveSet,
+ SProcXFixesSelectSelectionInput,
+ SProcXFixesSelectCursorInput, SProcXFixesGetCursorImage,
/*************** Version 2 ******************/
- SProcXFixesCreateRegion,
- SProcXFixesCreateRegionFromBitmap,
- SProcXFixesCreateRegionFromWindow,
- SProcXFixesCreateRegionFromGC,
- SProcXFixesCreateRegionFromPicture,
- SProcXFixesDestroyRegion,
- SProcXFixesSetRegion,
- SProcXFixesCopyRegion,
- SProcXFixesCombineRegion,
- SProcXFixesCombineRegion,
- SProcXFixesCombineRegion,
- SProcXFixesInvertRegion,
- SProcXFixesTranslateRegion,
- SProcXFixesRegionExtents,
- SProcXFixesFetchRegion,
- SProcXFixesSetGCClipRegion,
- SProcXFixesSetWindowShapeRegion,
- SProcXFixesSetPictureClipRegion,
- SProcXFixesSetCursorName,
- SProcXFixesGetCursorName,
- SProcXFixesGetCursorImageAndName,
- SProcXFixesChangeCursor,
- SProcXFixesChangeCursorByName,
+ SProcXFixesCreateRegion,
+ SProcXFixesCreateRegionFromBitmap,
+ SProcXFixesCreateRegionFromWindow,
+ SProcXFixesCreateRegionFromGC,
+ SProcXFixesCreateRegionFromPicture,
+ SProcXFixesDestroyRegion,
+ SProcXFixesSetRegion,
+ SProcXFixesCopyRegion,
+ SProcXFixesCombineRegion,
+ SProcXFixesCombineRegion,
+ SProcXFixesCombineRegion,
+ SProcXFixesInvertRegion,
+ SProcXFixesTranslateRegion,
+ SProcXFixesRegionExtents,
+ SProcXFixesFetchRegion,
+ SProcXFixesSetGCClipRegion,
+ SProcXFixesSetWindowShapeRegion,
+ SProcXFixesSetPictureClipRegion,
+ SProcXFixesSetCursorName,
+ SProcXFixesGetCursorName,
+ SProcXFixesGetCursorImageAndName,
+ SProcXFixesChangeCursor, SProcXFixesChangeCursorByName,
/*************** Version 3 ******************/
- SProcXFixesExpandRegion,
+ SProcXFixesExpandRegion,
/*************** Version 4 ****************/
- SProcXFixesHideCursor,
- SProcXFixesShowCursor,
+ SProcXFixesHideCursor, SProcXFixesShowCursor,
/*************** Version 5 ****************/
- SProcXFixesCreatePointerBarrier,
- SProcXFixesDestroyPointerBarrier,
-};
+SProcXFixesCreatePointerBarrier, SProcXFixesDestroyPointerBarrier,};
static int
-SProcXFixesDispatch (ClientPtr client)
+SProcXFixesDispatch(ClientPtr client)
{
REQUEST(xXFixesReq);
if (stuff->xfixesReqType >= XFixesNumberRequests)
- return BadRequest;
+ return BadRequest;
return (*SProcXFixesVector[stuff->xfixesReqType]) (client);
}
static void
-XFixesClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
+XFixesClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- XFixesClientPtr pXFixesClient = GetXFixesClient (pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ XFixesClientPtr pXFixesClient = GetXFixesClient(pClient);
pXFixesClient->major_version = 0;
pXFixesClient->minor_version = 0;
}
-/*ARGSUSED*/
-static void
-XFixesResetProc (ExtensionEntry *extEntry)
+ /*ARGSUSED*/ static void
+XFixesResetProc(ExtensionEntry * extEntry)
{
- DeleteCallback (&ClientStateCallback, XFixesClientCallback, 0);
+ DeleteCallback(&ClientStateCallback, XFixesClientCallback, 0);
}
void
@@ -243,56 +233,58 @@ XFixesExtensionInit(void)
{
ExtensionEntry *extEntry;
- if (!dixRegisterPrivateKey(&XFixesClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (XFixesClientRec)))
- return;
- if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0))
- return;
-
- if (XFixesSelectionInit() && XFixesCursorInit () && XFixesRegionInit () &&
- (extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents,
- XFixesNumberErrors,
- ProcXFixesDispatch, SProcXFixesDispatch,
- XFixesResetProc, StandardMinorOpcode)) != 0)
- {
- XFixesReqCode = (unsigned char)extEntry->base;
- XFixesEventBase = extEntry->eventBase;
- XFixesErrorBase = extEntry->errorBase;
- EventSwapVector[XFixesEventBase + XFixesSelectionNotify] =
- (EventSwapPtr) SXFixesSelectionNotifyEvent;
- EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
- (EventSwapPtr) SXFixesCursorNotifyEvent;
- SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
- SetResourceTypeErrorValue(PointerBarrierType,
- XFixesErrorBase + BadBarrier);
+ if (!dixRegisterPrivateKey
+ (&XFixesClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XFixesClientRec)))
+ return;
+ if (!AddCallback(&ClientStateCallback, XFixesClientCallback, 0))
+ return;
+
+ if (XFixesSelectionInit() && XFixesCursorInit() && XFixesRegionInit() &&
+ (extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents,
+ XFixesNumberErrors,
+ ProcXFixesDispatch, SProcXFixesDispatch,
+ XFixesResetProc, StandardMinorOpcode)) != 0) {
+ XFixesReqCode = (unsigned char) extEntry->base;
+ XFixesEventBase = extEntry->eventBase;
+ XFixesErrorBase = extEntry->errorBase;
+ EventSwapVector[XFixesEventBase + XFixesSelectionNotify] =
+ (EventSwapPtr) SXFixesSelectionNotifyEvent;
+ EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
+ (EventSwapPtr) SXFixesCursorNotifyEvent;
+ SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
+ SetResourceTypeErrorValue(PointerBarrierType,
+ XFixesErrorBase + BadBarrier);
}
}
#ifdef PANORAMIX
-int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr);
+int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
void
-PanoramiXFixesInit (void)
+PanoramiXFixesInit(void)
{
int i;
for (i = 0; i < XFixesNumberRequests; i++)
- PanoramiXSaveXFixesVector[i] = ProcXFixesVector[i];
+ PanoramiXSaveXFixesVector[i] = ProcXFixesVector[i];
/*
* Stuff in Xinerama aware request processing hooks
*/
ProcXFixesVector[X_XFixesSetGCClipRegion] = PanoramiXFixesSetGCClipRegion;
- ProcXFixesVector[X_XFixesSetWindowShapeRegion] = PanoramiXFixesSetWindowShapeRegion;
- ProcXFixesVector[X_XFixesSetPictureClipRegion] = PanoramiXFixesSetPictureClipRegion;
+ ProcXFixesVector[X_XFixesSetWindowShapeRegion] =
+ PanoramiXFixesSetWindowShapeRegion;
+ ProcXFixesVector[X_XFixesSetPictureClipRegion] =
+ PanoramiXFixesSetPictureClipRegion;
}
void
-PanoramiXFixesReset (void)
+PanoramiXFixesReset(void)
{
int i;
for (i = 0; i < XFixesNumberRequests; i++)
- ProcXFixesVector[i] = PanoramiXSaveXFixesVector[i];
+ ProcXFixesVector[i] = PanoramiXSaveXFixesVector[i];
}
#endif
diff --git a/xorg-server/xfixes/xfixes.h b/xorg-server/xfixes/xfixes.h
index 5765e64b5..19af09f7d 100644
--- a/xorg-server/xfixes/xfixes.h
+++ b/xorg-server/xfixes/xfixes.h
@@ -50,23 +50,22 @@ extern _X_EXPORT int XFixesErrorBase;
}
extern _X_EXPORT RegionPtr
-XFixesRegionCopy (RegionPtr pRegion);
+ XFixesRegionCopy(RegionPtr pRegion);
struct PointerBarrier {
CARD16 x1, x2, y1, y2;
CARD32 directions;
};
-
extern int
-barrier_get_direction(int, int, int, int);
-extern BOOL
-barrier_is_blocking(const struct PointerBarrier*, int, int, int, int, double*);
+ barrier_get_direction(int, int, int, int);
extern BOOL
-barrier_is_blocking_direction(const struct PointerBarrier*, int);
+barrier_is_blocking(const struct PointerBarrier *, int, int, int, int,
+ double *);
+extern BOOL barrier_is_blocking_direction(const struct PointerBarrier *, int);
extern void
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y);
-
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
+ int *y);
-#endif /* _XFIXES_H_ */
+#endif /* _XFIXES_H_ */