aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/pseudoramiX.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xquartz/pseudoramiX.c')
-rw-r--r--xorg-server/hw/xquartz/pseudoramiX.c270
1 files changed, 133 insertions, 137 deletions
diff --git a/xorg-server/hw/xquartz/pseudoramiX.c b/xorg-server/hw/xquartz/pseudoramiX.c
index 5a5b9c2e7..f5375039b 100644
--- a/xorg-server/hw/xquartz/pseudoramiX.c
+++ b/xorg-server/hw/xquartz/pseudoramiX.c
@@ -47,9 +47,9 @@ Equipment Corporation.
Bool noPseudoramiXExtension = FALSE;
-extern int ProcPanoramiXQueryVersion (ClientPtr client);
+extern int ProcPanoramiXQueryVersion(ClientPtr client);
-static void PseudoramiXResetProc(ExtensionEntry *extEntry);
+static void PseudoramiXResetProc(ExtensionEntry * extEntry);
static int ProcPseudoramiXQueryVersion(ClientPtr client);
static int ProcPseudoramiXGetState(ClientPtr client);
@@ -67,7 +67,6 @@ static int SProcPseudoramiXIsActive(ClientPtr client);
static int SProcPseudoramiXQueryScreens(ClientPtr client);
static int SProcPseudoramiXDispatch(ClientPtr client);
-
typedef struct {
int x;
int y;
@@ -80,7 +79,6 @@ static int pseudoramiXScreensAllocated = 0;
static int pseudoramiXNumScreens = 0;
static unsigned long pseudoramiXGeneration = 0;
-
// Add a PseudoramiX screen.
// The rest of the X server will know nothing about this screen.
// Can be called before or after extension init.
@@ -90,13 +88,14 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
{
PseudoramiXScreenRec *s;
- if (noPseudoramiXExtension) return;
+ if (noPseudoramiXExtension)
+ return;
if (pseudoramiXNumScreens == pseudoramiXScreensAllocated) {
pseudoramiXScreensAllocated += pseudoramiXScreensAllocated + 1;
pseudoramiXScreens = realloc(pseudoramiXScreens,
- pseudoramiXScreensAllocated *
- sizeof(PseudoramiXScreenRec));
+ pseudoramiXScreensAllocated *
+ sizeof(PseudoramiXScreenRec));
}
DEBUG_LOG("x: %d, y: %d, w: %d, h: %d\n", x, y, w, h);
@@ -108,15 +107,16 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
s->h = h;
}
-
// Initialize PseudoramiX.
// Copied from PanoramiXExtensionInit
-void PseudoramiXExtensionInit(int argc, char *argv[])
+void
+PseudoramiXExtensionInit(int argc, char *argv[])
{
- Bool success = FALSE;
- ExtensionEntry *extEntry;
+ Bool success = FALSE;
+ ExtensionEntry *extEntry;
- if (noPseudoramiXExtension) return;
+ if (noPseudoramiXExtension)
+ return;
TRACE();
@@ -134,11 +134,11 @@ void PseudoramiXExtensionInit(int argc, char *argv[])
extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
ProcPseudoramiXDispatch,
SProcPseudoramiXDispatch,
- PseudoramiXResetProc,
- StandardMinorOpcode);
+ PseudoramiXResetProc, StandardMinorOpcode);
if (!extEntry) {
ErrorF("PseudoramiXExtensionInit(): AddExtension failed\n");
- } else {
+ }
+ else {
pseudoramiXGeneration = serverGeneration;
success = TRUE;
}
@@ -151,34 +151,34 @@ void PseudoramiXExtensionInit(int argc, char *argv[])
}
}
-
-void PseudoramiXResetScreens(void)
+void
+PseudoramiXResetScreens(void)
{
TRACE();
pseudoramiXNumScreens = 0;
}
-
-static void PseudoramiXResetProc(ExtensionEntry *extEntry)
+static void
+PseudoramiXResetProc(ExtensionEntry * extEntry)
{
TRACE();
PseudoramiXResetScreens();
}
-
// was PanoramiX
-static int ProcPseudoramiXQueryVersion(ClientPtr client)
+static int
+ProcPseudoramiXQueryVersion(ClientPtr client)
{
TRACE();
return ProcPanoramiXQueryVersion(client);
}
-
// was PanoramiX
-static int ProcPseudoramiXGetState(ClientPtr client)
+static int
+ProcPseudoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
@@ -186,11 +186,11 @@ static int ProcPseudoramiXGetState(ClientPtr client)
register int rc;
TRACE();
-
+
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -201,13 +201,13 @@ static int ProcPseudoramiXGetState(ClientPtr client)
swapl(&rep.length);
swaps(&rep.state);
}
- WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep);
+ WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep);
return Success;
}
-
// was PanoramiX
-static int ProcPseudoramiXGetScreenCount(ClientPtr client)
+static int
+ProcPseudoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
@@ -215,11 +215,11 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client)
register int rc;
TRACE();
-
+
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
@@ -230,31 +230,31 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client)
swapl(&rep.length);
swaps(&rep.ScreenCount);
}
- WriteToClient (client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep);
return Success;
}
-
// was PanoramiX
-static int ProcPseudoramiXGetScreenSize(ClientPtr client)
+static int
+ProcPseudoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
- WindowPtr pWin;
- xPanoramiXGetScreenSizeReply rep;
- register int n, rc;
+ WindowPtr pWin;
+ xPanoramiXGetScreenSizeReply rep;
+ register int n, rc;
TRACE();
-
+
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/* screen dimensions */
- rep.width = pseudoramiXScreens[stuff->screen].w;
+ rep.width = pseudoramiXScreens[stuff->screen].w;
// was screenInfo.screens[stuff->screen]->width;
rep.height = pseudoramiXScreens[stuff->screen].h;
// was screenInfo.screens[stuff->screen]->height;
@@ -264,19 +264,19 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client)
swaps(&rep.width);
swaps(&rep.height);
}
- WriteToClient (client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
+ WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep);
return Success;
}
-
// was Xinerama
-static int ProcPseudoramiXIsActive(ClientPtr client)
+static int
+ProcPseudoramiXIsActive(ClientPtr client)
{
/* REQUEST(xXineramaIsActiveReq); */
- xXineramaIsActiveReply rep;
+ xXineramaIsActiveReply rep;
TRACE();
-
+
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
rep.type = X_Reply;
@@ -284,23 +284,24 @@ static int ProcPseudoramiXIsActive(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.state = !noPseudoramiXExtension;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.state);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.state);
}
- WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
return Success;
}
-
// was Xinerama
-static int ProcPseudoramiXQueryScreens(ClientPtr client)
+static int
+ProcPseudoramiXQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
- xXineramaQueryScreensReply rep;
+ xXineramaQueryScreensReply rep;
+
+ DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n",
+ noPseudoramiXExtension, pseudoramiXNumScreens);
- DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n", noPseudoramiXExtension, pseudoramiXNumScreens);
-
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
rep.type = X_Reply;
@@ -308,155 +309,150 @@ static int ProcPseudoramiXQueryScreens(ClientPtr client)
rep.number = noPseudoramiXExtension ? 0 : pseudoramiXNumScreens;
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.number);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.number);
}
- WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep);
if (!noPseudoramiXExtension) {
- xXineramaScreenInfo scratch;
- int i;
-
- for(i = 0; i < pseudoramiXNumScreens; i++) {
- scratch.x_org = pseudoramiXScreens[i].x;
- scratch.y_org = pseudoramiXScreens[i].y;
- scratch.width = pseudoramiXScreens[i].w;
- scratch.height = pseudoramiXScreens[i].h;
-
- if(client->swapped) {
- swaps(&scratch.x_org);
- swaps(&scratch.y_org);
- swaps(&scratch.width);
- swaps(&scratch.height);
- }
- WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
- }
+ xXineramaScreenInfo scratch;
+ int i;
+
+ for (i = 0; i < pseudoramiXNumScreens; i++) {
+ scratch.x_org = pseudoramiXScreens[i].x;
+ scratch.y_org = pseudoramiXScreens[i].y;
+ scratch.width = pseudoramiXScreens[i].w;
+ scratch.height = pseudoramiXScreens[i].h;
+
+ if (client->swapped) {
+ swaps(&scratch.x_org);
+ swaps(&scratch.y_org);
+ swaps(&scratch.width);
+ swaps(&scratch.height);
+ }
+ WriteToClient(client, sz_XineramaScreenInfo, (char *) &scratch);
+ }
}
return Success;
}
-
// was PanoramiX
-static int ProcPseudoramiXDispatch (ClientPtr client)
-{ REQUEST(xReq);
+static int
+ProcPseudoramiXDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
TRACE();
- switch (stuff->data)
- {
- case X_PanoramiXQueryVersion:
- return ProcPseudoramiXQueryVersion(client);
- case X_PanoramiXGetState:
- return ProcPseudoramiXGetState(client);
- case X_PanoramiXGetScreenCount:
- return ProcPseudoramiXGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return ProcPseudoramiXGetScreenSize(client);
- case X_XineramaIsActive:
- return ProcPseudoramiXIsActive(client);
- case X_XineramaQueryScreens:
- return ProcPseudoramiXQueryScreens(client);
+ switch (stuff->data) {
+ case X_PanoramiXQueryVersion:
+ return ProcPseudoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return ProcPseudoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return ProcPseudoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return ProcPseudoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return ProcPseudoramiXIsActive(client);
+ case X_XineramaQueryScreens:
+ return ProcPseudoramiXQueryScreens(client);
}
return BadRequest;
}
-
-
static int
-SProcPseudoramiXQueryVersion (ClientPtr client)
+SProcPseudoramiXQueryVersion(ClientPtr client)
{
- REQUEST(xPanoramiXQueryVersionReq);
+ REQUEST(xPanoramiXQueryVersionReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
- return ProcPseudoramiXQueryVersion(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
+ return ProcPseudoramiXQueryVersion(client);
}
static int
SProcPseudoramiXGetState(ClientPtr client)
{
- REQUEST(xPanoramiXGetStateReq);
+ REQUEST(xPanoramiXGetStateReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
- return ProcPseudoramiXGetState(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ return ProcPseudoramiXGetState(client);
}
static int
SProcPseudoramiXGetScreenCount(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenCountReq);
+ REQUEST(xPanoramiXGetScreenCountReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
- return ProcPseudoramiXGetScreenCount(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ return ProcPseudoramiXGetScreenCount(client);
}
static int
SProcPseudoramiXGetScreenSize(ClientPtr client)
{
- REQUEST(xPanoramiXGetScreenSizeReq);
+ REQUEST(xPanoramiXGetScreenSizeReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
- return ProcPseudoramiXGetScreenSize(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ return ProcPseudoramiXGetScreenSize(client);
}
-
static int
SProcPseudoramiXIsActive(ClientPtr client)
{
- REQUEST(xXineramaIsActiveReq);
+ REQUEST(xXineramaIsActiveReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
- return ProcPseudoramiXIsActive(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return ProcPseudoramiXIsActive(client);
}
-
static int
SProcPseudoramiXQueryScreens(ClientPtr client)
{
- REQUEST(xXineramaQueryScreensReq);
+ REQUEST(xXineramaQueryScreensReq);
TRACE();
- swaps(&stuff->length);
- REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
- return ProcPseudoramiXQueryScreens(client);
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return ProcPseudoramiXQueryScreens(client);
}
-
static int
-SProcPseudoramiXDispatch (ClientPtr client)
-{ REQUEST(xReq);
+SProcPseudoramiXDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
TRACE();
- switch (stuff->data)
- {
- case X_PanoramiXQueryVersion:
- return SProcPseudoramiXQueryVersion(client);
- case X_PanoramiXGetState:
- return SProcPseudoramiXGetState(client);
- case X_PanoramiXGetScreenCount:
- return SProcPseudoramiXGetScreenCount(client);
- case X_PanoramiXGetScreenSize:
- return SProcPseudoramiXGetScreenSize(client);
- case X_XineramaIsActive:
- return SProcPseudoramiXIsActive(client);
- case X_XineramaQueryScreens:
- return SProcPseudoramiXQueryScreens(client);
+ switch (stuff->data) {
+ case X_PanoramiXQueryVersion:
+ return SProcPseudoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return SProcPseudoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return SProcPseudoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return SProcPseudoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return SProcPseudoramiXIsActive(client);
+ case X_XineramaQueryScreens:
+ return SProcPseudoramiXQueryScreens(client);
}
return BadRequest;
}