diff options
Diffstat (limited to 'xserver/hw/xquartz/pseudoramiX.c')
-rw-r--r-- | xserver/hw/xquartz/pseudoramiX.c | 90 |
1 files changed, 61 insertions, 29 deletions
diff --git a/xserver/hw/xquartz/pseudoramiX.c b/xserver/hw/xquartz/pseudoramiX.c index 8bb7f2d01..23dbc7328 100644 --- a/xserver/hw/xquartz/pseudoramiX.c +++ b/xserver/hw/xquartz/pseudoramiX.c @@ -37,14 +37,17 @@ #include <dix-config.h> #endif -#include "darwin.h" #include "pseudoramiX.h" #include "extnsionst.h" +#include "extinit.h" #include "dixstruct.h" #include "window.h" #include <X11/extensions/panoramiXproto.h> #include "globals.h" +#define TRACE PseudoramiXTrace("TRACE " __FILE__ ":%s",__FUNCTION__) +#define DEBUG_LOG PseudoramiXDebug + Bool noPseudoramiXExtension = FALSE; extern int @@ -95,6 +98,26 @@ static int pseudoramiXScreensAllocated = 0; static int pseudoramiXNumScreens = 0; static unsigned long pseudoramiXGeneration = 0; +static void +PseudoramiXTrace(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + LogVMessageVerb(X_NONE, 10, format, ap); + va_end(ap); +} + +static void +PseudoramiXDebug(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + LogVMessageVerb(X_NONE, 3, format, ap); + va_end(ap); +} + // Add a PseudoramiX screen. // The rest of the X server will know nothing about this screen. // Can be called before or after extension init. @@ -125,14 +148,14 @@ PseudoramiXAddScreen(int x, int y, int w, int h) // Initialize PseudoramiX. // Copied from PanoramiXExtensionInit void -PseudoramiXExtensionInit(int argc, char *argv[]) +PseudoramiXExtensionInit(void) { Bool success = FALSE; ExtensionEntry *extEntry; if (noPseudoramiXExtension) return; - TRACE(); + TRACE; /* Even with only one screen we need to enable PseudoramiX to allow dynamic screen configuration changes. */ @@ -169,7 +192,7 @@ PseudoramiXExtensionInit(int argc, char *argv[]) void PseudoramiXResetScreens(void) { - TRACE(); + TRACE; pseudoramiXNumScreens = 0; } @@ -177,7 +200,7 @@ PseudoramiXResetScreens(void) static void PseudoramiXResetProc(ExtensionEntry *extEntry) { - TRACE(); + TRACE; PseudoramiXResetScreens(); } @@ -186,7 +209,7 @@ PseudoramiXResetProc(ExtensionEntry *extEntry) static int ProcPseudoramiXQueryVersion(ClientPtr client) { - TRACE(); + TRACE; return ProcPanoramiXQueryVersion(client); } @@ -200,7 +223,7 @@ ProcPseudoramiXGetState(ClientPtr client) xPanoramiXGetStateReply rep; register int rc; - TRACE(); + TRACE; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); @@ -211,12 +234,13 @@ ProcPseudoramiXGetState(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; rep.state = !noPseudoramiXExtension; + rep.window = stuff->window; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); - swaps(&rep.state); + swapl(&rep.window); } - WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep); + WriteToClient(client, sizeof(xPanoramiXGetStateReply),&rep); return Success; } @@ -229,7 +253,7 @@ ProcPseudoramiXGetScreenCount(ClientPtr client) xPanoramiXGetScreenCountReply rep; register int rc; - TRACE(); + TRACE; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); @@ -240,12 +264,13 @@ ProcPseudoramiXGetScreenCount(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; rep.ScreenCount = pseudoramiXNumScreens; + rep.window = stuff->window; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); - swaps(&rep.ScreenCount); + swapl(&rep.window); } - WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep); + WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply),&rep); return Success; } @@ -256,9 +281,12 @@ ProcPseudoramiXGetScreenSize(ClientPtr client) REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin; xPanoramiXGetScreenSizeReply rep; - register int n, rc; + register int rc; + + TRACE; - TRACE(); + if (stuff->screen >= pseudoramiXNumScreens) + return BadMatch; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); @@ -273,13 +301,17 @@ ProcPseudoramiXGetScreenSize(ClientPtr client) // was screenInfo.screens[stuff->screen]->width; rep.height = pseudoramiXScreens[stuff->screen].h; // was screenInfo.screens[stuff->screen]->height; + rep.window = stuff->window; + rep.screen = stuff->screen; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); - swaps(&rep.width); - swaps(&rep.height); + swapl(&rep.width); + swapl(&rep.height); + swapl(&rep.window); + swapl(&rep.screen); } - WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep); + WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply),&rep); return Success; } @@ -290,7 +322,7 @@ ProcPseudoramiXIsActive(ClientPtr client) /* REQUEST(xXineramaIsActiveReq); */ xXineramaIsActiveReply rep; - TRACE(); + TRACE; REQUEST_SIZE_MATCH(xXineramaIsActiveReq); @@ -303,7 +335,7 @@ ProcPseudoramiXIsActive(ClientPtr client) swapl(&rep.length); swapl(&rep.state); } - WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *)&rep); + WriteToClient(client, sizeof(xXineramaIsActiveReply),&rep); return Success; } @@ -329,7 +361,7 @@ ProcPseudoramiXQueryScreens(ClientPtr client) swapl(&rep.length); swapl(&rep.number); } - WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep); + WriteToClient(client, sizeof(xXineramaQueryScreensReply),&rep); if (!noPseudoramiXExtension) { xXineramaScreenInfo scratch; @@ -347,7 +379,7 @@ ProcPseudoramiXQueryScreens(ClientPtr client) swaps(&scratch.width); swaps(&scratch.height); } - WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch); + WriteToClient(client, sz_XineramaScreenInfo,&scratch); } } @@ -359,7 +391,7 @@ static int ProcPseudoramiXDispatch(ClientPtr client) { REQUEST(xReq); - TRACE(); + TRACE; switch (stuff->data) { case X_PanoramiXQueryVersion: return ProcPseudoramiXQueryVersion(client); @@ -387,7 +419,7 @@ SProcPseudoramiXQueryVersion(ClientPtr client) { REQUEST(xPanoramiXQueryVersionReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); @@ -399,7 +431,7 @@ SProcPseudoramiXGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); @@ -411,7 +443,7 @@ SProcPseudoramiXGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); @@ -423,7 +455,7 @@ SProcPseudoramiXGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); @@ -435,7 +467,7 @@ SProcPseudoramiXIsActive(ClientPtr client) { REQUEST(xXineramaIsActiveReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaIsActiveReq); @@ -447,7 +479,7 @@ SProcPseudoramiXQueryScreens(ClientPtr client) { REQUEST(xXineramaQueryScreensReq); - TRACE(); + TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); @@ -459,7 +491,7 @@ SProcPseudoramiXDispatch(ClientPtr client) { REQUEST(xReq); - TRACE(); + TRACE; switch (stuff->data) { case X_PanoramiXQueryVersion: |