summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Hill <colin.james.hill@gmail.com>2011-01-23 16:15:37 -0800
committerColin Hill <colin.james.hill@gmail.com>2011-01-23 16:15:37 -0800
commit65662291ed4cee113087fff04c4d23df0e4d314a (patch)
tree2859b9370f897808251828173e57b5e4e6c1a525
parent1c74aaf1cda50be926637d6792cb622b941468de (diff)
Made code style more consistent.
-rw-r--r--src/client.h28
-rw-r--r--src/driver.c443
-rw-r--r--src/xlibclient.c51
3 files changed, 248 insertions, 274 deletions
diff --git a/src/client.h b/src/client.h
index f91a59c..507d66f 100644
--- a/src/client.h
+++ b/src/client.h
@@ -33,24 +33,24 @@ Bool NestedvClientCheckDisplay(char *displayName);
Bool NestedvClientValidDepth(int depth);
NestedvClientPrivatePtr NestedvClientCreateScreen(int scrnIndex,
- char *displayName,
- int width,
- int height,
- int originX,
- int originY,
- int depth,
- int bitsPerPixel,
- Pixel *retRedMask,
- Pixel *retGreenMask,
- Pixel *retBlueMask);
+ char *displayName,
+ int width,
+ int height,
+ int originX,
+ int originY,
+ int depth,
+ int bitsPerPixel,
+ Pixel *retRedMask,
+ Pixel *retGreenMask,
+ Pixel *retBlueMask);
char *NestedvClientGetFrameBuffer(NestedvClientPrivatePtr pPriv);
void NestedvClientUpdateScreen(NestedvClientPrivatePtr pPriv,
- int16_t x1,
- int16_t y1,
- int16_t x2,
- int16_t y2);
+ int16_t x1,
+ int16_t y1,
+ int16_t x2,
+ int16_t y2);
void NestedvClientHideCursor(NestedvClientPrivatePtr pPriv); /* Hide cursor function */
diff --git a/src/driver.c b/src/driver.c
index 451e057..bff863f 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -52,24 +52,23 @@ static void NestedvIdentify(int flags);
static const OptionInfoRec *NestedvAvailableOptions(int chipid, int busid);
static Bool NestedvProbe(DriverPtr drv, int flags);
static Bool NestedvDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op,
- pointer ptr);
-
+ pointer ptr);
static Bool NestedvPreInit(ScrnInfoPtr pScrn, int flags);
static Bool NestedvScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
- char **argv);
+ char **argv);
static Bool NestedvSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
static void NestedvAdjustFrame(int scrnIndex, int x, int y, int flags);
static Bool NestedvEnterVT(int scrnIndex, int flags);
static void NestedvLeaveVT(int scrnIndex, int flags);
static void NestedvFreeScreen(int scrnIndex, int flags);
static ModeStatus NestedvValidMode(int scrnIndex, DisplayModePtr mode,
- Bool verbose, int flags);
+ Bool verbose, int flags);
static Bool NestedvSaveScreen(ScreenPtr pScreen, int mode);
static Bool NestedvCreateScreenResources(ScreenPtr pScreen);
static void NestedvShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf);
static void *NestedvShadowWindow(ScreenPtr pScreen, CARD32 row, CARD32 offset,
- int mode, CARD32 *size, void *closure);
+ int mode, CARD32 *size, void *closure);
static Bool NestedvCloseScreen(int scrnIndex, ScreenPtr pScreen);
static CARD32 NestedvTimerCallback(OsTimerPtr timer, CARD32 time, pointer arg);
@@ -137,8 +136,7 @@ _X_EXPORT XF86ModuleData nestedvModuleData = {
};
/* These stuff should be valid to all server generations */
-typedef struct NestedvPrivate
-{
+typedef struct NestedvPrivate {
char *displayName;
int originX;
int originY;
@@ -149,43 +147,42 @@ typedef struct NestedvPrivate
ShadowUpdateProc update;
/*ShadowWindowProc window;*/
} NestedvPrivate, *NestedvPrivatePtr;
+
#define PNESTEDV(p) ((NestedvPrivatePtr)((p)->driverPrivate))
#define PCLIENTDATA(p) (PNESTEDV(p)->clientData)
/*static ScrnInfoPtr NESTEDVScrn;*/
static pointer
-NestedvSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
+NestedvSetup(pointer module, pointer opts, int *errmaj, int *errmin) {
static Bool setupDone = FALSE;
if (!setupDone) {
- setupDone = TRUE;
- xf86AddDriver(&NESTEDV, module, HaveDriverFuncs);
- return (pointer)1;
+ setupDone = TRUE;
+ xf86AddDriver(&NESTEDV, module, HaveDriverFuncs);
+
+ return (pointer)1;
} else {
- if (errmaj)
- *errmaj = LDR_ONCEONLY;
- return NULL;
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+
+ return NULL;
}
}
static void
-NestedvIdentify(int flags)
-{
+NestedvIdentify(int flags) {
xf86PrintChipsets(NESTEDV_NAME, "Driver for nestedv servers",
- NestedvChipsets);
+ NestedvChipsets);
}
static const OptionInfoRec *
-NestedvAvailableOptions(int chipid, int busid)
-{
+NestedvAvailableOptions(int chipid, int busid) {
return NestedvOptions;
}
static Bool
-NestedvProbe(DriverPtr drv, int flags)
-{
+NestedvProbe(DriverPtr drv, int flags) {
Bool foundScreen = FALSE;
int numDevSections;
GDevPtr *devSections;
@@ -195,37 +192,37 @@ NestedvProbe(DriverPtr drv, int flags)
int entityIndex;
if (flags & PROBE_DETECT)
- return FALSE;
+ return FALSE;
if ((numDevSections = xf86MatchDevice(NESTEDV_DRIVER_NAME,
- &devSections)) <= 0) {
- return FALSE;
+ &devSections)) <= 0) {
+ return FALSE;
}
if (numDevSections > 0) {
- for(i = 0; i < numDevSections; i++) {
- pScrn = NULL;
- entityIndex = xf86ClaimNoSlot(drv, NESTEDV_CHIP, devSections[i],
- TRUE);
- pScrn = xf86AllocateScreen(drv, 0);
- if (pScrn) {
- xf86AddEntityToScreen(pScrn, entityIndex);
- pScrn->driverVersion = NESTEDV_VERSION;
- pScrn->driverName = NESTEDV_DRIVER_NAME;
- pScrn->name = NESTEDV_NAME;
- pScrn->Probe = NestedvProbe;
- pScrn->PreInit = NestedvPreInit;
- pScrn->ScreenInit = NestedvScreenInit;
- pScrn->SwitchMode = NestedvSwitchMode;
- pScrn->AdjustFrame = NestedvAdjustFrame;
- pScrn->EnterVT = NestedvEnterVT;
- pScrn->LeaveVT = NestedvLeaveVT;
- pScrn->FreeScreen = NestedvFreeScreen;
- pScrn->ValidMode = NestedvValidMode;
- foundScreen = TRUE;
- }
- }
+ for(i = 0; i < numDevSections; i++) {
+ pScrn = NULL;
+ entityIndex = xf86ClaimNoSlot(drv, NESTEDV_CHIP, devSections[i],
+ TRUE);
+ pScrn = xf86AllocateScreen(drv, 0);
+ if (pScrn) {
+ xf86AddEntityToScreen(pScrn, entityIndex);
+ pScrn->driverVersion = NESTEDV_VERSION;
+ pScrn->driverName = NESTEDV_DRIVER_NAME;
+ pScrn->name = NESTEDV_NAME;
+ pScrn->Probe = NestedvProbe;
+ pScrn->PreInit = NestedvPreInit;
+ pScrn->ScreenInit = NestedvScreenInit;
+ pScrn->SwitchMode = NestedvSwitchMode;
+ pScrn->AdjustFrame = NestedvAdjustFrame;
+ pScrn->EnterVT = NestedvEnterVT;
+ pScrn->LeaveVT = NestedvLeaveVT;
+ pScrn->FreeScreen = NestedvFreeScreen;
+ pScrn->ValidMode = NestedvValidMode;
+ foundScreen = TRUE;
+ }
+ }
}
return foundScreen;
@@ -236,45 +233,43 @@ NestedvProbe(DriverPtr drv, int flags)
#endif
static Bool
-NestedvDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr)
-{
+NestedvDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) {
CARD32 *flag;
xf86Msg(X_INFO, "NestedvDriverFunc\n");
+
/* XXX implement */
switch(op) {
- case GET_REQUIRED_HW_INTERFACES:
- flag = (CARD32*)ptr;
- (*flag) = HW_SKIP_CONSOLE;
- return TRUE;
-
- case RR_GET_INFO:
- case RR_SET_CONFIG:
- case RR_GET_MODE_MM:
- default:
- return FALSE;
+ case GET_REQUIRED_HW_INTERFACES:
+ flag = (CARD32*)ptr;
+ (*flag) = HW_SKIP_CONSOLE;
+ return TRUE;
+
+ case RR_GET_INFO:
+ case RR_SET_CONFIG:
+ case RR_GET_MODE_MM:
+ default:
+ return FALSE;
}
}
-static Bool NestedvAllocatePrivate(ScrnInfoPtr pScrn)
-{
+static Bool NestedvAllocatePrivate(ScrnInfoPtr pScrn) {
if (pScrn->driverPrivate != NULL) {
- xf86Msg(X_WARNING, "NestedvAllocatePrivate called for an already "
- "allocated private!\n");
- return FALSE;
+ xf86Msg(X_WARNING, "NestedvAllocatePrivate called for an already "
+ "allocated private!\n");
+ return FALSE;
}
pScrn->driverPrivate = xnfcalloc(sizeof(NestedvPrivate), 1);
if (pScrn->driverPrivate == NULL)
- return FALSE;
+ return FALSE;
return TRUE;
}
-static void NestedvFreePrivate(ScrnInfoPtr pScrn)
-{
+static void NestedvFreePrivate(ScrnInfoPtr pScrn) {
if (pScrn->driverPrivate == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Double freeing NestedvPrivate!\n");
- return;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Double freeing NestedvPrivate!\n");
+ return;
}
free(pScrn->driverPrivate);
@@ -282,35 +277,34 @@ static void NestedvFreePrivate(ScrnInfoPtr pScrn)
}
/* Data from here is valid to all server generations */
-static Bool NestedvPreInit(ScrnInfoPtr pScrn, int flags)
-{
+static Bool NestedvPreInit(ScrnInfoPtr pScrn, int flags) {
NestedvPrivatePtr pNestedv;
char *originString = NULL;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NestedvPreInit\n");
if (flags & PROBE_DETECT)
- return FALSE;
+ return FALSE;
if (!NestedvAllocatePrivate(pScrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate private\n");
- return FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate private\n");
+ return FALSE;
}
pNestedv = PNESTEDV(pScrn);
if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb))
- return FALSE;
+ return FALSE;
xf86PrintDepthBpp(pScrn);
if (pScrn->depth > 8) {
- rgb zeros = {0, 0, 0};
- if (!xf86SetWeight(pScrn, zeros, zeros)) {
- return FALSE;
- }
+ rgb zeros = {0, 0, 0};
+ if (!xf86SetWeight(pScrn, zeros, zeros)) {
+ return FALSE;
+ }
}
if (!xf86SetDefaultVisual(pScrn, -1))
- return FALSE;
+ return FALSE;
pScrn->monitor = pScrn->confScreen->monitor; /* XXX */
@@ -318,58 +312,58 @@ static Bool NestedvPreInit(ScrnInfoPtr pScrn, int flags)
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, NestedvOptions);
if (xf86IsOptionSet(NestedvOptions, OPTION_DISPLAY)) {
- pNestedv->displayName = xf86GetOptValString(NestedvOptions,
- OPTION_DISPLAY);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using display \"%s\"\n",
- pNestedv->displayName);
+ pNestedv->displayName = xf86GetOptValString(NestedvOptions,
+ OPTION_DISPLAY);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using display \"%s\"\n",
+ pNestedv->displayName);
} else {
- pNestedv->displayName = NULL;
+ pNestedv->displayName = NULL;
}
if (xf86IsOptionSet(NestedvOptions, OPTION_ORIGIN)) {
- originString = xf86GetOptValString(NestedvOptions, OPTION_ORIGIN);
- if (sscanf(originString, "%d %d", &pNestedv->originX,
- &pNestedv->originY) != 2) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Invalid value for option \"Origin\"\n");
- return FALSE;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using origin x:%d y:%d\n",
- pNestedv->originX, pNestedv->originY);
+ originString = xf86GetOptValString(NestedvOptions, OPTION_ORIGIN);
+ if (sscanf(originString, "%d %d", &pNestedv->originX,
+ &pNestedv->originY) != 2) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Invalid value for option \"Origin\"\n");
+ return FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using origin x:%d y:%d\n",
+ pNestedv->originX, pNestedv->originY);
} else {
- pNestedv->originX = 0;
- pNestedv->originY = 0;
+ pNestedv->originX = 0;
+ pNestedv->originY = 0;
}
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
if (!NestedvClientCheckDisplay(pNestedv->displayName)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Can't open display: %s\n",
- pNestedv->displayName);
- return FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Can't open display: %s\n",
+ pNestedv->displayName);
+ return FALSE;
}
if (!NestedvClientValidDepth(pScrn->depth)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid depth: %d\n",
- pScrn->depth);
- return FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid depth: %d\n",
+ pScrn->depth);
+ return FALSE;
}
/*if (pScrn->depth > 1) {
- Gamma zeros = {0.0, 0.0, 0.0};
- if (!xf86SetGamma(pScrn, zeros))
- return FALSE;
+ Gamma zeros = {0.0, 0.0, 0.0};
+ if (!xf86SetGamma(pScrn, zeros))
+ return FALSE;
}*/
if (NestedvValidateModes(pScrn) < 1) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes\n");
- return FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes\n");
+ return FALSE;
}
if (!pScrn->modes) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
- return FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
+ return FALSE;
}
xf86SetCrtcForModes(pScrn, 0);
@@ -378,11 +372,11 @@ static Bool NestedvPreInit(ScrnInfoPtr pScrn, int flags)
xf86SetDpi(pScrn, 0, 0);
if (!xf86LoadSubModule(pScrn, "shadow"))
- return FALSE;
+ return FALSE;
if (!xf86LoadSubModule(pScrn, "fb"))
- return FALSE;
+ return FALSE;
if (!xf86LoadSubModule(pScrn, "ramdac"))
- return FALSE;
+ return FALSE;
pScrn->memPhysBase = 0;
pScrn->fbOffset = 0;
@@ -391,8 +385,7 @@ static Bool NestedvPreInit(ScrnInfoPtr pScrn, int flags)
}
int
-NestedvValidateModes(ScrnInfoPtr pScrn)
-{
+NestedvValidateModes(ScrnInfoPtr pScrn) {
DisplayModePtr mode;
int i, width, height, ret = 0;
int maxX = 0, maxY = 0;
@@ -411,20 +404,20 @@ NestedvValidateModes(ScrnInfoPtr pScrn)
for(i = 0; pScrn->display->modes[i] != NULL; i++) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, " %s\n",
pScrn->display->modes[i]);
- if (sscanf(pScrn->display->modes[i], "%dx%d", &width,
- &height) != 2) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "This is not the mode name I was expecting...\n");
- return 0;
- }
- if (!NestedvAddMode(pScrn, width, height)) {
- return 0;
- }
+ if (sscanf(pScrn->display->modes[i], "%dx%d", &width,
+ &height) != 2) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "This is not the mode name I was expecting...\n");
+ return 0;
+ }
+ if (!NestedvAddMode(pScrn, width, height)) {
+ return 0;
+ }
}
} else {
- if (!NestedvAddMode(pScrn, 640, 480)) {
- return 0;
- }
+ if (!NestedvAddMode(pScrn, 640, 480)) {
+ return 0;
+ }
}
pScrn->modePool = NULL;
@@ -432,34 +425,34 @@ NestedvValidateModes(ScrnInfoPtr pScrn)
/* Now set virtualX, virtualY, displayWidth and virtualFrom */
if (pScrn->display->virtualX >= pScrn->modes->HDisplay &&
- pScrn->display->virtualY >= pScrn->modes->VDisplay) {
- pScrn->virtualX = pScrn->display->virtualX;
- pScrn->virtualY = pScrn->display->virtualY;
+ pScrn->display->virtualY >= pScrn->modes->VDisplay) {
+ pScrn->virtualX = pScrn->display->virtualX;
+ pScrn->virtualY = pScrn->display->virtualY;
} else {
- /* XXX: if not specified, make virtualX and virtualY as big as the max X
- * and Y. I'm not sure this is correct */
- mode = pScrn->modes;
- while (mode != NULL) {
- if (mode->HDisplay > maxX)
- maxX = mode->HDisplay;
- if (mode->VDisplay > maxY)
- maxY = mode->VDisplay;
- mode = mode->next;
- }
- pScrn->virtualX = maxX;
- pScrn->virtualY = maxY;
+ /* XXX: if not specified, make virtualX and virtualY as big as the max X
+ * and Y. I'm not sure this is correct */
+ mode = pScrn->modes;
+ while (mode != NULL) {
+ if (mode->HDisplay > maxX)
+ maxX = mode->HDisplay;
+ if (mode->VDisplay > maxY)
+ maxY = mode->VDisplay;
+ mode = mode->next;
+ }
+ pScrn->virtualX = maxX;
+ pScrn->virtualY = maxY;
}
pScrn->virtualFrom = X_DEFAULT;
pScrn->displayWidth = pScrn->virtualX;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Virtual size: %dx%d\n",
- pScrn->virtualX, pScrn->virtualY);
+ pScrn->virtualX, pScrn->virtualY);
/* Calculate the return value */
mode = pScrn->modes;
while (mode != NULL) {
- mode = mode->next;
- ret++;
+ mode = mode->next;
+ ret++;
}
/* Finally, make the mode list circular */
@@ -483,58 +476,57 @@ NestedvValidateModes(ScrnInfoPtr pScrn)
clockRanges->interlaceAllowed = TRUE;
clockRanges->doubleScanAllowed = TRUE;
rc = xf86ValidateModes(pScrn, /* scrp */
- pScrn->monitor->Modes, /* availModes */
- pScrn->display->modes, /* modeNames */
- clockRanges, /* cockRanges */
- NULL, /* linePitches (opt) */
- 256, /* minPitch (opt) */
- 2048, /* maxPitch (opt) */
- (8*pScrn->bitsPerPixel), /* pitchInc */
- 0, /* minHeight (opt) */
- 0, /* maxHeight (opt) */
- pScrn->display->virtualX, /* virualX (opt) */
- pScrn->display->virtualY, /* virtualY (opt) */
- pScrn->videoRam * 1024, /* apertureSize */
- LOOKUP_BEST_REFRESH /* strategy */);
+ pScrn->monitor->Modes, /* availModes */
+ pScrn->display->modes, /* modeNames */
+ clockRanges, /* cockRanges */
+ NULL, /* linePitches (opt) */
+ 256, /* minPitch (opt) */
+ 2048, /* maxPitch (opt) */
+ (8*pScrn->bitsPerPixel), /* pitchInc */
+ 0, /* minHeight (opt) */
+ 0, /* maxHeight (opt) */
+ pScrn->display->virtualX, /* virualX (opt) */
+ pScrn->display->virtualY, /* virtualY (opt) */
+ pScrn->videoRam * 1024, /* apertureSize */
+ LOOKUP_BEST_REFRESH /* strategy */);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "pScrn->modePool: 0x%x\n",
- pScrn->modePool);
+ pScrn->modePool);
int rounds = 0;
for (mode = pScrn->modes;
(mode != pScrn->modes) && (rounds == 1);
- mode = mode->next) {
- rounds = 1;
- NestedvValidMode(pScrn->scrnIndex, mode, FALSE, 0);
+ mode = mode->next) {
+ rounds = 1;
+ NestedvValidMode(pScrn->scrnIndex, mode, FALSE, 0);
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "pScrn->virtualX: %d\n",
- pScrn->virtualX);
+ pScrn->virtualX);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "pScrn->virtualY: %d\n",
- pScrn->virtualY);
+ pScrn->virtualY);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "pScrn->displayWidth: %d\n",
- pScrn->displayWidth);
+ pScrn->displayWidth);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "pScrn->virtualFrom: %d\n",
- pScrn->virtualFrom);
+ pScrn->virtualFrom);
if (rc < 1) {
- return rc;
+ return rc;
} else {
- xf86PruneDriverModes(pScrn);
- return rc;
+ xf86PruneDriverModes(pScrn);
+ return rc;
}
#endif
}
Bool
-NestedvAddMode(ScrnInfoPtr pScrn, int width, int height)
-{
+NestedvAddMode(ScrnInfoPtr pScrn, int width, int height) {
DisplayModePtr mode;
char nameBuf[64];
int rc;
size_t len;
if (snprintf(nameBuf, 64, "%dx%d", width, height) >= 64)
- return FALSE;
+ return FALSE;
mode = XNFcalloc(sizeof(DisplayModeRec));
mode->status = MODE_OK;
@@ -552,12 +544,12 @@ NestedvAddMode(ScrnInfoPtr pScrn, int width, int height)
* but we'll maintain pScrn->modes->prev to know the last element */
mode->next = NULL;
if (!pScrn->modes) {
- pScrn->modes = mode;
- mode->prev = mode;
+ pScrn->modes = mode;
+ mode->prev = mode;
} else {
- mode->prev = pScrn->modes->prev;
- pScrn->modes->prev->next = mode;
- pScrn->modes->prev = mode;
+ mode->prev = pScrn->modes->prev;
+ pScrn->modes->prev->next = mode;
+ pScrn->modes->prev = mode;
}
return TRUE;
@@ -565,8 +557,7 @@ NestedvAddMode(ScrnInfoPtr pScrn, int width, int height)
/* Called at each server generation */
static Bool NestedvScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
- char **argv)
-{
+ char **argv) {
ScrnInfoPtr pScrn;
NestedvPrivatePtr pNestedv;
Pixel redMask, greenMask, blueMask;
@@ -583,32 +574,32 @@ static Bool NestedvScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
* NestedvSave(pScrn); */
pNestedv->clientData = NestedvClientCreateScreen(scrnIndex,
- pNestedv->displayName,
- pScrn->virtualX,
- pScrn->virtualY,
- pNestedv->originX,
- pNestedv->originY,
- pScrn->depth,
- pScrn->bitsPerPixel,
- &redMask, &greenMask, &blueMask);
+ pNestedv->displayName,
+ pScrn->virtualX,
+ pScrn->virtualY,
+ pNestedv->originX,
+ pNestedv->originY,
+ pScrn->depth,
+ pScrn->bitsPerPixel,
+ &redMask, &greenMask, &blueMask);
if (!pNestedv->clientData) {
- xf86DrvMsg(scrnIndex, X_ERROR, "Failed to create client screen\n");
- return FALSE;
+ xf86DrvMsg(scrnIndex, X_ERROR, "Failed to create client screen\n");
+ return FALSE;
}
miClearVisualTypes();
if (!miSetVisualTypesAndMasks(pScrn->depth,
- miGetDefaultVisualMask(pScrn->depth),
- pScrn->rgbBits, pScrn->defaultVisual,
- redMask, greenMask, blueMask))
- return FALSE;
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual,
+ redMask, greenMask, blueMask))
+ return FALSE;
if (!miSetPixmapDepths())
- return FALSE;
+ return FALSE;
if (!fbScreenInit(pScreen, NestedvClientGetFrameBuffer(PCLIENTDATA(pScrn)),
- pScrn->virtualX, pScrn->virtualY, pScrn->xDpi,
- pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel))
- return FALSE;
+ pScrn->virtualX, pScrn->virtualY, pScrn->xDpi,
+ pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel))
+ return FALSE;
fbPictureInit(pScreen, 0, 0);
@@ -617,14 +608,14 @@ static Bool NestedvScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
xf86SetBackingStore(pScreen);
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
if (!miCreateDefColormap(pScreen))
- return FALSE;
+ return FALSE;
pNestedv->update = NestedvShadowUpdate;
/*pNestedv->window = NestedvShadowWindow;*/
pScreen->SaveScreen = NestedvSaveScreen;
if (!shadowSetup(pScreen))
- return FALSE;
+ return FALSE;
pNestedv->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = NestedvCreateScreenResources;
@@ -633,15 +624,14 @@ static Bool NestedvScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
pScreen->CloseScreen = NestedvCloseScreen;
pNestedv->timer = TimerSet(NULL, 0, TIMER_CALLBACK_INTERVAL,
- NestedvTimerCallback, (pointer)pScrn);
+ NestedvTimerCallback, (pointer)pScrn);
return TRUE;
}
static Bool
-NestedvCreateScreenResources(ScreenPtr pScreen)
-{
+NestedvCreateScreenResources(ScreenPtr pScreen) {
xf86DrvMsg(pScreen->myNum, X_INFO, "NestedvCreateScreenResources\n");
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
NestedvPrivatePtr pNestedv = PNESTEDV(pScrn);
@@ -652,21 +642,19 @@ NestedvCreateScreenResources(ScreenPtr pScreen)
pScreen->CreateScreenResources = NestedvCreateScreenResources;
shadowAdd(pScreen, pScreen->GetScreenPixmap(pScreen), pNestedv->update,
- /*pNestedv->window*/ 0, 0, 0);
+ /*pNestedv->window*/ 0, 0, 0);
}
static void
-NestedvShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf)
-{
+NestedvShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf) {
RegionPtr pRegion = DamageRegion(pBuf->pDamage);
NestedvClientUpdateScreen(PCLIENTDATA(xf86Screens[pScreen->myNum]),
- pRegion->extents.x1, pRegion->extents.y1,
- pRegion->extents.x2, pRegion->extents.y2);
+ pRegion->extents.x1, pRegion->extents.y1,
+ pRegion->extents.x2, pRegion->extents.y2);
}
static Bool
-NestedvCloseScreen(int scrnIndex, ScreenPtr pScreen)
-{
+NestedvCloseScreen(int scrnIndex, ScreenPtr pScreen) {
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
xf86DrvMsg(scrnIndex, X_INFO, "NestedvCloseScreen\n");
@@ -680,63 +668,55 @@ NestedvCloseScreen(int scrnIndex, ScreenPtr pScreen)
return (*pScreen->CloseScreen)(scrnIndex, pScreen);
}
-static CARD32 NestedvTimerCallback(OsTimerPtr timer, CARD32 time, pointer arg)
-{
+static CARD32 NestedvTimerCallback(OsTimerPtr timer, CARD32 time, pointer arg) {
ScrnInfoPtr pScrn = (ScrnInfoPtr) arg;
NestedvClientTimerCallback(PCLIENTDATA(pScrn));
return TIMER_CALLBACK_INTERVAL;
}
static void *NestedvShadowWindow(ScreenPtr pScreen, CARD32 row, CARD32 offset,
- int mode, CARD32 *size, void *closure)
-{
+ int mode, CARD32 *size, void *closure) {
xf86DrvMsg(pScreen->myNum, X_INFO, "NestedvShadowWindow\n");
}
-static Bool NestedvSaveScreen(ScreenPtr pScreen, int mode)
-{
+static Bool NestedvSaveScreen(ScreenPtr pScreen, int mode) {
xf86DrvMsg(pScreen->myNum, X_INFO, "NestedvSaveScreen\n");
}
-static Bool NestedvSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
-{
+static Bool NestedvSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) {
xf86DrvMsg(scrnIndex, X_INFO, "NestedvSwitchMode\n");
}
-static void NestedvAdjustFrame(int scrnIndex, int x, int y, int flags)
-{
+static void NestedvAdjustFrame(int scrnIndex, int x, int y, int flags) {
xf86DrvMsg(scrnIndex, X_INFO, "NestedvAdjustFrame\n");
}
-static Bool NestedvEnterVT(int scrnIndex, int flags)
-{
+static Bool NestedvEnterVT(int scrnIndex, int flags) {
xf86DrvMsg(scrnIndex, X_INFO, "NestedvEnterVT\n");
}
-static void NestedvLeaveVT(int scrnIndex, int flags)
-{
+static void NestedvLeaveVT(int scrnIndex, int flags) {
xf86DrvMsg(scrnIndex, X_INFO, "NestedvLeaveVT\n");
}
-static void NestedvFreeScreen(int scrnIndex, int flags)
-{
+static void NestedvFreeScreen(int scrnIndex, int flags) {
xf86DrvMsg(scrnIndex, X_INFO, "NestedvFreeScreen\n");
}
static ModeStatus NestedvValidMode(int scrnIndex, DisplayModePtr mode,
- Bool verbose, int flags)
-{
+ Bool verbose, int flags) {
xf86DrvMsg(scrnIndex, X_INFO, "NestedvValidMode:\n");
+
if (!mode)
- xf86DrvMsg(scrnIndex, X_ERROR, "NULL MODE!\n");
+ xf86DrvMsg(scrnIndex, X_ERROR, "NULL MODE!\n");
+
xf86DrvMsg(scrnIndex, X_INFO, " name: %s\n", mode->name);
xf86DrvMsg(scrnIndex, X_INFO, " HDisplay: %d\n", mode->HDisplay);
xf86DrvMsg(scrnIndex, X_INFO, " VDisplay: %d\n", mode->VDisplay);
return MODE_OK;
}
-void NestedvPrintPscreen(ScrnInfoPtr p)
-{
+void NestedvPrintPscreen(ScrnInfoPtr p) {
/* XXX: finish implementing this someday? */
xf86DrvMsg(p->scrnIndex, X_INFO, "Printing pScrn:\n");
xf86DrvMsg(p->scrnIndex, X_INFO, "driverVersion: %d\n", p->driverVersion);
@@ -760,8 +740,7 @@ void NestedvPrintPscreen(ScrnInfoPtr p)
xf86DrvMsg(p->scrnIndex, X_INFO, "\n");*/
}
-void NestedvPrintMode(ScrnInfoPtr p, DisplayModePtr m)
-{
+void NestedvPrintMode(ScrnInfoPtr p, DisplayModePtr m) {
xf86DrvMsg(p->scrnIndex, X_INFO, "HDisplay %d\n", m->HDisplay);
xf86DrvMsg(p->scrnIndex, X_INFO, "HSyncStart %d\n", m->HSyncStart);
xf86DrvMsg(p->scrnIndex, X_INFO, "HSyncEnd %d\n", m->HSyncEnd);
diff --git a/src/xlibclient.c b/src/xlibclient.c
index c136e0f..6585bc9 100644
--- a/src/xlibclient.c
+++ b/src/xlibclient.c
@@ -52,8 +52,7 @@ struct NestedvClientPrivate {
/* Checks if a display is open */
Bool
-NestedvClientCheckDisplay(char *displayName)
-{
+NestedvClientCheckDisplay(char *displayName) {
Display *d;
d = XOpenDisplay(displayName);
@@ -66,25 +65,23 @@ NestedvClientCheckDisplay(char *displayName)
}
Bool
-NestedvClientValidDepth(int depth)
-{
+NestedvClientValidDepth(int depth) {
/* XXX: implement! */
return TRUE;
}
NestedvClientPrivatePtr
NestedvClientCreateScreen(int scrnIndex,
-char *displayName,
-int width,
-int height,
-int originX,
-int originY,
-int depth,
-int bitsPerPixel,
-Pixel *retRedMask,
-Pixel *retGreenMask,
-Pixel *retBlueMask)
-{
+ char *displayName,
+ int width,
+ int height,
+ int originX,
+ int originY,
+ int depth,
+ int bitsPerPixel,
+ Pixel *retRedMask,
+ Pixel *retGreenMask,
+ Pixel *retBlueMask) {
NestedvClientPrivatePtr pPriv;
XSizeHints sizeHints;
@@ -216,29 +213,29 @@ xf86DrvMsg(scrnIndex, X_INFO, "blu_mask: 0x%lx\n", pPriv->img->blue_mask);
return pPriv;
}
-void NestedvClientHideCursor(NestedvClientPrivatePtr pPriv)
-{
+void NestedvClientHideCursor(NestedvClientPrivatePtr pPriv) {
char noData[]= {0,0,0,0,0,0,0,0};
pPriv->color1.red = pPriv->color1.green = pPriv->color1.blue = 0;
+
pPriv->bitmapNoData = XCreateBitmapFromData(pPriv->display,
- pPriv->window, noData, 7, 7);
+ pPriv->window, noData, 7, 7);
+
pPriv->mycursor = XCreatePixmapCursor(pPriv->display,
- pPriv->bitmapNoData, pPriv->bitmapNoData,
- &pPriv->color1, &pPriv->color1, 0, 0);
+ pPriv->bitmapNoData, pPriv->bitmapNoData,
+ &pPriv->color1, &pPriv->color1, 0, 0);
+
XDefineCursor(pPriv->display, pPriv->window, pPriv->mycursor);
XFreeCursor(pPriv->display, pPriv->mycursor);
}
char *
-NestedvClientGetFrameBuffer(NestedvClientPrivatePtr pPriv)
-{
+NestedvClientGetFrameBuffer(NestedvClientPrivatePtr pPriv) {
return pPriv->img->data;
}
void
NestedvClientUpdateScreen(NestedvClientPrivatePtr pPriv, int16_t x1,
- int16_t y1, int16_t x2, int16_t y2)
-{
+ int16_t y1, int16_t x2, int16_t y2) {
if (pPriv->usingShm) {
XShmPutImage(pPriv->display, pPriv->window, pPriv->gc, pPriv->img,
x1, y1, x1, y1, x2 - x1, y2 - y1, FALSE);
@@ -252,8 +249,7 @@ NestedvClientUpdateScreen(NestedvClientPrivatePtr pPriv, int16_t x1,
}
void
-NestedvClientTimerCallback(NestedvClientPrivatePtr pPriv)
-{
+NestedvClientTimerCallback(NestedvClientPrivatePtr pPriv) {
XEvent ev;
char *msg = "Cursor";
char *msg2 = "Root";
@@ -280,8 +276,7 @@ NestedvClientTimerCallback(NestedvClientPrivatePtr pPriv)
}
void
-NestedvClientCloseScreen(NestedvClientPrivatePtr pPriv)
-{
+NestedvClientCloseScreen(NestedvClientPrivatePtr pPriv) {
if (pPriv->usingShm) {
XShmDetach(pPriv->display, &pPriv->shminfo);
shmdt(pPriv->shminfo.shmaddr);