diff options
author | marha <marha@users.sourceforge.net> | 2012-03-28 09:11:07 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-28 09:11:07 +0200 |
commit | 9b51c6da8bffdd67353b1e1245698a7eac478481 (patch) | |
tree | cde44c263cb1756fae5b4a83facb3c0cdfa474e4 /xorg-server/hw/xquartz/xpr | |
parent | fb2b04331b6ae2cd11f6132cf16f6fcd848fb6b8 (diff) | |
parent | ec617f09d07e32d6f57c0da133f53ad3d43a568a (diff) | |
download | vcxsrv-9b51c6da8bffdd67353b1e1245698a7eac478481.tar.gz vcxsrv-9b51c6da8bffdd67353b1e1245698a7eac478481.tar.bz2 vcxsrv-9b51c6da8bffdd67353b1e1245698a7eac478481.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'xorg-server/hw/xquartz/xpr')
21 files changed, 1023 insertions, 901 deletions
diff --git a/xorg-server/hw/xquartz/xpr/appledri.c b/xorg-server/hw/xquartz/xpr/appledri.c index 4ef0061b2..1bb837958 100644 --- a/xorg-server/hw/xquartz/xpr/appledri.c +++ b/xorg-server/hw/xquartz/xpr/appledri.c @@ -1,29 +1,29 @@ /************************************************************************** -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -Copyright (c) 2002, 2009-2011 Apple Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + Copyright 2000 VA Linux Systems, Inc. + Copyright (c) 2002, 2009-2012 Apple Inc. + All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ @@ -32,6 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Kevin E. Martin <martin@valinux.com> * Jens Owen <jens@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeremy Huddleston <jeremyhu@apple.com> * */ @@ -59,14 +60,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static int DRIErrorBase = 0; -static void AppleDRIResetProc(ExtensionEntry * extEntry); -static int ProcAppleDRICreatePixmap(ClientPtr client); +static void +AppleDRIResetProc(ExtensionEntry* extEntry); +static int +ProcAppleDRICreatePixmap(ClientPtr client); static unsigned char DRIReqCode = 0; static int DRIEventBase = 0; -static void SNotifyEvent(xAppleDRINotifyEvent * from, - xAppleDRINotifyEvent * to); +static void +SNotifyEvent(xAppleDRINotifyEvent *from, xAppleDRINotifyEvent *to); typedef struct _DRIEvent *DRIEventPtr; typedef struct _DRIEvent { @@ -76,8 +79,9 @@ typedef struct _DRIEvent { unsigned int mask; } DRIEventRec; - /*ARGSUSED*/ static void -AppleDRIResetProc(ExtensionEntry * extEntry) +/*ARGSUSED*/ +static void +AppleDRIResetProc(ExtensionEntry* extEntry) { DRIReset(); } @@ -101,7 +105,7 @@ ProcAppleDRIQueryVersion(register ClientPtr client) swaps(&rep.minorVersion); swapl(&rep.patchVersion); } - WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), (char *)&rep); return Success; } @@ -135,7 +139,7 @@ ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client) WriteToClient(client, sizeof(xAppleDRIQueryDirectRenderingCapableReply), - (char *) &rep); + (char *)&rep); return Success; } @@ -152,26 +156,28 @@ ProcAppleDRIAuthConnection(register ClientPtr client) rep.sequenceNumber = client->sequence; rep.authenticated = 1; - if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) { - ErrorF("Failed to authenticate %u\n", (unsigned int) stuff->magic); + if (!DRIAuthConnection(screenInfo.screens[stuff->screen], + stuff->magic)) { + ErrorF("Failed to authenticate %u\n", (unsigned int)stuff->magic); rep.authenticated = 0; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); - swapl(&rep.authenticated); /* Yes, this is a CARD32 ... sigh */ + swapl(&rep.authenticated); /* Yes, this is a CARD32 ... sigh */ } - WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), (char *) &rep); + WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), (char *)&rep); return Success; } static void -surface_notify(void *_arg, void *data) +surface_notify(void *_arg, + void *data) { DRISurfaceNotifyArg *arg = _arg; - int client_index = (int) x_cvt_vptr_to_uint(data); + int client_index = (int)x_cvt_vptr_to_uint(data); xAppleDRINotifyEvent se; if (client_index < 0 || client_index >= currentMaxClients) @@ -181,7 +187,7 @@ surface_notify(void *_arg, void *data) se.kind = arg->kind; se.arg = arg->id; se.time = currentTime.milliseconds; - WriteEventsToClient(clients[client_index], 1, (xEvent *) &se); + WriteEventsToClient(clients[client_index], 1, (xEvent *)&se); } static int @@ -207,9 +213,10 @@ ProcAppleDRICreateSurface(ClientPtr client) rep.key_0 = rep.key_1 = rep.uid = 0; if (!DRICreateSurface(screenInfo.screens[stuff->screen], - (Drawable) stuff->drawable, pDrawable, + (Drawable)stuff->drawable, pDrawable, stuff->client_id, &sid, key, - surface_notify, x_cvt_uint_to_vptr(client->index))) { + surface_notify, + x_cvt_uint_to_vptr(client->index))) { return BadValue; } @@ -225,7 +232,7 @@ ProcAppleDRICreateSurface(ClientPtr client) swapl(&rep.uid); } - WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), (char *) &rep); + WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), (char *)&rep); return Success; } @@ -233,10 +240,8 @@ static int ProcAppleDRIDestroySurface(register ClientPtr client) { int rc; - REQUEST(xAppleDRIDestroySurfaceReq); DrawablePtr pDrawable; - REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, @@ -245,7 +250,8 @@ ProcAppleDRIDestroySurface(register ClientPtr client) return rc; if (!DRIDestroySurface(screenInfo.screens[stuff->screen], - (Drawable) stuff->drawable, pDrawable, NULL, NULL)) { + (Drawable)stuff->drawable, + pDrawable, NULL, NULL)) { return BadValue; } @@ -272,12 +278,14 @@ ProcAppleDRICreatePixmap(ClientPtr client) return rc; if (!DRICreatePixmap(screenInfo.screens[stuff->screen], - (Drawable) stuff->drawable, - pDrawable, path, PATH_MAX)) { + (Drawable)stuff->drawable, + pDrawable, + path, PATH_MAX)) { return BadValue; } - if (!DRIGetPixmapData(pDrawable, &width, &height, &pitch, &bpp, &ptr)) { + if (!DRIGetPixmapData(pDrawable, &width, &height, + &pitch, &bpp, &ptr)) { return BadValue; } @@ -317,7 +325,6 @@ ProcAppleDRIDestroyPixmap(ClientPtr client) { DrawablePtr pDrawable; int rc; - REQUEST(xAppleDRIDestroyPixmapReq); REQUEST_SIZE_MATCH(xAppleDRIDestroyPixmapReq); @@ -342,6 +349,7 @@ ProcAppleDRIDispatch(register ClientPtr client) switch (stuff->data) { case X_AppleDRIQueryVersion: return ProcAppleDRIQueryVersion(client); + case X_AppleDRIQueryDirectRenderingCapable: return ProcAppleDRIQueryDirectRenderingCapable(client); } @@ -352,12 +360,16 @@ ProcAppleDRIDispatch(register ClientPtr client) switch (stuff->data) { case X_AppleDRIAuthConnection: return ProcAppleDRIAuthConnection(client); + case X_AppleDRICreateSurface: return ProcAppleDRICreateSurface(client); + case X_AppleDRIDestroySurface: return ProcAppleDRIDestroySurface(client); + case X_AppleDRICreatePixmap: return ProcAppleDRICreatePixmap(client); + case X_AppleDRIDestroyPixmap: return ProcAppleDRIDestroyPixmap(client); @@ -367,7 +379,8 @@ ProcAppleDRIDispatch(register ClientPtr client) } static void -SNotifyEvent(xAppleDRINotifyEvent * from, xAppleDRINotifyEvent * to) +SNotifyEvent(xAppleDRINotifyEvent *from, + xAppleDRINotifyEvent *to) { to->type = from->type; to->kind = from->kind; @@ -451,6 +464,7 @@ SProcAppleDRIDispatch(register ClientPtr client) switch (stuff->data) { case X_AppleDRIQueryVersion: return SProcAppleDRIQueryVersion(client); + case X_AppleDRIQueryDirectRenderingCapable: return SProcAppleDRIQueryDirectRenderingCapable(client); } @@ -461,12 +475,16 @@ SProcAppleDRIDispatch(register ClientPtr client) switch (stuff->data) { case X_AppleDRIAuthConnection: return SProcAppleDRIAuthConnection(client); + case X_AppleDRICreateSurface: return SProcAppleDRICreateSurface(client); + case X_AppleDRIDestroySurface: return SProcAppleDRIDestroySurface(client); + case X_AppleDRICreatePixmap: return SProcAppleDRICreatePixmap(client); + case X_AppleDRIDestroyPixmap: return SProcAppleDRIDestroyPixmap(client); @@ -478,7 +496,7 @@ SProcAppleDRIDispatch(register ClientPtr client) void AppleDRIExtensionInit(void) { - ExtensionEntry *extEntry; + ExtensionEntry* extEntry; if (DRIExtensionInit() && (extEntry = AddExtension(APPLEDRINAME, @@ -486,13 +504,13 @@ AppleDRIExtensionInit(void) AppleDRINumberErrors, ProcAppleDRIDispatch, SProcAppleDRIDispatch, - AppleDRIResetProc, StandardMinorOpcode))) { + AppleDRIResetProc, + StandardMinorOpcode))) { size_t i; - - DRIReqCode = (unsigned char) extEntry->base; + DRIReqCode = (unsigned char)extEntry->base; DRIErrorBase = extEntry->errorBase; DRIEventBase = extEntry->eventBase; for (i = 0; i < AppleDRINumberEvents; i++) - EventSwapVector[DRIEventBase + i] = (EventSwapPtr) SNotifyEvent; + EventSwapVector[DRIEventBase + i] = (EventSwapPtr)SNotifyEvent; } } diff --git a/xorg-server/hw/xquartz/xpr/appledri.h b/xorg-server/hw/xquartz/xpr/appledri.h index 36964c6cd..a96c96fc8 100644 --- a/xorg-server/hw/xquartz/xpr/appledri.h +++ b/xorg-server/hw/xquartz/xpr/appledri.h @@ -1,30 +1,30 @@ /* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */ /************************************************************************** -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -Copyright (c) 2002, 2008, 2009 Apple Computer, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + Copyright 2000 VA Linux Systems, Inc. + Copyright (c) 2002-2012 Apple Computer, Inc. + All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ @@ -33,6 +33,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Kevin E. Martin <martin@valinux.com> * Jens Owen <jens@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeremy Huddleston <jeremyhu@apple.com> * */ @@ -41,81 +42,94 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <X11/Xfuncproto.h> -#define X_AppleDRIQueryVersion 0 -#define X_AppleDRIQueryDirectRenderingCapable 1 -#define X_AppleDRICreateSurface 2 -#define X_AppleDRIDestroySurface 3 -#define X_AppleDRIAuthConnection 4 -#define X_AppleDRICreateSharedBuffer 5 -#define X_AppleDRISwapBuffers 6 -#define X_AppleDRICreatePixmap 7 -#define X_AppleDRIDestroyPixmap 8 +#define X_AppleDRIQueryVersion 0 +#define X_AppleDRIQueryDirectRenderingCapable 1 +#define X_AppleDRICreateSurface 2 +#define X_AppleDRIDestroySurface 3 +#define X_AppleDRIAuthConnection 4 +#define X_AppleDRICreateSharedBuffer 5 +#define X_AppleDRISwapBuffers 6 +#define X_AppleDRICreatePixmap 7 +#define X_AppleDRIDestroyPixmap 8 /* Requests up to and including 18 were used in a previous version */ /* Events */ -#define AppleDRIObsoleteEvent1 0 -#define AppleDRIObsoleteEvent2 1 -#define AppleDRIObsoleteEvent3 2 -#define AppleDRISurfaceNotify 3 -#define AppleDRINumberEvents 4 +#define AppleDRIObsoleteEvent1 0 +#define AppleDRIObsoleteEvent2 1 +#define AppleDRIObsoleteEvent3 2 +#define AppleDRISurfaceNotify 3 +#define AppleDRINumberEvents 4 /* Errors */ -#define AppleDRIClientNotLocal 0 -#define AppleDRIOperationNotSupported 1 -#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1) +#define AppleDRIClientNotLocal 0 +#define AppleDRIOperationNotSupported 1 +#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1) /* Kinds of SurfaceNotify events: */ -#define AppleDRISurfaceNotifyChanged 0 -#define AppleDRISurfaceNotifyDestroyed 1 +#define AppleDRISurfaceNotifyChanged 0 +#define AppleDRISurfaceNotifyDestroyed 1 #ifndef _APPLEDRI_SERVER_ typedef struct { - int type; /* of event */ + int type; /* of event */ unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came frome a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* window of event */ - Time time; /* server timestamp when event happened */ - int kind; /* subtype of event */ + Bool send_event; /* true if this came frome a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* window of event */ + Time time; /* server timestamp when event happened */ + int kind; /* subtype of event */ int arg; } XAppleDRINotifyEvent; _XFUNCPROTOBEGIN -Bool XAppleDRIQueryExtension (Display *dpy, int *event_base, int *error_base); +Bool +XAppleDRIQueryExtension(Display *dpy, int *event_base, int *error_base); -Bool XAppleDRIQueryVersion (Display *dpy, int *majorVersion, - int *minorVersion, int *patchVersion); +Bool +XAppleDRIQueryVersion(Display *dpy, int *majorVersion, int *minorVersion, + int *patchVersion); -Bool XAppleDRIQueryDirectRenderingCapable (Display *dpy, int screen, - Bool *isCapable); +Bool +XAppleDRIQueryDirectRenderingCapable(Display *dpy, int screen, + Bool *isCapable); -void *XAppleDRISetSurfaceNotifyHandler (void (*fun) (Display *dpy, - unsigned uid, int kind)); +void * +XAppleDRISetSurfaceNotifyHandler(void (*fun)(Display *dpy, unsigned uid, + int kind)); -Bool XAppleDRIAuthConnection (Display *dpy, int screen, unsigned int magic); +Bool +XAppleDRIAuthConnection(Display *dpy, int screen, unsigned int magic); -Bool XAppleDRICreateSurface (Display *dpy, int screen, Drawable drawable, - unsigned int client_id, unsigned int key[2], - unsigned int* uid); +Bool XAppleDRICreateSurface(Display * dpy, int screen, Drawable drawable, + unsigned int client_id, unsigned int key[2], + unsigned int* uid); -Bool XAppleDRIDestroySurface (Display *dpy, int screen, Drawable drawable); +Bool +XAppleDRIDestroySurface(Display *dpy, int screen, Drawable drawable); -Bool XAppleDRISynchronizeSurfaces (Display *dpy); +Bool +XAppleDRISynchronizeSurfaces(Display *dpy); -Bool XAppleDRICreateSharedBuffer(Display *dpy, int screen, Drawable drawable, - Bool doubleSwap, char *path, size_t pathlen, - int *width, int *height); +Bool +XAppleDRICreateSharedBuffer(Display *dpy, int screen, Drawable drawable, + Bool doubleSwap, char *path, size_t pathlen, + int *width, + int *height); -Bool XAppleDRISwapBuffers(Display *dpy, int screen, Drawable drawable); +Bool +XAppleDRISwapBuffers(Display *dpy, int screen, Drawable drawable); -Bool XAppleDRICreatePixmap(Display *dpy, int screen, Drawable drawable, - int *width, int *height, int *pitch, int *bpp, - size_t *size, char *bufname, size_t bufnamesize); +Bool +XAppleDRICreatePixmap(Display *dpy, int screen, Drawable drawable, int *width, + int *height, int *pitch, int *bpp, size_t *size, + char *bufname, + size_t bufnamesize); -Bool XAppleDRIDestroyPixmap(Display *dpy, Pixmap pixmap); +Bool +XAppleDRIDestroyPixmap(Display *dpy, Pixmap pixmap); _XFUNCPROTOEND diff --git a/xorg-server/hw/xquartz/xpr/appledristr.h b/xorg-server/hw/xquartz/xpr/appledristr.h index 131a699d9..71346c428 100644 --- a/xorg-server/hw/xquartz/xpr/appledristr.h +++ b/xorg-server/hw/xquartz/xpr/appledristr.h @@ -1,29 +1,29 @@ /************************************************************************** -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -Copyright (c) 2002, 2008, 2009 Apple Computer, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + Copyright 2000 VA Linux Systems, Inc. + Copyright (c) 2002-2012 Apple Computer, Inc. + All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ @@ -32,6 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Kevin E. Martin <martin@valinux.com> * Jens Owen <jens@valinux.com> * Rickard E. (Rik) Fiath <faith@valinux.com> + * Jeremy Huddleston <jeremyhu@apple.com> * */ @@ -40,47 +41,44 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "appledri.h" -#define APPLEDRINAME "Apple-DRI" +#define APPLEDRINAME "Apple-DRI" -#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */ -#define APPLE_DRI_MINOR_VERSION 0 -#define APPLE_DRI_PATCH_VERSION 0 +#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */ +#define APPLE_DRI_MINOR_VERSION 0 +#define APPLE_DRI_PATCH_VERSION 0 typedef struct _AppleDRIQueryVersion { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIQueryVersion */ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIQueryVersion */ CARD16 length B16; } xAppleDRIQueryVersionReq; - -#define sz_xAppleDRIQueryVersionReq 4 +#define sz_xAppleDRIQueryVersionReq 4 typedef struct { - BYTE type; /* X_Reply */ + BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; - CARD16 majorVersion B16; /* major version of DRI protocol */ - CARD16 minorVersion B16; /* minor version of DRI protocol */ - CARD32 patchVersion B32; /* patch version of DRI protocol */ + CARD16 majorVersion B16; /* major version of DRI protocol */ + CARD16 minorVersion B16; /* minor version of DRI protocol */ + CARD32 patchVersion B32; /* patch version of DRI protocol */ CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xAppleDRIQueryVersionReply; - -#define sz_xAppleDRIQueryVersionReply 32 +#define sz_xAppleDRIQueryVersionReply 32 typedef struct _AppleDRIQueryDirectRenderingCapable { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ CARD16 length B16; CARD32 screen B32; } xAppleDRIQueryDirectRenderingCapableReq; - -#define sz_xAppleDRIQueryDirectRenderingCapableReq 8 +#define sz_xAppleDRIQueryDirectRenderingCapableReq 8 typedef struct { - BYTE type; /* X_Reply */ + BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; @@ -94,18 +92,16 @@ typedef struct { CARD32 pad8 B32; CARD32 pad9 B32; } xAppleDRIQueryDirectRenderingCapableReply; - -#define sz_xAppleDRIQueryDirectRenderingCapableReply 32 +#define sz_xAppleDRIQueryDirectRenderingCapableReply 32 typedef struct _AppleDRIAuthConnection { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICloseConnection */ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseConnection */ CARD16 length B16; CARD32 screen B32; CARD32 magic B32; } xAppleDRIAuthConnectionReq; - -#define sz_xAppleDRIAuthConnectionReq 12 +#define sz_xAppleDRIAuthConnectionReq 12 typedef struct { BYTE type; @@ -119,22 +115,20 @@ typedef struct { CARD32 pad5 B32; CARD32 pad6 B32; } xAppleDRIAuthConnectionReply; - -#define zx_xAppleDRIAuthConnectionReply 32 +#define zx_xAppleDRIAuthConnectionReply 32 typedef struct _AppleDRICreateSurface { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRICreateSurface */ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICreateSurface */ CARD16 length B16; CARD32 screen B32; CARD32 drawable B32; CARD32 client_id B32; } xAppleDRICreateSurfaceReq; - -#define sz_xAppleDRICreateSurfaceReq 16 +#define sz_xAppleDRICreateSurfaceReq 16 typedef struct { - BYTE type; /* X_Reply */ + BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; @@ -145,24 +139,22 @@ typedef struct { CARD32 pad5 B32; CARD32 pad6 B32; } xAppleDRICreateSurfaceReply; - -#define sz_xAppleDRICreateSurfaceReply 32 +#define sz_xAppleDRICreateSurfaceReply 32 typedef struct _AppleDRIDestroySurface { - CARD8 reqType; /* always DRIReqCode */ - CARD8 driReqType; /* always X_DRIDestroySurface */ + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIDestroySurface */ CARD16 length B16; CARD32 screen B32; CARD32 drawable B32; } xAppleDRIDestroySurfaceReq; - -#define sz_xAppleDRIDestroySurfaceReq 12 +#define sz_xAppleDRIDestroySurfaceReq 12 typedef struct _AppleDRINotify { - BYTE type; /* always eventBase + event type */ + BYTE type; /* always eventBase + event type */ BYTE kind; CARD16 sequenceNumber B16; - CARD32 time B32; /* time of change */ + CARD32 time B32; /* time of change */ CARD32 pad1 B32; CARD32 arg B32; CARD32 pad3 B32; @@ -170,8 +162,7 @@ typedef struct _AppleDRINotify { CARD32 pad5 B32; CARD32 pad6 B32; } xAppleDRINotifyEvent; - -#define sz_xAppleDRINotifyEvent 32 +#define sz_xAppleDRINotifyEvent 32 typedef struct { CARD8 reqType; @@ -190,7 +181,7 @@ typedef struct { BYTE data1; CARD16 sequenceNumber B16; CARD32 length B32; - CARD32 stringLength B32; /* 0 on error */ + CARD32 stringLength B32; /* 0 on error */ CARD32 width B32; CARD32 height B32; CARD32 pad1 B32; @@ -211,35 +202,35 @@ typedef struct { #define sz_xAppleDRISwapBuffersReq 12 typedef struct { - CARD8 reqType; /*1 */ - CARD8 driReqType; /*2 */ - CARD16 length B16; /*4 */ - CARD32 screen B32; /*8 */ - CARD32 drawable B32; /*12 */ + CARD8 reqType; /*1 */ + CARD8 driReqType; /*2 */ + CARD16 length B16; /*4 */ + CARD32 screen B32; /*8 */ + CARD32 drawable B32; /*12 */ } xAppleDRICreatePixmapReq; #define sz_xAppleDRICreatePixmapReq 12 typedef struct { - BYTE type; /*1 */ - BOOL pad1; /*2 */ - CARD16 sequenceNumber B16; /*4 */ - CARD32 length B32; /*8 */ - CARD32 width B32; /*12 */ - CARD32 height B32; /*16 */ - CARD32 pitch B32; /*20 */ - CARD32 bpp B32; /*24 */ - CARD32 size B32; /*28 */ - CARD32 stringLength B32; /*32 */ + BYTE type; /*1 */ + BOOL pad1; /*2 */ + CARD16 sequenceNumber B16; /*4 */ + CARD32 length B32; /*8 */ + CARD32 width B32; /*12 */ + CARD32 height B32; /*16 */ + CARD32 pitch B32; /*20 */ + CARD32 bpp B32; /*24 */ + CARD32 size B32; /*28 */ + CARD32 stringLength B32; /*32 */ } xAppleDRICreatePixmapReply; #define sz_xAppleDRICreatePixmapReply 32 typedef struct { - CARD8 reqType; /*1 */ - CARD8 driReqType; /*2 */ - CARD16 length B16; /*4 */ - CARD32 drawable B32; /*8 */ + CARD8 reqType; /*1 */ + CARD8 driReqType; /*2 */ + CARD16 length B16; /*4 */ + CARD32 drawable B32; /*8 */ } xAppleDRIDestroyPixmapReq; #define sz_xAppleDRIDestroyPixmapReq 8 @@ -248,12 +239,12 @@ typedef struct { void AppleDRISendEvent( #if NeedFunctionPrototypes - int /* type */ , - unsigned int /* mask */ , - int /* which */ , - int /* arg */ + int /* type */, + unsigned int /* mask */, + int /* which */, + int /* arg */ #endif ); -#endif /* _APPLEDRI_SERVER_ */ -#endif /* _APPLEDRISTR_H_ */ +#endif /* _APPLEDRI_SERVER_ */ +#endif /* _APPLEDRISTR_H_ */ diff --git a/xorg-server/hw/xquartz/xpr/dri.c b/xorg-server/hw/xquartz/xpr/dri.c index 0ce1d0771..002ec94a7 100644 --- a/xorg-server/hw/xquartz/xpr/dri.c +++ b/xorg-server/hw/xquartz/xpr/dri.c @@ -1,29 +1,29 @@ /************************************************************************** -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -Copyright (c) 2002, 2009 Apple Computer, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + Copyright 2000 VA Linux Systems, Inc. + Copyright (c) 2002-2012 Apple Computer, Inc. + All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ @@ -31,7 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Jens Owen <jens@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com> - * + * Jeremy Huddleston <jeremyhu@apple.com> */ #ifdef HAVE_DIX_CONFIG_H @@ -75,23 +75,20 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <AvailabilityMacros.h> static DevPrivateKeyRec DRIScreenPrivKeyRec; - -#define DRIScreenPrivKey (&DRIScreenPrivKeyRec) +#define DRIScreenPrivKey (&DRIScreenPrivKeyRec) static DevPrivateKeyRec DRIWindowPrivKeyRec; - -#define DRIWindowPrivKey (&DRIWindowPrivKeyRec) +#define DRIWindowPrivKey (&DRIWindowPrivKeyRec) static DevPrivateKeyRec DRIPixmapPrivKeyRec; - -#define DRIPixmapPrivKey (&DRIPixmapPrivKeyRec) +#define DRIPixmapPrivKey (&DRIPixmapPrivKeyRec) static DevPrivateKeyRec DRIPixmapBufferPrivKeyRec; - #define DRIPixmapBufferPrivKey (&DRIPixmapBufferPrivKeyRec) static RESTYPE DRIDrawablePrivResType; static x_hash_table *surface_hash; /* maps surface ids -> drawablePrivs */ -static Bool DRIFreePixmapImp(DrawablePtr pDrawable); +static Bool +DRIFreePixmapImp(DrawablePtr pDrawable); typedef struct { DrawablePtr pDrawable; @@ -100,8 +97,8 @@ typedef struct { int width; int height; char shmPath[PATH_MAX]; - int fd; /* From shm_open (for now) */ - size_t length; /* length of buffer */ + int fd; /* From shm_open (for now) */ + size_t length; /* length of buffer */ void *buffer; } DRIPixmapBuffer, *DRIPixmapBufferPtr; @@ -120,7 +117,7 @@ DRIScreenInit(ScreenPtr pScreen) if (!dixRegisterPrivateKey(&DRIPixmapBufferPrivKeyRec, PRIVATE_PIXMAP, 0)) return FALSE; - pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec)); + pDRIPriv = (DRIScreenPrivPtr)calloc(1, sizeof(DRIScreenPrivRec)); if (!pDRIPriv) { dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); return FALSE; @@ -197,7 +194,7 @@ DRIReset(void) } Bool -DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable) +DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -217,8 +214,7 @@ DRIAuthConnection(ScreenPtr pScreen, unsigned int magic) DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (drmAuthMagic(pDRIPriv->drmFD, magic)) - return FALSE; + if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE; #endif return TRUE; } @@ -240,7 +236,7 @@ DRIUpdateSurface(DRIDrawablePrivPtr pDRIDrawablePriv, DrawablePtr pDraw) #endif if (pDraw->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDraw; + WindowPtr pWin = (WindowPtr)pDraw; WindowPtr pTopWin = TopLevelParent(pWin); wc.x = pWin->drawable.x - (pTopWin->drawable.x - pTopWin->borderWidth); @@ -271,7 +267,8 @@ DRIUpdateSurface(DRIDrawablePrivPtr pDRIDrawablePriv, DrawablePtr pDraw) /* Return NULL if an error occurs. */ static DRIDrawablePrivPtr -CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id * widPtr) +CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, + xp_window_id *widPtr) { DRIDrawablePrivPtr pDRIDrawablePriv; xp_window_id wid = 0; @@ -289,7 +286,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id * widPtr) return NULL; } - pDRIDrawablePriv->pDraw = (DrawablePtr) pWin; + pDRIDrawablePriv->pDraw = (DrawablePtr)pWin; pDRIDrawablePriv->pScreen = pScreen; pDRIDrawablePriv->refCount = 0; pDRIDrawablePriv->drawableIndex = -1; @@ -323,7 +320,8 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id * widPtr) } /* save private off of preallocated index */ - dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, pDRIDrawablePriv); + dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, + pDRIDrawablePriv); } *widPtr = wid; @@ -347,7 +345,7 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) return NULL; } - pDRIDrawablePriv->pDraw = (DrawablePtr) pPix; + pDRIDrawablePriv->pDraw = (DrawablePtr)pPix; pDRIDrawablePriv->pScreen = pScreen; pDRIDrawablePriv->refCount = 0; pDRIDrawablePriv->drawableIndex = -1; @@ -362,13 +360,14 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) return NULL; } - /* + /* * The DRIUpdateSurface will be called to resize the surface * after this function, if the export is successful. */ /* save private off of preallocated index */ - dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, pDRIDrawablePriv); + dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, + pDRIDrawablePriv); } return pDRIDrawablePriv; @@ -377,8 +376,8 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) Bool DRICreateSurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, xp_client_id client_id, - xp_surface_id * surface_id, unsigned int ret_key[2], - void (*notify) (void *arg, void *data), void *notify_data) + xp_surface_id *surface_id, unsigned int ret_key[2], + void (*notify)(void *arg, void *data), void *notify_data) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); xp_window_id wid = 0; @@ -386,18 +385,18 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, if (pDrawable->type == DRAWABLE_WINDOW) { pDRIDrawablePriv = CreateSurfaceForWindow(pScreen, - (WindowPtr) pDrawable, &wid); + (WindowPtr)pDrawable, &wid); if (NULL == pDRIDrawablePriv) - return FALSE; /*error */ + return FALSE; /*error*/ } #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 else if (pDrawable->type == DRAWABLE_PIXMAP) { pDRIDrawablePriv = CreateSurfaceForPixmap(pScreen, - (PixmapPtr) pDrawable); + (PixmapPtr)pDrawable); if (NULL == pDRIDrawablePriv) - return FALSE; /*error */ + return FALSE; /*error*/ } #endif else { @@ -413,25 +412,26 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, /* try to give the client access to the surface */ if (client_id != 0) { /* - * Xplugin accepts a 0 wid if the surface id is offscreen, such + * Xplugin accepts a 0 wid if the surface id is offscreen, such * as for a pixmap. */ - err = xp_export_surface(wid, pDRIDrawablePriv->sid, client_id, key); + err = xp_export_surface(wid, pDRIDrawablePriv->sid, + client_id, key); if (err != Success) { xp_destroy_surface(pDRIDrawablePriv->sid); free(pDRIDrawablePriv); - /* + /* * Now set the dix privates to NULL that were previously set. * This prevents reusing an invalid pointer. */ if (pDrawable->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDrawable; + WindowPtr pWin = (WindowPtr)pDrawable; dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); } else if (pDrawable->type == DRAWABLE_PIXMAP) { - PixmapPtr pPix = (PixmapPtr) pDrawable; + PixmapPtr pPix = (PixmapPtr)pDrawable; dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL); } @@ -449,11 +449,11 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, if (surface_hash == NULL) surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); x_hash_table_insert(surface_hash, - x_cvt_uint_to_vptr(pDRIDrawablePriv->sid), - pDRIDrawablePriv); + x_cvt_uint_to_vptr( + pDRIDrawablePriv->sid), pDRIDrawablePriv); /* track this in case this window is destroyed */ - AddResource(id, DRIDrawablePrivResType, (pointer) pDrawable); + AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable); /* Initialize shape */ DRIUpdateSurface(pDRIDrawablePriv, pDrawable); @@ -478,15 +478,15 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, Bool DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, - void (*notify) (void *, void *), void *notify_data) + void (*notify)(void *, void *), void *notify_data) { DRIDrawablePrivPtr pDRIDrawablePriv; if (pDrawable->type == DRAWABLE_WINDOW) { - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW((WindowPtr) pDrawable); + pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW((WindowPtr)pDrawable); } else if (pDrawable->type == DRAWABLE_PIXMAP) { - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP((PixmapPtr) pDrawable); + pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP((PixmapPtr)pDrawable); } else { return FALSE; @@ -498,13 +498,14 @@ DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, */ if (notify != NULL) { - pDRIDrawablePriv->notifiers = - x_hook_remove(pDRIDrawablePriv->notifiers, notify, notify_data); + pDRIDrawablePriv->notifiers = x_hook_remove( + pDRIDrawablePriv->notifiers, + notify, notify_data); } --pDRIDrawablePriv->refCount; - /* + /* * Check if the drawable privates still have a reference to the * surface. */ @@ -512,7 +513,7 @@ DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, if (pDRIDrawablePriv->refCount <= 0) { /* * This calls back to DRIDrawablePrivDelete which - * frees the private area and dispatches events, if needed. + * frees the private area and dispatches events, if needed. */ FreeResourceByType(id, DRIDrawablePrivResType, FALSE); } @@ -521,30 +522,30 @@ DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, return TRUE; } -/* +/* * The assumption is that this is called when the refCount of a surface - * drops to <= 0, or the window/pixmap is destroyed. + * drops to <= 0, or the window/pixmap is destroyed. */ Bool DRIDrawablePrivDelete(pointer pResource, XID id) { - DrawablePtr pDrawable = (DrawablePtr) pResource; + DrawablePtr pDrawable = (DrawablePtr)pResource; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); DRIDrawablePrivPtr pDRIDrawablePriv = NULL; WindowPtr pWin = NULL; PixmapPtr pPix = NULL; if (pDrawable->type == DRAWABLE_WINDOW) { - pWin = (WindowPtr) pDrawable; + pWin = (WindowPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); } else if (pDrawable->type == DRAWABLE_PIXMAP) { - pPix = (PixmapPtr) pDrawable; + pPix = (PixmapPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix); } if (pDRIDrawablePriv == NULL) { - /* + /* * We reuse __func__ and the resource type for the GLXPixmap code. * Attempt to free a pixmap buffer associated with the resource * if possible. @@ -558,7 +559,8 @@ DRIDrawablePrivDelete(pointer pResource, XID id) } if (pDRIDrawablePriv->sid != 0) { - DRISurfaceNotify(pDRIDrawablePriv->sid, AppleDRISurfaceNotifyDestroyed); + DRISurfaceNotify(pDRIDrawablePriv->sid, + AppleDRISurfaceNotifyDestroyed); } if (pDRIDrawablePriv->notifiers != NULL) @@ -591,7 +593,7 @@ DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg) pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures; - (*pScreen->WindowExposures) (pWin, prgn, bsreg); + (*pScreen->WindowExposures)(pWin, prgn, bsreg); pScreen->WindowExposures = DRIWindowExposures; } @@ -614,7 +616,7 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow; /* call lower layers */ - (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); + (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc); /* rewrap */ pScreen->CopyWindow = DRICopyWindow; @@ -631,7 +633,7 @@ DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree; /* call lower layers */ - returnValue = (*pScreen->ValidateTree) (pParent, pChild, kind); + returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind); /* rewrap */ pScreen->ValidateTree = DRIValidateTree; @@ -658,7 +660,7 @@ DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree; /* call lower layers */ - (*pScreen->PostValidateTree) (pParent, pChild, kind); + (*pScreen->PostValidateTree)(pParent, pChild, kind); /* rewrap */ pScreen->PostValidateTree = DRIPostValidateTree; @@ -679,7 +681,7 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy) if (pDRIPriv->wrap.ClipNotify) { pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify; - (*pScreen->ClipNotify) (pWin, dx, dy); + (*pScreen->ClipNotify)(pWin, dx, dy); pScreen->ClipNotify = DRIClipNotify; } @@ -696,14 +698,16 @@ DRIGetWrappedFuncs(ScreenPtr pScreen) } void -DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion) +DRIQueryVersion(int *majorVersion, + int *minorVersion, + int *patchVersion) { *majorVersion = APPLE_DRI_MAJOR_VERSION; *minorVersion = APPLE_DRI_MINOR_VERSION; *patchVersion = APPLE_DRI_PATCH_VERSION; } -/* +/* * Note: this also cleans up the hash table in addition to notifying clients. * The sid/surface-id should not be used after this, because it will be * invalid. @@ -753,7 +757,8 @@ DRISurfaceNotify(xp_surface_id id, int kind) */ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id, - DrawablePtr pDrawable, char *path, size_t pathmax) + DrawablePtr pDrawable, char *path, + size_t pathmax) { DRIPixmapBufferPtr shared; PixmapPtr pPix; @@ -761,7 +766,7 @@ DRICreatePixmap(ScreenPtr pScreen, Drawable id, if (pDrawable->type != DRAWABLE_PIXMAP) return FALSE; - pPix = (PixmapPtr) pDrawable; + pPix = (PixmapPtr)pDrawable; shared = malloc(sizeof(*shared)); if (NULL == shared) { @@ -782,7 +787,8 @@ DRICreatePixmap(ScreenPtr pScreen, Drawable id, shared->height = pDrawable->height; if (-1 == snprintf(shared->shmPath, sizeof(shared->shmPath), - "%d_0x%lx", getpid(), (unsigned long) id)) { + "%d_0x%lx", getpid(), + (unsigned long)id)) { FatalError("buffer overflow in %s\n", __func__); } @@ -821,7 +827,7 @@ DRICreatePixmap(ScreenPtr pScreen, Drawable id, dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared); - AddResource(id, DRIDrawablePrivResType, (pointer) pDrawable); + AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable); return TRUE; } @@ -836,7 +842,7 @@ DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height, if (pDrawable->type != DRAWABLE_PIXMAP) return FALSE; - pPix = (PixmapPtr) pDrawable; + pPix = (PixmapPtr)pDrawable; shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey); @@ -864,7 +870,7 @@ DRIFreePixmapImp(DrawablePtr pDrawable) if (pDrawable->type != DRAWABLE_PIXMAP) return FALSE; - pPix = (PixmapPtr) pDrawable; + pPix = (PixmapPtr)pDrawable; shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey); @@ -876,7 +882,7 @@ DRIFreePixmapImp(DrawablePtr pDrawable) shm_unlink(shared->shmPath); free(shared); - dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer) NULL); + dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer)NULL); return TRUE; } diff --git a/xorg-server/hw/xquartz/xpr/dri.h b/xorg-server/hw/xquartz/xpr/dri.h index b4342617c..8717a5186 100644 --- a/xorg-server/hw/xquartz/xpr/dri.h +++ b/xorg-server/hw/xquartz/xpr/dri.h @@ -1,35 +1,35 @@ /************************************************************************** -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright (c) 2002, 2009 Apple Computer, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + Copyright (c) 2002-2012 Apple Computer, Inc. + All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Jens Owen <jens@precisioninsight.com> - * + * Jeremy Huddleston <jeremyhu@apple.com> */ /* Prototypes for AppleDRI functions */ @@ -43,7 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "appledri.h" #include <Xplugin.h> -typedef void (*ClipNotifyPtr) (WindowPtr, int, int); +typedef void (*ClipNotifyPtr)(WindowPtr, int, int); /* * These functions can be wrapped by the DRI. Each of these have @@ -63,19 +63,26 @@ typedef struct { int kind; } DRISurfaceNotifyArg; -extern Bool DRIScreenInit(ScreenPtr pScreen); +extern Bool +DRIScreenInit(ScreenPtr pScreen); -extern Bool DRIFinishScreenInit(ScreenPtr pScreen); +extern Bool +DRIFinishScreenInit(ScreenPtr pScreen); -extern void DRICloseScreen(ScreenPtr pScreen); +extern void +DRICloseScreen(ScreenPtr pScreen); -extern Bool DRIExtensionInit(void); +extern Bool +DRIExtensionInit(void); -extern void DRIReset(void); +extern void +DRIReset(void); -extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable); +extern Bool +DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool *isCapable); -extern Bool DRIAuthConnection(ScreenPtr pScreen, unsigned int magic); +extern Bool +DRIAuthConnection(ScreenPtr pScreen, unsigned int magic); extern Bool DRICreateSurface(ScreenPtr pScreen, Drawable id, @@ -83,42 +90,52 @@ extern Bool DRICreateSurface(ScreenPtr pScreen, xp_client_id client_id, xp_surface_id * surface_id, unsigned int key[2], - void (*notify) (void *arg, void *data), + void (*notify)(void *arg, void *data), void *notify_data); -extern Bool DRIDestroySurface(ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable, - void (*notify) (void *arg, void *data), - void *notify_data); +extern Bool +DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, + void (*notify)(void *arg, + void *data), void *notify_data); -extern Bool DRIDrawablePrivDelete(pointer pResource, XID id); +extern Bool +DRIDrawablePrivDelete(pointer pResource, XID id); -extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen); +extern DRIWrappedFuncsRec * +DRIGetWrappedFuncs(ScreenPtr pScreen); -extern void DRICopyWindow(WindowPtr pWin, - DDXPointRec ptOldOrg, RegionPtr prgnSrc); +extern void +DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); -extern int DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); +extern int +DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); -extern void DRIPostValidateTree(WindowPtr pParent, - WindowPtr pChild, VTKind kind); +extern void +DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); -extern void DRIClipNotify(WindowPtr pWin, int dx, int dy); +extern void +DRIClipNotify(WindowPtr pWin, int dx, int dy); -extern void DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg); +extern void +DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg); -extern void DRISurfaceNotify(xp_surface_id id, int kind); +extern void +DRISurfaceNotify(xp_surface_id id, int kind); -extern void DRIQueryVersion(int *majorVersion, - int *minorVersion, int *patchVersion); +extern void +DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion); -extern Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id, - DrawablePtr pDrawable, char *path, size_t pathmax); +extern Bool +DRICreatePixmap(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, + char *path, + size_t pathmax); -extern Bool DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height, - int *pitch, int *bpp, void **ptr); +extern Bool +DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height, int *pitch, + int *bpp, + void **ptr); -extern void DRIDestroyPixmap(DrawablePtr pDrawable); +extern void +DRIDestroyPixmap(DrawablePtr pDrawable); #endif diff --git a/xorg-server/hw/xquartz/xpr/driWrap.c b/xorg-server/hw/xquartz/xpr/driWrap.c index eca31b263..5f9f3abd3 100644 --- a/xorg-server/hw/xquartz/xpr/driWrap.c +++ b/xorg-server/hw/xquartz/xpr/driWrap.c @@ -1,27 +1,32 @@ /* -Copyright (c) 2009 Apple Computer, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + * Copyright (c) 2009-2012 Apple Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -55,23 +60,21 @@ typedef struct { } DRISavedDrawableState; static DevPrivateKeyRec driGCKeyRec; - #define driGCKey (&driGCKeyRec) static DevPrivateKeyRec driWrapScreenKeyRec; - #define driWrapScreenKey (&driWrapScreenKeyRec) static GCOps driGCOps; #define wrap(priv, real, member, func) { \ - priv->member = real->member; \ - real->member = func; \ - } + priv->member = real->member; \ + real->member = func; \ +} -#define unwrap(priv, real, member) { \ - real->member = priv->member; \ - } +#define unwrap(priv, real, member) { \ + real->member = priv->member; \ +} static DRIGCRec * DRIGetGCPriv(GCPtr pGC) @@ -94,7 +97,8 @@ DRIWrapGC(GCPtr pGC) } static void -DRISurfaceSetDrawable(DrawablePtr pDraw, DRISavedDrawableState * saved) +DRISurfaceSetDrawable(DrawablePtr pDraw, + DRISavedDrawableState *saved) { saved->didSave = FALSE; @@ -102,8 +106,9 @@ DRISurfaceSetDrawable(DrawablePtr pDraw, DRISavedDrawableState * saved) int pitch, width, height, bpp; void *buffer; - if (DRIGetPixmapData(pDraw, &width, &height, &pitch, &bpp, &buffer)) { - PixmapPtr pPix = (PixmapPtr) pDraw; + if (DRIGetPixmapData(pDraw, &width, &height, &pitch, &bpp, + &buffer)) { + PixmapPtr pPix = (PixmapPtr)pDraw; saved->devKind = pPix->devKind; saved->devPrivate.ptr = pPix->devPrivate.ptr; @@ -116,9 +121,10 @@ DRISurfaceSetDrawable(DrawablePtr pDraw, DRISavedDrawableState * saved) } static void -DRISurfaceRestoreDrawable(DrawablePtr pDraw, DRISavedDrawableState * saved) +DRISurfaceRestoreDrawable(DrawablePtr pDraw, + DRISavedDrawableState *saved) { - PixmapPtr pPix = (PixmapPtr) pDraw; + PixmapPtr pPix = (PixmapPtr)pDraw; if (!saved->didSave) return; @@ -129,7 +135,8 @@ DRISurfaceRestoreDrawable(DrawablePtr pDraw, DRISavedDrawableState * saved) static void DRIFillSpans(DrawablePtr dst, GCPtr pGC, int nInit, - DDXPointPtr pptInit, int *pwidthInit, int sorted) + DDXPointPtr pptInit, int *pwidthInit, + int sorted) { DRISavedDrawableState saved; @@ -146,7 +153,8 @@ DRIFillSpans(DrawablePtr dst, GCPtr pGC, int nInit, static void DRISetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc, - DDXPointPtr pptInit, int *pwidthInit, int nspans, int sorted) + DDXPointPtr pptInit, int *pwidthInit, + int nspans, int sorted) { DRISavedDrawableState saved; @@ -181,7 +189,8 @@ DRIPutImage(DrawablePtr dst, GCPtr pGC, static RegionPtr DRICopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, - int srcx, int srcy, int w, int h, int dstx, int dsty) + int srcx, int srcy, int w, int h, + int dstx, int dsty) { RegionPtr pReg; DRISavedDrawableState pSrcSaved, dstSaved; @@ -204,7 +213,8 @@ DRICopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, static RegionPtr DRICopyPlane(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, int srcx, int srcy, - int w, int h, int dstx, int dsty, unsigned long plane) + int w, int h, int dstx, int dsty, + unsigned long plane) { RegionPtr pReg; DRISavedDrawableState pSrcSaved, dstSaved; @@ -226,7 +236,8 @@ DRICopyPlane(DrawablePtr pSrc, DrawablePtr dst, } static void -DRIPolyPoint(DrawablePtr dst, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) +DRIPolyPoint(DrawablePtr dst, GCPtr pGC, + int mode, int npt, DDXPointPtr pptInit) { DRISavedDrawableState saved; @@ -242,7 +253,8 @@ DRIPolyPoint(DrawablePtr dst, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) } static void -DRIPolylines(DrawablePtr dst, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) +DRIPolylines(DrawablePtr dst, GCPtr pGC, + int mode, int npt, DDXPointPtr pptInit) { DRISavedDrawableState saved; @@ -258,7 +270,8 @@ DRIPolylines(DrawablePtr dst, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit) } static void -DRIPolySegment(DrawablePtr dst, GCPtr pGC, int nseg, xSegment * pSeg) +DRIPolySegment(DrawablePtr dst, GCPtr pGC, + int nseg, xSegment *pSeg) { DRISavedDrawableState saved; @@ -274,7 +287,8 @@ DRIPolySegment(DrawablePtr dst, GCPtr pGC, int nseg, xSegment * pSeg) } static void -DRIPolyRectangle(DrawablePtr dst, GCPtr pGC, int nRects, xRectangle *pRects) +DRIPolyRectangle(DrawablePtr dst, GCPtr pGC, + int nRects, xRectangle *pRects) { DRISavedDrawableState saved; @@ -288,9 +302,8 @@ DRIPolyRectangle(DrawablePtr dst, GCPtr pGC, int nRects, xRectangle *pRects) DRISurfaceRestoreDrawable(dst, &saved); } - static void -DRIPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc * parcs) +DRIPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs) { DRISavedDrawableState saved; @@ -307,7 +320,8 @@ DRIPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc * parcs) static void DRIFillPolygon(DrawablePtr dst, GCPtr pGC, - int shape, int mode, int count, DDXPointPtr pptInit) + int shape, int mode, int count, + DDXPointPtr pptInit) { DRISavedDrawableState saved; @@ -340,7 +354,8 @@ DRIPolyFillRect(DrawablePtr dst, GCPtr pGC, } static void -DRIPolyFillArc(DrawablePtr dst, GCPtr pGC, int narcsInit, xArc * parcsInit) +DRIPolyFillArc(DrawablePtr dst, GCPtr pGC, + int narcsInit, xArc *parcsInit) { DRISavedDrawableState saved; @@ -356,7 +371,8 @@ DRIPolyFillArc(DrawablePtr dst, GCPtr pGC, int narcsInit, xArc * parcsInit) } static int -DRIPolyText8(DrawablePtr dst, GCPtr pGC, int x, int y, int count, char *chars) +DRIPolyText8(DrawablePtr dst, GCPtr pGC, + int x, int y, int count, char *chars) { int ret; DRISavedDrawableState saved; @@ -395,7 +411,8 @@ DRIPolyText16(DrawablePtr dst, GCPtr pGC, } static void -DRIImageText8(DrawablePtr dst, GCPtr pGC, int x, int y, int count, char *chars) +DRIImageText8(DrawablePtr dst, GCPtr pGC, + int x, int y, int count, char *chars) { DRISavedDrawableState saved; @@ -430,7 +447,7 @@ DRIImageText16(DrawablePtr dst, GCPtr pGC, static void DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, unsigned int nglyphInit, - CharInfoPtr * ppciInit, pointer unused) + CharInfoPtr *ppciInit, pointer unused) { DRISavedDrawableState saved; @@ -448,7 +465,7 @@ DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC, static void DRIPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, pointer pglyphBase) + CharInfoPtr *ppci, pointer pglyphBase) { DRISavedDrawableState saved; @@ -539,12 +556,12 @@ DRIWrapInit(ScreenPtr pScreen) if (!dixRegisterPrivateKey(&driGCKeyRec, PRIVATE_GC, sizeof(DRIGCRec))) return FALSE; - if (!dixRegisterPrivateKey - (&driWrapScreenKeyRec, PRIVATE_SCREEN, sizeof(DRIWrapScreenRec))) + if (!dixRegisterPrivateKey(&driWrapScreenKeyRec, PRIVATE_SCREEN, + sizeof(DRIWrapScreenRec))) return FALSE; - pScreenPriv = - dixGetPrivateAddr(&pScreen->devPrivates, &driWrapScreenKeyRec); + pScreenPriv = dixGetPrivateAddr(&pScreen->devPrivates, + &driWrapScreenKeyRec); pScreenPriv->CreateGC = pScreen->CreateGC; pScreen->CreateGC = DRICreateGC; diff --git a/xorg-server/hw/xquartz/xpr/driWrap.h b/xorg-server/hw/xquartz/xpr/driWrap.h index d31d5ddaf..1bc34ee9e 100644 --- a/xorg-server/hw/xquartz/xpr/driWrap.h +++ b/xorg-server/hw/xquartz/xpr/driWrap.h @@ -1,31 +1,36 @@ /* -Copyright (c) 2009 Apple Computer, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + * Copyright (c) 2009-2012 Apple Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ #ifndef DRIWRAP_H #include "scrnintstr.h" -Bool DRIWrapInit(ScreenPtr pScreen); +Bool +DRIWrapInit(ScreenPtr pScreen); #endif /*DRIWRAP_H*/ diff --git a/xorg-server/hw/xquartz/xpr/dristruct.h b/xorg-server/hw/xquartz/xpr/dristruct.h index 13d590b1f..068e9a253 100644 --- a/xorg-server/hw/xquartz/xpr/dristruct.h +++ b/xorg-server/hw/xquartz/xpr/dristruct.h @@ -1,35 +1,35 @@ /************************************************************************** -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright (c) 2002 Apple Computer, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + Copyright (c) 2002-2012 Apple Computer, Inc. + All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Jens Owen <jens@precisioninsight.com> - * + * Jeremy Huddleston <jeremyhu@apple.com> */ #ifndef DRI_STRUCT_H @@ -41,10 +41,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define DRI_MAX_DRAWABLES 256 #define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \ - dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey)) + dixLookupPrivate(&(pWin)-> \ + devPrivates, \ + DRIWindowPrivKey)) #define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \ - dixLookupPrivate(&(pPix)->devPrivates, DRIPixmapPrivKey)) + dixLookupPrivate(&(pPix)-> \ + devPrivates, \ + DRIPixmapPrivKey)) typedef struct _DRIDrawablePrivRec { xp_surface_id sid; @@ -53,15 +57,22 @@ typedef struct _DRIDrawablePrivRec { ScreenPtr pScreen; int refCount; unsigned int key[2]; - x_list *notifiers; /* list of (FUN . DATA) */ + x_list *notifiers; /* list of (FUN . DATA) */ } DRIDrawablePrivRec, *DRIDrawablePrivPtr; -#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \ - dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey)) +#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \ + dixLookupPrivate(&(pScreen) \ + -> \ + devPrivates, \ + DRIScreenPrivKey)) #define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ - dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \ - DRIScreenPrivKey)) + dixLookupPrivate(&screenInfo \ + .screens[ \ + screenIndex \ + ]-> \ + devPrivates, \ + DRIScreenPrivKey)) typedef struct _DRIScreenPrivRec { Bool directRenderingSupport; @@ -70,4 +81,4 @@ typedef struct _DRIScreenPrivRec { DrawablePtr DRIDrawables[DRI_MAX_DRAWABLES]; } DRIScreenPrivRec, *DRIScreenPrivPtr; -#endif /* DRI_STRUCT_H */ +#endif /* DRI_STRUCT_H */ diff --git a/xorg-server/hw/xquartz/xpr/x-hash.c b/xorg-server/hw/xquartz/xpr/x-hash.c index a3ff66177..26e079ff0 100644 --- a/xorg-server/hw/xquartz/xpr/x-hash.c +++ b/xorg-server/hw/xquartz/xpr/x-hash.c @@ -1,31 +1,32 @@ /* x-hash.c - basic hash tables - - Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ + * + * Copyright (c) 2002-2012 Apple Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -47,59 +48,61 @@ struct x_hash_table_struct { x_destroy_fun *destroy_value; }; -#define ITEM_NEW(k, v) X_PFX (list_prepend) ((x_list *) (k), v) -#define ITEM_FREE(i) X_PFX (list_free_1) (i) -#define ITEM_KEY(i) ((void *) (i)->next) -#define ITEM_VALUE(i) ((i)->data) +#define ITEM_NEW(k, v) X_PFX(list_prepend) ((x_list *)(k), v) +#define ITEM_FREE(i) X_PFX(list_free_1) (i) +#define ITEM_KEY(i) ((void *)(i)->next) +#define ITEM_VALUE(i) ((i)->data) #define SPLIT_THRESHOLD_FACTOR 2 /* http://planetmath.org/?op=getobj&from=objects&name=GoodHashTablePrimes */ static const unsigned int bucket_sizes[] = { - 29, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, - 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, + 29, 53, 97, 193, 389, 769, 1543, + 3079, 6151, 12289, 24593, 49157, + 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, + 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, 1610612741 }; -#define N_BUCKET_SIZES (sizeof (bucket_sizes) / sizeof (bucket_sizes[0])) +#define N_BUCKET_SIZES (sizeof(bucket_sizes) / sizeof(bucket_sizes[0])) static inline unsigned int -hash_table_total_buckets(x_hash_table * h) +hash_table_total_buckets(x_hash_table *h) { return bucket_sizes[h->bucket_index]; } static inline void -hash_table_destroy_item(x_hash_table * h, void *k, void *v) +hash_table_destroy_item(x_hash_table *h, void *k, void *v) { if (h->destroy_key != 0) - (*h->destroy_key) (k); + (*h->destroy_key)(k); if (h->destroy_value != 0) - (*h->destroy_value) (v); + (*h->destroy_value)(v); } static inline size_t -hash_table_hash_key(x_hash_table * h, void *k) +hash_table_hash_key(x_hash_table *h, void *k) { if (h->hash_key != 0) - return (*h->hash_key) (k); + return (*h->hash_key)(k); else - return (size_t) k; + return (size_t)k; } static inline int -hash_table_compare_keys(x_hash_table * h, void *k1, void *k2) +hash_table_compare_keys(x_hash_table *h, void *k1, void *k2) { if (h->compare_keys == 0) return k1 == k2; else - return (*h->compare_keys) (k1, k2) == 0; + return (*h->compare_keys)(k1, k2) == 0; } static void -hash_table_split(x_hash_table * h) +hash_table_split(x_hash_table *h) { x_list **new, **old; x_list *node, *item, *next; @@ -139,10 +142,11 @@ hash_table_split(x_hash_table * h) free(old); } -X_EXTERN x_hash_table *X_PFX(hash_table_new) (x_hash_fun * hash, - x_compare_fun * compare, - x_destroy_fun * key_destroy, - x_destroy_fun * value_destroy) { +X_EXTERN x_hash_table * +X_PFX(hash_table_new) (x_hash_fun * hash, + x_compare_fun * compare, + x_destroy_fun * key_destroy, + x_destroy_fun * value_destroy) { x_hash_table *h; h = calloc(1, sizeof(x_hash_table)); @@ -166,7 +170,7 @@ X_EXTERN x_hash_table *X_PFX(hash_table_new) (x_hash_fun * hash, } X_EXTERN void - X_PFX(hash_table_free) (x_hash_table * h) { +X_PFX(hash_table_free) (x_hash_table * h) { int n, i; x_list *node, *item; @@ -188,14 +192,14 @@ X_EXTERN void } X_EXTERN unsigned int - X_PFX(hash_table_size) (x_hash_table * h) { +X_PFX(hash_table_size) (x_hash_table * h) { assert(h != NULL); return h->total_keys; } static void -hash_table_modify(x_hash_table * h, void *k, void *v, int replace) +hash_table_modify(x_hash_table *h, void *k, void *v, int replace) { size_t hash_value; x_list *node, *item; @@ -210,7 +214,8 @@ hash_table_modify(x_hash_table * h, void *k, void *v, int replace) if (hash_table_compare_keys(h, ITEM_KEY(item), k)) { if (replace) { - hash_table_destroy_item(h, ITEM_KEY(item), ITEM_VALUE(item)); + hash_table_destroy_item(h, ITEM_KEY(item), + ITEM_VALUE(item)); item->next = k; ITEM_VALUE(item) = v; } @@ -236,17 +241,17 @@ hash_table_modify(x_hash_table * h, void *k, void *v, int replace) } X_EXTERN void - X_PFX(hash_table_insert) (x_hash_table * h, void *k, void *v) { +X_PFX(hash_table_insert) (x_hash_table * h, void *k, void *v) { hash_table_modify(h, k, v, 0); } X_EXTERN void - X_PFX(hash_table_replace) (x_hash_table * h, void *k, void *v) { +X_PFX(hash_table_replace) (x_hash_table * h, void *k, void *v) { hash_table_modify(h, k, v, 1); } X_EXTERN void - X_PFX(hash_table_remove) (x_hash_table * h, void *k) { +X_PFX(hash_table_remove) (x_hash_table * h, void *k) { size_t hash_value; x_list **ptr, *item; @@ -270,8 +275,8 @@ X_EXTERN void } } -X_EXTERN void *X_PFX(hash_table_lookup) (x_hash_table * h, void *k, - void **k_ret) { +X_EXTERN void * +X_PFX(hash_table_lookup) (x_hash_table * h, void *k, void **k_ret) { size_t hash_value; x_list *node, *item; @@ -298,7 +303,6 @@ X_EXTERN void *X_PFX(hash_table_lookup) (x_hash_table * h, void *k, } X_EXTERN void - X_PFX(hash_table_foreach) (x_hash_table * h, x_hash_foreach_fun * fun, void *data) { int i, n; @@ -311,7 +315,7 @@ X_PFX(hash_table_foreach) (x_hash_table * h, for (i = 0; i < n; i++) { for (node = h->buckets[i]; node != 0; node = node->next) { item = node->data; - (*fun) (ITEM_KEY(item), ITEM_VALUE(item), data); + (*fun)(ITEM_KEY(item), ITEM_VALUE(item), data); } } } diff --git a/xorg-server/hw/xquartz/xpr/x-hash.h b/xorg-server/hw/xquartz/xpr/x-hash.h index c4543346a..2cdae7c5d 100644 --- a/xorg-server/hw/xquartz/xpr/x-hash.h +++ b/xorg-server/hw/xquartz/xpr/x-hash.h @@ -1,31 +1,32 @@ /* x-hash.h -- basic hash table class - - Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ + * + * Copyright (c) 2002-2012 Apple Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ #ifndef X_HASH_H #define X_HASH_H 1 @@ -35,10 +36,10 @@ typedef struct x_hash_table_struct x_hash_table; -typedef int (x_compare_fun) (const void *a, const void *b); -typedef unsigned int (x_hash_fun) (const void *k); -typedef void (x_destroy_fun) (void *x); -typedef void (x_hash_foreach_fun) (void *k, void *v, void *data); +typedef int (x_compare_fun)(const void *a, const void *b); +typedef unsigned int (x_hash_fun)(const void *k); +typedef void (x_destroy_fun)(void *x); +typedef void (x_hash_foreach_fun)(void *k, void *v, void *data); /* for X_PFX and X_EXTERN */ #include "x-list.h" @@ -57,25 +58,27 @@ X_EXTERN void X_PFX(hash_table_remove) (x_hash_table * h, void *k); X_EXTERN void *X_PFX(hash_table_lookup) (x_hash_table * h, void *k, void **k_ret); X_EXTERN void X_PFX(hash_table_foreach) (x_hash_table * h, - x_hash_foreach_fun * fun, void *data); + x_hash_foreach_fun * fun, + void *data); /* Conversion between unsigned int (e.g. xp_resource_id) and void pointer */ /* Forward declarations */ -static __inline__ void *X_PFX(cvt_uint_to_vptr) (unsigned int val) - __attribute__ ((always_inline)); +static __inline__ void * +X_PFX(cvt_uint_to_vptr) (unsigned int val) __attribute__((always_inline)); static __inline__ unsigned int - X_PFX(cvt_vptr_to_uint) (void *val) __attribute__ ((always_inline)); +X_PFX(cvt_vptr_to_uint) (void * val) __attribute__((always_inline)); /* Implementations */ -static __inline__ void *X_PFX(cvt_uint_to_vptr) (unsigned int val) { - return (void *) ((unsigned long) (val)); +static __inline__ void * +X_PFX(cvt_uint_to_vptr) (unsigned int val) { + return (void *)((unsigned long)(val)); } static __inline__ unsigned int - X_PFX(cvt_vptr_to_uint) (void *val) { - size_t sv = (size_t) val; - unsigned int uv = (unsigned int) sv; +X_PFX(cvt_vptr_to_uint) (void * val) { + size_t sv = (size_t)val; + unsigned int uv = (unsigned int)sv; /* If this assert fails, chances are val actually is a pointer, or there's been memory corruption */ @@ -84,4 +87,4 @@ static __inline__ unsigned int return uv; } -#endif /* X_HASH_H */ +#endif /* X_HASH_H */ diff --git a/xorg-server/hw/xquartz/xpr/x-hook.c b/xorg-server/hw/xquartz/xpr/x-hook.c index fd34658e7..b5d8ab90e 100644 --- a/xorg-server/hw/xquartz/xpr/x-hook.c +++ b/xorg-server/hw/xquartz/xpr/x-hook.c @@ -1,31 +1,32 @@ /* x-hook.c - - Copyright (c) 2003 Apple Computer, Inc. All rights reserved. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ + * + * Copyright (c) 2002-2012 Apple Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -36,18 +37,18 @@ #include <assert.h> #include "os.h" -#define CELL_NEW(f,d) X_PFX (list_prepend) ((x_list *) (f), (d)) -#define CELL_FREE(c) X_PFX (list_free_1) (c) -#define CELL_FUN(c) ((x_hook_function *) ((c)->next)) -#define CELL_DATA(c) ((c)->data) +#define CELL_NEW(f, d) X_PFX(list_prepend) ((x_list *)(f), (d)) +#define CELL_FREE(c) X_PFX(list_free_1) (c) +#define CELL_FUN(c) ((x_hook_function *)((c)->next)) +#define CELL_DATA(c) ((c)->data) -X_EXTERN x_list *X_PFX(hook_add) (x_list * lst, x_hook_function * fun, - void *data) { +X_EXTERN x_list * +X_PFX(hook_add) (x_list * lst, x_hook_function * fun, void *data) { return X_PFX(list_prepend) (lst, CELL_NEW(fun, data)); } -X_EXTERN x_list *X_PFX(hook_remove) (x_list * lst, x_hook_function * fun, - void *data) { +X_EXTERN x_list * +X_PFX(hook_remove) (x_list * lst, x_hook_function * fun, void *data) { x_list *node, *cell; x_list *to_delete = NULL; @@ -68,7 +69,7 @@ X_EXTERN x_list *X_PFX(hook_remove) (x_list * lst, x_hook_function * fun, } X_EXTERN void - X_PFX(hook_run) (x_list * lst, void *arg) { +X_PFX(hook_run) (x_list * lst, void *arg) { x_list *node, *cell; x_hook_function **fun; void **data; @@ -92,7 +93,7 @@ X_EXTERN void } for (i = 0; i < length; i++) { - (*fun[i]) (arg, data[i]); + (*fun[i])(arg, data[i]); } free(fun); @@ -100,7 +101,7 @@ X_EXTERN void } X_EXTERN void - X_PFX(hook_free) (x_list * lst) { +X_PFX(hook_free) (x_list * lst) { x_list *node; for (node = lst; node != NULL; node = node->next) { diff --git a/xorg-server/hw/xquartz/xpr/x-hook.h b/xorg-server/hw/xquartz/xpr/x-hook.h index da3407f92..7ba8ac9f6 100644 --- a/xorg-server/hw/xquartz/xpr/x-hook.h +++ b/xorg-server/hw/xquartz/xpr/x-hook.h @@ -1,38 +1,39 @@ /* x-hook.h -- lists of function,data pairs to call. - - Copyright (c) 2003 Apple Computer, Inc. All rights reserved. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ + * + * Copyright (c) 2003-2012 Apple Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ #ifndef X_HOOK_H #define X_HOOK_H 1 #include "x-list.h" -typedef void x_hook_function(void *arg, void *data); +typedef void x_hook_function (void *arg, void *data); X_EXTERN x_list *X_PFX(hook_add) (x_list * lst, x_hook_function * fun, void *data); @@ -41,4 +42,4 @@ X_EXTERN x_list *X_PFX(hook_remove) (x_list * lst, x_hook_function * fun, X_EXTERN void X_PFX(hook_run) (x_list * lst, void *arg); X_EXTERN void X_PFX(hook_free) (x_list * lst); -#endif /* X_HOOK_H */ +#endif /* X_HOOK_H */ diff --git a/xorg-server/hw/xquartz/xpr/x-list.c b/xorg-server/hw/xquartz/xpr/x-list.c index 757ff4cb0..29543d4e0 100644 --- a/xorg-server/hw/xquartz/xpr/x-list.c +++ b/xorg-server/hw/xquartz/xpr/x-list.c @@ -1,31 +1,32 @@ /* x-list.c - - Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ + * + * Copyright (c) 2002-2012 Apple Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -50,14 +51,14 @@ static x_list *freelist; static pthread_mutex_t freelist_lock = PTHREAD_MUTEX_INITIALIZER; static inline void -list_free_1(x_list * node) +list_free_1(x_list *node) { node->next = freelist; freelist = node; } X_EXTERN void - X_PFX(list_free_1) (x_list * node) { +X_PFX(list_free_1) (x_list * node) { assert(node != NULL); pthread_mutex_lock(&freelist_lock); @@ -68,7 +69,7 @@ X_EXTERN void } X_EXTERN void - X_PFX(list_free) (x_list * lst) { +X_PFX(list_free) (x_list * lst) { x_list *next; pthread_mutex_lock(&freelist_lock); @@ -81,7 +82,8 @@ X_EXTERN void pthread_mutex_unlock(&freelist_lock); } -X_EXTERN x_list *X_PFX(list_prepend) (x_list * lst, void *data) { +X_EXTERN x_list * +X_PFX(list_prepend) (x_list * lst, void *data) { x_list *node; pthread_mutex_lock(&freelist_lock); @@ -111,7 +113,8 @@ X_EXTERN x_list *X_PFX(list_prepend) (x_list * lst, void *data) { return node; } -X_EXTERN x_list *X_PFX(list_append) (x_list * lst, void *data) { +X_EXTERN x_list * +X_PFX(list_append) (x_list * lst, void *data) { x_list *head = lst; if (lst == NULL) @@ -125,10 +128,12 @@ X_EXTERN x_list *X_PFX(list_append) (x_list * lst, void *data) { return head; } -X_EXTERN x_list *X_PFX(list_reverse) (x_list * lst) { +X_EXTERN x_list * +X_PFX(list_reverse) (x_list * lst) { x_list *head = NULL, *next; - while (lst != NULL) { + while (lst != NULL) + { next = lst->next; lst->next = head; head = lst; @@ -138,7 +143,8 @@ X_EXTERN x_list *X_PFX(list_reverse) (x_list * lst) { return head; } -X_EXTERN x_list *X_PFX(list_find) (x_list * lst, void *data) { +X_EXTERN x_list * +X_PFX(list_find) (x_list * lst, void *data) { for (; lst != NULL; lst = lst->next) { if (lst->data == data) return lst; @@ -147,19 +153,20 @@ X_EXTERN x_list *X_PFX(list_find) (x_list * lst, void *data) { return NULL; } -X_EXTERN x_list *X_PFX(list_nth) (x_list * lst, int n) { +X_EXTERN x_list * +X_PFX(list_nth) (x_list * lst, int n) { while (n-- > 0 && lst != NULL) lst = lst->next; return lst; } -X_EXTERN x_list *X_PFX(list_pop) (x_list * lst, void **data_ret) { +X_EXTERN x_list * +X_PFX(list_pop) (x_list * lst, void **data_ret) { void *data = NULL; if (lst != NULL) { x_list *tem = lst; - data = lst->data; lst = lst->next; X_PFX(list_free_1) (tem); @@ -171,22 +178,22 @@ X_EXTERN x_list *X_PFX(list_pop) (x_list * lst, void **data_ret) { return lst; } -X_EXTERN x_list *X_PFX(list_filter) (x_list * lst, - int (*pred) (void *item, void *data), - void *data) { +X_EXTERN x_list * +X_PFX(list_filter) (x_list * lst, + int (*pred)(void *item, void *data), void *data) { x_list *ret = NULL, *node; for (node = lst; node != NULL; node = node->next) { - if ((*pred) (node->data, data)) + if ((*pred)(node->data, data)) ret = X_PFX(list_prepend) (ret, node->data); } return X_PFX(list_reverse) (ret); } -X_EXTERN x_list *X_PFX(list_map) (x_list * lst, - void *(*fun) (void *item, void *data), - void *data) { +X_EXTERN x_list * +X_PFX(list_map) (x_list * lst, + void *(*fun)(void *item, void *data), void *data) { x_list *ret = NULL, *node; for (node = lst; node != NULL; node = node->next) { @@ -196,7 +203,8 @@ X_EXTERN x_list *X_PFX(list_map) (x_list * lst, return X_PFX(list_reverse) (ret); } -X_EXTERN x_list *X_PFX(list_copy) (x_list * lst) { +X_EXTERN x_list * +X_PFX(list_copy) (x_list * lst) { x_list *copy = NULL; for (; lst != NULL; lst = lst->next) { @@ -206,7 +214,8 @@ X_EXTERN x_list *X_PFX(list_copy) (x_list * lst) { return X_PFX(list_reverse) (copy); } -X_EXTERN x_list *X_PFX(list_remove) (x_list * lst, void *data) { +X_EXTERN x_list * +X_PFX(list_remove) (x_list * lst, void *data) { x_list **ptr, *node; for (ptr = &lst; *ptr != NULL;) { @@ -224,7 +233,7 @@ X_EXTERN x_list *X_PFX(list_remove) (x_list * lst, void *data) { } X_EXTERN unsigned int - X_PFX(list_length) (x_list * lst) { +X_PFX(list_length) (x_list * lst) { unsigned int n; n = 0; @@ -235,17 +244,17 @@ X_EXTERN unsigned int } X_EXTERN void - X_PFX(list_foreach) (x_list * lst, - void (*fun) (void *data, void *user_data), + void (*fun)(void *data, void *user_data), void *user_data) { for (; lst != NULL; lst = lst->next) { - (*fun) (lst->data, user_data); + (*fun)(lst->data, user_data); } } static x_list * -list_sort_1(x_list * lst, int length, int (*less) (const void *, const void *)) +list_sort_1(x_list *lst, int length, + int (*less)(const void *, const void *)) { x_list *mid, *ptr; x_list *out_head, *out; @@ -274,13 +283,14 @@ list_sort_1(x_list * lst, int length, int (*less) (const void *, const void *)) assert(lst != NULL && mid != NULL); - if ((*less) (mid->data, lst->data)) + if ((*less)(mid->data, lst->data)) out = out_head = mid, mid = mid->next; else out = out_head = lst, lst = lst->next; - while (lst != NULL && mid != NULL) { - if ((*less) (mid->data, lst->data)) + while (lst != NULL && mid != NULL) + { + if ((*less)(mid->data, lst->data)) out = out->next = mid, mid = mid->next; else out = out->next = lst, lst = lst->next; @@ -294,8 +304,8 @@ list_sort_1(x_list * lst, int length, int (*less) (const void *, const void *)) return out_head; } -X_EXTERN x_list *X_PFX(list_sort) (x_list * lst, - int (*less) (const void *, const void *)) { +X_EXTERN x_list * +X_PFX(list_sort) (x_list * lst, int (*less)(const void *, const void *)) { int length; length = X_PFX(list_length) (lst); diff --git a/xorg-server/hw/xquartz/xpr/x-list.h b/xorg-server/hw/xquartz/xpr/x-list.h index 04af024a2..28385fd99 100644 --- a/xorg-server/hw/xquartz/xpr/x-list.h +++ b/xorg-server/hw/xquartz/xpr/x-list.h @@ -1,31 +1,32 @@ /* x-list.h -- simple list type - - Copyright (c) 2002 Apple Computer, Inc. All rights reserved. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ + * + * Copyright (c) 2002-2012 Apple Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ #ifndef X_LIST_H #define X_LIST_H 1 @@ -40,38 +41,38 @@ struct x_list_struct { }; #ifndef X_PFX -# define X_PFX(x) x_ ## x +#define X_PFX(x) x_ ## x #endif #ifndef X_EXTERN -# define X_EXTERN __private_extern__ +#define X_EXTERN __private_extern__ #endif -X_EXTERN void X_PFX (list_free_1) (x_list *node); -X_EXTERN x_list *X_PFX (list_prepend) (x_list *lst, void *data); - -X_EXTERN x_list *X_PFX (list_append) (x_list *lst, void *data); -X_EXTERN x_list *X_PFX (list_remove) (x_list *lst, void *data); -X_EXTERN void X_PFX (list_free) (x_list *lst); -X_EXTERN x_list *X_PFX (list_pop) (x_list *lst, void **data_ret); - -X_EXTERN x_list *X_PFX (list_copy) (x_list *lst); -X_EXTERN x_list *X_PFX (list_reverse) (x_list *lst); -X_EXTERN x_list *X_PFX (list_find) (x_list *lst, void *data); -X_EXTERN x_list *X_PFX (list_nth) (x_list *lst, int n); -X_EXTERN x_list *X_PFX (list_filter) (x_list *src, - int (*pred) (void *item, void *data), - void *data); -X_EXTERN x_list *X_PFX (list_map) (x_list *src, - void *(*fun) (void *item, void *data), - void *data); - -X_EXTERN unsigned int X_PFX (list_length) (x_list *lst); -X_EXTERN void X_PFX (list_foreach) (x_list *lst, void (*fun) - (void *data, void *user_data), - void *user_data); - -X_EXTERN x_list *X_PFX (list_sort) (x_list *lst, int (*less) (const void *, - const void *)); +X_EXTERN void X_PFX(list_free_1) (x_list * node); +X_EXTERN x_list *X_PFX(list_prepend) (x_list * lst, void *data); + +X_EXTERN x_list *X_PFX(list_append) (x_list * lst, void *data); +X_EXTERN x_list *X_PFX(list_remove) (x_list * lst, void *data); +X_EXTERN void X_PFX(list_free) (x_list * lst); +X_EXTERN x_list *X_PFX(list_pop) (x_list * lst, void **data_ret); + +X_EXTERN x_list *X_PFX(list_copy) (x_list * lst); +X_EXTERN x_list *X_PFX(list_reverse) (x_list * lst); +X_EXTERN x_list *X_PFX(list_find) (x_list * lst, void *data); +X_EXTERN x_list *X_PFX(list_nth) (x_list * lst, int n); +X_EXTERN x_list *X_PFX(list_filter) (x_list * src, + int (*pred)(void *item, void *data), + void *data); +X_EXTERN x_list *X_PFX(list_map) (x_list * src, + void *(*fun)(void *item, void *data), + void *data); + +X_EXTERN unsigned int X_PFX(list_length) (x_list * lst); +X_EXTERN void X_PFX(list_foreach) (x_list * lst, void (*fun) + (void *data, void *user_data), + void *user_data); + +X_EXTERN x_list *X_PFX(list_sort) (x_list * lst, + int (*less)(const void *, const void *)); #endif /* X_LIST_H */ diff --git a/xorg-server/hw/xquartz/xpr/xpr.h b/xorg-server/hw/xquartz/xpr/xpr.h index 0b138ddd7..fc614ebc3 100644 --- a/xorg-server/hw/xquartz/xpr/xpr.h +++ b/xorg-server/hw/xquartz/xpr/xpr.h @@ -2,6 +2,7 @@ * Xplugin rootless implementation * * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * Copyright (c) 2002-2012 Apple Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -36,21 +37,31 @@ #include "darwin.h" #undef DEBUG_LOG -#define DEBUG_LOG(msg, args...) ASL_LOG(ASL_LEVEL_DEBUG, "xpr", msg, ##args) +#define DEBUG_LOG(msg, args ...) ASL_LOG(ASL_LEVEL_DEBUG, "xpr", msg, ## args) -Bool QuartzModeBundleInit(void); +Bool +QuartzModeBundleInit(void); -void AppleDRIExtensionInit(void); -void xprAppleWMInit(void); -Bool xprInit(ScreenPtr pScreen); -Bool xprIsX11Window(int windowNumber); -WindowPtr xprGetXWindow(xp_window_id wid); +void +AppleDRIExtensionInit(void); +void +xprAppleWMInit(void); +Bool +xprInit(ScreenPtr pScreen); +Bool +xprIsX11Window(int windowNumber); +WindowPtr +xprGetXWindow(xp_window_id wid); -void xprHideWindows(Bool hide); +void +xprHideWindows(Bool hide); -Bool QuartzInitCursor(ScreenPtr pScreen); -void QuartzSuspendXCursor(ScreenPtr pScreen); -void QuartzResumeXCursor(ScreenPtr pScreen); +Bool +QuartzInitCursor(ScreenPtr pScreen); +void +QuartzSuspendXCursor(ScreenPtr pScreen); +void +QuartzResumeXCursor(ScreenPtr pScreen); /* If we are rooted, we need the root window and desktop levels to be below * the menubar (24) but above native windows. Normal window level is 0. @@ -59,11 +70,11 @@ void QuartzResumeXCursor(ScreenPtr pScreen); */ #include <X11/extensions/applewmconst.h> -static const int normal_window_levels[AppleWMNumWindowLevels+1] = { -0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29, +static const int normal_window_levels[AppleWMNumWindowLevels + 1] = { + 0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29, }; -static const int rooted_window_levels[AppleWMNumWindowLevels+1] = { -20, 21, 22, 23, 19, 18, +static const int rooted_window_levels[AppleWMNumWindowLevels + 1] = { + 20, 21, 22, 23, 19, 18, }; #endif /* XPR_H */ diff --git a/xorg-server/hw/xquartz/xpr/xprAppleWM.c b/xorg-server/hw/xquartz/xpr/xprAppleWM.c index 77b9fa3e8..8c4f5efb8 100644 --- a/xorg-server/hw/xquartz/xpr/xprAppleWM.c +++ b/xorg-server/hw/xquartz/xpr/xprAppleWM.c @@ -1,7 +1,7 @@ /* * Xplugin rootless implementation functions for AppleWM extension * - * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2002-2012 Apple Computer, Inc. All rights reserved. * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -107,7 +107,8 @@ xprAttachTransient(WindowPtr pWinChild, WindowPtr pWinParent) RootlessStopDrawing(pWinChild, FALSE); - if (xp_configure_window(child_wid, XP_ATTACH_TRANSIENT, &wc) != Success) { + if (xp_configure_window(child_wid, XP_ATTACH_TRANSIENT, + &wc) != Success) { return BadValue; } @@ -119,9 +120,10 @@ static int xprFrameDraw(WindowPtr pWin, xp_frame_class class, xp_frame_attr attr, - const BoxRec * outer, - const BoxRec * inner, - unsigned int title_len, const unsigned char *title_bytes) + const BoxRec *outer, + const BoxRec *inner, + unsigned int title_len, + const unsigned char *title_bytes) { xp_window_id wid; diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c index b0afa8c0e..0392a4639 100644 --- a/xorg-server/hw/xquartz/xpr/xprCursor.c +++ b/xorg-server/hw/xquartz/xpr/xprCursor.c @@ -57,11 +57,11 @@ typedef struct { } QuartzCursorScreenRec, *QuartzCursorScreenPtr; static DevPrivateKeyRec darwinCursorScreenKeyRec; - #define darwinCursorScreenKey (&darwinCursorScreenKeyRec) #define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \ - dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey)) + dixLookupPrivate(&pScreen->devPrivates, \ + darwinCursorScreenKey)) static Bool load_cursor(CursorPtr src, int screen) @@ -89,11 +89,10 @@ load_cursor(CursorPtr src, int screen) if (src->bits->argb != NULL) { #if BITMAP_BIT_ORDER == MSBFirst rowbytes = src->bits->width * sizeof(CARD32); - data = (uint32_t *) src->bits->argb; + data = (uint32_t *)src->bits->argb; #else - const uint32_t *be_data = (uint32_t *) src->bits->argb; + const uint32_t *be_data = (uint32_t *)src->bits->argb; unsigned i; - rowbytes = src->bits->width * sizeof(CARD32); data = malloc(rowbytes * src->bits->height); free_data = TRUE; @@ -134,13 +133,15 @@ load_cursor(CursorPtr src, int screen) mrow = src->bits->mask; drow = data; - while (ycount-- > 0) { + while (ycount-- > 0) + { xcount = bits_to_bytes(src->bits->width); sptr = srow; mptr = mrow; dptr = drow; - while (xcount-- > 0) { + while (xcount-- > 0) + { uint8_t s, m; int i; @@ -167,7 +168,7 @@ load_cursor(CursorPtr src, int screen) srow += BitmapBytePad(src->bits->width); mrow += BitmapBytePad(src->bits->width); - drow = (uint32_t *) ((char *) drow + rowbytes); + drow = (uint32_t *)((char *)drow + rowbytes); } } else { @@ -182,12 +183,12 @@ load_cursor(CursorPtr src, int screen) } /* -=========================================================================== + =========================================================================== - Pointer sprite functions + Pointer sprite functions -=========================================================================== -*/ + =========================================================================== + */ /* * QuartzRealizeCursor @@ -219,7 +220,8 @@ QuartzUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) * Set the cursor sprite and position. */ static void -QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, +QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, + int x, int y) { QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); @@ -249,16 +251,15 @@ QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, */ static void QuartzMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ -} +{} /* -=========================================================================== + =========================================================================== - Pointer screen functions + Pointer screen functions -=========================================================================== -*/ + =========================================================================== + */ /* * QuartzCursorOffScreen @@ -309,12 +310,12 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = { }; /* -=========================================================================== + =========================================================================== - Other screen functions + Other screen functions -=========================================================================== -*/ + =========================================================================== + */ /* * QuartzCursorQueryBestSize @@ -332,7 +333,7 @@ QuartzCursorQueryBestSize(int class, unsigned short *width, *height = 32; } else { - (*ScreenPriv->QueryBestSize) (class, width, height, pScreen); + (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); } } @@ -383,8 +384,7 @@ QuartzInitCursor(ScreenPtr pScreen) */ void QuartzSuspendXCursor(ScreenPtr pScreen) -{ -} +{} /* * QuartzResumeXCursor diff --git a/xorg-server/hw/xquartz/xpr/xprEvent.c b/xorg-server/hw/xquartz/xpr/xprEvent.c index 7f4b077c3..106a91931 100644 --- a/xorg-server/hw/xquartz/xpr/xprEvent.c +++ b/xorg-server/hw/xquartz/xpr/xprEvent.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 Apple Inc. +/* Copyright (c) 2008-2012 Apple Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files @@ -56,12 +56,13 @@ #include "xprEvent.h" Bool -QuartzModeEventHandler(int screenNum, XQuartzEvent * e, DeviceIntPtr dev) +QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) { switch (e->subtype) { case kXquartzWindowState: DEBUG_LOG("kXquartzWindowState\n"); - RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]), e->data[1]); + RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]), + e->data[1]); return TRUE; case kXquartzWindowMoved: @@ -73,6 +74,7 @@ QuartzModeEventHandler(int screenNum, XQuartzEvent * e, DeviceIntPtr dev) DEBUG_LOG("kXquartzBringAllToFront\n"); RootlessOrderAllWindows(e->data[0]); return TRUE; + default: return FALSE; } diff --git a/xorg-server/hw/xquartz/xpr/xprEvent.h b/xorg-server/hw/xquartz/xpr/xprEvent.h index ebfa36bd8..4f9cc6118 100644 --- a/xorg-server/hw/xquartz/xpr/xprEvent.h +++ b/xorg-server/hw/xquartz/xpr/xprEvent.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 Apple Inc. +/* Copyright (c) 2008-2012 Apple Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files @@ -29,6 +29,7 @@ #ifndef __XPR_EVENT_H__ #define __XPR_EVENT_H__ -Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev); +Bool +QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev); #endif diff --git a/xorg-server/hw/xquartz/xpr/xprFrame.c b/xorg-server/hw/xquartz/xpr/xprFrame.c index ed81c4b48..4c7aac42b 100644 --- a/xorg-server/hw/xquartz/xpr/xprFrame.c +++ b/xorg-server/hw/xquartz/xpr/xprFrame.c @@ -1,7 +1,7 @@ /* * Xplugin rootless implementation frame functions * - * Copyright (c) 2002-2011 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2002-2012 Apple Computer, Inc. All rights reserved. * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -49,21 +49,21 @@ #include <pthread.h> #endif -#define DEFINE_ATOM_HELPER(func,atom_name) \ -static Atom func (void) { \ - static int generation; \ - static Atom atom; \ - if (generation != serverGeneration) { \ - generation = serverGeneration; \ - atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \ - } \ - return atom; \ -} +#define DEFINE_ATOM_HELPER(func, atom_name) \ + static Atom func(void) { \ + static int generation; \ + static Atom atom; \ + if (generation != serverGeneration) { \ + generation = serverGeneration; \ + atom = MakeAtom(atom_name, strlen(atom_name), TRUE); \ + } \ + return atom; \ + } DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID") /* Maps xp_window_id -> RootlessWindowRec */ -static x_hash_table *window_hash; +static x_hash_table * window_hash; /* Need to guard window_hash since xprIsX11Window can be called from any thread. */ #ifdef HAVE_LIBDISPATCH @@ -74,15 +74,16 @@ static pthread_rwlock_t window_hash_rwlock; /* Prototypes for static functions */ static Bool -xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, - int newX, int newY, RegionPtr pShape); +xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, + int newY, + RegionPtr pShape); static void xprDestroyFrame(RootlessFrameID wid); static void xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); static void -xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, - int newX, int newY, unsigned int newW, unsigned int newH, +xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY, + unsigned int newW, unsigned int newH, unsigned int gravity); static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid); @@ -97,8 +98,9 @@ xprStopDrawing(RootlessFrameID wid, Bool flush); static void xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage); static void -xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec * rects, - int shift_x, int shift_y); +xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects, + int shift_x, + int shift_y); static void xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin); static Bool @@ -108,12 +110,13 @@ xprHideWindow(RootlessFrameID wid); static void xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen); static void -xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec * dstRects, - int dx, int dy); +xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, + int dx, + int dy); static inline xp_error xprConfigureWindow(xp_window_id id, unsigned int mask, - const xp_window_changes * values) + const xp_window_changes *values) { return xp_configure_window(id, mask, values); } @@ -131,17 +134,18 @@ xprSetNativeProperty(RootlessWindowPtr pFrame) data = native_id; dixChangeWindowProperty(serverClient, pFrame->win, - xa_native_window_id(), XA_INTEGER, 32, - PropModeReplace, 1, &data, TRUE); + xa_native_window_id(), + XA_INTEGER, 32, PropModeReplace, 1, &data, + TRUE); } } static xp_error xprColormapCallback(void *data, int first_color, int n_colors, - uint32_t * colors) + uint32_t *colors) { - return (RootlessResolveColormap(data, first_color, n_colors, colors) ? - XP_Success : XP_BadMatch); + return (RootlessResolveColormap(data, first_color, n_colors, + colors) ? XP_Success : XP_BadMatch); } /* @@ -195,7 +199,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, wc.window_level = rooted_window_levels[pFrame->level]; mask |= XP_WINDOW_LEVEL; - err = xp_create_window(mask, &wc, (xp_window_id *) & pFrame->wid); + err = xp_create_window(mask, &wc, (xp_window_id *)&pFrame->wid); if (err != Success) { return FALSE; @@ -203,8 +207,8 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, #ifdef HAVE_LIBDISPATCH dispatch_async(window_hash_serial_q, ^ { - x_hash_table_insert(window_hash, pFrame->wid, pFrame);} - ); + x_hash_table_insert(window_hash, pFrame->wid, pFrame); + }); #else pthread_rwlock_wrlock(&window_hash_rwlock); x_hash_table_insert(window_hash, pFrame->wid, pFrame); @@ -226,7 +230,8 @@ xprDestroyFrame(RootlessFrameID wid) #ifdef HAVE_LIBDISPATCH dispatch_async(window_hash_serial_q, ^ { - x_hash_table_remove(window_hash, wid);}); + x_hash_table_remove(window_hash, wid); + }); #else pthread_rwlock_wrlock(&window_hash_rwlock); x_hash_table_remove(window_hash, wid); @@ -236,7 +241,8 @@ xprDestroyFrame(RootlessFrameID wid) err = xp_destroy_window(x_cvt_vptr_to_uint(wid)); if (err != Success) FatalError("Could not destroy window %d (%d).", - (int) x_cvt_vptr_to_uint(wid), (int) err); + (int)x_cvt_vptr_to_uint( + wid), (int)err); } /* @@ -283,11 +289,10 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) { xp_window_changes wc; unsigned int mask = XP_STACKING; - #ifdef HAVE_LIBDISPATCH __block #endif - RootlessWindowRec * winRec; + RootlessWindowRec * winRec; /* Stack frame below nextWid it if it exists, or raise frame above everything otherwise. */ @@ -303,8 +308,8 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) #ifdef HAVE_LIBDISPATCH dispatch_sync(window_hash_serial_q, ^ { - winRec = x_hash_table_lookup(window_hash, wid, NULL);} - ); + winRec = x_hash_table_lookup(window_hash, wid, NULL); + }); #else pthread_rwlock_rdlock(&window_hash_rwlock); winRec = x_hash_table_lookup(window_hash, wid, NULL); @@ -371,12 +376,12 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) unsigned int rowbytes[2]; xp_error err; - err = - xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes, - NULL); + err = xp_lock_window(x_cvt_vptr_to_uint( + wid), NULL, NULL, data, rowbytes, NULL); if (err != Success) FatalError("Could not lock window %d for drawing (%d).", - (int) x_cvt_vptr_to_uint(wid), (int) err); + (int)x_cvt_vptr_to_uint( + wid), (int)err); *pixelData = data[0]; *bytesPerRow = rowbytes[0]; @@ -396,7 +401,8 @@ xprStopDrawing(RootlessFrameID wid, Bool flush) */ if (err != Success) ErrorF("Could not unlock window %d after drawing (%d).", - (int) x_cvt_vptr_to_uint(wid), (int) err); + (int)x_cvt_vptr_to_uint( + wid), (int)err); } /* @@ -412,7 +418,7 @@ xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage) * Mark damaged rectangles as requiring redisplay to screen. */ static void -xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec * rects, +xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects, int shift_x, int shift_y) { xp_mark_window(x_cvt_vptr_to_uint(wid), nrects, rects, shift_x, shift_y); @@ -446,7 +452,7 @@ xprDoReorderWindow(RootlessWindowPtr pFrame) * Used to accelerate scrolling. */ static void -xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec * dstRects, +xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, int dx, int dy) { xp_copy_window(x_cvt_vptr_to_uint(wid), x_cvt_vptr_to_uint(wid), @@ -487,8 +493,8 @@ xprInit(ScreenPtr pScreen) assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL))); #ifdef HAVE_LIBDISPATCH assert((window_hash_serial_q = - dispatch_queue_create(BUNDLE_ID_PREFIX ".X11.xpr_window_hash", - NULL))); + dispatch_queue_create(BUNDLE_ID_PREFIX ".X11.xpr_window_hash", + NULL))); #else assert(0 == pthread_rwlock_init(&window_hash_rwlock, NULL)); #endif @@ -505,14 +511,13 @@ xprGetXWindow(xp_window_id wid) { #ifdef HAVE_LIBDISPATCH RootlessWindowRec *winRec __block; - dispatch_sync(window_hash_serial_q, ^ { - winRec = - x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), - NULL);}); + winRec = + x_hash_table_lookup(window_hash, + x_cvt_uint_to_vptr(wid), NULL); + }); #else RootlessWindowRec *winRec; - pthread_rwlock_rdlock(&window_hash_rwlock); winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL); pthread_rwlock_unlock(&window_hash_rwlock); @@ -553,7 +558,6 @@ xprHideWindows(Bool hide) for (screen = 0; screen < screenInfo.numScreens; screen++) { RootlessFrameID prevWid = NULL; - pRoot = screenInfo.screens[screen]->root; for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) { @@ -583,13 +587,13 @@ xprHideWindows(Bool hide) } // XXX: identical to x_cvt_vptr_to_uint ? -#define MAKE_WINDOW_ID(x) ((xp_window_id)((size_t)(x))) +#define MAKE_WINDOW_ID(x) ((xp_window_id)((size_t)(x))) Bool no_configure_window; static inline int configure_window(xp_window_id id, unsigned int mask, - const xp_window_changes * values) + const xp_window_changes *values) { if (!no_configure_window) return xp_configure_window(id, mask, values); @@ -598,12 +602,11 @@ configure_window(xp_window_id id, unsigned int mask, } static - void +void xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen) { /* This is how we tell xp that the colormap may have changed. */ xp_window_changes wc; - wc.colormap = xprColormapCallback; wc.colormap_data = pScreen; @@ -611,11 +614,10 @@ xprUpdateColormap(RootlessFrameID wid, ScreenPtr pScreen) } static - void +void xprHideWindow(RootlessFrameID wid) { xp_window_changes wc; - wc.stack_mode = XP_UNMAPPED; wc.sibling = 0; configure_window(MAKE_WINDOW_ID(wid), XP_STACKING, &wc); diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c index 185369e6b..efe2aa882 100644 --- a/xorg-server/hw/xquartz/xpr/xprScreen.c +++ b/xorg-server/hw/xquartz/xpr/xprScreen.c @@ -1,7 +1,7 @@ /* * Xplugin rootless implementation screen functions * - * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2002-2012 Apple Computer, Inc. All Rights Reserved. * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -55,7 +55,7 @@ #endif /* 10.4's deferred update makes X slower.. have to live with the tearing - for now.. */ + * for now.. */ #define XP_NO_DEFERRED_UPDATES 8 // Name of GLX bundle for native OpenGL @@ -81,9 +81,10 @@ eventHandler(unsigned int type, const void *arg, const xp_window_state_event *ws_arg = arg; DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", - ws_arg->id, ws_arg->state); - DarwinSendDDXEvent(kXquartzWindowState, 2, ws_arg->id, - ws_arg->state); + ws_arg->id, + ws_arg->state); + DarwinSendDDXEvent(kXquartzWindowState, 2, + ws_arg->id, ws_arg->state); } else { DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n"); @@ -93,14 +94,14 @@ eventHandler(unsigned int type, const void *arg, case XP_EVENT_WINDOW_MOVED: DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n"); if (arg_size == sizeof(xp_window_id)) { - xp_window_id id = *(xp_window_id *) arg; - + xp_window_id id = *(xp_window_id *)arg; DarwinSendDDXEvent(kXquartzWindowMoved, 1, id); } break; case XP_EVENT_SURFACE_DESTROYED: DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n"); + case XP_EVENT_SURFACE_CHANGED: DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n"); if (arg_size == sizeof(xp_surface_id)) { @@ -111,18 +112,19 @@ eventHandler(unsigned int type, const void *arg, else kind = AppleDRISurfaceNotifyChanged; - DRISurfaceNotify(*(xp_surface_id *) arg, kind); + DRISurfaceNotify(*(xp_surface_id *)arg, kind); } break; + #ifdef XP_EVENT_SPACE_CHANGED - case XP_EVENT_SPACE_CHANGED: + case XP_EVENT_SPACE_CHANGED: DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n"); if (arg_size == sizeof(uint32_t)) { - uint32_t space_id = *(uint32_t *) arg; - + uint32_t space_id = *(uint32_t *)arg; DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id); } break; + #endif default: ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type); @@ -159,18 +161,19 @@ displayScreenBounds(CGDirectDisplayID id) frame = CGDisplayBounds(id); DEBUG_LOG(" %dx%d @ (%d,%d).\n", - (int) frame.size.width, (int) frame.size.height, - (int) frame.origin.x, (int) frame.origin.y); + (int)frame.size.width, (int)frame.size.height, + (int)frame.origin.x, (int)frame.origin.y); /* Remove menubar to help standard X11 window managers. */ - if (XQuartzIsRootless && frame.origin.x == 0 && frame.origin.y == 0) { + if (XQuartzIsRootless && + frame.origin.x == 0 && frame.origin.y == 0) { frame.origin.y += aquaMenuBarHeight; frame.size.height -= aquaMenuBarHeight; } DEBUG_LOG(" %dx%d @ (%d,%d).\n", - (int) frame.size.width, (int) frame.size.height, - (int) frame.origin.x, (int) frame.origin.y); + (int)frame.size.width, (int)frame.size.height, + (int)frame.origin.x, (int)frame.origin.y); return frame; } @@ -190,11 +193,11 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, // Find all the CoreGraphics displays CGGetActiveDisplayList(0, NULL, &displayCount); - DEBUG_LOG("displayCount: %d\n", (int) displayCount); + DEBUG_LOG("displayCount: %d\n", (int)displayCount); if (!displayCount) { - ErrorF - ("CoreGraphics has reported no connected displays. Creating a stub 800x600 display.\n"); + ErrorF( + "CoreGraphics has reported no connected displays. Creating a stub 800x600 display.\n"); *x = *y = 0; *width = 800; *height = 600; @@ -219,7 +222,6 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, /* Get the union of all screens */ for (i = 0; i < displayCount; i++) { CGDirectDisplayID dpy = displayList[i]; - frame = displayScreenBounds(dpy); unionRect = CGRectUnion(unionRect, frame); } @@ -242,7 +244,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, frame.origin.y -= unionRect.origin.y; DEBUG_LOG(" placed at X11 coordinate (%d,%d).\n", - (int) frame.origin.x, (int) frame.origin.y); + (int)frame.origin.x, (int)frame.origin.y); PseudoramiXAddScreen(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); @@ -276,12 +278,14 @@ xprDisplayInit(void) FatalError("Could not initialize the Xplugin library."); xp_select_events(XP_EVENT_DISPLAY_CHANGED - | XP_EVENT_WINDOW_STATE_CHANGED | XP_EVENT_WINDOW_MOVED + | XP_EVENT_WINDOW_STATE_CHANGED + | XP_EVENT_WINDOW_MOVED #ifdef XP_EVENT_SPACE_CHANGED | XP_EVENT_SPACE_CHANGED #endif | XP_EVENT_SURFACE_CHANGED - | XP_EVENT_SURFACE_DESTROYED, eventHandler, NULL); + | XP_EVENT_SURFACE_DESTROYED, + eventHandler, NULL); AppleDRIExtensionInit(); xprAppleWMInit(); @@ -305,9 +309,8 @@ xprAddScreen(int index, ScreenPtr pScreen) if (depth == -1) { #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - depth = - CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * - CGDisplayBitsPerSample(kCGDirectMainDisplay); + depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * + CGDisplayBitsPerSample(kCGDirectMainDisplay); #else CGDisplayModeRef modeRef; CFStringRef encStrRef; @@ -321,19 +324,19 @@ xprAddScreen(int index, ScreenPtr pScreen) if (!encStrRef) goto have_depth; - if (CFStringCompare - (encStrRef, CFSTR(IO32BitDirectPixels), - kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + if (CFStringCompare(encStrRef, CFSTR(IO32BitDirectPixels), + kCFCompareCaseInsensitive) == + kCFCompareEqualTo) { depth = 24; } - else if (CFStringCompare - (encStrRef, CFSTR(IO16BitDirectPixels), - kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + else if (CFStringCompare(encStrRef, CFSTR(IO16BitDirectPixels), + kCFCompareCaseInsensitive) == + kCFCompareEqualTo) { depth = 15; } - else if (CFStringCompare - (encStrRef, CFSTR(IO8BitIndexedPixels), - kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + else if (CFStringCompare(encStrRef, CFSTR(IO8BitIndexedPixels), + kCFCompareCaseInsensitive) == + kCFCompareEqualTo) { depth = 8; } @@ -342,10 +345,10 @@ xprAddScreen(int index, ScreenPtr pScreen) } #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - have_depth: +have_depth: #endif switch (depth) { - case 8: // pseudo-working + case 8: // pseudo-working dfb->visuals = PseudoColorMask; dfb->preferredCVC = PseudoColor; dfb->depth = 8; @@ -355,8 +358,9 @@ xprAddScreen(int index, ScreenPtr pScreen) dfb->greenMask = 0; dfb->blueMask = 0; break; + case 15: - dfb->visuals = TrueColorMask; //LARGE_VISUALS; + dfb->visuals = TrueColorMask; //LARGE_VISUALS; dfb->preferredCVC = TrueColor; dfb->depth = 15; dfb->bitsPerRGB = 5; @@ -365,13 +369,14 @@ xprAddScreen(int index, ScreenPtr pScreen) dfb->greenMask = GM_ARGB(0, 5, 5, 5); dfb->blueMask = BM_ARGB(0, 5, 5, 5); break; -// case 24: + + // case 24: default: if (depth != 24) - ErrorF - ("Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d)\n", - depth, darwinDesiredDepth); - dfb->visuals = TrueColorMask; //LARGE_VISUALS; + ErrorF( + "Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d)\n", + depth, darwinDesiredDepth); + dfb->visuals = TrueColorMask; //LARGE_VISUALS; dfb->preferredCVC = TrueColor; dfb->depth = 24; dfb->bitsPerRGB = 8; |