diff options
author | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
commit | 76bcc36ed305418a3ddc5752d287ede894243e1b (patch) | |
tree | bacb320c825768471ce56f058f17ce863d592376 /xorg-server/Xext/xres.c | |
parent | 7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff) | |
parent | 0f834b91a4768673833ab4917e87d86c237bb1a6 (diff) | |
download | vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2 vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
xorg-server/Xext/shm.c
xorg-server/Xext/syncsrv.h
xorg-server/Xext/xvmain.c
xorg-server/Xi/exevents.c
xorg-server/Xi/opendev.c
xorg-server/composite/compalloc.c
xorg-server/composite/compoverlay.c
xorg-server/dix/colormap.c
xorg-server/dix/devices.c
xorg-server/dix/dispatch.c
xorg-server/dix/dixfonts.c
xorg-server/dix/eventconvert.c
xorg-server/dix/events.c
xorg-server/dix/gc.c
xorg-server/dix/getevents.c
xorg-server/dix/main.c
xorg-server/dix/privates.c
xorg-server/dix/registry.c
xorg-server/dix/resource.c
xorg-server/exa/exa_accel.c
xorg-server/exa/exa_migration_classic.c
xorg-server/exa/exa_unaccel.c
xorg-server/fb/fb.h
xorg-server/fb/fbcopy.c
xorg-server/fb/fbpixmap.c
xorg-server/glx/dispatch.h
xorg-server/glx/glapi.h
xorg-server/glx/glapi_gentable.c
xorg-server/glx/glapitable.h
xorg-server/glx/glprocs.h
xorg-server/glx/glxcmds.c
xorg-server/glx/glxcmdsswap.c
xorg-server/glx/glxdricommon.c
xorg-server/glx/glxdriswrast.c
xorg-server/glx/glxext.c
xorg-server/glx/indirect_dispatch.c
xorg-server/glx/indirect_dispatch.h
xorg-server/glx/indirect_dispatch_swap.c
xorg-server/glx/indirect_size.h
xorg-server/glx/indirect_size_get.h
xorg-server/glx/indirect_table.c
xorg-server/glx/indirect_util.c
xorg-server/glx/rensize.c
xorg-server/glx/single2swap.c
xorg-server/glx/singlepix.c
xorg-server/glx/singlepixswap.c
xorg-server/glx/singlesize.c
xorg-server/hw/dmx/dmxinit.c
xorg-server/hw/kdrive/ephyr/ephyr.c
xorg-server/hw/kdrive/ephyr/hostx.c
xorg-server/hw/kdrive/ephyr/hostx.h
xorg-server/hw/kdrive/src/kinput.c
xorg-server/hw/xfree86/common/compiler.h
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/glwrap.c
xorg-server/hw/xwin/glx/indirect.c
xorg-server/hw/xwin/glx/wgl_ext_api.h
xorg-server/hw/xwin/glx/winpriv.c
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winallpriv.c
xorg-server/hw/xwin/winauth.c
xorg-server/hw/xwin/winclipboard.h
xorg-server/hw/xwin/winclipboardinit.c
xorg-server/hw/xwin/winclipboardthread.c
xorg-server/hw/xwin/winclipboardunicode.c
xorg-server/hw/xwin/winclipboardwndproc.c
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/winclipboardxevents.c
xorg-server/hw/xwin/wincmap.c
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/wincursor.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winengine.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/wingc.c
xorg-server/hw/xwin/wingetsp.c
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winkeybd.h
xorg-server/hw/xwin/winlayouts.h
xorg-server/hw/xwin/winmisc.c
xorg-server/hw/xwin/winmonitors.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsg.c
xorg-server/hw/xwin/winmsg.h
xorg-server/hw/xwin/winmultiwindowclass.c
xorg-server/hw/xwin/winmultiwindowicons.c
xorg-server/hw/xwin/winmultiwindowshape.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winnativegdi.c
xorg-server/hw/xwin/winpfbdd.c
xorg-server/hw/xwin/winpixmap.c
xorg-server/hw/xwin/winpolyline.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winregistry.c
xorg-server/hw/xwin/winscrinit.c
xorg-server/hw/xwin/winsetsp.c
xorg-server/hw/xwin/winshaddd.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/hw/xwin/winwin32rootlesswindow.c
xorg-server/hw/xwin/winwin32rootlesswndproc.c
xorg-server/hw/xwin/winwindow.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/hw/xwin/winwndproc.c
xorg-server/include/callback.h
xorg-server/include/dixstruct.h
xorg-server/include/misc.h
xorg-server/include/os.h
xorg-server/include/scrnintstr.h
xorg-server/mi/micmap.c
xorg-server/mi/miinitext.c
xorg-server/mi/mioverlay.c
xorg-server/mi/misprite.c
xorg-server/mi/mivaltree.c
xorg-server/mi/miwindow.c
xorg-server/miext/damage/damage.c
xorg-server/miext/rootless/rootlessGC.c
xorg-server/miext/rootless/rootlessWindow.c
xorg-server/os/WaitFor.c
xorg-server/os/access.c
xorg-server/os/connection.c
xorg-server/os/io.c
xorg-server/os/log.c
xorg-server/os/osinit.c
xorg-server/os/utils.c
xorg-server/os/xdmcp.c
xorg-server/os/xprintf.c
xorg-server/os/xstrans.c
xorg-server/render/mipict.c
xorg-server/xkb/xkbActions.c
xorg-server/xkb/xkbInit.c
xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/Xext/xres.c')
-rw-r--r-- | xorg-server/Xext/xres.c | 184 |
1 files changed, 94 insertions, 90 deletions
diff --git a/xorg-server/Xext/xres.c b/xorg-server/Xext/xres.c index 232fbab5b..9d89b6550 100644 --- a/xorg-server/Xext/xres.c +++ b/xorg-server/Xext/xres.c @@ -24,30 +24,30 @@ #include "protocol-versions.h" static int -ProcXResQueryVersion (ClientPtr client) +ProcXResQueryVersion(ClientPtr client) { REQUEST(xXResQueryVersionReq); xXResQueryVersionReply rep; - REQUEST_SIZE_MATCH (xXResQueryVersionReq); + REQUEST_SIZE_MATCH(xXResQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.server_major = SERVER_XRES_MAJOR_VERSION; rep.server_minor = SERVER_XRES_MINOR_VERSION; - if (client->swapped) { + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.server_major); swaps(&rep.server_minor); } - WriteToClient(client, sizeof (xXResQueryVersionReply), (char *)&rep); + WriteToClient(client, sizeof(xXResQueryVersionReply), (char *) &rep); return Success; } static int -ProcXResQueryClients (ClientPtr client) +ProcXResQueryClients(ClientPtr client) { /* REQUEST(xXResQueryClientsReq); */ xXResQueryClientsReply rep; @@ -59,11 +59,11 @@ ProcXResQueryClients (ClientPtr client) current_clients = malloc(currentMaxClients * sizeof(int)); num_clients = 0; - for(i = 0; i < currentMaxClients; i++) { - if(clients[i]) { - current_clients[num_clients] = i; - num_clients++; - } + for (i = 0; i < currentMaxClients; i++) { + if (clients[i]) { + current_clients[num_clients] = i; + num_clients++; + } } rep.type = X_Reply; @@ -74,21 +74,21 @@ ProcXResQueryClients (ClientPtr client) swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.num_clients); - } - WriteToClient (client, sizeof (xXResQueryClientsReply), (char *) &rep); + } + WriteToClient(client, sizeof(xXResQueryClientsReply), (char *) &rep); - if(num_clients) { + if (num_clients) { xXResClient scratch; - for(i = 0; i < num_clients; i++) { + for (i = 0; i < num_clients; i++) { scratch.resource_base = clients[current_clients[i]]->clientAsMask; scratch.resource_mask = RESOURCE_ID_MASK; - - if(client->swapped) { + + if (client->swapped) { swapl(&scratch.resource_base); swapl(&scratch.resource_mask); } - WriteToClient (client, sz_xXResClient, (char *) &scratch); + WriteToClient(client, sz_xXResClient, (char *) &scratch); } } @@ -97,17 +97,16 @@ ProcXResQueryClients (ClientPtr client) return Success; } - static void -ResFindAllRes (pointer value, XID id, RESTYPE type, pointer cdata) +ResFindAllRes(pointer value, XID id, RESTYPE type, pointer cdata) { - int *counts = (int *)cdata; + int *counts = (int *) cdata; counts[(type & TypeMask) - 1]++; } static int -ProcXResQueryClientResources (ClientPtr client) +ProcXResQueryClientResources(ClientPtr client) { REQUEST(xXResQueryClientResourcesReq); xXResQueryClientResourcesReply rep; @@ -118,7 +117,7 @@ ProcXResQueryClientResources (ClientPtr client) clientID = CLIENT_ID(stuff->xid); - if((clientID >= currentMaxClients) || !clients[clientID]) { + if ((clientID >= currentMaxClients) || !clients[clientID]) { client->errorValue = stuff->xid; return BadValue; } @@ -129,8 +128,9 @@ ProcXResQueryClientResources (ClientPtr client) num_types = 0; - for(i = 0; i <= lastResourceType; i++) { - if(counts[i]) num_types++; + for (i = 0; i <= lastResourceType; i++) { + if (counts[i]) + num_types++; } rep.type = X_Reply; @@ -141,93 +141,96 @@ ProcXResQueryClientResources (ClientPtr client) swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.num_types); - } + } - WriteToClient (client,sizeof(xXResQueryClientResourcesReply),(char*)&rep); + WriteToClient(client, sizeof(xXResQueryClientResourcesReply), + (char *) &rep); - if(num_types) { + if (num_types) { xXResType scratch; - const char *name; + const char *name; - for(i = 0; i < lastResourceType; i++) { - if(!counts[i]) continue; + for (i = 0; i < lastResourceType; i++) { + if (!counts[i]) + continue; - name = LookupResourceName(i + 1); + name = LookupResourceName(i + 1); if (strcmp(name, XREGISTRY_UNKNOWN)) - scratch.resource_type = MakeAtom(name, strlen(name), TRUE); - else { + scratch.resource_type = MakeAtom(name, strlen(name), TRUE); + else { char buf[40]; + snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1); - scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE); + scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE); } scratch.count = counts[i]; - if(client->swapped) { + if (client->swapped) { swapl(&scratch.resource_type); swapl(&scratch.count); } - WriteToClient (client, sz_xXResType, (char *) &scratch); + WriteToClient(client, sz_xXResType, (char *) &scratch); } } free(counts); - + return Success; } static unsigned long -ResGetApproxPixmapBytes (PixmapPtr pix) +ResGetApproxPixmapBytes(PixmapPtr pix) { - unsigned long nPixels; - int bytesPerPixel; + unsigned long nPixels; + int bytesPerPixel; - bytesPerPixel = pix->drawable.bitsPerPixel>>3; - nPixels = pix->drawable.width * pix->drawable.height; + bytesPerPixel = pix->drawable.bitsPerPixel >> 3; + nPixels = pix->drawable.width * pix->drawable.height; - /* Divide by refcnt as pixmap could be shared between clients, - * so total pixmap mem is shared between these. - */ - return ( nPixels * bytesPerPixel ) / pix->refcnt; + /* Divide by refcnt as pixmap could be shared between clients, + * so total pixmap mem is shared between these. + */ + return (nPixels * bytesPerPixel) / pix->refcnt; } -static void -ResFindPixmaps (pointer value, XID id, pointer cdata) +static void +ResFindPixmaps(pointer value, XID id, pointer cdata) { - unsigned long *bytes = (unsigned long *)cdata; - PixmapPtr pix = (PixmapPtr)value; + unsigned long *bytes = (unsigned long *) cdata; + PixmapPtr pix = (PixmapPtr) value; - *bytes += ResGetApproxPixmapBytes(pix); + *bytes += ResGetApproxPixmapBytes(pix); } static void -ResFindWindowPixmaps (pointer value, XID id, pointer cdata) +ResFindWindowPixmaps(pointer value, XID id, pointer cdata) { - unsigned long *bytes = (unsigned long *)cdata; - WindowPtr pWin = (WindowPtr)value; + unsigned long *bytes = (unsigned long *) cdata; + WindowPtr pWin = (WindowPtr) value; - if (pWin->backgroundState == BackgroundPixmap) - *bytes += ResGetApproxPixmapBytes(pWin->background.pixmap); + if (pWin->backgroundState == BackgroundPixmap) + *bytes += ResGetApproxPixmapBytes(pWin->background.pixmap); - if (pWin->border.pixmap != NULL && !pWin->borderIsPixel) - *bytes += ResGetApproxPixmapBytes(pWin->border.pixmap); + if (pWin->border.pixmap != NULL && !pWin->borderIsPixel) + *bytes += ResGetApproxPixmapBytes(pWin->border.pixmap); } static void -ResFindGCPixmaps (pointer value, XID id, pointer cdata) +ResFindGCPixmaps(pointer value, XID id, pointer cdata) { - unsigned long *bytes = (unsigned long *)cdata; - GCPtr pGC = (GCPtr)value; + unsigned long *bytes = (unsigned long *) cdata; + GCPtr pGC = (GCPtr) value; - if (pGC->stipple != NULL) - *bytes += ResGetApproxPixmapBytes(pGC->stipple); + if (pGC->stipple != NULL) + *bytes += ResGetApproxPixmapBytes(pGC->stipple); - if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel) - *bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap); + if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel) + *bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap); } static int -ProcXResQueryClientPixmapBytes (ClientPtr client) +ProcXResQueryClientPixmapBytes(ClientPtr client) { REQUEST(xXResQueryClientPixmapBytesReq); xXResQueryClientPixmapBytesReply rep; @@ -238,29 +241,27 @@ ProcXResQueryClientPixmapBytes (ClientPtr client) clientID = CLIENT_ID(stuff->xid); - if((clientID >= currentMaxClients) || !clients[clientID]) { + if ((clientID >= currentMaxClients) || !clients[clientID]) { client->errorValue = stuff->xid; return BadValue; } bytes = 0; - FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps, - (pointer)(&bytes)); + FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps, + (pointer) (&bytes)); /* * Make sure win background pixmaps also held to account. */ - FindClientResourcesByType(clients[clientID], RT_WINDOW, - ResFindWindowPixmaps, - (pointer)(&bytes)); + FindClientResourcesByType(clients[clientID], RT_WINDOW, + ResFindWindowPixmaps, (pointer) (&bytes)); /* * GC Tile & Stipple pixmaps too. - */ - FindClientResourcesByType(clients[clientID], RT_GC, - ResFindGCPixmaps, - (pointer)(&bytes)); + */ + FindClientResourcesByType(clients[clientID], RT_GC, + ResFindGCPixmaps, (pointer) (&bytes)); #ifdef COMPOSITE /* FIXME: include composite pixmaps too */ @@ -281,13 +282,14 @@ ProcXResQueryClientPixmapBytes (ClientPtr client) swapl(&rep.bytes); swapl(&rep.bytes_overflow); } - WriteToClient (client,sizeof(xXResQueryClientPixmapBytesReply),(char*)&rep); + WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), + (char *) &rep); return Success; } static int -ProcResDispatch (ClientPtr client) +ProcResDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { @@ -299,40 +301,41 @@ ProcResDispatch (ClientPtr client) return ProcXResQueryClientResources(client); case X_XResQueryClientPixmapBytes: return ProcXResQueryClientPixmapBytes(client); - default: break; + default: + break; } return BadRequest; } static int -SProcXResQueryVersion (ClientPtr client) +SProcXResQueryVersion(ClientPtr client) { REQUEST(xXResQueryVersionReq); - REQUEST_SIZE_MATCH (xXResQueryVersionReq); + REQUEST_SIZE_MATCH(xXResQueryVersionReq); return ProcXResQueryVersion(client); } static int -SProcXResQueryClientResources (ClientPtr client) +SProcXResQueryClientResources(ClientPtr client) { REQUEST(xXResQueryClientResourcesReq); - REQUEST_SIZE_MATCH (xXResQueryClientResourcesReq); + REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq); swapl(&stuff->xid); return ProcXResQueryClientResources(client); } static int -SProcXResQueryClientPixmapBytes (ClientPtr client) +SProcXResQueryClientPixmapBytes(ClientPtr client) { REQUEST(xXResQueryClientPixmapBytesReq); - REQUEST_SIZE_MATCH (xXResQueryClientPixmapBytesReq); + REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq); swapl(&stuff->xid); return ProcXResQueryClientPixmapBytes(client); } static int -SProcResDispatch (ClientPtr client) +SProcResDispatch(ClientPtr client) { REQUEST(xReq); swaps(&stuff->length); @@ -340,13 +343,14 @@ SProcResDispatch (ClientPtr client) switch (stuff->data) { case X_XResQueryVersion: return SProcXResQueryVersion(client); - case X_XResQueryClients: /* nothing to swap */ + case X_XResQueryClients: /* nothing to swap */ return ProcXResQueryClients(client); case X_XResQueryClientResources: return SProcXResQueryClientResources(client); case X_XResQueryClientPixmapBytes: return SProcXResQueryClientPixmapBytes(client); - default: break; + default: + break; } return BadRequest; @@ -356,6 +360,6 @@ void ResExtensionInit(INITARGS) { (void) AddExtension(XRES_NAME, 0, 0, - ProcResDispatch, SProcResDispatch, - NULL, StandardMinorOpcode); + ProcResDispatch, SProcResDispatch, + NULL, StandardMinorOpcode); } |