From 2c93083edd29a65e73bb2e8eff9d353e92845c9b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 18 Feb 2007 23:49:38 -0800 Subject: [PATCH 01/63] Add support for user-defined modelines in RandR. The RandR protocol spec has several requests in support of user-defined modes, but the implementation was stubbed out inside the X server. Fill out the DIX portion and start on the xf86 DDX portion. It might be necessary to add more code to the DDX to insert the user-defined modes into the output mode list. (cherry picked from commit 63cc2a51ef87130c632a874672a8c9167f14314e) Conflicts: randr/randrstr.h Updated code to work in master with recent security API changes. --- hw/xfree86/modes/xf86RandR12.c | 50 ++++++++ randr/mirandr.c | 17 ++- randr/randrstr.h | 35 +++++- randr/rrcrtc.c | 11 +- randr/rrinfo.c | 6 +- randr/rrmode.c | 217 ++++++++++++++++++++++++++++----- randr/rroutput.c | 98 +++++++++++++-- randr/rrscreen.c | 16 ++- 8 files changed, 400 insertions(+), 50 deletions(-) diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index ce780b6ef..73647a68b 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -728,6 +728,54 @@ xf86RandR12OutputSetProperty (ScreenPtr pScreen, return output->funcs->set_property(output, property, value); } +static Bool +xf86RandR12OutputValidateMode (ScreenPtr pScreen, + RROutputPtr randr_output, + RRModePtr randr_mode) +{ + xf86OutputPtr output = randr_output->devPrivate; + DisplayModePtr mode = randr_mode->devPrivate; + + if (!mode) + { + mode = xalloc (sizeof (DisplayModeRec) + randr_mode->mode.nameLength + 1); + if (!mode) + return FALSE; + mode->name = (char *) mode + 1; + memcpy (mode->name, randr_mode->name, randr_mode->mode.nameLength); + mode->name[randr_mode->mode.nameLength] = '\0'; + mode->Clock = randr_mode->mode.dotClock / 1000; + mode->HDisplay = randr_mode->mode.width; + mode->HSyncStart = randr_mode->mode.hSyncStart; + mode->HSyncEnd = randr_mode->mode.hSyncEnd; + mode->HTotal = randr_mode->mode.hTotal; + mode->HSkew = randr_mode->mode.hSkew; + + mode->VDisplay = randr_mode->mode.height; + mode->VSyncStart = randr_mode->mode.vSyncStart; + mode->VSyncEnd = randr_mode->mode.vSyncEnd; + mode->VTotal = randr_mode->mode.vTotal; + + mode->Flags = randr_mode->mode.modeFlags; + randr_mode->devPrivate = mode; + } + if (!output->funcs->mode_valid (output, mode)) + return FALSE; + return TRUE; +} + +static void +xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode) +{ + DisplayModePtr mode = randr_mode->devPrivate; + + if (mode) + { + xfree (mode); + randr_mode->devPrivate = NULL; + } +} + /** * Given a list of xf86 modes and a RandR Output object, construct * RandR modes and assign them to the output @@ -958,6 +1006,8 @@ xf86RandR12Init12 (ScreenPtr pScreen) rp->rrCrtcSet = xf86RandR12CrtcSet; rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma; rp->rrOutputSetProperty = xf86RandR12OutputSetProperty; + rp->rrOutputValidateMode = xf86RandR12OutputValidateMode; + rp->rrModeDestroy = xf86RandR12ModeDestroy; rp->rrSetConfig = NULL; pScrn->PointerMoved = xf86RandR12PointerMoved; if (!xf86RandR12CreateObjects12 (pScreen)) diff --git a/randr/mirandr.c b/randr/mirandr.c index 0b763e111..47136fb96 100644 --- a/randr/mirandr.c +++ b/randr/mirandr.c @@ -73,6 +73,20 @@ miRROutputSetProperty (ScreenPtr pScreen, return TRUE; } +Bool +miRROutputValidateMode (ScreenPtr pScreen, + RROutputPtr output, + RRModePtr mode) +{ + return FALSE; +} + +void +miRRModeDestroy (ScreenPtr pScreen, + RRModePtr mode) +{ +} + /* * This function assumes that only a single depth can be * displayed at a time, but that all visuals of that depth @@ -102,7 +116,8 @@ miRandRInit (ScreenPtr pScreen) pScrPriv->rrCrtcSet = miRRCrtcSet; pScrPriv->rrCrtcSetGamma = miRRCrtcSetGamma; pScrPriv->rrOutputSetProperty = miRROutputSetProperty; - + pScrPriv->rrOutputValidateMode = miRROutputValidateMode; + pScrPriv->rrModeDestroy = miRRModeDestroy; RRScreenSetSizeRange (pScreen, pScreen->width, pScreen->height, diff --git a/randr/randrstr.h b/randr/randrstr.h index 505821269..f6d35cf1d 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -80,7 +80,7 @@ struct _rrMode { xRRModeInfo mode; char *name; void *devPrivate; - Bool userDefined; + ScreenPtr userScreen; }; struct _rrPropertyValue { @@ -135,6 +135,8 @@ struct _rrOutput { int numModes; int numPreferred; RRModePtr *modes; + int numUserModes; + RRModePtr *userModes; Bool changed; RRPropertyPtr properties; void *devPrivate; @@ -164,6 +166,13 @@ typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen, Atom property, RRPropertyValuePtr value); +typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen, + RROutputPtr output, + RRModePtr mode); + +typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, + RRModePtr mode); + #endif typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations); @@ -208,6 +217,8 @@ typedef struct _rrScrPriv { RRCrtcSetProcPtr rrCrtcSet; RRCrtcSetGammaProcPtr rrCrtcSetGamma; RROutputSetPropertyProcPtr rrOutputSetProperty; + RROutputValidateModeProcPtr rrOutputValidateMode; + RRModeDestroyProcPtr rrModeDestroy; #endif /* @@ -394,6 +405,15 @@ miRROutputSetProperty (ScreenPtr pScreen, Atom property, RRPropertyValuePtr value); +Bool +miRROutputValidateMode (ScreenPtr pScreen, + RROutputPtr output, + RRModePtr mode); + +void +miRRModeDestroy (ScreenPtr pScreen, + RRModePtr mode); + /* randr.c */ /* * Send all pending events @@ -549,6 +569,11 @@ Bool RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations); +/* + * Return the area of the frame buffer scanned out by the crtc, + * taking into account the current mode and rotation + */ + void RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height); @@ -672,6 +697,14 @@ RROutputSetModes (RROutputPtr output, int numModes, int numPreferred); +int +RROutputAddUserMode (RROutputPtr output, + RRModePtr mode); + +int +RROutputDeleteUserMode (RROutputPtr output, + RRModePtr mode); + Bool RROutputSetCrtcs (RROutputPtr output, RRCrtcPtr *crtcs, diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index db506f4b0..315dd6c08 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -666,10 +666,15 @@ ProcRRSetCrtcConfig (ClientPtr client) return BadMatch; } /* validate mode for this output */ - for (j = 0; j < outputs[i]->numModes; j++) - if (outputs[i]->modes[j] == mode) + for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++) + { + RRModePtr m = (j < outputs[i]->numModes ? + outputs[i]->modes[j] : + outputs[i]->userModes[j - outputs[i]->numModes]); + if (m == mode) break; - if (j == outputs[i]->numModes) + } + if (j == outputs[i]->numModes + outputs[i]->numUserModes) { if (outputs) xfree (outputs); diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 797cdb1b4..549d501dc 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -157,9 +157,11 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations) pScrPriv->nSizes = 0; /* find size bounds */ - for (i = 0; i < output->numModes; i++) + for (i = 0; i < output->numModes + output->numUserModes; i++) { - RRModePtr mode = output->modes[i]; + RRModePtr mode = (i < output->numModes ? + output->modes[i] : + output->userModes[i-output->numModes]); CARD16 width = mode->mode.width; CARD16 height = mode->mode.height; diff --git a/randr/rrmode.c b/randr/rrmode.c index 261e1b75f..11175810c 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -48,25 +48,13 @@ RRModeEqual (xRRModeInfo *a, xRRModeInfo *b) static int num_modes; static RRModePtr *modes; -RRModePtr -RRModeGet (xRRModeInfo *modeInfo, - const char *name) +static RRModePtr +RRModeCreate (xRRModeInfo *modeInfo, + const char *name, + ScreenPtr userScreen) { - int i; - RRModePtr mode; - RRModePtr *newModes; - - for (i = 0; i < num_modes; i++) - { - mode = modes[i]; - if (RRModeEqual (&mode->mode, modeInfo) && - !memcmp (name, mode->name, modeInfo->nameLength)) - { - ++mode->refcnt; - return mode; - } - } - + RRModePtr mode, *newModes; + if (!RRInit ()) return NULL; @@ -78,7 +66,7 @@ RRModeGet (xRRModeInfo *modeInfo, mode->name = (char *) (mode + 1); memcpy (mode->name, name, modeInfo->nameLength); mode->name[modeInfo->nameLength] = '\0'; - mode->userDefined = FALSE; + mode->userScreen = userScreen; if (num_modes) newModes = xrealloc (modes, (num_modes + 1) * sizeof (RRModePtr)); @@ -104,11 +92,75 @@ RRModeGet (xRRModeInfo *modeInfo, return mode; } +static RRModePtr +RRModeFindByName (const char *name, + CARD16 nameLength) +{ + int i; + RRModePtr mode; + + for (i = 0; i < num_modes; i++) + { + mode = modes[i]; + if (mode->mode.nameLength == nameLength && + !memcmp (name, mode->name, nameLength)) + { + return mode; + } + } + return NULL; +} + +RRModePtr +RRModeGet (xRRModeInfo *modeInfo, + const char *name) +{ + int i; + + for (i = 0; i < num_modes; i++) + { + RRModePtr mode = modes[i]; + if (RRModeEqual (&mode->mode, modeInfo) && + !memcmp (name, mode->name, modeInfo->nameLength)) + { + ++mode->refcnt; + return mode; + } + } + + return RRModeCreate (modeInfo, name, NULL); +} + +static RRModePtr +RRModeCreateUser (ScreenPtr pScreen, + xRRModeInfo *modeInfo, + const char *name, + int *error) +{ + RRModePtr mode; + + mode = RRModeFindByName (name, modeInfo->nameLength); + if (mode) + { + *error = BadName; + return NULL; + } + + mode = RRModeCreate (modeInfo, name, pScreen); + if (!mode) + { + *error = BadAlloc; + return NULL; + } + *error = Success; + return mode; +} + RRModePtr * RRModesForScreen (ScreenPtr pScreen, int *num_ret) { rrScrPriv(pScreen); - int o, c; + int o, c, m; RRModePtr *screen_modes; int num_screen_modes = 0; @@ -122,9 +174,11 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret) RROutputPtr output = pScrPriv->outputs[o]; int m, n; - for (m = 0; m < output->numModes; m++) + for (m = 0; m < output->numModes + output->numUserModes; m++) { - RRModePtr mode = output->modes[m]; + RRModePtr mode = (m < output->numModes ? + output->modes[m] : + output->userModes[m-output->numModes]); for (n = 0; n < num_screen_modes; n++) if (screen_modes[n] == mode) break; @@ -150,6 +204,23 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret) if (n == num_screen_modes) screen_modes[num_screen_modes++] = mode; } + /* + * Add all user modes for this screen + */ + for (m = 0; m < num_modes; m++) + { + RRModePtr mode = modes[m]; + int n; + + if (mode->userScreen != pScreen) + continue; + for (n = 0; n < num_screen_modes; n++) + if (screen_modes[n] == mode) + break; + if (n == num_screen_modes) + screen_modes[num_screen_modes++] = mode; + } + *num_ret = num_screen_modes; return screen_modes; } @@ -205,38 +276,122 @@ int ProcRRCreateMode (ClientPtr client) { REQUEST(xRRCreateModeReq); + xRRCreateModeReply rep; + WindowPtr pWin; + ScreenPtr pScreen; + rrScrPrivPtr pScrPriv; + xRRModeInfo *modeInfo; + long units_after; + char *name; + int error, rc; + RRModePtr mode; - REQUEST_SIZE_MATCH(xRRCreateModeReq); - (void) stuff; - return BadImplementation; + REQUEST_AT_LEAST_SIZE (xRRCreateModeReq); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; + + pScreen = pWin->drawable.pScreen; + pScrPriv = rrGetScrPriv(pScreen); + + modeInfo = &stuff->modeInfo; + name = (char *) (stuff + 1); + units_after = (stuff->length - (sizeof (xRRCreateModeReq) >> 2)); + + /* check to make sure requested name fits within the data provided */ + if ((int) (modeInfo->nameLength + 3) >> 2 > units_after) + return BadLength; + + mode = RRModeCreateUser (pScreen, modeInfo, name, &error); + if (!mode) + return error; + + rep.type = X_Reply; + rep.pad0 = 0; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.mode = mode->mode.id; + if (client->swapped) + { + int n; + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.mode, n); + } + WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep); + + return client->noClientException; } int ProcRRDestroyMode (ClientPtr client) { REQUEST(xRRDestroyModeReq); + RRModePtr mode; REQUEST_SIZE_MATCH(xRRDestroyModeReq); - (void) stuff; - return BadImplementation; + mode = LookupIDByType (stuff->mode, RRModeType); + if (!mode) + { + client->errorValue = stuff->mode; + return RRErrorBase + BadRRMode; + } + if (!mode->userScreen) + return BadMatch; + if (mode->refcnt > 1) + return BadAccess; + FreeResource (stuff->mode, 0); + return Success; } int ProcRRAddOutputMode (ClientPtr client) { REQUEST(xRRAddOutputModeReq); + RRModePtr mode; + RROutputPtr output; REQUEST_SIZE_MATCH(xRRAddOutputModeReq); - (void) stuff; - return BadImplementation; + output = LookupOutput(client, stuff->output, DixReadAccess); + + if (!output) + { + client->errorValue = stuff->output; + return RRErrorBase + BadRROutput; + } + + mode = LookupIDByType (stuff->mode, RRModeType); + if (!mode) + { + client->errorValue = stuff->mode; + return RRErrorBase + BadRRMode; + } + + return RROutputAddUserMode (output, mode); } int ProcRRDeleteOutputMode (ClientPtr client) { REQUEST(xRRDeleteOutputModeReq); + RRModePtr mode; + RROutputPtr output; REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); - (void) stuff; - return BadImplementation; + output = LookupOutput(client, stuff->output, DixReadAccess); + + if (!output) + { + client->errorValue = stuff->output; + return RRErrorBase + BadRROutput; + } + + mode = LookupIDByType (stuff->mode, RRModeType); + if (!mode) + { + client->errorValue = stuff->mode; + return RRErrorBase + BadRRMode; + } + + return RROutputDeleteUserMode (output, mode); } diff --git a/randr/rroutput.c b/randr/rroutput.c index df1741f5c..6e95c9598 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -76,6 +76,8 @@ RROutputCreate (const char *name, output->numModes = 0; output->numPreferred = 0; output->modes = NULL; + output->numUserModes = 0; + output->userModes = NULL; output->properties = NULL; output->changed = FALSE; output->devPrivate = devPrivate; @@ -192,6 +194,74 @@ RROutputSetModes (RROutputPtr output, return TRUE; } +int +RROutputAddUserMode (RROutputPtr output, + RRModePtr mode) +{ + int m; + ScreenPtr pScreen = output->pScreen; + rrScrPriv(pScreen); + RRModePtr *newModes; + + /* Check to see if this mode is already listed for this output */ + for (m = 0; m < output->numModes + output->numUserModes; m++) + { + RRModePtr e = (m < output->numModes ? + output->modes[m] : + output->userModes[m - output->numModes]); + if (mode == e) + return Success; + } + + /* Check with the DDX to see if this mode is OK */ + if (pScrPriv->rrOutputValidateMode) + if (!pScrPriv->rrOutputValidateMode (pScreen, output, mode)) + return BadMatch; + + if (output->userModes) + newModes = xrealloc (output->userModes, + (output->numUserModes + 1) * sizeof (RRModePtr)); + else + newModes = xalloc (sizeof (RRModePtr)); + if (!newModes) + return BadAlloc; + + output->userModes = newModes; + output->userModes[output->numUserModes++] = mode; + ++mode->refcnt; + RROutputChanged (output, TRUE); + RRTellChanged (pScreen); + return Success; +} + +int +RROutputDeleteUserMode (RROutputPtr output, + RRModePtr mode) +{ + int m; + + /* Find this mode in the user mode list */ + for (m = 0; m < output->numUserModes; m++) + { + RRModePtr e = output->userModes[m]; + + if (mode == e) + break; + } + /* Not there, access error */ + if (m == output->numUserModes) + return BadAccess; + + /* make sure the mode isn't active for this output */ + if (output->crtc && output->crtc->mode == mode) + return BadMatch; + + memmove (output->userModes + m, output->userModes + m + 1, + (output->numUserModes - m - 1) * sizeof (RRModePtr)); + RRModeDestroy (mode); + return Success; +} + Bool RROutputSetCrtcs (RROutputPtr output, RRCrtcPtr *crtcs, @@ -308,9 +378,9 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output) * Destroy a Output at shutdown */ void -RROutputDestroy (RROutputPtr crtc) +RROutputDestroy (RROutputPtr output) { - FreeResource (crtc->id, 0); + FreeResource (output->id, 0); } static int @@ -318,6 +388,7 @@ RROutputDestroyResource (pointer value, XID pid) { RROutputPtr output = (RROutputPtr) value; ScreenPtr pScreen = output->pScreen; + int m; if (pScreen) { @@ -335,8 +406,15 @@ RROutputDestroyResource (pointer value, XID pid) } } } + /* XXX destroy all modes? */ if (output->modes) xfree (output->modes); + + for (m = 0; m < output->numUserModes; m++) + RRModeDestroy (output->userModes[m]); + if (output->userModes) + xfree (output->userModes); + if (output->crtcs) xfree (output->crtcs); if (output->clones) @@ -383,7 +461,10 @@ ProcRRGetOutputInfo (ClientPtr client) output = LookupOutput(client, stuff->output, DixReadAccess); if (!output) + { + client->errorValue = stuff->output; return RRErrorBase + BadRROutput; + } pScreen = output->pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -398,13 +479,13 @@ ProcRRGetOutputInfo (ClientPtr client) rep.connection = output->connection; rep.subpixelOrder = output->subpixelOrder; rep.nCrtcs = output->numCrtcs; - rep.nModes = output->numModes; + rep.nModes = output->numModes + output->numUserModes; rep.nPreferred = output->numPreferred; rep.nClones = output->numClones; rep.nameLength = output->nameLength; extraLen = ((output->numCrtcs + - output->numModes + + output->numModes + output->numUserModes + output->numClones + ((rep.nameLength + 3) >> 2)) << 2); @@ -420,7 +501,7 @@ ProcRRGetOutputInfo (ClientPtr client) crtcs = (RRCrtc *) extra; modes = (RRMode *) (crtcs + output->numCrtcs); - clones = (RROutput *) (modes + output->numModes); + clones = (RROutput *) (modes + output->numModes + output->numUserModes); name = (char *) (clones + output->numClones); for (i = 0; i < output->numCrtcs; i++) @@ -429,9 +510,12 @@ ProcRRGetOutputInfo (ClientPtr client) if (client->swapped) swapl (&crtcs[i], n); } - for (i = 0; i < output->numModes; i++) + for (i = 0; i < output->numModes + output->numUserModes; i++) { - modes[i] = output->modes[i]->mode.id; + if (i < output->numModes) + modes[i] = output->modes[i]->mode.id; + else + modes[i] = output->userModes[i - output->numModes]->mode.id; if (client->swapped) swapl (&modes[i], n); } diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 168000351..ad74ac3af 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -473,7 +473,7 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output) { RR10DataPtr data; RRScreenSizePtr size; - int nmode = output->numModes; + int nmode = output->numModes + output->numUserModes; int o, os, l, r; RRScreenRatePtr refresh; CARD16 vRefresh; @@ -500,11 +500,14 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output) /* * find modes not yet listed */ - for (o = 0; o < output->numModes; o++) + for (o = 0; o < output->numModes + output->numUserModes; o++) { if (used[o]) continue; - mode = output->modes[o]; + if (o < output->numModes) + mode = output->modes[o]; + else + mode = output->userModes[o - output->numModes]; l = data->nsize; size[l].id = data->nsize; @@ -524,9 +527,12 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output) /* * Find all modes with matching size */ - for (os = o; os < output->numModes; os++) + for (os = o; os < output->numModes + output->numUserModes; os++) { - mode = output->modes[os]; + if (os < output->numModes) + mode = output->modes[os]; + else + mode = output->userModes[os - output->numModes]; if (mode->mode.width == size[l].width && mode->mode.height == size[l].height) { From 9d0c3b52f25df89738fb1a62ccffda8c8cbb4689 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 20 Feb 2007 23:04:26 -0800 Subject: [PATCH 02/63] Eliminate RRModeRec devPrivate field. The xf86 mode setting code was mis-using this field to try and store a pointer to a DisplayModeRec, however, each output has its own copy of every DisplayModeRec leaving the one in in the RRModeRec devPrivate field pointing at a random DisplayModeRec. Instead of attempting to rectify this, eliminating the devPrivate entirely turned out to be very easy; the DDX code now accepts an arbitrary RRModeRec structure and set that to the hardware, converting it on the fly to a DisplayModeRec as needed. (cherry picked from commit 3506b9376c2b0db09bfff58d64e07af88a6e8195) --- hw/xfree86/modes/xf86RandR12.c | 147 +++++++++++++++++++++++---------- randr/randrstr.h | 1 - 2 files changed, 103 insertions(+), 45 deletions(-) diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 73647a68b..4213fea52 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -556,6 +556,56 @@ xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y) } #if RANDR_12_INTERFACE + +#define FLAG_BITS (RR_HSyncPositive | \ + RR_HSyncNegative | \ + RR_VSyncPositive | \ + RR_VSyncNegative | \ + RR_Interlace | \ + RR_DoubleScan | \ + RR_CSync | \ + RR_CSyncPositive | \ + RR_CSyncNegative | \ + RR_HSkewPresent | \ + RR_BCast | \ + RR_PixelMultiplex | \ + RR_DoubleClock | \ + RR_ClockDivideBy2) + +static Bool +xf86RandRModeMatches (RRModePtr randr_mode, + DisplayModePtr mode) +{ +#if 0 + if (match_name) + { + /* check for same name */ + int len = strlen (mode->name); + if (randr_mode->mode.nameLength != len) return FALSE; + if (memcmp (randr_mode->name, mode->name, len) != 0) return FALSE; + } +#endif + + /* check for same timings */ + if (randr_mode->mode.dotClock / 1000 != mode->Clock) return FALSE; + if (randr_mode->mode.width != mode->HDisplay) return FALSE; + if (randr_mode->mode.hSyncStart != mode->HSyncStart) return FALSE; + if (randr_mode->mode.hSyncEnd != mode->HSyncEnd) return FALSE; + if (randr_mode->mode.hTotal != mode->HTotal) return FALSE; + if (randr_mode->mode.hSkew != mode->HSkew) return FALSE; + if (randr_mode->mode.height != mode->VDisplay) return FALSE; + if (randr_mode->mode.vSyncStart != mode->VSyncStart) return FALSE; + if (randr_mode->mode.vSyncEnd != mode->VSyncEnd) return FALSE; + if (randr_mode->mode.vTotal != mode->VTotal) return FALSE; + + /* check for same flags (using only the XF86 valid flag bits) */ + if ((randr_mode->mode.modeFlags & FLAG_BITS) != (mode->Flags & FLAG_BITS)) + return FALSE; + + /* everything matches */ + return TRUE; +} + static Bool xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc) { @@ -594,12 +644,15 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc) * We make copies of modes, so pointer equality * isn't sufficient */ - for (j = 0; j < randr_output->numModes; j++) + for (j = 0; j < randr_output->numModes + randr_output->numUserModes; j++) { - DisplayModePtr outMode = randr_output->modes[j]->devPrivate; - if (xf86ModesEqual(mode, outMode)) + RRModePtr m = (j < randr_output->numModes ? + randr_output->modes[j] : + randr_output->userModes[j-randr_output->numModes]); + + if (xf86RandRModeMatches (m, mode)) { - randr_mode = randr_output->modes[j]; + randr_mode = m; break; } } @@ -611,6 +664,39 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc) return ret; } +/* + * Convert a RandR mode to a DisplayMode + */ +static void +xf86RandRModeConvert (ScrnInfoPtr scrn, + RRModePtr randr_mode, + DisplayModePtr mode) +{ + mode->prev = NULL; + mode->next = NULL; + mode->name = NULL; + mode->status = MODE_OK; + mode->type = 0; + + mode->Clock = randr_mode->mode.dotClock / 1000; + + mode->HDisplay = randr_mode->mode.width; + mode->HSyncStart = randr_mode->mode.hSyncStart; + mode->HSyncEnd = randr_mode->mode.hSyncEnd; + mode->HTotal = randr_mode->mode.hTotal; + mode->HSkew = randr_mode->mode.hSkew; + + mode->VDisplay = randr_mode->mode.height; + mode->VSyncStart = randr_mode->mode.vSyncStart; + mode->VSyncEnd = randr_mode->mode.vSyncEnd; + mode->VTotal = randr_mode->mode.vTotal; + mode->VScan = 0; + + mode->Flags = randr_mode->mode.modeFlags & FLAG_BITS; + + xf86SetModeCrtc (mode, scrn->adjustFlags); +} + static Bool xf86RandR12CrtcSet (ScreenPtr pScreen, RRCrtcPtr randr_crtc, @@ -624,16 +710,15 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcPtr crtc = randr_crtc->devPrivate; - DisplayModePtr mode = randr_mode ? randr_mode->devPrivate : NULL; Bool changed = FALSE; int o, ro; xf86CrtcPtr *save_crtcs; Bool save_enabled = crtc->enabled; save_crtcs = ALLOCATE_LOCAL(config->num_crtc * sizeof (xf86CrtcPtr)); - if ((mode != NULL) != crtc->enabled) + if ((randr_mode != NULL) != crtc->enabled) changed = TRUE; - else if (mode && !xf86ModesEqual (&crtc->mode, mode)) + else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode)) changed = TRUE; if (rotation != crtc->rotation) @@ -667,11 +752,14 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, /* XXX need device-independent mode setting code through an API */ if (changed) { - crtc->enabled = mode != NULL; + crtc->enabled = randr_mode != NULL; - if (mode) + if (randr_mode) { - if (!xf86CrtcSetMode (crtc, mode, rotation, x, y)) + DisplayModeRec mode; + + xf86RandRModeConvert (pScrn, randr_mode, &mode); + if (!xf86CrtcSetMode (crtc, &mode, rotation, x, y)) { crtc->enabled = save_enabled; for (o = 0; o < config->num_output; o++) @@ -685,7 +773,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, /* * Save the last successful setting for EnterVT */ - crtc->desiredMode = *mode; + crtc->desiredMode = mode; crtc->desiredRotation = rotation; crtc->desiredX = x; crtc->desiredY = y; @@ -733,33 +821,12 @@ xf86RandR12OutputValidateMode (ScreenPtr pScreen, RROutputPtr randr_output, RRModePtr randr_mode) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; xf86OutputPtr output = randr_output->devPrivate; - DisplayModePtr mode = randr_mode->devPrivate; + DisplayModeRec mode; - if (!mode) - { - mode = xalloc (sizeof (DisplayModeRec) + randr_mode->mode.nameLength + 1); - if (!mode) - return FALSE; - mode->name = (char *) mode + 1; - memcpy (mode->name, randr_mode->name, randr_mode->mode.nameLength); - mode->name[randr_mode->mode.nameLength] = '\0'; - mode->Clock = randr_mode->mode.dotClock / 1000; - mode->HDisplay = randr_mode->mode.width; - mode->HSyncStart = randr_mode->mode.hSyncStart; - mode->HSyncEnd = randr_mode->mode.hSyncEnd; - mode->HTotal = randr_mode->mode.hTotal; - mode->HSkew = randr_mode->mode.hSkew; - - mode->VDisplay = randr_mode->mode.height; - mode->VSyncStart = randr_mode->mode.vSyncStart; - mode->VSyncEnd = randr_mode->mode.vSyncEnd; - mode->VTotal = randr_mode->mode.vTotal; - - mode->Flags = randr_mode->mode.modeFlags; - randr_mode->devPrivate = mode; - } - if (!output->funcs->mode_valid (output, mode)) + xf86RandRModeConvert (pScrn, randr_mode, &mode); + if (output->funcs->mode_valid (output, &mode) != MODE_OK) return FALSE; return TRUE; } @@ -767,13 +834,6 @@ xf86RandR12OutputValidateMode (ScreenPtr pScreen, static void xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode) { - DisplayModePtr mode = randr_mode->devPrivate; - - if (mode) - { - xfree (mode); - randr_mode->devPrivate = NULL; - } } /** @@ -822,7 +882,6 @@ xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes) rrmode = RRModeGet (&modeInfo, mode->name); if (rrmode) { - rrmode->devPrivate = mode; rrmodes[nmode++] = rrmode; npreferred += pref; } diff --git a/randr/randrstr.h b/randr/randrstr.h index f6d35cf1d..0dee99921 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -79,7 +79,6 @@ struct _rrMode { int refcnt; xRRModeInfo mode; char *name; - void *devPrivate; ScreenPtr userScreen; }; From 2489dae9f7def788910eee5733931392df83a0d6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 15 Mar 2007 20:26:07 -0700 Subject: [PATCH 03/63] Correct ref counting of RRMode structures RRModes are referenced by the resource db, RROutput and RRCrtc structures. Ensure that the mode reference count is decremented each time a reference is lost from one of these sources. The missing destroys were in RRCrtcDestroyResource and RROutputDestroyResource, which only happen at server reset time, so modes would be unavailable in subsequent server generations. --- randr/rrcrtc.c | 2 ++ randr/rroutput.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 315dd6c08..ecf5bb251 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -361,6 +361,8 @@ RRCrtcDestroyResource (pointer value, XID pid) } if (crtc->gammaRed) xfree (crtc->gammaRed); + if (crtc->mode) + RRModeDestroy (crtc->mode); xfree (crtc); return 1; } diff --git a/randr/rroutput.c b/randr/rroutput.c index 6e95c9598..160071bcf 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -406,9 +406,12 @@ RROutputDestroyResource (pointer value, XID pid) } } } - /* XXX destroy all modes? */ if (output->modes) + { + for (m = 0; m < output->numModes; m++) + RRModeDestroy (output->modes[m]); xfree (output->modes); + } for (m = 0; m < output->numUserModes; m++) RRModeDestroy (output->userModes[m]); From b5a8a71e64c76b8dd42962cbd7984215c6ce4aa8 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 17 Mar 2007 17:26:11 -0700 Subject: [PATCH 04/63] Remove extra (and wrong) I2C ByteTimeout setting in DDC code. The DDC code sets the I2C timeouts to VESA standards, except that it had an extra setting of the ByteTimeout value which was wrong (off by a factor of 50). Removing this should help DDC work on many more monitors. Note that the Intel driver duplicated these settings, along with the error. Yay for cult and paste coding. --- hw/xfree86/ddc/xf86DDC.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 4ce585c9f..0f24c520e 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -344,7 +344,6 @@ DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len) dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ dev->StartTimeout = 550; dev->BitTimeout = 40; - dev->ByteTimeout = 40; dev->AcknTimeout = 40; dev->pI2CBus = pBus; From 720f302d241e88e6e9f2962207da1aa9a79728b7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 17 Mar 2007 20:14:05 -0700 Subject: [PATCH 05/63] Slow down DDC I2C bus using a RiseFallTime of 20us for old monitors. This time value makes the bus run slowly enough for even the least reliable of monitors. Thanks to Pavel Troller for finding the necessary change. --- hw/xfree86/ddc/xf86DDC.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 0f24c520e..8080c8d2a 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -337,6 +337,12 @@ DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len) unsigned char *R_Buffer; int i; + /* + * Slow down the bus so that older monitors don't + * miss things. + */ + pBus->RiseFallTime = 20; + if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) { dev = xf86CreateI2CDevRec(); dev->DevName = "ddc2"; From b8df961843a95b29258ae9c5d46ccfc620d8de1c Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 19 Mar 2007 18:03:26 -0700 Subject: [PATCH 06/63] Define XF86PM on Solaris x86 builds now that we have sun_apm.c --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index fe7770986..14c4ccbda 100644 --- a/configure.ac +++ b/configure.ac @@ -1413,6 +1413,8 @@ return 0;} fi if test "${OS_MINOR}" -lt 8 ; then solaris_usl_console="yes" + else + XORG_CFLAGS="$XORG_CFLAGS -DXF86PM" fi ;; *) From 80d29475b9a2ebbb303a8e324e09a15c528d5556 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 21 Mar 2007 00:10:38 +0200 Subject: [PATCH 07/63] mieq: Allow event handlers for arbitrary events to be set Allow arbitrary events to use mieq by letting custom handlers be set. --- mi/mi.h | 3 +++ mi/mieq.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/mi/mi.h b/mi/mi.h index 8d9d120bd..53b5c4487 100644 --- a/mi/mi.h +++ b/mi/mi.h @@ -186,6 +186,9 @@ extern void mieqProcessInputEvents( void ); +typedef void (*mieqHandler)(int, xEventPtr, DeviceIntPtr, int); +void mieqSetHandler(int event, mieqHandler handler); + /* miexpose.c */ extern RegionPtr miHandleExposures( diff --git a/mi/mieq.c b/mi/mieq.c index 507cdd337..5bd87ebdb 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -74,6 +74,7 @@ typedef struct _EventQueue { EventRec events[QUEUE_SIZE]; /* static allocation for signals */ ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ + mieqHandler handlers[128]; /* custom event handler */ } EventQueueRec, *EventQueuePtr; static EventQueueRec miEventQueue; @@ -81,11 +82,15 @@ static EventQueueRec miEventQueue; Bool mieqInit() { + int i; + miEventQueue.head = miEventQueue.tail = 0; miEventQueue.lastEventTime = GetTimeInMillis (); miEventQueue.lastMotion = FALSE; miEventQueue.pEnqueueScreen = screenInfo.screens[0]; miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen; + for (i = 0; i < 128; i++) + miEventQueue.handlers[i] = NULL; SetInputCheck(&miEventQueue.head, &miEventQueue.tail); return TRUE; } @@ -178,6 +183,16 @@ mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX) miEventQueue.pDequeueScreen = pScreen; } +void +mieqSetHandler(int event, mieqHandler handler) +{ + if (handler && miEventQueue.handlers[event]) + ErrorF("mieq: warning: overriding existing handler %p with %p for " + "event %d\n", miEventQueue.handlers[event], handler, event); + + miEventQueue.handlers[event] = handler; +} + /* Call this from ProcessInputEvents(). */ void mieqProcessInputEvents() @@ -215,6 +230,15 @@ mieqProcessInputEvents() else ++miEventQueue.head; + /* If someone's registered a custom event handler, let them + * steal it. */ + if (miEventQueue.handlers[e->event->u.u.type]) { + miEventQueue.handlers[e->event->u.u.type](miEventQueue.pDequeueScreen->myNum, + e->event, dev, + e->nevents); + return; + } + /* If this is a core event, make sure our keymap, et al, is * changed to suit. */ if (e->event[0].u.u.type == KeyPress || From 0f75c47e0c5f4b2778930a6fabf894fc1dffd9d3 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 21 Mar 2007 00:12:02 +0200 Subject: [PATCH 08/63] xfree86 input: Re-enable DGA support Re-enable DGA support for relative mouse motion. --- hw/xfree86/common/xf86DGA.c | 180 ++++++++++++++++++++-------- hw/xfree86/common/xf86Xinput.c | 37 ++++++ hw/xfree86/common/xf86Xinput.h | 4 + hw/xfree86/dixmods/extmod/dgaproc.h | 5 +- 4 files changed, 177 insertions(+), 49 deletions(-) diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 204457fb1..28058b5ea 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -51,11 +51,14 @@ static unsigned long DGAGeneration = 0; static int DGAScreenIndex = -1; +static int mieq_installed = 0; static Bool DGACloseScreen(int i, ScreenPtr pScreen); static void DGADestroyColormap(ColormapPtr pmap); static void DGAInstallColormap(ColormapPtr pmap); static void DGAUninstallColormap(ColormapPtr pmap); +static void DGAHandleEvent(int screen_num, xEvent *event, + DeviceIntPtr device, int nevents); static void DGACopyModeInfo( @@ -96,7 +99,6 @@ typedef struct { Bool grabKeyboard; } DGAScreenRec, *DGAScreenPtr; - _X_EXPORT Bool DGAInit( ScreenPtr pScreen, @@ -146,7 +148,6 @@ DGAInit( modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; #endif - pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = DGACloseScreen; @@ -157,11 +158,6 @@ DGAInit( pScreenPriv->UninstallColormap = pScreen->UninstallColormap; pScreen->UninstallColormap = DGAUninstallColormap; - /* - * This is now set in InitOutput(). - * - pScrn->SetDGAMode = xf86SetDGAMode; - */ return TRUE; } @@ -247,12 +243,22 @@ FreeMarkedVisuals(ScreenPtr pScreen) } } - static Bool DGACloseScreen(int i, ScreenPtr pScreen) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + if (XDGAEventBase) { + OsBlockSignals(); + ProcessInputEvents(); + mieqSetHandler(*XDGAEventBase + MotionNotify, NULL); + mieqSetHandler(*XDGAEventBase + ButtonPress, NULL); + mieqSetHandler(*XDGAEventBase + ButtonRelease, NULL); + mieqSetHandler(*XDGAEventBase + KeyPress, NULL); + mieqSetHandler(*XDGAEventBase + KeyRelease, NULL); + OsReleaseSignals(); + } + FreeMarkedVisuals(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; @@ -462,6 +468,15 @@ DGASetInputMode(int index, Bool keyboard, Bool mouse) { pScreenPriv->grabMouse = mouse; pScreenPriv->grabKeyboard = keyboard; + + if (!mieq_installed) { + mieqSetHandler(*XDGAEventBase + MotionNotify, DGAHandleEvent); + mieqSetHandler(*XDGAEventBase + ButtonPress, DGAHandleEvent); + mieqSetHandler(*XDGAEventBase + ButtonRelease, DGAHandleEvent); + mieqSetHandler(*XDGAEventBase + KeyPress, DGAHandleEvent); + mieqSetHandler(*XDGAEventBase + KeyRelease, DGAHandleEvent); + mieq_installed = 1; + } } } @@ -903,21 +918,93 @@ DGAVTSwitch(void) return TRUE; } - -/* We have the power to steal or modify events that are about to get queued */ - Bool -DGAStealKeyEvent(int index, xEvent *e) +DGAStealKeyEvent(int index, int key_code, int is_down) { -} + DGAScreenPtr pScreenPriv; + dgaEvent de; + + if(DGAScreenIndex < 0) /* no DGA */ + return FALSE; + + pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); + + if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */ + return FALSE; + + de.u.u.type = *XDGAEventBase + (is_down ? KeyPress : KeyRelease); + de.u.u.detail = key_code; + de.u.event.time = GetTimeInMillis(); + mieqEnqueue (inputInfo.keyboard, (xEvent *) &de); + + return TRUE; +} static int DGAMouseX, DGAMouseY; Bool -DGAStealMouseEvent(int index, xEvent *e, int dx, int dy) +DGAStealMotionEvent(int index, int dx, int dy) { + DGAScreenPtr pScreenPriv; + dgaEvent de; + + if(DGAScreenIndex < 0) /* no DGA */ + return FALSE; + + pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); + + if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */ + return FALSE; + + DGAMouseX += dx; + if (DGAMouseX < 0) + DGAMouseX = 0; + else if (DGAMouseX > screenInfo.screens[index]->width) + DGAMouseX = screenInfo.screens[index]->width; + DGAMouseY += dy; + if (DGAMouseY < 0) + DGAMouseY = 0; + else if (DGAMouseY > screenInfo.screens[index]->height) + DGAMouseY = screenInfo.screens[index]->height; + de.u.u.type = *XDGAEventBase + MotionNotify; + de.u.u.detail = 0; + de.u.event.time = GetTimeInMillis(); + de.u.event.dx = dx; + de.u.event.dy = dy; + de.u.event.pad1 = DGAMouseX; + de.u.event.pad2 = DGAMouseY; + mieqEnqueue (inputInfo.pointer, (xEvent *) &de); + return TRUE; } +Bool +DGAStealButtonEvent(int index, int button, int is_down) +{ + DGAScreenPtr pScreenPriv; + dgaEvent de; + + if (DGAScreenIndex < 0) + return FALSE; + + pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); + + if (!pScreenPriv || !pScreenPriv->grabMouse) + return FALSE; + + de.u.u.type = *XDGAEventBase + (is_down ? ButtonPress : ButtonRelease); + de.u.u.detail = button; + de.u.event.time = GetTimeInMillis(); + de.u.event.dx = 0; + de.u.event.dy = 0; + de.u.event.pad1 = DGAMouseX; + de.u.event.pad2 = DGAMouseY; + mieqEnqueue (inputInfo.pointer, (xEvent *) &de); + + return TRUE; +} + +/* We have the power to steal or modify events that are about to get queued */ + Bool DGAIsDgaEvent (xEvent *e) { @@ -1124,39 +1211,6 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse) } } -Bool -DGADeliverEvent (ScreenPtr pScreen, xEvent *e) -{ - dgaEvent *de = (dgaEvent *) e; - DGAScreenPtr pScreenPriv; - int coreEquiv; - - /* no DGA */ - if (DGAScreenIndex < 0 || XDGAEventBase == 0) - return FALSE; - pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - /* DGA not initialized on this screen */ - if (!pScreenPriv) - return FALSE; - - coreEquiv = de->u.u.type - *XDGAEventBase; - /* Not a DGA event */ - if (coreEquiv < KeyPress || coreEquiv > MotionNotify) - return FALSE; - - switch (coreEquiv) { - case KeyPress: - case KeyRelease: - DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard); - break; - default: - DGAProcessPointerEvent (pScreen, de, inputInfo.pointer); - break; - } - return TRUE; -} - _X_EXPORT Bool DGAOpenFramebuffer( int index, @@ -1215,3 +1269,35 @@ DGAGetOldDGAMode(int index) return 0; } +static void +DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents) +{ + dgaEvent *de = (dgaEvent *) event; + ScreenPtr pScreen = screenInfo.screens[screen_num]; + DGAScreenPtr pScreenPriv; + int coreEquiv; + + /* no DGA */ + if (DGAScreenIndex < 0 || XDGAEventBase == 0) + return; + pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + + /* DGA not initialized on this screen */ + if (!pScreenPriv) + return; + + coreEquiv = de->u.u.type - *XDGAEventBase; + /* Not a DGA event; shouldn't happen, but you never know. */ + if (coreEquiv < KeyPress || coreEquiv > MotionNotify) + return; + + switch (coreEquiv) { + case KeyPress: + case KeyRelease: + DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard); + break; + default: + DGAProcessPointerEvent (pScreen, de, inputInfo.pointer); + break; + } +} diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 16e330d43..b8f4b69e4 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -90,6 +90,10 @@ #include "mi.h" +#ifdef XFreeXDGA +#include "dgaproc.h" +#endif + xEvent *xf86Events = NULL; static Bool @@ -395,10 +399,12 @@ xf86PostMotionEvent(DeviceIntPtr device, { va_list var; int i = 0, nevents = 0; + int dx, dy; Bool drag = xf86SendDragEvents(device); int *valuators = NULL; int flags = 0; xEvent *xE = NULL; + int index; if (is_absolute) flags = POINTER_ABSOLUTE; @@ -412,6 +418,22 @@ xf86PostMotionEvent(DeviceIntPtr device, valuators[i] = va_arg(var, int); va_end(var); +#if XFreeXDGA + if (first_valuator == 0 && num_valuators >= 2) { + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (is_absolute) { + dx = valuators[0] - device->valuator->lastx; + dy = valuators[1] - device->valuator->lasty; + } + else { + dx = valuators[0]; + dy = valuators[1]; + } + if (DGAStealMotionEvent(index, dx, dy)) + goto out; + } +#endif + if (!xf86Events) xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); if (!xf86Events) @@ -430,6 +452,7 @@ xf86PostMotionEvent(DeviceIntPtr device, } } +out: xfree(valuators); } @@ -476,6 +499,13 @@ xf86PostButtonEvent(DeviceIntPtr device, va_list var; int *valuators = NULL; int i = 0, nevents = 0; + int index; + +#if XFreeXDGA + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (DGAStealButtonEvent(index, button, is_down)) + return; +#endif valuators = xcalloc(sizeof(int), num_valuators); @@ -552,6 +582,13 @@ xf86PostKeyboardEvent(DeviceIntPtr device, int is_down) { int nevents = 0, i = 0; + int index; + +#if XFreeXDGA + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (DGAStealKeyEvent(index, key_code, is_down)) + return; +#endif if (!xf86Events) xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h index fe65643ce..47dbc7023 100644 --- a/hw/xfree86/common/xf86Xinput.h +++ b/hw/xfree86/common/xf86Xinput.h @@ -191,6 +191,10 @@ InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags); InputDriverPtr xf86LookupInputDriver(const char *name); InputInfoPtr xf86LookupInput(const char *name); void xf86DeleteInput(InputInfoPtr pInp, int flags); +void xf86MotionHistoryAllocate(LocalDevicePtr local); +int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff, + unsigned long start, unsigned long stop, + ScreenPtr pScreen); /* xf86Option.c */ void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts, diff --git a/hw/xfree86/dixmods/extmod/dgaproc.h b/hw/xfree86/dixmods/extmod/dgaproc.h index 5e424afb2..aaea4e20c 100644 --- a/hw/xfree86/dixmods/extmod/dgaproc.h +++ b/hw/xfree86/dixmods/extmod/dgaproc.h @@ -120,8 +120,9 @@ int DGAGetOldDGAMode(int Index); int DGAGetModeInfo(int Index, XDGAModePtr mode, int num); Bool DGAVTSwitch(void); -Bool DGAStealMouseEvent(int Index, xEvent *e, int dx, int dy); -Bool DGAStealKeyEvent(int Index, xEvent *e); +Bool DGAStealButtonEvent(int Index, int button, int is_down); +Bool DGAStealMotionEvent(int Index, int dx, int dy); +Bool DGAStealKeyEvent(int Index, int key_code, int is_down); Bool DGAIsDgaEvent (xEvent *e); Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e); From 9398d62f27ee1b287e4458fd8b011c10f7b59efd Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 21 Mar 2007 00:18:24 +0200 Subject: [PATCH 09/63] XFree86 input: Add backwards compatibility for motion history Add the old motion history API back, as a shim around the new mi API. --- hw/xfree86/common/xf86Helper.c | 13 +++++++++++++ hw/xfree86/common/xf86Xinput.c | 3 +++ hw/xfree86/common/xf86Xinput.h | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 93c89fd5f..913735bc9 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -2981,3 +2981,16 @@ xf86IsUnblank(int mode) return TRUE; } } + +_X_EXPORT void +xf86MotionHistoryAllocate(LocalDevicePtr local) +{ + AllocateMotionHistory(local->dev); +} + +_X_EXPORT int +xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start, + unsigned long stop, ScreenPtr pScreen) +{ + return GetMotionHistory(pDev, buff, start, stop, pScreen); +} diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index b8f4b69e4..c9c8059c0 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -132,6 +132,9 @@ xf86ProcessCommonOptions(LocalDevicePtr local, } else { xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name); } + + /* Backwards compatibility. */ + local->history_size = GetMotionHistorySize(); } /*********************************************************************** diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h index 47dbc7023..b2bc8dec1 100644 --- a/hw/xfree86/common/xf86Xinput.h +++ b/hw/xfree86/common/xf86Xinput.h @@ -86,6 +86,9 @@ #define XI_PRIVATE(dev) \ (((LocalDevicePtr)((dev)->public.devicePrivate))->private) +/* Stupid API backwards-compatibility. */ +#define TS_Raw 60 +#define TS_Scaled 61 #ifdef XINPUT /* This holds the input driver entry and module information. */ @@ -144,6 +147,7 @@ typedef struct _LocalDeviceRec { InputDriverPtr drv; pointer module; pointer options; + unsigned int history_size; } LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr; typedef struct _DeviceAssocRec From 021fc5cb2cb4a7972b4a6fcb570c1da92787d68d Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 18 Mar 2007 16:31:19 -0400 Subject: [PATCH 10/63] Static markup and dead code cull over xkb/. The former has been pulled into the server now as include/xkbsrv.h, and the world updated to look for it in the new place, since it made no sense to define server API in an extension header. Any further work along this line will need to do similar things with XKBgeom.h and friends. --- Xext/xevie.c | 2 +- dix/devices.c | 2 +- dix/dispatch.c | 2 +- dix/events.c | 2 +- dix/getevents.c | 2 +- hw/dmx/dmxclient.h | 4 +- hw/kdrive/src/kinput.c | 2 +- hw/xfree86/common/xf86Config.c | 2 +- hw/xfree86/common/xf86DGA.c | 2 +- hw/xfree86/common/xf86XKB.c | 2 +- hw/xfree86/dixmods/xkbKillSrv.c | 2 +- hw/xfree86/dixmods/xkbPrivate.c | 2 +- hw/xfree86/dixmods/xkbVT.c | 2 +- hw/xfree86/loader/dixsym.c | 2 +- hw/xgl/egl/kinput.c | 2 +- hw/xgl/glx/xglx.c | 2 +- hw/xnest/Keyboard.c | 2 +- hw/xwin/InitOutput.c | 2 +- hw/xwin/winconfig.c | 2 +- hw/xwin/winkeybd.c | 2 +- include/xkbsrv.h | 1022 +++++++++++++++++++++++++++++++ os/utils.c | 2 +- xkb/Makefile.am | 3 +- xkb/XKBAlloc.c | 157 +---- xkb/XKBGAlloc.c | 2 +- xkb/XKBMAlloc.c | 80 +-- xkb/XKBMisc.c | 183 +----- xkb/ddxBeep.c | 2 +- xkb/ddxCtrls.c | 2 +- xkb/ddxDevBtn.c | 2 +- xkb/ddxFakeBtn.c | 2 +- xkb/ddxFakeMtn.c | 2 +- xkb/ddxInit.c | 2 +- xkb/ddxKeyClick.c | 2 +- xkb/ddxKillSrv.c | 2 +- xkb/ddxLEDs.c | 4 +- xkb/ddxList.c | 2 +- xkb/ddxLoad.c | 8 +- xkb/ddxPrivate.c | 2 +- xkb/ddxVT.c | 2 +- xkb/maprules.c | 2 +- xkb/xkb.c | 63 +- xkb/xkb.h | 42 -- xkb/xkbAccessX.c | 8 +- xkb/xkbActions.c | 8 +- xkb/xkbDflts.h | 37 -- xkb/xkbEvents.c | 46 +- xkb/xkbInit.c | 26 +- xkb/xkbLEDs.c | 453 +++++--------- xkb/xkbPrKeyEv.c | 2 +- xkb/xkbSwap.c | 2 +- xkb/xkbUtils.c | 57 +- xkb/xkberrs.c | 31 - xkb/xkbfmisc.c | 109 +--- xkb/xkbout.c | 126 +--- xkb/xkbtext.c | 96 +-- xkb/xkmread.c | 14 +- 57 files changed, 1269 insertions(+), 1378 deletions(-) create mode 100644 include/xkbsrv.h diff --git a/Xext/xevie.c b/Xext/xevie.c index e979e7e4d..2fd68f8ce 100644 --- a/Xext/xevie.c +++ b/Xext/xevie.c @@ -52,7 +52,7 @@ of the copyright holder. #include "inputstr.h" #include "windowstr.h" #include "cursorstr.h" -#include +#include #include "../os/osdep.h" diff --git a/dix/devices.c b/dix/devices.c index 8eb54f770..f73841932 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -67,7 +67,7 @@ SOFTWARE. #define XKB_IN_SERVER #endif #ifdef XKB -#include +#include #endif #include "xace.h" diff --git a/dix/dispatch.c b/dix/dispatch.c index b258aa6f4..32f67886e 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -143,7 +143,7 @@ int ProcInitialConnection(); #define XKB_IN_SERVER #endif #include "inputstr.h" -#include +#include #endif #ifdef XSERVER_DTRACE diff --git a/dix/events.c b/dix/events.c index c0b62b826..02598a394 100644 --- a/dix/events.c +++ b/dix/events.c @@ -133,7 +133,7 @@ of the copyright holder. #ifdef XKB #include -#include +#include extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); #endif diff --git a/dix/getevents.c b/dix/getevents.c index 935112d85..3f636bc80 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -44,7 +44,7 @@ #ifdef XKB #include -#include +#include extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies); #endif diff --git a/hw/dmx/dmxclient.h b/hw/dmx/dmxclient.h index 586b82990..657a1275f 100644 --- a/hw/dmx/dmxclient.h +++ b/hw/dmx/dmxclient.h @@ -126,7 +126,7 @@ typedef XID KeySym64; #undef KeySym #endif -/* These are in exglobals.h, but that conflicts with X11/extensions/XKBsrv.h */ +/* These are in exglobals.h, but that conflicts with xkbsrv.h */ extern int ProximityIn; extern int ProximityOut; extern int DeviceValuator; @@ -144,7 +144,7 @@ extern int ChangeDeviceNotify; #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include +#include #undef XPointer #endif #include diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 3bf6bad2b..857f04f6d 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -42,7 +42,7 @@ #endif #ifdef XKB -#include +#include #endif #include diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index c0e21dd5e..1bd3c62f1 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -75,7 +75,7 @@ extern DeviceAssocRec mouse_assoc; #ifdef XKB #undef XKB_IN_SERVER #define XKB_IN_SERVER -#include +#include #endif #ifdef RENDER diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 28058b5ea..43db1ee1a 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -43,7 +43,7 @@ #include "servermd.h" #include "micmap.h" #ifdef XKB -#include +#include #endif #include "xf86Xinput.h" diff --git a/hw/xfree86/common/xf86XKB.c b/hw/xfree86/common/xf86XKB.c index 399eb02d9..b805885bd 100644 --- a/hw/xfree86/common/xf86XKB.c +++ b/hw/xfree86/common/xf86XKB.c @@ -73,7 +73,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XF86_OS_PRIVS #include "xf86_OSlib.h" -#include +#include void xf86InitXkb(void) diff --git a/hw/xfree86/dixmods/xkbKillSrv.c b/hw/xfree86/dixmods/xkbKillSrv.c index 415873ad0..b3399db4a 100644 --- a/hw/xfree86/dixmods/xkbKillSrv.c +++ b/hw/xfree86/dixmods/xkbKillSrv.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include #include "xf86.h" diff --git a/hw/xfree86/dixmods/xkbPrivate.c b/hw/xfree86/dixmods/xkbPrivate.c index e6d4f0fc0..e0cd21739 100644 --- a/hw/xfree86/dixmods/xkbPrivate.c +++ b/hw/xfree86/dixmods/xkbPrivate.c @@ -12,7 +12,7 @@ #include #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #include "xf86.h" diff --git a/hw/xfree86/dixmods/xkbVT.c b/hw/xfree86/dixmods/xkbVT.c index a1cdc7016..e6d69e2eb 100644 --- a/hw/xfree86/dixmods/xkbVT.c +++ b/hw/xfree86/dixmods/xkbVT.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include #include "xf86.h" diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index 594bf4377..5d06b05c7 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -86,7 +86,7 @@ #endif #include "selection.h" #ifdef XKB -#include +#include extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval; #endif diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c index b374bf580..5fd23f568 100644 --- a/hw/xgl/egl/kinput.c +++ b/hw/xgl/egl/kinput.c @@ -41,7 +41,7 @@ #ifdef XKB #define XKB_IN_SERVER -#include +#include #endif static DeviceIntPtr pKdKeyboard, pKdPointer; diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c index 57cb84702..92974f0d4 100644 --- a/hw/xgl/glx/xglx.c +++ b/hw/xgl/glx/xglx.c @@ -50,7 +50,7 @@ #ifdef XKB #include -#include +#include #include extern Bool diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index 0dacae70b..bb3cb1376 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -36,7 +36,7 @@ is" without express or implied warranty. #ifdef XKB #include -#include +#include #include extern Bool diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 39a5eda7f..9457c9cc7 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -44,7 +44,7 @@ from The Open Group. #include #endif #if defined(XKB) && defined(WIN32) -#include +#include #endif #ifdef RELOCATE_PROJECTROOT #include diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c index e3d18083e..2c1877172 100644 --- a/hw/xwin/winconfig.c +++ b/hw/xwin/winconfig.c @@ -40,7 +40,7 @@ #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include +#include #endif #ifdef XWIN_XF86CONFIG diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index 164e39160..d574f2053 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -44,7 +44,7 @@ #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include +#include #endif static Bool g_winKeyState[NUM_KEYCODES]; diff --git a/include/xkbsrv.h b/include/xkbsrv.h new file mode 100644 index 000000000..5edee539b --- /dev/null +++ b/include/xkbsrv.h @@ -0,0 +1,1022 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBSRV_H_ +#define _XKBSRV_H_ + +#ifdef XKB_IN_SERVER +#define XkbAllocClientMap SrvXkbAllocClientMap +#define XkbAllocServerMap SrvXkbAllocServerMap +#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey +#define XkbCopyKeyTypes SrvXkbCopyKeyTypes +#define XkbFreeClientMap SrvXkbFreeClientMap +#define XkbFreeServerMap SrvXkbFreeServerMap +#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols +#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey +#define XkbResizeKeyActions SrvXkbResizeKeyActions +#define XkbResizeKeySyms SrvXkbResizeKeySyms +#define XkbResizeKeyType SrvXkbResizeKeyType +#define XkbAllocCompatMap SrvXkbAllocCompatMap +#define XkbAllocControls SrvXkbAllocControls +#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps +#define XkbAllocKeyboard SrvXkbAllocKeyboard +#define XkbAllocNames SrvXkbAllocNames +#define XkbFreeCompatMap SrvXkbFreeCompatMap +#define XkbFreeKeyboard SrvXkbFreeKeyboard +#define XkbFreeNames SrvXkbFreeNames +#define XkbLatchModifiers SrvXkbLatchModifiers +#define XkbLatchGroup SrvXkbLatchGroup +#define XkbVirtualModsToReal SrvXkbVirtualModsToReal +#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange +#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges +#endif + +#include +#include +#include "inputstr.h" + +typedef struct _XkbInterest { + DeviceIntPtr dev; + ClientPtr client; + XID resource; + struct _XkbInterest * next; + CARD16 extDevNotifyMask; + CARD16 stateNotifyMask; + CARD16 namesNotifyMask; + CARD32 ctrlsNotifyMask; + CARD8 compatNotifyMask; + BOOL bellNotifyMask; + BOOL actionMessageMask; + CARD16 accessXNotifyMask; + CARD32 iStateNotifyMask; + CARD32 iMapNotifyMask; + CARD16 altSymsNotifyMask; + CARD32 autoCtrls; + CARD32 autoCtrlValues; +} XkbInterestRec,*XkbInterestPtr; + +typedef struct _XkbRadioGroup { + CARD8 flags; + CARD8 nMembers; + CARD8 dfltDown; + CARD8 currentDown; + CARD8 members[XkbRGMaxMembers]; +} XkbRadioGroupRec, *XkbRadioGroupPtr; + +typedef struct _XkbEventCause { + CARD8 kc; + CARD8 event; + CARD8 mjr; + CARD8 mnr; + ClientPtr client; +} XkbEventCauseRec,*XkbEventCausePtr; +#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ + (c)->mjr= (c)->mnr= 0; \ + (c)->client= NULL; } +#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ + (c)->mjr= (j),(c)->mnr= (n);\ + (c)->client= (cl); } +#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) +#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) +#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) + +#define _OFF_TIMER 0 +#define _KRG_WARN_TIMER 1 +#define _KRG_TIMER 2 +#define _SK_TIMEOUT_TIMER 3 +#define _ALL_TIMEOUT_TIMER 4 + +#define _BEEP_NONE 0 +#define _BEEP_FEATURE_ON 1 +#define _BEEP_FEATURE_OFF 2 +#define _BEEP_FEATURE_CHANGE 3 +#define _BEEP_SLOW_WARN 4 +#define _BEEP_SLOW_PRESS 5 +#define _BEEP_SLOW_ACCEPT 6 +#define _BEEP_SLOW_REJECT 7 +#define _BEEP_SLOW_RELEASE 8 +#define _BEEP_STICKY_LATCH 9 +#define _BEEP_STICKY_LOCK 10 +#define _BEEP_STICKY_UNLOCK 11 +#define _BEEP_LED_ON 12 +#define _BEEP_LED_OFF 13 +#define _BEEP_LED_CHANGE 14 +#define _BEEP_BOUNCE_REJECT 15 + +typedef struct _XkbSrvInfo { + XkbStateRec prev_state; + XkbStateRec state; + XkbDescPtr desc; + + DeviceIntPtr device; + KbdCtrlProcPtr kbdProc; + + XkbRadioGroupPtr radioGroups; + CARD8 nRadioGroups; + CARD8 clearMods; + CARD8 setMods; + INT16 groupChange; + + CARD16 dfltPtrDelta; + + double mouseKeysCurve; + double mouseKeysCurveFactor; + INT16 mouseKeysDX; + INT16 mouseKeysDY; + CARD8 mouseKeysFlags; + Bool mouseKeysAccel; + CARD8 mouseKeysCounter; + + CARD8 lockedPtrButtons; + CARD8 shiftKeyCount; + KeyCode mouseKey; + KeyCode inactiveKey; + KeyCode slowKey; + KeyCode repeatKey; + CARD8 krgTimerActive; + CARD8 beepType; + CARD8 beepCount; + + CARD32 flags; + CARD32 lastPtrEventTime; + CARD32 lastShiftEventTime; + OsTimerPtr beepTimer; + OsTimerPtr mouseKeyTimer; + OsTimerPtr slowKeysTimer; + OsTimerPtr bounceKeysTimer; + OsTimerPtr repeatKeyTimer; + OsTimerPtr krgTimer; +} XkbSrvInfoRec, *XkbSrvInfoPtr; + +#define XkbSLI_IsDefault (1L<<0) +#define XkbSLI_HasOwnState (1L<<1) + +typedef struct _XkbSrvLedInfo { + CARD16 flags; + CARD16 class; + CARD16 id; + union { + KbdFeedbackPtr kf; + LedFeedbackPtr lf; + } fb; + + CARD32 physIndicators; + CARD32 autoState; + CARD32 explicitState; + CARD32 effectiveState; + + CARD32 mapsPresent; + CARD32 namesPresent; + XkbIndicatorMapPtr maps; + Atom * names; + + CARD32 usesBase; + CARD32 usesLatched; + CARD32 usesLocked; + CARD32 usesEffective; + CARD32 usesCompat; + CARD32 usesControls; + + CARD32 usedComponents; +} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; + +/* + * Settings for xkbClientFlags field (used by DIX) + * These flags _must_ not overlap with XkbPCF_* + */ +#define _XkbClientInitialized (1<<15) + +#define _XkbWantsDetectableAutoRepeat(c)\ + ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) + +/* + * Settings for flags field + */ +#define _XkbStateNotifyInProgress (1<<0) + +typedef struct +{ + ProcessInputProc processInputProc; + ProcessInputProc realInputProc; + DeviceUnwrapProc unwrapProc; +} xkbDeviceInfoRec, *xkbDeviceInfoPtr; + +#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + if (device->public.processInputProc == device->public.realInputProc)\ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \ + device->public.processInputProc = oldprocs->processInputProc; \ + device->public.realInputProc = oldprocs->realInputProc; \ + device->unwrapProc = oldprocs->unwrapProc; + +#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) + +/***====================================================================***/ + + +/***====================================================================***/ + +#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) +#define XkbAllFilteredEventsMask \ + (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) + +/***====================================================================***/ + +extern int XkbReqCode; +extern int XkbEventBase; +extern int XkbDisableLockActions; +extern char * XkbBaseDirectory; +extern char * XkbBinDirectory; +extern char * XkbInitialMap; +extern unsigned int XkbXIUnsupported; + +extern Bool noXkbExtension; + +extern pointer XkbLastRepeatEvent; + +extern CARD32 xkbDebugFlags; + +#define _XkbAlloc(s) xalloc((s)) +#define _XkbCalloc(n,s) Xcalloc((n)*(s)) +#define _XkbRealloc(o,s) Xrealloc((o),(s)) +#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) +#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) +#define _XkbTypedRealloc(o,n,t) \ + ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) +#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) +#define _XkbFree(p) Xfree(p) + +#define _XkbLibError(c,l,d) \ + { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } +#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) +#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) +#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) + +extern int DeviceKeyPress,DeviceKeyRelease; +extern int DeviceButtonPress,DeviceButtonRelease; + +#ifdef XINPUT +#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) +#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) +#else +#define _XkbIsPressEvent(t) ((t)==KeyPress) +#define _XkbIsReleaseEvent(t) ((t)==KeyRelease) +#endif + +#define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ + ((k)<=(c)->curKeySyms.maxKeyCode)) +#define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ + (c)->curKeySyms.minKeyCode+1) + +#define XConvertCase(s,l,u) XkbConvertCase(s,l,u) +#undef IsKeypadKey +#define IsKeypadKey(s) XkbKSIsKeypad(s) + +#define Status int +#define XPointer pointer +#define Display struct _XDisplay + +#ifndef True +#define True 1 +#define False 0 +#endif + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +_XFUNCPROTOBEGIN + +extern void XkbUseMsg( + void +); + +extern int XkbProcessArguments( + int /* argc */, + char ** /* argv */, + int /* i */ +); + +extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); + +extern void XkbFreeCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern void XkbFreeNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern DeviceIntPtr _XkbLookupAnyDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupKeyboard( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupBellDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupLedDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupButtonDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern XkbDescPtr XkbAllocKeyboard( + void +); + +extern Status XkbAllocClientMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nTypes */ +); + +extern Status XkbAllocServerMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nNewActions */ +); + +extern void XkbFreeClientMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern void XkbFreeServerMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern Status XkbAllocIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern Status XkbAllocCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nInterpret */ +); + +extern Status XkbAllocNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* nTotalRG */, + int /* nTotalAliases */ +); + +extern Status XkbAllocControls( + XkbDescPtr /* xkb */, + unsigned int /* which*/ +); + +extern Status XkbCopyKeyTypes( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */, + int /* num_types */ +); + +extern Status XkbResizeKeyType( + XkbDescPtr /* xkb */, + int /* type_ndx */, + int /* map_count */, + Bool /* want_preserve */, + int /* new_num_lvls */ +); + +extern void XkbFreeKeyboard( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeDesc */ +); + +extern void XkbSetActionKeyMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* mods */ +); + +extern Bool XkbCheckActionVMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* changed */ +); + +extern unsigned int XkbMaskForVMask( + XkbDescPtr /* xkb */, + unsigned int /* vmask */ +); + +extern Bool XkbVirtualModsToReal( + XkbDescPtr /* xkb */, + unsigned int /* virtua_mask */, + unsigned int * /* mask_rtrn */ +); + +extern unsigned int XkbAdjustGroup( + int /* group */, + XkbControlsPtr /* ctrls */ +); + +extern KeySym *XkbResizeKeySyms( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern XkbAction *XkbResizeKeyActions( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern void XkbUpdateKeyTypesFromCore( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */ +); + +extern void XkbUpdateDescActions( + XkbDescPtr /* xkb */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* changes */ +); + +extern void XkbUpdateActions( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */, + unsigned int * /* needChecksRtrn */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateCoreDescription( + DeviceIntPtr /* keybd */, + Bool /* resize */ +); + +extern void XkbApplyMappingChange( + DeviceIntPtr /* pXDev */, + CARD8 /* request */, + KeyCode /* firstKey */, + CARD8 /* num */, + ClientPtr /* client */ +); + +extern void XkbSetIndicators( + DeviceIntPtr /* pXDev */, + CARD32 /* affect */, + CARD32 /* values */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateIndicators( + DeviceIntPtr /* keybd */, + CARD32 /* changed */, + Bool /* check_edevs */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( + DeviceIntPtr /* dev */, + KbdFeedbackPtr /* kf */, + LedFeedbackPtr /* lf */, + unsigned int /* needed_parts */ +); + +extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( + DeviceIntPtr /* dev */, + unsigned int /* class */, + unsigned int /* id */, + unsigned int /* needed_parts */ +); + +extern void XkbApplyLedNameChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_names */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyLedMapChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_maps */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyLedStateChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_leds */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbFlushLedEvents( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + XkbSrvLedInfoPtr /* sli */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern unsigned int XkbIndicatorsToUpdate( + DeviceIntPtr /* dev */, + unsigned long /* state_changes */, + Bool /* enabled_ctrl_changes */ +); + +extern void XkbComputeDerivedState( + XkbSrvInfoPtr /* xkbi */ +); + +extern void XkbCheckSecondaryEffects( + XkbSrvInfoPtr /* xkbi */, + unsigned int /* which */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbCheckIndicatorMaps( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* which */ +); + +extern unsigned int XkbStateChangedFlags( + XkbStatePtr /* old */, + XkbStatePtr /* new */ +); + +extern void XkbSendStateNotify( + DeviceIntPtr /* kbd */, + xkbStateNotify * /* pSN */ +); + +extern void XkbSendMapNotify( + DeviceIntPtr /* kbd */, + xkbMapNotify * /* ev */ +); + +extern int XkbComputeControlsNotify( + DeviceIntPtr /* kbd */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */, + xkbControlsNotify * /* pCN */, + Bool /* forceCtrlProc */ +); + +extern void XkbSendControlsNotify( + DeviceIntPtr /* kbd */, + xkbControlsNotify * /* ev */ +); + +extern void XkbSendCompatMapNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern void XkbHandleBell( + BOOL /* force */, + BOOL /* eventOnly */, + DeviceIntPtr /* kbd */, + CARD8 /* percent */, + pointer /* ctrl */, + CARD8 /* class */, + Atom /* name */, + WindowPtr /* pWin */, + ClientPtr /* pClient */ +); + +extern void XkbSendAccessXNotify( + DeviceIntPtr /* kbd */, + xkbAccessXNotify * /* pEv */ +); + +extern void XkbSendNamesNotify( + DeviceIntPtr /* kbd */, + xkbNamesNotify * /* ev */ +); + +extern void XkbSendCompatNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern void XkbSendActionMessage( + DeviceIntPtr /* kbd */, + xkbActionMessage * /* ev */ +); + +extern void XkbSendExtensionDeviceNotify( + DeviceIntPtr /* kbd */, + ClientPtr /* client */, + xkbExtensionDeviceNotify * /* ev */ +); + +extern void XkbSendNotification( + DeviceIntPtr /* kbd */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern void XkbProcessKeyboardEvent( + struct _xEvent * /* xE */, + DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void XkbHandleActions( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + struct _xEvent * /* xE */, + int /* count */ +); + +extern Bool XkbEnableDisableControls( + XkbSrvInfoPtr /* xkbi */, + unsigned long /* change */, + unsigned long /* newValues */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void AccessXInit( + DeviceIntPtr /* dev */ +); + +extern Bool AccessXFilterPressEvent( + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +); + +extern Bool AccessXFilterReleaseEvent( + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void AccessXCancelRepeatKey( + XkbSrvInfoPtr /* xkbi */, + KeyCode /* key */ +); + +extern void AccessXComputeCurveFactor( + XkbSrvInfoPtr /* xkbi */, + XkbControlsPtr /* ctrls */ +); + +extern XkbInterestPtr XkbFindClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */ +); + +extern XkbInterestPtr XkbAddClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */, + XID /* id */ +); + +extern int XkbRemoveResourceClient( + DevicePtr /* inDev */, + XID /* id */ +); + +extern int XkbDDXInitDevice( + DeviceIntPtr /* dev */ +); + +extern int XkbDDXAccessXBeep( + DeviceIntPtr /* dev */, + unsigned int /* what */, + unsigned int /* which */ +); + +extern void XkbDDXKeyClick( + DeviceIntPtr /* dev */, + int /* keycode */, + int /* synthetic */ +); + +extern int XkbDDXUsesSoftRepeat( + DeviceIntPtr /* dev */ +); + +extern void XkbDDXKeybdCtrlProc( + DeviceIntPtr /* dev */, + KeybdCtrl * /* ctrl */ +); + +extern void XkbDDXChangeControls( + DeviceIntPtr /* dev */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */ +); + +extern void XkbDDXUpdateDeviceIndicators( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + CARD32 /* newState */ +); + +extern void XkbDDXFakePointerButton( + int /* event */, + int /* button */ +); + +extern void XkbDDXFakePointerMotion( + unsigned int /* flags */, + int /* x */, + int /* y */ +); + +extern void XkbDDXFakeDeviceButton( + DeviceIntPtr /* dev */, + Bool /* press */, + int /* button */ +); + +extern int XkbDDXTerminateServer( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern int XkbDDXSwitchScreen( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern int XkbDDXPrivate( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern void XkbDisableComputedAutoRepeats( + DeviceIntPtr /* pXDev */, + unsigned int /* key */ +); + +extern void XkbSetRepeatKeys( + DeviceIntPtr /* pXDev */, + int /* key */, + int /* onoff */ +); + +extern int XkbLatchModifiers( + DeviceIntPtr /* pXDev */, + CARD8 /* mask */, + CARD8 /* latches */ +); + +extern int XkbLatchGroup( + DeviceIntPtr /* pXDev */, + int /* group */ +); + +extern void XkbClearAllLatchesAndLocks( + DeviceIntPtr /* dev */, + XkbSrvInfoPtr /* xkbi */, + Bool /* genEv */, + XkbEventCausePtr /* cause */ +); + +extern void XkbSetRulesDflts( + char * /* rulesFile */, + char * /* model */, + char * /* layout */, + char * /* variant */, + char * /* options */ +); + +extern void XkbInitDevice( + DeviceIntPtr /* pXDev */ +); + +extern Bool XkbInitKeyboardDeviceStruct( + DeviceIntPtr /* pXDev */, + XkbComponentNamesPtr /* pNames */, + KeySymsPtr /* pSyms */, + CARD8 /* pMods */[], + BellProcPtr /* bellProc */, + KbdCtrlProcPtr /* ctrlProc */ +); + +extern int SProcXkbDispatch( + ClientPtr /* client */ +); + +extern XkbGeometryPtr XkbLookupNamedGeometry( + DeviceIntPtr /* dev */, + Atom /* name */, + Bool * /* shouldFree */ +); + +extern char * _XkbDupString( + char * /* str */ +); + +extern void XkbConvertCase( + KeySym /* sym */, + KeySym * /* lower */, + KeySym * /* upper */ +); + +extern Status XkbChangeKeycodeRange( + XkbDescPtr /* xkb */, + int /* minKC */, + int /* maxKC */, + XkbChangesPtr /* changes */ +); + +extern int XkbFinishDeviceInit( + DeviceIntPtr /* pXDev */ +); + +extern void XkbFreeSrvLedInfo( + XkbSrvLedInfoPtr /* sli */ +); + +extern void XkbFreeInfo( + XkbSrvInfoPtr /* xkbi */ +); + +extern Status XkbChangeTypesOfKey( + XkbDescPtr /* xkb */, + int /* key */, + int /* nGroups */, + unsigned int /* groups */, + int * /* newTypesIn */, + XkbMapChangesPtr /* changes */ +); + +extern int XkbKeyTypesForCoreSymbols( + XkbDescPtr /* xkb */, + int /* map_width */, + KeySym * /* core_syms */, + unsigned int /* protected */, + int * /* types_inout */, + KeySym * /* xkb_syms_rtrn */ +); + +extern Bool XkbApplyCompatMapToKey( + XkbDescPtr /* xkb */, + KeyCode /* key */, + XkbChangesPtr /* changes */ +); + +extern Bool XkbApplyVirtualModChanges( + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +extern void XkbSendNewKeyboardNotify( + DeviceIntPtr /* kbd */, + xkbNewKeyboardNotify * /* pNKN */ +); + +#ifdef XKBSRV_NEED_FILE_FUNCS + +#include +#include +#include + +#define _XkbListKeymaps 0 +#define _XkbListKeycodes 1 +#define _XkbListTypes 2 +#define _XkbListCompat 3 +#define _XkbListSymbols 4 +#define _XkbListGeometry 5 +#define _XkbListNumComponents 6 + +typedef struct _XkbSrvListInfo { + int szPool; + int nPool; + char * pool; + + int maxRtrn; + int nTotal; + + char * pattern[_XkbListNumComponents]; + int nFound[_XkbListNumComponents]; +} XkbSrvListInfoRec,*XkbSrvListInfoPtr; + +extern Status XkbDDXList( + DeviceIntPtr /* dev */, + XkbSrvListInfoPtr /* listing */, + ClientPtr /* client */ +); + +extern unsigned int XkbDDXLoadKeymapByNames( + DeviceIntPtr /* keybd */, + XkbComponentNamesPtr /* names */, + unsigned int /* want */, + unsigned int /* need */, + XkbFileInfoPtr /* finfoRtrn */, + char * /* keymapNameRtrn */, + int /* keymapNameRtrnLen */ +); + +extern Bool XkbDDXNamesFromRules( + DeviceIntPtr /* keybd */, + char * /* rules */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */ +); + +extern Bool XkbDDXApplyConfig( + XPointer /* cfg_in */, + XkbSrvInfoPtr /* xkbi */ +); + +extern XPointer XkbDDXPreloadConfig( + char ** /* rulesFileRtrn */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */, + DeviceIntPtr /* dev */ +); + +extern int _XkbStrCaseCmp( + char * /* str1 */, + char * /* str2 */ +); + +#endif /* XKBSRV_NEED_FILE_FUNCS */ + +_XFUNCPROTOEND + +#define XkbAtomGetString(d,s) NameForAtom(s) + +#endif /* _XKBSRV_H_ */ diff --git a/os/utils.c b/os/utils.c index 612c2644a..06c9b8807 100644 --- a/os/utils.c +++ b/os/utils.c @@ -117,7 +117,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #endif #ifdef XKB -#include +#include #endif #ifdef XCSECURITY #include "securitysrv.h" diff --git a/xkb/Makefile.am b/xkb/Makefile.am index 996d52761..78cdf7196 100644 --- a/xkb/Makefile.am +++ b/xkb/Makefile.am @@ -41,7 +41,8 @@ X11_SRCS = \ XKBGAlloc.c \ XKBMAlloc.c -XI_SRCS = xkbPrOtherEv.c +# ends up unused... +# XI_SRCS = xkbPrOtherEv.c libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XI_SRCS) $(XKBFILE_SRCS) \ $(X11_SRCS) diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c index c474733d0..f0a1f890e 100644 --- a/xkb/XKBAlloc.c +++ b/xkb/XKBAlloc.c @@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "misc.h" #include "inputstr.h" -#include +#include #include /***===================================================================***/ @@ -259,7 +259,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which) } /*ARGSUSED*/ -void +static void XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap) { if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) { @@ -284,7 +284,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb) return Success; } -void +static void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb!=NULL)&&(xkb->indicators!=NULL)) { @@ -335,154 +335,3 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll) _XkbFree(xkb); return; } - -/***====================================================================***/ - -XkbDeviceLedInfoPtr -XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId) -{ -XkbDeviceLedInfoPtr devli; -register int i; - - if ((!devi)||(!XkbSingleXIClass(ledClass))||(!XkbSingleXIId(ledId))) - return NULL; - for (i=0,devli=devi->leds;inum_leds;i++,devli++) { - if ((devli->led_class==ledClass)&&(devli->led_id==ledId)) - return devli; - } - if (devi->num_leds>=devi->sz_leds) { - XkbDeviceLedInfoRec *prev_leds = devi->leds; - - if (devi->sz_leds>0) devi->sz_leds*= 2; - else devi->sz_leds= 1; - devi->leds= _XkbTypedRealloc(devi->leds,devi->sz_leds, - XkbDeviceLedInfoRec); - if (!devi->leds) { - _XkbFree(prev_leds); - devi->sz_leds= devi->num_leds= 0; - return NULL; - } - i= devi->num_leds; - for (devli=&devi->leds[i];isz_leds;i++,devli++) { - bzero(devli,sizeof(XkbDeviceLedInfoRec)); - devli->led_class= XkbXINone; - devli->led_id= XkbXINone; - } - } - devli= &devi->leds[devi->num_leds++]; - bzero(devli,sizeof(XkbDeviceLedInfoRec)); - devli->led_class= ledClass; - devli->led_id= ledId; - return devli; -} - -Status -XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal) -{ - XkbAction *prev_btn_acts; - - if ((!devi)||(newTotal>255)) - return BadValue; - if ((devi->btn_acts!=NULL)&&(newTotal==devi->num_btns)) - return Success; - if (newTotal==0) { - if (devi->btn_acts!=NULL) { - _XkbFree(devi->btn_acts); - devi->btn_acts= NULL; - } - devi->num_btns= 0; - return Success; - } - prev_btn_acts = devi->btn_acts; - devi->btn_acts= _XkbTypedRealloc(devi->btn_acts,newTotal,XkbAction); - if (devi->btn_acts==NULL) { - _XkbFree(prev_btn_acts); - devi->num_btns= 0; - return BadAlloc; - } - if (newTotal>devi->num_btns) { - XkbAction *act; - act= &devi->btn_acts[devi->num_btns]; - bzero((char *)act,(newTotal-devi->num_btns)*sizeof(XkbAction)); - } - devi->num_btns= newTotal; - return Success; -} - -/*ARGSUSED*/ -XkbDeviceInfoPtr -XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds) -{ -XkbDeviceInfoPtr devi; - - devi= _XkbTypedCalloc(1,XkbDeviceInfoRec); - if (devi!=NULL) { - devi->device_spec= deviceSpec; - devi->has_own_state= False; - devi->num_btns= 0; - devi->btn_acts= NULL; - if (nButtons>0) { - devi->num_btns= nButtons; - devi->btn_acts= _XkbTypedCalloc(nButtons,XkbAction); - if (!devi->btn_acts) { - _XkbFree(devi); - return NULL; - } - } - devi->dflt_kbd_fb= XkbXINone; - devi->dflt_led_fb= XkbXINone; - devi->num_leds= 0; - devi->sz_leds= 0; - devi->leds= NULL; - if (szLeds>0) { - devi->sz_leds= szLeds; - devi->leds= _XkbTypedCalloc(szLeds,XkbDeviceLedInfoRec); - if (!devi->leds) { - if (devi->btn_acts) - _XkbFree(devi->btn_acts); - _XkbFree(devi); - return NULL; - } - } - } - return devi; -} - - -void -XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI) -{ - if (devi) { - if (freeDevI) { - which= XkbXI_AllDeviceFeaturesMask; - if (devi->name) { - _XkbFree(devi->name); - devi->name= NULL; - } - } - if ((which&XkbXI_ButtonActionsMask)&&(devi->btn_acts)) { - _XkbFree(devi->btn_acts); - devi->num_btns= 0; - devi->btn_acts= NULL; - } - if ((which&XkbXI_IndicatorsMask)&&(devi->leds)) { - register int i; - if ((which&XkbXI_IndicatorsMask)==XkbXI_IndicatorsMask) { - _XkbFree(devi->leds); - devi->sz_leds= devi->num_leds= 0; - devi->leds= NULL; - } - else { - XkbDeviceLedInfoPtr devli; - for (i=0,devli=devi->leds;inum_leds;i++,devli++) { - if (which&XkbXI_IndicatorMapsMask) - bzero((char *)&devli->maps[0],sizeof(devli->maps)); - else bzero((char *)&devli->names[0],sizeof(devli->names)); - } - } - } - if (freeDevI) - _XkbFree(devi); - } - return; -} diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index edaed10f3..815cc95f5 100644 --- a/xkb/XKBGAlloc.c +++ b/xkb/XKBGAlloc.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "misc.h" #include "inputstr.h" -#include +#include #include #ifdef X_NOT_POSIX diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index ef4097dad..4b7428b2e 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -39,7 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include #define XKBSRV_NEED_FILE_FUNCS -#include +#include /***====================================================================***/ @@ -220,7 +220,7 @@ XkbServerMapPtr map; /***====================================================================***/ -Status +static Status XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) { if ((!from)||(!into)) @@ -275,82 +275,6 @@ register int i,rtrn; return Success; } -XkbKeyTypePtr -XkbAddKeyType( XkbDescPtr xkb, - Atom name, - int map_count, - Bool want_preserve, - int num_lvls) -{ -register int i; -unsigned tmp; -XkbKeyTypePtr type; -XkbClientMapPtr map; - - if ((!xkb)||(num_lvls<1)) - return NULL; - map= xkb->map; - if ((map)&&(map->types)) { - for (i=0;inum_types;i++) { - if (map->types[i].name==name) { - Status status; - status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls); - return (status==Success?&map->types[i]:NULL); - } - } - } - if ((!map)||(!map->types)||(!map->num_typesmap; - tmp= 0; - if (map->num_types<=XkbKeypadIndex) - tmp|= XkbKeypadMask; - if (map->num_types<=XkbAlphabeticIndex) - tmp|= XkbAlphabeticMask; - if (map->num_types<=XkbTwoLevelIndex) - tmp|= XkbTwoLevelMask; - if (map->num_types<=XkbOneLevelIndex) - tmp|= XkbOneLevelMask; - if (XkbInitCanonicalKeyTypes(xkb,tmp,XkbNoModifier)==Success) { - for (i=0;inum_types;i++) { - Status status; - if (map->types[i].name!=name) - continue; - status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls); - return (status==Success?&map->types[i]:NULL); - } - } - } - if ((map->num_types<=map->size_types)&& - (XkbAllocClientMap(xkb,XkbKeyTypesMask,map->num_types+1)!=Success)) { - return NULL; - } - type= &map->types[map->num_types]; - map->num_types++; - bzero((char *)type,sizeof(XkbKeyTypeRec)); - type->num_levels= num_lvls; - type->map_count= map_count; - type->name= name; - if (map_count>0) { - type->map= _XkbTypedCalloc(map_count,XkbKTMapEntryRec); - if (!type->map) { - map->num_types--; - return NULL; - } - if (want_preserve) { - type->preserve= _XkbTypedCalloc(map_count,XkbModsRec); - if (!type->preserve) { - _XkbFree(type->map); - map->num_types--; - return NULL; - } - } - } - return type; -} - Status XkbResizeKeyType( XkbDescPtr xkb, int type_ndx, diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index 7ed47697e..0404108a2 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -39,102 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include #define XKBSRV_NEED_FILE_FUNCS -#include - -/***====================================================================***/ - -#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec)) -static XkbKTMapEntryRec map2Level[]= { - { True, ShiftMask, {1, ShiftMask, 0} } -}; - -static XkbKTMapEntryRec mapAlpha[]= { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { True, LockMask, { 0, LockMask, 0 } } -}; - -static XkbModsRec preAlpha[]= { - { 0, 0, 0 }, - { LockMask, LockMask, 0 } -}; - -#define NL_VMOD_MASK 0 -static XkbKTMapEntryRec mapKeypad[]= { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { False, 0, { 1, 0, NL_VMOD_MASK } } -}; - -static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = { - { { 0, 0, 0 }, - 1, /* num_levels */ - 0, /* map_count */ - NULL, NULL, - None, NULL - }, - { { ShiftMask, ShiftMask, 0 }, - 2, /* num_levels */ - mapSize(map2Level), /* map_count */ - map2Level, NULL, - None, NULL - }, - { { ShiftMask|LockMask, ShiftMask|LockMask, 0 }, - 2, /* num_levels */ - mapSize(mapAlpha), /* map_count */ - mapAlpha, preAlpha, - None, NULL - }, - { { ShiftMask, ShiftMask, NL_VMOD_MASK }, - 2, /* num_levels */ - mapSize(mapKeypad), /* map_count */ - mapKeypad, NULL, - None, NULL - } -}; - -Status -XkbInitCanonicalKeyTypes(XkbDescPtr xkb,unsigned which,int keypadVMod) -{ -XkbClientMapPtr map; -XkbKeyTypePtr from,to; -Status rtrn; - - if (!xkb) - return BadMatch; - rtrn= XkbAllocClientMap(xkb,XkbKeyTypesMask,XkbNumRequiredTypes); - if (rtrn!=Success) - return rtrn; - map= xkb->map; - if ((which&XkbAllRequiredTypes)==0) - return Success; - rtrn= Success; - from= canonicalTypes; - to= map->types; - if (which&XkbOneLevelMask) - rtrn= XkbCopyKeyType(&from[XkbOneLevelIndex],&to[XkbOneLevelIndex]); - if ((which&XkbTwoLevelMask)&&(rtrn==Success)) - rtrn= XkbCopyKeyType(&from[XkbTwoLevelIndex],&to[XkbTwoLevelIndex]); - if ((which&XkbAlphabeticMask)&&(rtrn==Success)) - rtrn= XkbCopyKeyType(&from[XkbAlphabeticIndex],&to[XkbAlphabeticIndex]); - if ((which&XkbKeypadMask)&&(rtrn==Success)) { - XkbKeyTypePtr type; - rtrn= XkbCopyKeyType(&from[XkbKeypadIndex],&to[XkbKeypadIndex]); - type= &to[XkbKeypadIndex]; - if ((keypadVMod>=0)&&(keypadVModmods.vmods= (1<map[0].active= True; - type->map[0].mods.mask= ShiftMask; - type->map[0].mods.real_mods= ShiftMask; - type->map[0].mods.vmods= 0; - type->map[0].level= 1; - type->map[1].active= False; - type->map[1].mods.mask= 0; - type->map[1].mods.real_mods= 0; - type->map[1].mods.vmods= (1<map[1].level= 1; - } - } - return Success; -} +#include /***====================================================================***/ @@ -558,88 +463,6 @@ unsigned changed,tmp; return True; } -Bool -XkbUpdateMapFromCore( XkbDescPtr xkb, - KeyCode first_key, - int num_keys, - int map_width, - KeySym * core_keysyms, - XkbChangesPtr changes) -{ -register int key,last_key; -KeySym * syms; - - syms= &core_keysyms[(first_key-xkb->min_key_code)*map_width]; - if (changes) { - if (changes->map.changed&XkbKeySymsMask) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms,first_key); - if (num_keys>1) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms, - first_key+num_keys-1); - } - } - else { - changes->map.changed|= XkbKeySymsMask; - changes->map.first_key_sym= first_key; - changes->map.num_key_syms= num_keys; - } - } - last_key= first_key+num_keys-1; - for (key=first_key;key<=last_key;key++,syms+= map_width) { - XkbMapChangesPtr mc; - unsigned explicit; - KeySym tsyms[XkbMaxSymsPerKey]; - int types[XkbNumKbdGroups]; - int nG; - - explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask; - types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); - types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index); - types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index); - types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index); - nG= XkbKeyTypesForCoreSymbols(xkb,map_width,syms,explicit,types,tsyms); - if (changes) - mc= &changes->map; - else mc= NULL; - XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc); - memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms, - XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); - XkbApplyCompatMapToKey(xkb,key,changes); - } - - if ((xkb->server->vmods!=NULL)&&(xkb->map->modmap!=NULL)&&(changes)&& - (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask))) { - unsigned char newVMods[XkbNumVirtualMods]; - register unsigned bit,i; - unsigned present; - - bzero(newVMods,XkbNumVirtualMods); - present= 0; - for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { - if (xkb->server->vmodmap[key]==0) - continue; - for (i=0,bit=1;iserver->vmodmap[key]) { - present|= bit; - newVMods[i]|= xkb->map->modmap[key]; - } - } - } - for (i=0,bit=1;iserver->vmods[i])) { - changes->map.changed|= XkbVirtualModsMask; - changes->map.vmods|= bit; - xkb->server->vmods[i]= newVMods[i]; - } - } - } - if (changes && (changes->map.changed&XkbVirtualModsMask)) - XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes); - return True; -} - Status XkbChangeTypesOfKey( XkbDescPtr xkb, int key, @@ -788,7 +611,7 @@ register unsigned mask; /***====================================================================***/ -Bool +static Bool XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed) { unsigned int tmp; @@ -814,7 +637,7 @@ unsigned int tmp; return False; } -void +static void XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb, XkbKeyTypePtr type, unsigned int changed, diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c index 53f3a6f9c..331357ded 100644 --- a/xkb/ddxBeep.c +++ b/xkb/ddxBeep.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include /*#define FALLING_TONE 1*/ diff --git a/xkb/ddxCtrls.c b/xkb/ddxCtrls.c index 5a9ad4018..0f7f9187f 100644 --- a/xkb/ddxCtrls.c +++ b/xkb/ddxCtrls.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include void diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c index 3de8f8721..7e27c5189 100644 --- a/xkb/ddxDevBtn.c +++ b/xkb/ddxDevBtn.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include #include diff --git a/xkb/ddxFakeBtn.c b/xkb/ddxFakeBtn.c index f7b746b05..77222236f 100644 --- a/xkb/ddxFakeBtn.c +++ b/xkb/ddxFakeBtn.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include void diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c index a19819fd7..1060afe99 100644 --- a/xkb/ddxFakeMtn.c +++ b/xkb/ddxFakeMtn.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include #ifdef PANORAMIX diff --git a/xkb/ddxInit.c b/xkb/ddxInit.c index 88c488c22..3bcf9d604 100644 --- a/xkb/ddxInit.c +++ b/xkb/ddxInit.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include int diff --git a/xkb/ddxKeyClick.c b/xkb/ddxKeyClick.c index 528b20207..685ae1b42 100644 --- a/xkb/ddxKeyClick.c +++ b/xkb/ddxKeyClick.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include void diff --git a/xkb/ddxKillSrv.c b/xkb/ddxKillSrv.c index 95d75897b..a573ecbd8 100644 --- a/xkb/ddxKillSrv.c +++ b/xkb/ddxKillSrv.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include int XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/ddxLEDs.c b/xkb/ddxLEDs.c index fd0195882..22899d766 100644 --- a/xkb/ddxLEDs.c +++ b/xkb/ddxLEDs.c @@ -37,10 +37,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include #include -void +static void XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new) { dev->kbdfeed->ctrl.leds= new; diff --git a/xkb/ddxList.c b/xkb/ddxList.c index 034f694ed..a91a9badf 100644 --- a/xkb/ddxList.c +++ b/xkb/ddxList.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "scrnintstr.h" #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #include #ifndef PATH_MAX diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index 6e8f8921c..c24c56c1c 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -44,7 +44,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "scrnintstr.h" #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #include #include "xkb.h" @@ -211,7 +211,7 @@ OutputDirectory( } } -Bool +static Bool XkbDDXCompileNamedKeymap( XkbDescPtr xkb, XkbComponentNamesPtr names, char * nameRtrn, @@ -298,7 +298,7 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; return False; } -Bool +static Bool XkbDDXCompileKeymapByNames( XkbDescPtr xkb, XkbComponentNamesPtr names, unsigned want, @@ -432,7 +432,7 @@ char tmpname[PATH_MAX]; return False; } -FILE * +static FILE * XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen) { char buf[PATH_MAX],xkm_output_dir[PATH_MAX]; diff --git a/xkb/ddxPrivate.c b/xkb/ddxPrivate.c index 7450b47ba..f67e20c27 100644 --- a/xkb/ddxPrivate.c +++ b/xkb/ddxPrivate.c @@ -6,7 +6,7 @@ #define NEED_EVENTS #include #include "windowstr.h" -#include +#include int XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/ddxVT.c b/xkb/ddxVT.c index f56f0796d..55c82a865 100644 --- a/xkb/ddxVT.c +++ b/xkb/ddxVT.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include +#include int XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/maprules.c b/xkb/maprules.c index b0a2225e2..0fa356ee5 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -48,7 +48,7 @@ #include "dix.h" #include #define XKBSRV_NEED_FILE_FUNCS -#include +#include #ifdef DEBUG #define PR_DEBUG(s) fprintf(stderr,s) diff --git a/xkb/xkb.c b/xkb/xkb.c index 2c97e05db..cf4243070 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -36,23 +36,20 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "misc.h" #include "inputstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #include "extnsionst.h" #include "xkb.h" #include int XkbEventBase; - int XkbErrorBase; +static int XkbErrorBase; int XkbReqCode; - int XkbKeyboardErrorCode; -Atom xkbONE_LEVEL; -Atom xkbTWO_LEVEL; -Atom xkbKEYPAD; +static int XkbKeyboardErrorCode; CARD32 xkbDebugFlags = 0; -CARD32 xkbDebugCtrls = 0; +static CARD32 xkbDebugCtrls = 0; -RESTYPE RT_XKBCLIENT; +static RESTYPE RT_XKBCLIENT; /***====================================================================***/ @@ -895,52 +892,6 @@ ProcXkbSetControls(ClientPtr client) return client->noClientException; } -/* FIXME: Needs to set rate on all core-sending devices. */ -int -XkbSetRepeatRate(DeviceIntPtr dev,int timeout,int interval,int major,int minor) -{ -int changed= 0; -XkbControlsRec old,*xkb; - - if ((!dev)||(!dev->key)||(!dev->key->xkbInfo)) - return 0; - xkb= dev->key->xkbInfo->desc->ctrls; - old= *xkb; - if ((timeout!=0) && (xkb->repeat_delay!=timeout)) { - xkb->repeat_delay= timeout; - changed++; - } - if ((interval!=0) && (xkb->repeat_interval!=interval)) { - xkb->repeat_interval= interval; - changed++; - } - if (changed) { - xkbControlsNotify cn; - XkbDDXChangeControls(dev,&old,xkb); - if (XkbComputeControlsNotify(dev,&old,xkb,&cn,False)) { - cn.keycode= 0; - cn.eventType = 0; - cn.requestMajor = major; - cn.requestMinor = minor; - XkbSendControlsNotify(dev,&cn); - } - } - return 1; -} - -int -XkbGetRepeatRate(DeviceIntPtr dev,int *timeout,int *interval) -{ -XkbControlsPtr xkb; - - if ((!dev)||(!dev->key)||(!dev->key->xkbInfo)) - return 0; - xkb= dev->key->xkbInfo->desc->ctrls; - if (timeout) *timeout= xkb->repeat_delay; - if (interval) *interval= xkb->repeat_interval; - return 1; -} - /***====================================================================***/ static int @@ -2820,7 +2771,7 @@ ProcXkbGetIndicatorState(ClientPtr client) /***====================================================================***/ -Status +static Status XkbComputeGetIndicatorMapReplySize( XkbIndicatorPtr indicators, xkbGetIndicatorMapReply *rep) @@ -2837,7 +2788,7 @@ int nIndicators; return Success; } -int +static int XkbSendIndicatorMap( ClientPtr client, XkbIndicatorPtr indicators, xkbGetIndicatorMapReply * rep) diff --git a/xkb/xkb.h b/xkb/xkb.h index 2be42582d..99b60bf5e 100644 --- a/xkb/xkb.h +++ b/xkb/xkb.h @@ -1,5 +1,3 @@ -/* $XFree86$ */ - /* #include "XKBfile.h" */ extern int ProcXkbUseExtension(ClientPtr client); @@ -29,50 +27,10 @@ extern int ProcXkbGetDeviceInfo(ClientPtr client); extern int ProcXkbSetDeviceInfo(ClientPtr client); extern int ProcXkbSetDebuggingFlags(ClientPtr client); -extern int XkbSetRepeatRate(DeviceIntPtr dev, int timeout, int interval, int major, int minor); -extern int XkbGetRepeatRate(DeviceIntPtr dev, int *timeout, int *interval); - extern void XkbExtensionInit(void); -extern Status XkbComputeGetIndicatorMapReplySize( - XkbIndicatorPtr indicators, - xkbGetIndicatorMapReply *rep); -extern int XkbSendIndicatorMap( - ClientPtr client, - XkbIndicatorPtr indicators, - xkbGetIndicatorMapReply *rep); - -extern void XkbComputeCompatState(XkbSrvInfoPtr xkbi); -extern void XkbSetPhysicalLockingKey(DeviceIntPtr dev, unsigned key); - extern Bool XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE); -extern Bool XkbApplyLEDChangeToKeyboard( - XkbSrvInfoPtr xkbi, - XkbIndicatorMapPtr map, - Bool on, - XkbChangesPtr change); - -extern Bool XkbWriteRulesProp(ClientPtr client, pointer closure); - -extern XkbAction XkbGetButtonAction(DeviceIntPtr kbd, DeviceIntPtr dev, int button); - -/* extern Status XkbMergeFile(XkbDescPtr xkb, XkbFileInfo finfo); */ - -extern Bool XkbDDXCompileNamedKeymap( - XkbDescPtr xkb, - XkbComponentNamesPtr names, - char * nameRtrn, - int nameRtrnLen); - -extern Bool XkbDDXCompileKeymapByNames( - XkbDescPtr xkb, - XkbComponentNamesPtr names, - unsigned want, - unsigned need, - char * nameRtrn, - int nameRtrnLen); - extern Bool XkbCopyKeymap( XkbDescPtr src, XkbDescPtr dst, diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index 0ab3dadf6..2954a0c0e 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include "inputstr.h" -#include +#include #if !defined(WIN32) && !defined(Lynx) #include #endif @@ -52,9 +52,9 @@ pointer XkbLastRepeatEvent= NULL; unsigned short XkbDfltAccessXTimeout= 120; unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS; -unsigned int XkbDfltAccessXTimeoutValues= 0; -unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; -unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; +static unsigned int XkbDfltAccessXTimeoutValues= 0; +static unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; +static unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask; unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask); diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index e0bf89c7b..2e0c89fc2 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -36,14 +36,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "misc.h" #include "inputstr.h" -#include +#include #include "xkb.h" #include static unsigned int _xkbServerGeneration; -int xkbDevicePrivateIndex = -1; +static int xkbDevicePrivateIndex = -1; -void +static void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data) { @@ -216,7 +216,7 @@ static XkbAction fake; return fake; } -XkbAction +static XkbAction XkbGetButtonAction(DeviceIntPtr kbd,DeviceIntPtr dev,int button) { XkbAction fake; diff --git a/xkb/xkbDflts.h b/xkb/xkbDflts.h index e31568abb..5d8690650 100644 --- a/xkb/xkbDflts.h +++ b/xkb/xkbDflts.h @@ -456,43 +456,6 @@ static XkbCompatMapRec compatMap= { num_dfltSI, num_dfltSI }; -static XkbIndicatorRec indicators= { - 0x0, - { - { 0x80, 0, 0x00, XkbIM_UseEffective, { LockMask, LockMask, 0 }, 0 }, - { 0x80, 0, 0x00, XkbIM_UseEffective, { 0, 0, vmod_NumLockMask }, 0 }, - { 0x80, 0, 0x00, XkbIM_UseLocked, { ShiftMask, ShiftMask, 0 }, 0 }, - { 0x80, 0, 0x00, 0, { 0, 0, 0 }, XkbMouseKeysMask }, - { 0x80, 0, 0x00, XkbIM_UseLocked, { 0, 0, vmod_ScrollLockMask }, 0 }, - { 0x80, XkbIM_UseEffective, 0xfe, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 } - } -}; static void initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb) { diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index 139221f3f..11dc17ad3 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "inputstr.h" #include "windowstr.h" -#include +#include #include "xkb.h" /***====================================================================***/ @@ -331,7 +331,7 @@ Time time = 0; return; } -void +static void XkbSendIndicatorNotify(DeviceIntPtr kbd,int xkbType,xkbIndicatorNotify *pEv) { int initialized; @@ -971,48 +971,6 @@ XkbInterestPtr interest; return NULL; } -int -XkbRemoveClient(DevicePtr inDev,ClientPtr client) -{ -XkbSrvInfoPtr xkbi; -DeviceIntPtr dev = (DeviceIntPtr)inDev; -XkbInterestPtr interest; -unsigned long autoCtrls,autoValues; -Bool found; - - found= False; - autoCtrls= autoValues= 0; - if ( dev->xkb_interest ) { - interest = dev->xkb_interest; - if (interest && (interest->client==client)){ - dev->xkb_interest = interest->next; - autoCtrls= interest->autoCtrls; - autoValues= interest->autoCtrlValues; - _XkbFree(interest); - found= True; - } - while ((!found)&&(interest->next)) { - if (interest->next->client==client) { - XkbInterestPtr victim = interest->next; - interest->next = victim->next; - autoCtrls= victim->autoCtrls; - autoValues= victim->autoCtrlValues; - _XkbFree(victim); - found= True; - } - interest = interest->next; - } - } - if (found && autoCtrls && dev->key && dev->key->xkbInfo ) { - XkbEventCauseRec cause; - - xkbi= dev->key->xkbInfo; - XkbSetCauseXkbReq(&cause,X_kbPerClientFlags,client); - XkbEnableDisableControls(xkbi,autoCtrls,autoValues,NULL,&cause); - } - return found; -} - int XkbRemoveResourceClient(DevicePtr inDev,XID id) { diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 5aa121da2..716bc26a5 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -47,7 +47,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "opaque.h" #include "property.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #include #include #include @@ -124,7 +124,7 @@ typedef struct _SrvXkmInfo { char * XkbBaseDirectory= XKB_BASE_DIRECTORY; char * XkbBinDirectory= XKB_BIN_DIRECTORY; -int XkbWantAccessX= 0; +static int XkbWantAccessX= 0; static XkbFileInfo * _XkbInitFileInfo= NULL; static Bool rulesDefined= False; @@ -134,20 +134,17 @@ static char * XkbLayoutDflt= NULL; static char * XkbVariantDflt= NULL; static char * XkbOptionsDflt= NULL; -char * XkbModelUsed= NULL; -char * XkbLayoutUsed= NULL; -char * XkbVariantUsed= NULL; -char * XkbOptionsUsed= NULL; - -int _XkbClientMajor= XkbMajorVersion; -int _XkbClientMinor= XkbMinorVersion; +static char * XkbModelUsed= NULL; +static char * XkbLayoutUsed= NULL; +static char * XkbVariantUsed= NULL; +static char * XkbOptionsUsed= NULL; _X_EXPORT Bool noXkbExtension= XKB_DFLT_DISABLED; -Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; +static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; /***====================================================================***/ -char * +static char * XkbGetRulesDflts(XkbRF_VarDefsPtr defs) { if (XkbModelDflt) defs->model= XkbModelDflt; @@ -161,7 +158,7 @@ XkbGetRulesDflts(XkbRF_VarDefsPtr defs) return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE); } -Bool +static Bool XkbWriteRulesProp(ClientPtr client, pointer closure) { int len,out; @@ -230,7 +227,7 @@ char * pval; return True; } -void +static void XkbSetRulesUsed(XkbRF_VarDefsPtr defs) { if (XkbModelUsed) @@ -289,9 +286,6 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, #include "xkbDflts.h" -/* A dummy to keep the compiler quiet */ -pointer xkbBogus = &indicators; - static Bool XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file) { diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index e94e0bff4..d607d9066 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include -#include +#include #include "xkb.h" /***====================================================================***/ @@ -82,7 +82,7 @@ XkbSrvLedInfoPtr sli; /* * Bool - * XkbApplyLEDChangeToKeyboard(xkbi,map,on,change) + *XkbApplyLEDChangeToKeyboard(xkbi,map,on,change) * * Some indicators "drive" the keyboard when their state is explicitly * changed, as described in section 9.2.1 of the XKB protocol spec. @@ -91,7 +91,7 @@ XkbSrvLedInfoPtr sli; * when the indicator described by 'map' is turned on or off. The * extent of the changes is reported in change, which must be defined. */ -Bool +static Bool XkbApplyLEDChangeToKeyboard( XkbSrvInfoPtr xkbi, XkbIndicatorMapPtr map, Bool on, @@ -166,6 +166,164 @@ XkbStatePtr state; } return (stateChange || ctrlChange); } + + /* + * Bool + * ComputeAutoState(map,state,ctrls) + * + * This function reports the effect of applying the specified + * indicator map given the specified state and controls, as + * described in section 9.2 of the XKB protocol specification. + */ + +static Bool +ComputeAutoState( XkbIndicatorMapPtr map, + XkbStatePtr state, + XkbControlsPtr ctrls) +{ +Bool on; +CARD8 mods,group; + + on= False; + mods= group= 0; + if (map->which_mods&XkbIM_UseAnyMods) { + if (map->which_mods&XkbIM_UseBase) + mods|= state->base_mods; + if (map->which_mods&XkbIM_UseLatched) + mods|= state->latched_mods; + if (map->which_mods&XkbIM_UseLocked) + mods|= state->locked_mods; + if (map->which_mods&XkbIM_UseEffective) + mods|= state->mods; + if (map->which_mods&XkbIM_UseCompat) + mods|= state->compat_state; + on = ((map->mods.mask&mods)!=0); + on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); + } + if (map->which_groups&XkbIM_UseAnyGroup) { + if (map->which_groups&XkbIM_UseBase) + group|= (1L << state->base_group); + if (map->which_groups&XkbIM_UseLatched) + group|= (1L << state->latched_group); + if (map->which_groups&XkbIM_UseLocked) + group|= (1L << state->locked_group); + if (map->which_groups&XkbIM_UseEffective) + group|= (1L << state->group); + on = on||(((map->groups&group)!=0)||(map->groups==0)); + } + if (map->ctrls) + on = on||(ctrls->enabled_ctrls&map->ctrls); + return on; +} + + +static void +XkbUpdateLedAutoState( DeviceIntPtr dev, + XkbSrvLedInfoPtr sli, + unsigned maps_to_check, + xkbExtensionDeviceNotify * ed, + XkbChangesPtr changes, + XkbEventCausePtr cause) +{ +DeviceIntPtr kbd; +XkbStatePtr state; +XkbControlsPtr ctrls; +XkbChangesRec my_changes; +xkbExtensionDeviceNotify my_ed; +register unsigned i,bit,affected; +register XkbIndicatorMapPtr map; +unsigned oldState; + + if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) + return; + + if (dev->key && dev->key->xkbInfo) + kbd= dev; + else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + + state= &kbd->key->xkbInfo->state; + ctrls= kbd->key->xkbInfo->desc->ctrls; + affected= maps_to_check; + oldState= sli->effectiveState; + sli->autoState&= ~affected; + for (i=0,bit=1;(imaps[i]; + if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) + sli->autoState|= bit; + } + sli->effectiveState= (sli->autoState|sli->explicitState); + affected= sli->effectiveState^oldState; + if (affected==0) + return; + + if (ed==NULL) { + ed= &my_ed; + bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); + } + else if ((ed->reason&XkbXI_IndicatorsMask)&& + ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { + XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); + } + + if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { + if (changes==NULL) { + changes= &my_changes; + bzero((char *)changes,sizeof(XkbChangesRec)); + } + changes->indicators.state_changes|= affected; + } + + ed->reason|= XkbXI_IndicatorStateMask; + ed->ledClass= sli->class; + ed->ledID= sli->id; + ed->ledsDefined= sli->namesPresent|sli->mapsPresent; + ed->ledState= sli->effectiveState; + ed->unsupported|= XkbXI_IndicatorStateMask; + ed->supported= XkbXI_AllFeaturesMask; + + if (changes!=&my_changes) changes= NULL; + if (ed!=&my_ed) ed= NULL; + if (changes || ed) + XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); + return; +} + +static void +XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) +{ +DeviceIntPtr edev; +XkbSrvLedInfoPtr sli; + + for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { + if (edev->kbdfeed) { + KbdFeedbackPtr kf; + for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { + if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) + continue; + sli= kf->xkb_sli; + XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, + changes,cause); + + } + } + if (edev->leds) { + LedFeedbackPtr lf; + for (lf=edev->leds;lf!=NULL;lf=lf->next) { + if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) + continue; + sli= lf->xkb_sli; + XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, + changes,cause); + + } + } + } + return; +} + /***====================================================================***/ @@ -228,55 +386,6 @@ unsigned side_affected; /***====================================================================***/ - /* - * Bool - * ComputeAutoState(map,state,ctrls) - * - * This function reports the effect of applying the specified - * indicator map given the specified state and controls, as - * described in section 9.2 of the XKB protocol specification. - */ - -static Bool -ComputeAutoState( XkbIndicatorMapPtr map, - XkbStatePtr state, - XkbControlsPtr ctrls) -{ -Bool on; -CARD8 mods,group; - - on= False; - mods= group= 0; - if (map->which_mods&XkbIM_UseAnyMods) { - if (map->which_mods&XkbIM_UseBase) - mods|= state->base_mods; - if (map->which_mods&XkbIM_UseLatched) - mods|= state->latched_mods; - if (map->which_mods&XkbIM_UseLocked) - mods|= state->locked_mods; - if (map->which_mods&XkbIM_UseEffective) - mods|= state->mods; - if (map->which_mods&XkbIM_UseCompat) - mods|= state->compat_state; - on = ((map->mods.mask&mods)!=0); - on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); - } - if (map->which_groups&XkbIM_UseAnyGroup) { - if (map->which_groups&XkbIM_UseBase) - group|= (1L << state->base_group); - if (map->which_groups&XkbIM_UseLatched) - group|= (1L << state->latched_group); - if (map->which_groups&XkbIM_UseLocked) - group|= (1L << state->locked_group); - if (map->which_groups&XkbIM_UseEffective) - group|= (1L << state->group); - on = on||(((map->groups&group)!=0)||(map->groups==0)); - } - if (map->ctrls) - on = on||(ctrls->enabled_ctrls&map->ctrls); - return on; -} - /***====================================================================***/ /* @@ -314,39 +423,6 @@ XkbSrvLedInfoPtr sli; /***====================================================================***/ -void -XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) -{ -DeviceIntPtr edev; -XkbSrvLedInfoPtr sli; - - for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { - if (edev->kbdfeed) { - KbdFeedbackPtr kf; - for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { - if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) - continue; - sli= kf->xkb_sli; - XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, - changes,cause); - - } - } - if (edev->leds) { - LedFeedbackPtr lf; - for (lf=edev->leds;lf!=NULL;lf=lf->next) { - if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) - continue; - sli= lf->xkb_sli; - XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, - changes,cause); - - } - } - } - return; -} - /***====================================================================***/ /* @@ -856,210 +932,3 @@ Bool kb_changed; XkbUpdateAllDeviceIndicators(NULL,cause); return; } - -/***====================================================================***/ - -void -XkbUpdateLedAutoState( DeviceIntPtr dev, - XkbSrvLedInfoPtr sli, - unsigned maps_to_check, - xkbExtensionDeviceNotify * ed, - XkbChangesPtr changes, - XkbEventCausePtr cause) -{ -DeviceIntPtr kbd; -XkbStatePtr state; -XkbControlsPtr ctrls; -XkbChangesRec my_changes; -xkbExtensionDeviceNotify my_ed; -register unsigned i,bit,affected; -register XkbIndicatorMapPtr map; -unsigned oldState; - - if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) - return; - - if (dev->key && dev->key->xkbInfo) - kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); - - state= &kbd->key->xkbInfo->state; - ctrls= kbd->key->xkbInfo->desc->ctrls; - affected= maps_to_check; - oldState= sli->effectiveState; - sli->autoState&= ~affected; - for (i=0,bit=1;(imaps[i]; - if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) - sli->autoState|= bit; - } - sli->effectiveState= (sli->autoState|sli->explicitState); - affected= sli->effectiveState^oldState; - if (affected==0) - return; - - if (ed==NULL) { - ed= &my_ed; - bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); - } - else if ((ed->reason&XkbXI_IndicatorsMask)&& - ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { - XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); - } - - if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { - if (changes==NULL) { - changes= &my_changes; - bzero((char *)changes,sizeof(XkbChangesRec)); - } - changes->indicators.state_changes|= affected; - } - - ed->reason|= XkbXI_IndicatorStateMask; - ed->ledClass= sli->class; - ed->ledID= sli->id; - ed->ledsDefined= sli->namesPresent|sli->mapsPresent; - ed->ledState= sli->effectiveState; - ed->unsupported|= XkbXI_IndicatorStateMask; - ed->supported= XkbXI_AllFeaturesMask; - - if (changes!=&my_changes) changes= NULL; - if (ed!=&my_ed) ed= NULL; - if (changes || ed) - XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); - return; -} - -/***====================================================================***/ - -static void -_UpdateButtonVMods( XkbDescPtr xkb, - unsigned num_btns, - XkbAction * acts, - unsigned changed, - xkbExtensionDeviceNotify * ed_inout) -{ -register int i; - - for (i=0;iany.type!=XkbSA_NoAction)&& - XkbUpdateActionVirtualMods(xkb,acts,changed)) { - if ((ed_inout->reason&XkbXI_ButtonActionsMask)==0) { - ed_inout->reason|= XkbXI_ButtonActionsMask; - ed_inout->firstBtn= i; - ed_inout->nBtns= 1; - } - else { - ed_inout->nBtns= (i-ed_inout->firstBtn)+1; - } - } - } - return; -} - -static void -_UpdateMapVMods( XkbDescPtr xkb, - register XkbIndicatorMapPtr map, - unsigned changed_vmods, - unsigned * changed_maps_rtrn) -{ -register int i; - - *changed_maps_rtrn= 0; - for (i=0;imods.vmods&changed_vmods) { - map->mods.mask= map->mods.real_mods; - map->mods.mask|= XkbMaskForVMask(xkb,map->mods.vmods); - *changed_maps_rtrn|= (1L<id; - if ((dev->button)&&(dev->button->xkb_acts)) { - _UpdateButtonVMods(xkb,dev->button->numButtons, - dev->button->xkb_acts,changed,&ed); - } - if (dev->kbdfeed) { - KbdFeedbackPtr kf; - for (kf=dev->kbdfeed;kf!=NULL;kf=kf->next) { - if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) - continue; - sli= kf->xkb_sli; - _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps); - if (changed_maps) { - if (ed.reason&XkbXI_IndicatorsMask) { - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - ed.reason= 0; - ed.firstBtn= ed.nBtns; - } - ed.ledClass= sli->class; - ed.ledID= sli->id; - ed.ledsDefined= sli->namesPresent|sli->mapsPresent; - ed.reason|= XkbXI_IndicatorMapsMask; - XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause); - } - } - } - if (dev->leds) { - LedFeedbackPtr lf; - for (lf=dev->leds;lf!=NULL;lf=lf->next) { - if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) - continue; - sli= lf->xkb_sli; - _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps); - if (changed_maps) { - if (ed.reason&XkbXI_IndicatorsMask) { - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - ed.reason= 0; - ed.firstBtn= ed.nBtns; - } - ed.ledClass= sli->class; - ed.ledID= sli->id; - ed.ledsDefined= sli->namesPresent|sli->mapsPresent; - ed.reason|= XkbXI_IndicatorMapsMask; - XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause); - } - } - } - if (ed.reason!=0) - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - return; -} - -void -XkbApplyVModChangesToAllDevices( DeviceIntPtr dev, - XkbDescPtr xkb, - unsigned changed, - XkbEventCausePtr cause) -{ -DeviceIntPtr edev; - if (dev!=(DeviceIntPtr)LookupKeyboardDevice()) - return; - for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { - if (edev->key) - continue; - _UpdateDeviceVMods(edev,xkb,changed,cause); - } - for (edev=inputInfo.off_devices;edev!=NULL;edev=edev->next) { - if (edev->key) - continue; - _UpdateDeviceVMods(edev,xkb,changed,cause); - } - return; -} diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c index 9944c8886..81124bcfb 100644 --- a/xkb/xkbPrKeyEv.c +++ b/xkb/xkbPrKeyEv.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "misc.h" #include "inputstr.h" -#include +#include #include diff --git a/xkb/xkbSwap.c b/xkb/xkbSwap.c index 9a04b77d5..da4c9053b 100644 --- a/xkb/xkbSwap.c +++ b/xkb/xkbSwap.c @@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "misc.h" #include "inputstr.h" -#include +#include #include #include "extnsionst.h" #include "xkb.h" diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 062159ec6..1d2366756 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -41,7 +41,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #include #include "xkb.h" @@ -172,44 +172,6 @@ register unsigned mask; return mask; } - -Bool -XkbApplyVModChanges( XkbSrvInfoPtr xkbi, - unsigned changed, - XkbChangesPtr changes, - unsigned * needChecksRtrn, - XkbEventCausePtr cause) -{ -XkbDescPtr xkb; -Bool check; - - xkb= xkbi->desc; -#ifdef DEBUG -{ -register unsigned i,bit; - for (i=0,bit=1;iserver->vmods[i]); - } -} -#endif - check= XkbApplyVirtualModChanges(xkb,changed,changes); - XkbApplyVModChangesToAllDevices(xkbi->device,xkb,changed,cause); - - if (needChecksRtrn!=NULL) { - if (check) - *needChecksRtrn= XkbStateNotifyMask|XkbIndicatorStateNotifyMask; - else *needChecksRtrn= 0; - } - else if (check) { - /* 7/12/95 (ef) -- XXX check compatibility and/or indicator state */ - } - return 1; -} - /***====================================================================***/ void @@ -658,7 +620,7 @@ int changed; return changed; } -void +static void XkbComputeCompatState(XkbSrvInfoPtr xkbi) { CARD16 grp_mask; @@ -772,21 +734,6 @@ XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi, /***====================================================================***/ -void -XkbSetPhysicalLockingKey(DeviceIntPtr dev,unsigned key) -{ -XkbDescPtr xkb; - - xkb= dev->key->xkbInfo->desc; - if ((key>=xkb->min_key_code) && (key<=xkb->max_key_code)) { - xkb->server->behaviors[key].type= XkbKB_Lock|XkbKB_Permanent; - } - else ErrorF("Internal Error! Bad XKB info in SetPhysicalLockingKey\n"); - return; -} - -/***====================================================================***/ - Bool XkbEnableDisableControls( XkbSrvInfoPtr xkbi, unsigned long change, diff --git a/xkb/xkberrs.c b/xkb/xkberrs.c index 095d573ea..3534356c6 100644 --- a/xkb/xkberrs.c +++ b/xkb/xkberrs.c @@ -32,37 +32,6 @@ #include #include -char * _XkbErrMessages[] = { - "success", /* _XkbSuccess */ - "key names not defined", /* _XkbErrMissingNames */ - "key types not defined", /* _XkbErrMissingTypes */ - "required key types not present", /* _XkbErrMissingReqTypes */ - "symbols not defined", /* _XkbErrMissingSymbols */ - "virtual modifier bindings not defined",/* _XkbErrMissingVMods */ - "indicators not defined", /* _XkbErrMissingIndicators */ - "compatibility map not defined", /* _XkbErrMissingCompatMap */ - "symbol interpretations not defined", /* _XkbErrMissingSymInterps */ - "geometry not defined", /* _XkbErrMissingGeometry */ - "illegal doodad type", /* _XkbErrIllegalDoodad */ - "illegal TOC type", /* _XkbErrIllegalTOCType */ - "illegal contents", /* _XkbErrIllegalContents */ - "empty file", /* _XkbErrEmptyFile */ - "file not found", /* _XkbErrFileNotFound */ - "cannot open", /* _XkbErrFileCannotOpen */ - "bad value", /* _XkbErrBadValue */ - "bad match", /* _XkbErrBadMatch */ - "illegal name for type", /* _XkbErrBadTypeName */ - "illegal width for type", /* _XkbErrBadTypeWidth */ - "bad file type", /* _XkbErrBadFileType */ - "bad file version", /* _XkbErrBadFileVersion */ - "error in Xkm file", /* _XkbErrBadFileFormat */ - "allocation failed", /* _XkbErrBadAlloc */ - "bad length", /* _XkbErrBadLength */ - "X request failed", /* _XkbErrXReqFailure */ - "not implemented" /* _XkbErrBadImplementation */ -}; - unsigned _XkbErrCode; char * _XkbErrLocation= NULL; unsigned _XkbErrData; - diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 4130bd998..05344b475 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -44,7 +44,7 @@ #include "dix.h" #include #define XKBSRV_NEED_FILE_FUNCS 1 -#include +#include #include #include "xkb.h" @@ -133,76 +133,6 @@ unsigned set,rtrn; /***===================================================================***/ -Bool -XkbLookupGroupAndLevel( XkbDescPtr xkb, - int key, - int * mods_inout, - int * grp_inout, - int * lvl_rtrn) -{ -int nG,eG; - - if ((!xkb)||(!XkbKeycodeInRange(xkb,key))||(!grp_inout)) - return False; - - nG= XkbKeyNumGroups(xkb,key); - eG= *grp_inout; - - if ( nG==0 ) { - *grp_inout= 0; - if (lvl_rtrn!=NULL) - *lvl_rtrn= 0; - return False; - } - else if ( nG==1 ) { - eG= 0; - } - else if ( eG>=nG ) { - unsigned gI= XkbKeyGroupInfo(xkb,key); - switch (XkbOutOfRangeGroupAction(gI)) { - default: - eG %= nG; - break; - case XkbClampIntoRange: - eG = nG-1; - break; - case XkbRedirectIntoRange: - eG = XkbOutOfRangeGroupNumber(gI); - if (eG>=nG) - eG= 0; - break; - } - } - *grp_inout= eG; - if (mods_inout!=NULL) { - XkbKeyTypePtr type; - int preserve; - - type = XkbKeyKeyType(xkb,key,eG); - if (lvl_rtrn!=NULL) - *lvl_rtrn= 0; - preserve= 0; - if (type->map) { /* find the shift level */ - register int i; - register XkbKTMapEntryPtr entry; - for (i=0,entry=type->map;imap_count;i++,entry++) { - if ((entry->active)&& - (((*mods_inout)&type->mods.mask)==entry->mods.mask)){ - if (lvl_rtrn!=NULL) - *lvl_rtrn= entry->level; - if (type->preserve) - preserve= type->preserve[i].mask; - break; - } - } - } - (*mods_inout)&= ~(type->mods.mask&(~preserve)); - } - return True; -} - -/***===================================================================***/ - static Bool XkbWriteSectionFromName(FILE *file,char *sectionName,char *name) { @@ -416,15 +346,6 @@ XkbFileInfo finfo; /***====================================================================***/ -/*ARGSUSED*/ -Status -XkbMergeFile(XkbDescPtr xkb,XkbFileInfo finfo) -{ - return BadImplementation; -} - -/***====================================================================***/ - int XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases) { @@ -484,34 +405,6 @@ unsigned rtrn; return rtrn; } -unsigned -XkbConvertXkbComponents(Bool toXkm,unsigned orig) -{ -unsigned rtrn; - - rtrn= 0; - if (toXkm) { - if (orig&XkbClientMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask; - if (orig&XkbServerMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask; - if (orig&XkbCompatMapMask) rtrn|= XkmCompatMapMask; - if (orig&XkbIndicatorMapMask) rtrn|= XkmIndicatorsMask; - if (orig&XkbNamesMask) rtrn|= XkmKeyNamesMask; - if (orig&XkbGeometryMask) rtrn|= XkmGeometryMask; - } - else { - if (orig!=0) rtrn|= XkbNamesMask; - if (orig&XkmTypesMask) rtrn|= XkbClientMapMask; - if (orig&XkmCompatMapMask) - rtrn|= XkbCompatMapMask|XkbIndicatorMapMask; - if (orig&XkmSymbolsMask) rtrn|=XkbClientMapMask|XkbServerMapMask; - if (orig&XkmIndicatorsMask) rtrn|= XkbIndicatorMapMask; - if (orig&XkmKeyNamesMask) - rtrn|= XkbNamesMask|XkbIndicatorMapMask; - if (orig&XkmGeometryMask) rtrn|= XkbGeometryMask; - } - return rtrn; -} - Bool XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing) { diff --git a/xkb/xkbout.c b/xkb/xkbout.c index 31cd4fae4..bdec8e7d3 100644 --- a/xkb/xkbout.c +++ b/xkb/xkbout.c @@ -44,7 +44,7 @@ #include "dix.h" #include #define XKBSRV_NEED_FILE_FUNCS 1 -#include +#include #include #include @@ -925,127 +925,3 @@ XkbGeometryPtr geom; fprintf(file,"};\n\n"); return True; } - -/*ARGSUSED*/ -Bool -XkbWriteXKBSemantics( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; - - fprintf(file,"xkb_semantics {\n"); - ok= XkbWriteXKBKeyTypes(file,result,False,False,addOn,priv); - ok= ok&&XkbWriteXKBCompatMap(file,result,False,False,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -/*ARGSUSED*/ -Bool -XkbWriteXKBLayout( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - fprintf(file,"xkb_layout {\n"); - ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv); - if (xkb->geom) - ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -/*ARGSUSED*/ -Bool -XkbWriteXKBKeymap( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - fprintf(file,"xkb_keymap {\n"); - ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBCompatMap(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv); - if (xkb->geom) - ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -Bool -XkbWriteXKBFile( FILE * out, - XkbFileInfo * result, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok = False; -Bool (*func)( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -) = NULL; - - switch (result->type) { - case XkmSemanticsFile: - func= XkbWriteXKBSemantics; - break; - case XkmLayoutFile: - func= XkbWriteXKBLayout; - break; - case XkmKeymapFile: - func= XkbWriteXKBKeymap; - break; - case XkmTypesIndex: - func= XkbWriteXKBKeyTypes; - break; - case XkmCompatMapIndex: - func= XkbWriteXKBCompatMap; - break; - case XkmSymbolsIndex: - func= XkbWriteXKBSymbols; - break; - case XkmKeyNamesIndex: - func= XkbWriteXKBKeycodes; - break; - case XkmGeometryFile: - case XkmGeometryIndex: - func= XkbWriteXKBGeometry; - break; - case XkmVirtualModsIndex: - case XkmIndicatorsIndex: - _XkbLibError(_XkbErrBadImplementation, - XkbConfigText(result->type,XkbMessage),0); - return False; - } - if (out==NULL) { - _XkbLibError(_XkbErrFileCannotOpen,"XkbWriteXkbFile",0); - ok= False; - } - else if (func) { - ok= (*func)(out,result,True,showImplicit,addOn,priv); - } - return ok; -} diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index defd45a64..3a5037150 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -44,7 +44,7 @@ #include "dix.h" #include #define XKBSRV_NEED_FILE_FUNCS 1 -#include +#include #include /***====================================================================***/ @@ -448,100 +448,6 @@ char * buf; return buf; } -char * -XkbAccessXDetailText(unsigned state,unsigned format) -{ -char *buf,*prefix; - - buf= tbGetBuffer(32); - if (format==XkbMessage) prefix= ""; - else prefix= "XkbAXN_"; - switch (state){ - case XkbAXN_SKPress: sprintf(buf,"%sSKPress",prefix); break; - case XkbAXN_SKAccept: sprintf(buf,"%sSKAccept",prefix); break; - case XkbAXN_SKRelease: sprintf(buf,"%sSKRelease",prefix); break; - case XkbAXN_SKReject: sprintf(buf,"%sSKReject",prefix); break; - case XkbAXN_BKAccept: sprintf(buf,"%sBKAccept",prefix); break; - case XkbAXN_BKReject: sprintf(buf,"%sBKReject",prefix); break; - case XkbAXN_AXKWarning: sprintf(buf,"%sAXKWarning",prefix); break; - default: sprintf(buf,"ILLEGAL"); break; - } - return buf; -} - -static char *nknNames[] = { - "keycodes", "geometry", "deviceID" -}; -#define NUM_NKN (sizeof(nknNames)/sizeof(char *)) - -char * -XkbNKNDetailMaskText(unsigned detail,unsigned format) -{ -char *buf,*prefix,*suffix; -register int i; -register unsigned bit; -int len,plen,slen; - - - if ((detail&XkbAllNewKeyboardEventsMask)==0) { - char *tmp = ""; - if (format==XkbCFile) tmp= "0"; - else if (format==XkbMessage) tmp= "none"; - buf= tbGetBuffer(strlen(tmp)+1); - strcpy(buf,tmp); - return buf; - } - else if ((detail&XkbAllNewKeyboardEventsMask)==XkbAllNewKeyboardEventsMask){ - char * tmp; - if (format==XkbCFile) tmp= "XkbAllNewKeyboardEventsMask"; - else tmp= "all"; - buf= tbGetBuffer(strlen(tmp)+1); - strcpy(buf,tmp); - return buf; - } - if (format==XkbMessage) { - prefix= ""; - suffix= ""; - slen= plen= 0; - } - else { - prefix= "XkbNKN_"; - plen= 7; - if (format==XkbCFile) - suffix= "Mask"; - else suffix= ""; - slen= strlen(suffix); - } - for (len=0,i=0,bit=1;i #define XKBSRV_NEED_FILE_FUNCS -#include +#include #include Atom @@ -1098,18 +1098,6 @@ unsigned i,size_toc; return 1; } -xkmSectionInfo * -XkmFindTOCEntry(xkmFileInfo *finfo,xkmSectionInfo *toc,unsigned type) -{ -register int i; - - for (i=0;inum_toc;i++) { - if (toc[i].type==type) - return &toc[i]; - } - return NULL; -} - Bool XkmReadFileSection( FILE * file, xkmSectionInfo * toc, From f34b9a20b0181d3c2641c305e91180711afbd4b9 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 21 Mar 2007 02:03:37 +0200 Subject: [PATCH 11/63] XKB: Be a tiny bit more conservative with type allocation Make sure size_types will _always_ be 0 if we don't have any types. --- xkb/xkbUtils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 1d2366756..bb6d8a0ae 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -1140,6 +1140,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) dtype->preserve = NULL; } } + + dst->map->size_types = src->map->num_types; + dst->map->num_types = src->map->num_types; } else { if (dst->map->types) { @@ -1155,9 +1158,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) xfree(dst->map->types); dst->map->types = NULL; } + dst->map->num_types = 0; + dst->map->size_types = 0; } - dst->map->size_types = src->map->num_types; - dst->map->num_types = src->map->num_types; if (src->map->modmap) { if (src->max_key_code != dst->max_key_code) { From f292de2ef13dc994a38029cee9e2642576893332 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 21 Mar 2007 02:04:12 +0200 Subject: [PATCH 12/63] XKB: Fix size_syms calculation bug Apparently it needed to be nSyms*15/10, not *12/10; make it match the other allocation code. --- xkb/XKBMAlloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index 4b7428b2e..9feaf8e93 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -399,7 +399,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; } if (nResize>0) { int nextMatch; - xkb->map->size_syms= (nTotal*12)/10; + xkb->map->size_syms= (nTotal*15)/10; newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym); if (newSyms==NULL) return BadAlloc; From 3e9f7a5504ab41d845e88f293d8498c963d8a7d8 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 21 Mar 2007 02:35:31 +0200 Subject: [PATCH 13/63] XFree86 DGA: Guard against NULL pointer dereferences. Ass, u, me ... --- hw/xfree86/common/xf86Xinput.c | 38 ++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index c9c8059c0..17ffed899 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -423,17 +423,19 @@ xf86PostMotionEvent(DeviceIntPtr device, #if XFreeXDGA if (first_valuator == 0 && num_valuators >= 2) { - index = miPointerGetScreen(inputInfo.pointer)->myNum; - if (is_absolute) { - dx = valuators[0] - device->valuator->lastx; - dy = valuators[1] - device->valuator->lasty; + if (miPointerGetScreen(inputInfo.pointer)) { + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (is_absolute) { + dx = valuators[0] - device->valuator->lastx; + dy = valuators[1] - device->valuator->lasty; + } + else { + dx = valuators[0]; + dy = valuators[1]; + } + if (DGAStealMotionEvent(index, dx, dy)) + goto out; } - else { - dx = valuators[0]; - dy = valuators[1]; - } - if (DGAStealMotionEvent(index, dx, dy)) - goto out; } #endif @@ -505,9 +507,11 @@ xf86PostButtonEvent(DeviceIntPtr device, int index; #if XFreeXDGA - index = miPointerGetScreen(inputInfo.pointer)->myNum; - if (DGAStealButtonEvent(index, button, is_down)) - return; + if (miPointerGetScreen(inputInfo.pointer)) { + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (DGAStealButtonEvent(index, button, is_down)) + return; + } #endif valuators = xcalloc(sizeof(int), num_valuators); @@ -588,9 +592,11 @@ xf86PostKeyboardEvent(DeviceIntPtr device, int index; #if XFreeXDGA - index = miPointerGetScreen(inputInfo.pointer)->myNum; - if (DGAStealKeyEvent(index, key_code, is_down)) - return; + if (miPointerGetScreen(inputInfo.pointer)) { + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (DGAStealKeyEvent(index, key_code, is_down)) + return; + } #endif if (!xf86Events) From b63e0d2545bb75e14d9de019a88f31e20a2f7377 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 20 Mar 2007 07:17:27 -0700 Subject: [PATCH 14/63] Clean up Rotate state on server reset. The rotation state is stored in the xf86_config structure which is not re-initialized at server reset time. Clean it up at CloseScreen time. (cherry picked from commit f8db7665dcd7af78ca4db2461e0bf787ec662cb1) --- hw/xfree86/loader/xf86sym.c | 1 + hw/xfree86/modes/xf86Crtc.c | 20 ++++++++++ hw/xfree86/modes/xf86Crtc.h | 8 ++++ hw/xfree86/modes/xf86Rotate.c | 74 +++++++++++++++++++++++++---------- 4 files changed, 82 insertions(+), 21 deletions(-) diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index bc7c8148b..5175f01f9 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -1170,6 +1170,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMVAR(pciNumBuses) /* modes */ + SYMVAR(xf86CrtcConfigPrivateIndex) SYMFUNC(xf86CrtcConfigInit) SYMFUNC(xf86CrtcConfigPrivateIndex) SYMFUNC(xf86CrtcCreate) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 1a4292092..a875cdf39 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -565,6 +565,22 @@ xf86CrtcCreateScreenResources (ScreenPtr screen) return TRUE; } +/* + * Clean up config on server reset + */ +static Bool +xf86CrtcCloseScreen (int index, ScreenPtr screen) +{ + ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + + screen->CloseScreen = config->CloseScreen; + + xf86RotateCloseScreen (screen); + + return screen->CloseScreen (index, screen); +} + /* * Called at ScreenInit time to set up */ @@ -596,6 +612,10 @@ xf86CrtcScreenInit (ScreenPtr screen) /* Wrap CreateScreenResources so we can initialize the RandR code */ config->CreateScreenResources = screen->CreateScreenResources; screen->CreateScreenResources = xf86CrtcCreateScreenResources; + + config->CloseScreen = screen->CloseScreen; + screen->CloseScreen = xf86CrtcCloseScreen; + return TRUE; } diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index b7515928e..42daf6079 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -544,6 +544,8 @@ typedef struct _xf86CrtcConfig { CreateScreenResourcesProcPtr CreateScreenResources; + CloseScreenProcPtr CloseScreen; + /* Cursor information */ xf86CursorInfoPtr cursor_info; CursorPtr cursor; @@ -593,6 +595,12 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, Bool xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation); +/* + * Clean up rotation during CloseScreen + */ +void +xf86RotateCloseScreen (ScreenPtr pScreen); + /** * Return whether any output is assigned to the crtc */ diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index e82b69e1b..e8fafd073 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -321,6 +321,58 @@ xf86RotateWakeupHandler(pointer data, int i, pointer LastSelectMask) { } +static void +xf86RotateDestroy (xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + ScreenPtr pScreen = pScrn->pScreen; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + int c; + + /* Free memory from rotation */ + if (crtc->rotatedPixmap || crtc->rotatedData) + { + crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData); + crtc->rotatedPixmap = NULL; + crtc->rotatedData = NULL; + } + + for (c = 0; c < xf86_config->num_crtc; c++) + if (crtc->rotatedPixmap || crtc->rotatedData) + return; + + /* + * Clean up damage structures when no crtcs are rotated + */ + if (xf86_config->rotation_damage) + { + /* Free damage structure */ + if (xf86_config->rotation_damage_registered) + { + DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, + xf86_config->rotation_damage); + xf86_config->rotation_damage_registered = FALSE; + } + DamageDestroy (xf86_config->rotation_damage); + xf86_config->rotation_damage = NULL; + /* Free block/wakeup handler */ + RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler, + xf86RotateWakeupHandler, + (pointer) pScreen); + } +} + +void +xf86RotateCloseScreen (ScreenPtr screen) +{ + ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + int c; + + for (c = 0; c < xf86_config->num_crtc; c++) + xf86RotateDestroy (xf86_config->crtc[c]); +} + Bool xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) { @@ -330,27 +382,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) if (rotation == RR_Rotate_0) { - /* Free memory from rotation */ - if (crtc->rotatedPixmap || crtc->rotatedData) - { - crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData); - crtc->rotatedPixmap = NULL; - crtc->rotatedData = NULL; - } - - if (xf86_config->rotation_damage) - { - /* Free damage structure */ - DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, - xf86_config->rotation_damage); - xf86_config->rotation_damage_registered = FALSE; - DamageDestroy (xf86_config->rotation_damage); - xf86_config->rotation_damage = NULL; - /* Free block/wakeup handler */ - RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler, - xf86RotateWakeupHandler, - (pointer) pScreen); - } + xf86RotateDestroy (crtc); } else { From 479b2be4badab0a67b1f091feb83c1364e27d783 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 23 Mar 2007 00:57:18 -0700 Subject: [PATCH 15/63] Clear allocated RandR screen private structure. Use xcalloc instead of xalloc when allocating this structure to ensure consistent contents at startup. (cherry picked from commit 16f4c0c1750824f2e5a001cef82a4122a7a2beb0) --- randr/randr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/randr/randr.c b/randr/randr.c index 5fa9baf84..4dd0ee5b4 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -230,7 +230,7 @@ Bool RRScreenInit(ScreenPtr pScreen) RRScreenGeneration = serverGeneration; } - pScrPriv = (rrScrPrivPtr) xalloc (sizeof (rrScrPrivRec)); + pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec)); if (!pScrPriv) return FALSE; From 510eaa346e68fd82c852c7b41fb0e2c5be12da78 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 23 Mar 2007 00:59:11 -0700 Subject: [PATCH 16/63] Clean up xf86CrtcRec and xf86OutputRec objects at CloseScreen. Erase pointers to structures which are freed at server reset time. (cherry picked from commit 492c768065f49306a2194a88edf96b85de0ff4ff) --- hw/xfree86/modes/xf86Crtc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index a875cdf39..fad0752eb 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -573,11 +573,25 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen) { ScrnInfoPtr scrn = xf86Screens[screen->myNum]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int o, c; screen->CloseScreen = config->CloseScreen; xf86RotateCloseScreen (screen); + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; + + output->crtc = NULL; + output->randr_output = NULL; + } + for (c = 0; c < config->num_crtc; c++) + { + xf86CrtcPtr crtc = config->crtc[c]; + + crtc->randr_crtc = NULL; + } return screen->CloseScreen (index, screen); } From 86d76390eb182f271f5fa5dc19205e97a867f7e7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 23 Mar 2007 01:03:40 -0700 Subject: [PATCH 17/63] Make sure RandR events are delivered from RRCrtcSet. Some paths were skipping the event delivery stage. (cherry picked from commit 9ca7ba5d6012295a77ed773c656e786440da973d) --- randr/rrcrtc.c | 93 +++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index ecf5bb251..7131dfb3a 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -262,6 +262,8 @@ RRCrtcSet (RRCrtcPtr crtc, RROutputPtr *outputs) { ScreenPtr pScreen = crtc->pScreen; + Bool ret = FALSE; + rrScrPriv(pScreen); /* See if nothing changed */ if (crtc->mode == mode && @@ -271,61 +273,64 @@ RRCrtcSet (RRCrtcPtr crtc, crtc->numOutputs == numOutputs && !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr))) { - return TRUE; + ret = TRUE; } - if (pScreen) + else { #if RANDR_12_INTERFACE - rrScrPriv(pScreen); if (pScrPriv->rrCrtcSet) { - return (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y, - rotation, numOutputs, outputs); + ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y, + rotation, numOutputs, outputs); } + else #endif -#if RANDR_10_INTERFACE - if (pScrPriv->rrSetConfig) { - RRScreenSize size; - RRScreenRate rate; - Bool ret; +#if RANDR_10_INTERFACE + if (pScrPriv->rrSetConfig) + { + RRScreenSize size; + RRScreenRate rate; - if (!mode) - { - RRCrtcNotify (crtc, NULL, x, y, rotation, 0, NULL); - return TRUE; + if (!mode) + { + RRCrtcNotify (crtc, NULL, x, y, rotation, 0, NULL); + ret = TRUE; + } + else + { + size.width = mode->mode.width; + size.height = mode->mode.height; + if (outputs[0]->mmWidth && outputs[0]->mmHeight) + { + size.mmWidth = outputs[0]->mmWidth; + size.mmHeight = outputs[0]->mmHeight; + } + else + { + size.mmWidth = pScreen->mmWidth; + size.mmHeight = pScreen->mmHeight; + } + size.nRates = 1; + rate.rate = RRVerticalRefresh (&mode->mode); + size.pRates = &rate; + ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size); + /* + * Old 1.0 interface tied screen size to mode size + */ + if (ret) + { + RRCrtcNotify (crtc, mode, x, y, rotation, 1, outputs); + RRScreenSizeNotify (pScreen); + } + } } - - size.width = mode->mode.width; - size.height = mode->mode.height; - if (outputs[0]->mmWidth && outputs[0]->mmHeight) - { - size.mmWidth = outputs[0]->mmWidth; - size.mmHeight = outputs[0]->mmHeight; - } - else - { - size.mmWidth = pScreen->mmWidth; - size.mmHeight = pScreen->mmHeight; - } - size.nRates = 1; - rate.rate = RRVerticalRefresh (&mode->mode); - size.pRates = &rate; - ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size); - /* - * Old 1.0 interface tied screen size to mode size - */ - if (ret) - { - RRCrtcNotify (crtc, mode, x, y, rotation, 1, outputs); - RRScreenSizeNotify (pScreen); - } - return ret; - } #endif - RRTellChanged (pScreen); + } + if (ret) + RRTellChanged (pScreen); } - return FALSE; + return ret; } /* @@ -718,6 +723,7 @@ ProcRRSetCrtcConfig (ClientPtr client) goto sendReply; } +#if 0 /* * if the client's config timestamp is not the same as the last config * timestamp, then the config information isn't up-to-date and @@ -728,6 +734,7 @@ ProcRRSetCrtcConfig (ClientPtr client) rep.status = RRSetConfigInvalidConfigTime; goto sendReply; } +#endif /* * Validate requested rotation From 7093367c3976bef5b9d219d9f2a7dc7dd3eeb091 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 23 Mar 2007 01:05:55 -0700 Subject: [PATCH 18/63] Fix Pending property API, adding RRPostPendingProperty. Pending Properties take effect when the driver says they do, so provide an API to tell DIX when a property effect is made. Also, allow driver to reject property values in RRChangeOutputProperty. (cherry picked from commit 8eb288fbd69e2ffd02521d2c6a964c8180d08ec8) --- hw/xfree86/modes/xf86Crtc.c | 2 +- randr/randrstr.h | 5 +- randr/rrproperty.c | 151 ++++++++++++++++++++++-------------- 3 files changed, 99 insertions(+), 59 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index fad0752eb..2341715e7 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1923,7 +1923,7 @@ xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len) if (data_len != 0) { RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8, - PropModeReplace, data_len, data, FALSE); + PropModeReplace, data_len, data, FALSE, TRUE); } else { RRDeleteOutputProperty(output->randr_output, edid_atom); } diff --git a/randr/randrstr.h b/randr/randrstr.h index 0dee99921..9f039f747 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -761,10 +761,13 @@ RRQueryOutputProperty (RROutputPtr output, Atom property); void RRDeleteOutputProperty (RROutputPtr output, Atom property); +Bool +RRPostPendingProperty (RROutputPtr output, Atom property); + int RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent); + pointer value, Bool sendevent, Bool pending); int RRConfigureOutputProperty (RROutputPtr output, Atom property, diff --git a/randr/rrproperty.c b/randr/rrproperty.c index edfed1f47..b0182daa7 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -121,19 +121,19 @@ RRDeleteOutputProperty (RROutputPtr output, Atom property) int RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent) + pointer value, Bool sendevent, Bool pending) { RRPropertyPtr prop; xRROutputPropertyNotifyEvent event; rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen); - int sizeInBytes; - int totalSize; - pointer data; + int size_in_bytes; + int total_size; + unsigned long total_len; RRPropertyValuePtr prop_value; + RRPropertyValueRec new_value; Bool add = FALSE; - sizeInBytes = format >> 3; - totalSize = len * sizeInBytes; + size_in_bytes = format >> 3; /* first see if property already exists */ prop = RRQueryOutputProperty (output, property); @@ -145,7 +145,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, add = TRUE; mode = PropModeReplace; } - if (prop->is_pending) + if (pending && prop->is_pending) prop_value = &prop->pending; else prop_value = &prop->current; @@ -159,68 +159,75 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, return(BadMatch); if ((prop_value->type != type) && (mode != PropModeReplace)) return(BadMatch); + new_value = *prop_value; if (mode == PropModeReplace) + total_len = len; + else + total_len = prop_value->size + len; + + if (mode == PropModeReplace || len > 0) { - if (totalSize != prop_value->size * (prop_value->format >> 3)) + pointer new_data, old_data; + + total_size = total_len * size_in_bytes; + new_value.data = (pointer)xalloc (total_size); + if (!new_value.data && total_size) { - if (prop_value->data) - data = (pointer)xrealloc(prop_value->data, totalSize); - else - data = (pointer)xalloc (totalSize); - if (!data && len) - { - if (add) - RRDestroyOutputProperty (prop); - return(BadAlloc); - } - prop_value->data = data; + if (add) + RRDestroyOutputProperty (prop); + return BadAlloc; } if (len) - memmove((char *)prop_value->data, (char *)value, totalSize); - prop_value->size = len; - prop_value->type = type; - prop_value->format = format; + memmove((char *)new_value.data, (char *)value, total_size); + new_value.size = len; + new_value.type = type; + new_value.format = format; + + switch (mode) { + case PropModeReplace: + new_data = new_value.data; + old_data = NULL; + break; + case PropModeAppend: + new_data = (pointer) (((char *) new_value.data) + + (prop_value->size * size_in_bytes)); + old_data = new_value.data; + break; + case PropModePrepend: + new_data = new_value.data; + old_data = (pointer) (((char *) new_value.data) + + (prop_value->size * size_in_bytes)); + break; + } + memcpy ((char *) new_data, (char *) value, len * size_in_bytes); + if (old_data) + memcpy ((char *) old_data, (char *) prop_value->data, + prop_value->size * size_in_bytes); + + if (pending && pScrPriv->rrOutputSetProperty && + !pScrPriv->rrOutputSetProperty(output->pScreen, output, + prop->propertyName, &new_value)) + { + if (new_value.data) + xfree (new_value.data); + return (BadValue); + } + if (prop_value->data) + xfree (prop_value->data); + *prop_value = new_value; } + else if (len == 0) { /* do nothing */ } - else if (mode == PropModeAppend) - { - data = (pointer)xrealloc(prop_value->data, - sizeInBytes * (len + prop_value->size)); - if (!data) - return(BadAlloc); - prop_value->data = data; - memmove(&((char *)data)[prop_value->size * sizeInBytes], - (char *)value, - totalSize); - prop_value->size += len; - } - else if (mode == PropModePrepend) - { - data = (pointer)xalloc(sizeInBytes * (len + prop_value->size)); - if (!data) - return(BadAlloc); - memmove(&((char *)data)[totalSize], (char *)prop_value->data, - (int)(prop_value->size * sizeInBytes)); - memmove((char *)data, (char *)value, totalSize); - xfree(prop_value->data); - prop_value->data = data; - prop_value->size += len; - } + if (add) { prop->next = output->properties; output->properties = prop; } - if (!prop->is_pending) { - /* What should we do in case of failure? */ - pScrPriv->rrOutputSetProperty(output->pScreen, output, - prop->propertyName, prop_value); - } - if (sendevent) { event.type = RREventBase + RRNotify; @@ -234,6 +241,33 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, return(Success); } +Bool +RRPostPendingProperty (RROutputPtr output, Atom property) +{ + RRPropertyPtr prop = RRQueryOutputProperty (output, property); + RRPropertyValuePtr pending_value; + RRPropertyValuePtr current_value; + + if (!prop) + return FALSE; + if (!prop->is_pending) + return FALSE; + pending_value = &prop->pending; + current_value = &prop->current; + + if (pending_value->type == current_value->type && + pending_value->format == current_value->format && + pending_value->size == current_value->size && + !memcmp (pending_value->data, current_value->data, pending_value->size)) + return TRUE; + + if (RRChangeOutputProperty (output, property, + pending_value->type, pending_value->format, PropModeReplace, + pending_value->size, pending_value->data, TRUE, FALSE) != Success) + return FALSE; + return TRUE; +} + RRPropertyPtr RRQueryOutputProperty (RROutputPtr output, Atom property) { @@ -474,7 +508,7 @@ ProcRRChangeOutputProperty (ClientPtr client) err = RRChangeOutputProperty(output, stuff->property, stuff->type, (int)format, - (int)mode, len, (pointer)&stuff[1], TRUE); + (int)mode, len, (pointer)&stuff[1], TRUE, TRUE); if (err != Success) return err; else @@ -508,8 +542,8 @@ int ProcRRGetOutputProperty (ClientPtr client) { REQUEST(xRRGetOutputPropertyReq); - RRPropertyPtr prop, *prev; - RRPropertyValuePtr prop_value; + RRPropertyPtr prop, *prev; + RRPropertyValuePtr prop_value; unsigned long n, len, ind; RROutputPtr output; xRRGetOutputPropertyReply reply; @@ -600,7 +634,10 @@ ProcRRGetOutputProperty (ClientPtr client) reply.bytesAfter = n - (ind + len); reply.format = prop_value->format; reply.length = (len + 3) >> 2; - reply.nItems = len / (prop_value->format / 8 ); + if (prop_value->format) + reply.nItems = len / (prop_value->format / 8); + else + reply.nItems = 0; reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) From 476f2b5aefa518262b69e487555e6094818d857a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 23 Mar 2007 01:17:14 -0700 Subject: [PATCH 19/63] Incorrect extra memory copy in RRChangeOutputProperty. Left over from previous version of the code, this memmove will break when the mode is not Replace. (cherry picked from commit 945aa0aa556429b50dea8e8ebc0008304b093eb7) --- randr/rrproperty.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/randr/rrproperty.c b/randr/rrproperty.c index b0182daa7..148e4a27d 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -177,8 +177,6 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, RRDestroyOutputProperty (prop); return BadAlloc; } - if (len) - memmove((char *)new_value.data, (char *)value, total_size); new_value.size = len; new_value.type = type; new_value.format = format; From 1f77120775dc05fc84a00dd55190af2fa50ae509 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 23 Mar 2007 14:39:10 -0700 Subject: [PATCH 20/63] Ensure that crtc desired values track most recent mode. desiredX and desiredY were not recorded during xf86InitialConfiguration. desiredX, desiredY and desiredRotation were not recorded during xf86SetSingleMode. (cherry picked from commit 36e5227215e0912ddf8a010db042467f00efe0fc) --- hw/xfree86/modes/xf86Crtc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 2341715e7..b9895d9da 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1589,6 +1589,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) { crtc->desiredMode = *mode; crtc->desiredRotation = output->initial_rotation; + crtc->desiredX = output->initial_x; + crtc->desiredY = output->initial_y; crtc->enabled = TRUE; crtc->x = output->initial_x; crtc->y = output->initial_y; @@ -1813,7 +1815,12 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0)) ok = FALSE; else + { crtc->desiredMode = *crtc_mode; + crtc->desiredRotation = rotation; + crtc->desiredX = 0; + crtc->desiredY = 0; + } } xf86DisableUnusedFunctions(pScrn); return ok; From 804080a7096347d48c686f2c8fbfd06326bce400 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 23 Mar 2007 23:41:36 -0700 Subject: [PATCH 21/63] Make pending properties force mode set. And, remove AttachScreen calls. Yes, two changes in one commit. Sorry 'bout that. The first change ensures that when pending property values have been changed, a mode set to the current mode will actually do something, rather than being identified as a no-op. In addition, the driver no longer needs to manage the migration of pending to current values, that is handled both within the xf86 mode setting code (to deal with non-RandR changes) as well as within the RandR extension itself. The second change eliminates the two-call Create/AttachScreen stuff that was done in a failed attempt to create RandR resources before the screen structures were allocated. Merging these back into the Create function is cleaner. (cherry picked from commit 57e87e0d006cbf1f5b175fe02eeb981f741d92f0) Conflicts: randr/randrstr.h randr/rrcrtc.c I think master and server-1.3-branch are more in sync now. --- hw/xfree86/modes/xf86Crtc.c | 6 +++ hw/xfree86/modes/xf86RandR12.c | 7 ++- randr/mirandr.c | 11 +--- randr/randrstr.h | 33 ++++-------- randr/rrcrtc.c | 92 +++++++++++++++++++--------------- randr/rrinfo.c | 11 +--- randr/rroutput.c | 49 ++++++++---------- randr/rrproperty.c | 87 +++++++++++++++++++------------- 8 files changed, 146 insertions(+), 150 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index b9895d9da..7d86b6606 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -312,7 +312,13 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, { xf86OutputPtr output = xf86_config->output[i]; if (output->crtc == crtc) + { output->funcs->commit(output); +#ifdef RANDR_12_INTERFACE + if (output->randr_output) + RRPostPendingProperties (output->randr_output); +#endif + } } /* XXX free adjustedmode */ diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 4213fea52..6f52ee2d9 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -1011,8 +1011,7 @@ xf86RandR12CreateObjects12 (ScreenPtr pScreen) { xf86CrtcPtr crtc = config->crtc[c]; - crtc->randr_crtc = RRCrtcCreate (crtc); - RRCrtcAttachScreen (crtc->randr_crtc, pScreen); + crtc->randr_crtc = RRCrtcCreate (pScreen, crtc); RRCrtcGammaSetSize (crtc->randr_crtc, 256); } /* @@ -1022,13 +1021,13 @@ xf86RandR12CreateObjects12 (ScreenPtr pScreen) { xf86OutputPtr output = config->output[o]; - output->randr_output = RROutputCreate (output->name, + output->randr_output = RROutputCreate (pScreen, output->name, strlen (output->name), output); - RROutputAttachScreen (output->randr_output, pScreen); if (output->funcs->create_resources != NULL) output->funcs->create_resources(output); + RRPostPendingProperties (output->randr_output); } return TRUE; } diff --git a/randr/mirandr.c b/randr/mirandr.c index 47136fb96..3c4991e5a 100644 --- a/randr/mirandr.c +++ b/randr/mirandr.c @@ -133,20 +133,13 @@ miRandRInit (ScreenPtr pScreen) if (!mode) return FALSE; - crtc = RRCrtcCreate (NULL); + crtc = RRCrtcCreate (pScreen, NULL); if (!crtc) return FALSE; - if (!RRCrtcAttachScreen (crtc, pScreen)) - { - RRCrtcDestroy (crtc); - return FALSE; - } - output = RROutputCreate ("screen", 6, NULL); + output = RROutputCreate (pScreen, "screen", 6, NULL); if (!output) return FALSE; - if (!RROutputAttachScreen (output, pScreen)) - return FALSE; if (!RROutputSetClones (output, NULL, 0)) return FALSE; if (!RROutputSetModes (output, &mode, 1, 0)) diff --git a/randr/randrstr.h b/randr/randrstr.h index 9f039f747..4cc3a469e 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -138,6 +138,7 @@ struct _rrOutput { RRModePtr *userModes; Bool changed; RRPropertyPtr properties; + Bool pendingProperties; void *devPrivate; }; @@ -496,16 +497,14 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged); * Create a CRTC */ RRCrtcPtr -RRCrtcCreate (void *devPrivate); +RRCrtcCreate (ScreenPtr pScreen, void *devPrivate); /* - * Attach a CRTC to a screen. Once done, this cannot be - * undone without destroying the CRTC; it is separate from Create - * only to allow an xf86-based driver to create objects in preinit + * Set the allowed rotations on a CRTC */ -Bool -RRCrtcAttachScreen (RRCrtcPtr crtc, ScreenPtr pScreen); - +void +RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations); + /* * Notify the extension that the Crtc has been reconfigured, * the driver calls this whenever it has updated the mode @@ -561,13 +560,6 @@ Bool RRCrtcGammaSetSize (RRCrtcPtr crtc, int size); -/* - * Set the allowable rotations of the CRTC. - */ -Bool -RRCrtcSetRotations (RRCrtcPtr crtc, - Rotation rotations); - /* * Return the area of the frame buffer scanned out by the crtc, * taking into account the current mode and rotation @@ -670,18 +662,11 @@ RROutputChanged (RROutputPtr output, Bool configChanged); */ RROutputPtr -RROutputCreate (const char *name, +RROutputCreate (ScreenPtr pScreen, + const char *name, int nameLength, void *devPrivate); -/* - * Attach an output to a screen, again split from creation so - * xf86 DDXen can create randr resources before the ScreenRec - * exists - */ -Bool -RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen); - /* * Notify extension that output parameters have been changed */ @@ -762,7 +747,7 @@ void RRDeleteOutputProperty (RROutputPtr output, Atom property); Bool -RRPostPendingProperty (RROutputPtr output, Atom property); +RRPostPendingProperties (RROutputPtr output); int RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 7131dfb3a..1dfc3bbb0 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -51,17 +51,32 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged) * Create a CRTC */ RRCrtcPtr -RRCrtcCreate (void *devPrivate) +RRCrtcCreate (ScreenPtr pScreen, void *devPrivate) { - RRCrtcPtr crtc; - + RRCrtcPtr crtc; + RRCrtcPtr *crtcs; + rrScrPrivPtr pScrPriv; + if (!RRInit()) return NULL; + + pScrPriv = rrGetScrPriv(pScreen); + + /* make space for the crtc pointer */ + if (pScrPriv->numCrtcs) + crtcs = xrealloc (pScrPriv->crtcs, + (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr)); + else + crtcs = xalloc (sizeof (RRCrtcPtr)); + if (!crtcs) + return FALSE; + pScrPriv->crtcs = crtcs; + crtc = xalloc (sizeof (RRCrtcRec)); if (!crtc) return NULL; crtc->id = FakeClientID (0); - crtc->pScreen = NULL; + crtc->pScreen = pScreen; crtc->mode = NULL; crtc->x = 0; crtc->y = 0; @@ -77,37 +92,20 @@ RRCrtcCreate (void *devPrivate) if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc)) return NULL; + /* attach the screen and crtc together */ + crtc->pScreen = pScreen; + pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc; + return crtc; } /* - * Attach a Crtc to a screen. This is done as a separate step - * so that an xf86-based driver can create CRTCs in PreInit - * before the Screen has been created + * Set the allowed rotations on a CRTC */ - -Bool -RRCrtcAttachScreen (RRCrtcPtr crtc, ScreenPtr pScreen) +void +RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations) { - rrScrPriv (pScreen); - RRCrtcPtr *crtcs; - - /* make space for the crtc pointer */ - if (pScrPriv->numCrtcs) - crtcs = xrealloc (pScrPriv->crtcs, - (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr)); - else - crtcs = xalloc (sizeof (RRCrtcPtr)); - if (!crtcs) - return FALSE; - - /* attach the screen and crtc together */ - crtc->pScreen = pScreen; - pScrPriv->crtcs = crtcs; - pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc; - - RRCrtcChanged (crtc, TRUE); - return TRUE; + crtc->rotations = rotations; } /* @@ -249,6 +247,22 @@ RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc) WriteEventsToClient (client, 1, (xEvent *) &ce); } +static Bool +RRCrtcPendingProperties (RRCrtcPtr crtc) +{ + ScreenPtr pScreen = crtc->pScreen; + rrScrPriv(pScreen); + int o; + + for (o = 0; o < pScrPriv->numOutputs; o++) + { + RROutputPtr output = pScrPriv->outputs[o]; + if (output->crtc == crtc && output->pendingProperties) + return TRUE; + } + return FALSE; +} + /* * Request that the Crtc be reconfigured */ @@ -271,7 +285,8 @@ RRCrtcSet (RRCrtcPtr crtc, crtc->y == y && crtc->rotation == rotation && crtc->numOutputs == numOutputs && - !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr))) + !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) && + !RRCrtcPendingProperties (crtc)) { ret = TRUE; } @@ -328,7 +343,13 @@ RRCrtcSet (RRCrtcPtr crtc, #endif } if (ret) + { + int o; RRTellChanged (pScreen); + + for (o = 0; o < numOutputs; o++) + RRPostPendingProperties (outputs[o]); + } } return ret; } @@ -468,17 +489,6 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc, return TRUE; } -/* - * Set the allowable rotations of the CRTC. - */ -Bool -RRCrtcSetRotations (RRCrtcPtr crtc, - Rotation rotations) -{ - crtc->rotations = rotations; - return TRUE; -} - /* * Initialize crtc type */ diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 549d501dc..5ef1a6b83 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -91,19 +91,12 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations) if (pScrPriv->numOutputs == 0 && pScrPriv->numCrtcs == 0) { - crtc = RRCrtcCreate (NULL); + crtc = RRCrtcCreate (pScreen, NULL); if (!crtc) return; - if (!RRCrtcAttachScreen (crtc, pScreen)) - { - RRCrtcDestroy (crtc); - return; - } - output = RROutputCreate ("default", 7, NULL); + output = RROutputCreate (pScreen, "default", 7, NULL); if (!output) return; - if (!RROutputAttachScreen (output, pScreen)) - return; RROutputSetCrtcs (output, &crtc, 1); RROutputSetCrtc (output, crtc); RROutputSetConnection (output, RR_Connected); diff --git a/randr/rroutput.c b/randr/rroutput.c index 160071bcf..e00116283 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -47,19 +47,35 @@ RROutputChanged (RROutputPtr output, Bool configChanged) */ RROutputPtr -RROutputCreate (const char *name, +RROutputCreate (ScreenPtr pScreen, + const char *name, int nameLength, void *devPrivate) { - RROutputPtr output; + RROutputPtr output; + RROutputPtr *outputs; + rrScrPrivPtr pScrPriv; if (!RRInit()) return NULL; + + pScrPriv = rrGetScrPriv(pScreen); + + if (pScrPriv->numOutputs) + outputs = xrealloc (pScrPriv->outputs, + (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr)); + else + outputs = xalloc (sizeof (RROutputPtr)); + if (!outputs) + return FALSE; + + pScrPriv->outputs = outputs; + output = xalloc (sizeof (RROutputRec) + nameLength + 1); if (!output) return NULL; output->id = FakeClientID (0); - output->pScreen = NULL; + output->pScreen = pScreen; output->name = (char *) (output + 1); output->nameLength = nameLength; memcpy (output->name, name, nameLength); @@ -85,35 +101,10 @@ RROutputCreate (const char *name, if (!AddResource (output->id, RROutputType, (pointer) output)) return NULL; + pScrPriv->outputs[pScrPriv->numOutputs++] = output; return output; } -/* - * Attach an Output to a screen. This is done as a separate step - * so that an xf86-based driver can create Outputs in PreInit - * before the Screen has been created - */ - -Bool -RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen) -{ - rrScrPriv (pScreen); - RROutputPtr *outputs; - - if (pScrPriv->numOutputs) - outputs = xrealloc (pScrPriv->outputs, - (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr)); - else - outputs = xalloc (sizeof (RROutputPtr)); - if (!outputs) - return FALSE; - output->pScreen = pScreen; - pScrPriv->outputs = outputs; - pScrPriv->outputs[pScrPriv->numOutputs++] = output; - RROutputChanged (output, FALSE); - return TRUE; -} - /* * Notify extension that output parameters have been changed */ diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 148e4a27d..5ac073f81 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -27,7 +27,7 @@ static void RRDeliverEvent (ScreenPtr pScreen, xEvent *event, CARD32 mask) { - + } void @@ -50,7 +50,7 @@ RRDeleteAllOutputProperties (RROutputPtr output) xfree(prop->current.data); if (prop->pending.data) xfree(prop->pending.data); - xfree(prop); + xfree(prop); } } @@ -67,7 +67,7 @@ static RRPropertyPtr RRCreateOutputProperty (Atom property) { RRPropertyPtr prop; - + prop = (RRPropertyPtr)xalloc(sizeof(RRPropertyRec)); if (!prop) return NULL; @@ -139,7 +139,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, prop = RRQueryOutputProperty (output, property); if (!prop) /* just add to list */ { - prop = RRCreateOutputProperty (property); + prop = RRCreateOutputProperty (property); if (!prop) return(BadAlloc); add = TRUE; @@ -149,11 +149,11 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, prop_value = &prop->pending; else prop_value = &prop->current; - + /* To append or prepend to a property the request format and type - must match those of the already defined property. The - existing format and type are irrelevant when using the mode - "PropModeReplace" since they will be written over. */ + must match those of the already defined property. The + existing format and type are irrelevant when using the mode + "PropModeReplace" since they will be written over. */ if ((format != prop_value->format) && (mode != PropModeReplace)) return(BadMatch); @@ -167,8 +167,8 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, if (mode == PropModeReplace || len > 0) { - pointer new_data, old_data; - + pointer new_data = NULL, old_data = NULL; + total_size = total_len * size_in_bytes; new_value.data = (pointer)xalloc (total_size); if (!new_value.data && total_size) @@ -197,11 +197,12 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, (prop_value->size * size_in_bytes)); break; } - memcpy ((char *) new_data, (char *) value, len * size_in_bytes); + if (new_data) + memcpy ((char *) new_data, (char *) value, len * size_in_bytes); if (old_data) memcpy ((char *) old_data, (char *) prop_value->data, prop_value->size * size_in_bytes); - + if (pending && pScrPriv->rrOutputSetProperty && !pScrPriv->rrOutputSetProperty(output->pScreen, output, prop->propertyName, &new_value)) @@ -214,18 +215,21 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, xfree (prop_value->data); *prop_value = new_value; } - + else if (len == 0) { /* do nothing */ } - + if (add) { prop->next = output->properties; output->properties = prop; } + if (pending && prop->is_pending) + output->pendingProperties = TRUE; + if (sendevent) { event.type = RREventBase + RRNotify; @@ -240,30 +244,45 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, } Bool -RRPostPendingProperty (RROutputPtr output, Atom property) +RRPostPendingProperties (RROutputPtr output) { - RRPropertyPtr prop = RRQueryOutputProperty (output, property); - RRPropertyValuePtr pending_value; - RRPropertyValuePtr current_value; - - if (!prop) - return FALSE; - if (!prop->is_pending) - return FALSE; - pending_value = &prop->pending; - current_value = &prop->current; + RRPropertyValuePtr pending_value; + RRPropertyValuePtr current_value; + RRPropertyPtr property; + Bool ret = TRUE; - if (pending_value->type == current_value->type && - pending_value->format == current_value->format && - pending_value->size == current_value->size && - !memcmp (pending_value->data, current_value->data, pending_value->size)) + if (!output->pendingProperties) return TRUE; - if (RRChangeOutputProperty (output, property, - pending_value->type, pending_value->format, PropModeReplace, - pending_value->size, pending_value->data, TRUE, FALSE) != Success) - return FALSE; - return TRUE; + output->pendingProperties = FALSE; + for (property = output->properties; property; property = property->next) + { + /* Skip non-pending properties */ + if (!property->is_pending) + continue; + + pending_value = &property->pending; + current_value = &property->current; + + /* + * If the pending and current values are equal, don't mark it + * as changed (which would deliver an event) + */ + if (pending_value->type == current_value->type && + pending_value->format == current_value->format && + pending_value->size == current_value->size && + !memcmp (pending_value->data, current_value->data, + pending_value->size)) + continue; + + if (RRChangeOutputProperty (output, property->propertyName, + pending_value->type, pending_value->format, + PropModeReplace, pending_value->size, + pending_value->data, TRUE, + FALSE) != Success) + ret = FALSE; + } + return ret; } RRPropertyPtr From 1072b88a8f352484e70bc749e300c936e5600480 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 25 Mar 2007 10:06:00 +1000 Subject: [PATCH 22/63] loader: fix already built-in message --- hw/xfree86/loader/loadmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index c220d8a61..a83b889b8 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -869,7 +869,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, for (cim = compiled_in_modules; *cim; cim++) if (!strcmp (module, *cim)) { - xf86MsgVerb(X_INFO, 3, "Module alread ybuilt-in"); + xf86MsgVerb(X_INFO, 3, "Module already built-in\n"); return (ModuleDescPtr) 1; } From ac2356843e38b3400142bc54b65393c12976fc07 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sun, 25 Mar 2007 09:41:33 +0930 Subject: [PATCH 23/63] dix: Increase allocation size for core keyboard keymap to avoid buffer overrun when copying keymap from extension devices. --- dix/devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/devices.c b/dix/devices.c index f73841932..5996b75cd 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -238,7 +238,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what) keySyms.mapWidth = 4; keySyms.map = (KeySym *)xcalloc(sizeof(KeySym), (keySyms.maxKeyCode - - keySyms.minKeyCode) * + keySyms.minKeyCode + 1) * keySyms.mapWidth); if (!keySyms.map) { ErrorF("Couldn't allocate core keymap\n"); From 9a0f25de7ca3c68af867b38936103d17daa92ac6 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 12:27:01 -0400 Subject: [PATCH 24/63] Static cleanups, dead code deletion. --- Xi/exglobals.h | 1 - Xi/extinit.c | 4 +- composite/compalloc.c | 2 +- composite/compext.c | 16 ++--- composite/compinit.c | 2 +- composite/compint.h | 15 ---- damageext/damageext.c | 18 ++--- damageext/damageextint.h | 14 ---- dbe/midbe.c | 17 ++--- dix/devices.c | 9 +-- dix/dispatch.c | 4 +- dix/events.c | 2 +- dix/extension.c | 2 +- dix/gc.c | 2 +- dix/resource.c | 2 +- hw/xfree86/common/xf86Bus.c | 2 +- hw/xfree86/common/xf86Bus.h | 1 - hw/xfree86/common/xf86Configure.c | 2 +- hw/xfree86/common/xf86Events.c | 4 +- hw/xfree86/common/xf86xv.c | 2 +- hw/xfree86/loader/loader.c | 116 ------------------------------ hw/xfree86/loader/loaderProcs.h | 4 -- hw/xfree86/loader/loadmod.c | 100 +++++++------------------- hw/xfree86/parser/DRI.c | 31 ++++---- hw/xfree86/parser/Flags.c | 9 --- hw/xfree86/parser/Layout.c | 38 +++++----- hw/xfree86/parser/Module.c | 2 +- hw/xfree86/parser/Monitor.c | 32 ++++----- hw/xfree86/parser/configProcs.h | 12 ---- hw/xfree86/parser/read.c | 38 +++++----- hw/xfree86/parser/scan.c | 16 +---- hw/xfree86/xf4bpp/Makefile.am | 1 - hw/xfree86/xf4bpp/offscreen.c | 19 ----- hw/xfree86/xf4bpp/ppcGC.c | 9 ++- hw/xfree86/xf4bpp/xf4bpp.h | 8 --- hw/xnest/Display.c | 2 +- hw/xnest/Screen.c | 2 +- include/globals.h | 4 -- include/inputstr.h | 2 +- mi/mioverlay.c | 4 +- mi/miscrinit.c | 2 +- miext/damage/damage.c | 18 ++--- miext/damage/damagestr.h | 6 +- os/connection.c | 10 +-- os/io.c | 10 +-- os/osdep.h | 6 -- os/utils.c | 6 +- os/xdmcp.c | 16 ++--- render/animcur.c | 4 +- render/glyph.c | 6 +- render/glyphstr.h | 2 - render/picture.c | 2 +- xfixes/xfixes.c | 8 +-- xfixes/xfixesint.h | 3 - 54 files changed, 187 insertions(+), 482 deletions(-) diff --git a/Xi/exglobals.h b/Xi/exglobals.h index 3afd1bb9e..61ebca8c4 100644 --- a/Xi/exglobals.h +++ b/Xi/exglobals.h @@ -37,7 +37,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. extern int IReqCode; extern int BadDevice; -extern int BadEvent; extern int BadMode; extern int DeviceBusy; extern int BadClass; diff --git a/Xi/extinit.c b/Xi/extinit.c index 454883762..d14e133ba 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -116,7 +116,7 @@ int ExtEventIndex; Mask ExtValidMasks[EMASKSIZE]; Mask ExtExclusiveMasks[EMASKSIZE]; -struct dev_type +static struct dev_type { Atom type; char *name; @@ -152,7 +152,7 @@ XExtEventInfo EventInfo[32]; int IReqCode = 0; int BadDevice = 0; -int BadEvent = 1; +static int BadEvent = 1; int BadMode = 2; int DeviceBusy = 3; int BadClass = 4; diff --git a/composite/compalloc.c b/composite/compalloc.c index 5bbf0a279..ce1ef7d80 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -48,7 +48,7 @@ #include "compint.h" -void +static void compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) { WindowPtr pWin = (WindowPtr) closure; diff --git a/composite/compext.c b/composite/compext.c index 13936fa18..4c25cc7da 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -50,10 +50,10 @@ #include "compint.h" static CARD8 CompositeReqCode; -int CompositeClientPrivateIndex; +static int CompositeClientPrivateIndex; RESTYPE CompositeClientWindowType; RESTYPE CompositeClientSubwindowsType; -RESTYPE CompositeClientOverlayType; +static RESTYPE CompositeClientOverlayType; static void deleteCompOverlayClient (CompOverlayClientPtr pOcToDel, ScreenPtr pScreen); @@ -423,7 +423,7 @@ createOverlayWindow (ScreenPtr pScreen) return pWin; } -int +static int ProcCompositeGetOverlayWindow (ClientPtr client) { REQUEST(xCompositeGetOverlayWindowReq); @@ -477,7 +477,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client) return client->noClientException; } -int +static int ProcCompositeReleaseOverlayWindow (ClientPtr client) { REQUEST(xCompositeReleaseOverlayWindowReq); @@ -515,7 +515,7 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client) return client->noClientException; } -int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { +static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { ProcCompositeQueryVersion, ProcCompositeRedirectWindow, ProcCompositeRedirectSubwindows, @@ -625,7 +625,7 @@ SProcCompositeNameWindowPixmap (ClientPtr client) return (*ProcCompositeVector[stuff->compositeReqType]) (client); } -int +static int SProcCompositeGetOverlayWindow (ClientPtr client) { int n; @@ -637,7 +637,7 @@ SProcCompositeGetOverlayWindow (ClientPtr client) return (*ProcCompositeVector[stuff->compositeReqType]) (client); } -int +static int SProcCompositeReleaseOverlayWindow (ClientPtr client) { int n; @@ -649,7 +649,7 @@ SProcCompositeReleaseOverlayWindow (ClientPtr client) return (*ProcCompositeVector[stuff->compositeReqType]) (client); } -int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { +static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { SProcCompositeQueryVersion, SProcCompositeRedirectWindow, SProcCompositeRedirectSubwindows, diff --git a/composite/compinit.c b/composite/compinit.c index 1d5cc7b04..27261dcad 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -51,7 +51,7 @@ int CompScreenPrivateIndex; int CompWindowPrivateIndex; int CompSubwindowsPrivateIndex; -int CompGeneration; +static int CompGeneration; static Bool diff --git a/composite/compint.h b/composite/compint.h index 3958b3b31..0bd55a9a6 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -171,9 +171,6 @@ extern RESTYPE CompositeClientSubwindowsType; * compalloc.c */ -void -compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure); - Bool compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update); @@ -292,18 +289,6 @@ compWindowUpdate (WindowPtr pWin); void deleteCompOverlayClientsForScreen (ScreenPtr pScreen); -int -ProcCompositeGetOverlayWindow (ClientPtr client); - -int -ProcCompositeReleaseOverlayWindow (ClientPtr client); - -int -SProcCompositeGetOverlayWindow (ClientPtr client); - -int -SProcCompositeReleaseOverlayWindow (ClientPtr client); - WindowPtr CompositeRealChildHead (WindowPtr pWin); diff --git a/damageext/damageext.c b/damageext/damageext.c index 739d20f09..57a7bce09 100755 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -28,12 +28,12 @@ #include "damageextint.h" -unsigned char DamageReqCode; -int DamageEventBase; -int DamageErrorBase; -int DamageClientPrivateIndex; -RESTYPE DamageExtType; -RESTYPE DamageExtWinType; +static unsigned char DamageReqCode; +static int DamageEventBase; +static int DamageErrorBase; +static int DamageClientPrivateIndex; +static RESTYPE DamageExtType; +static RESTYPE DamageExtWinType; /* Version of the damage extension supported by the server, as opposed to the * DAMAGE_* defines from damageproto for what version the proto header @@ -319,7 +319,7 @@ static const int version_requests[] = { #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) -int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = { +static int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ ProcDamageQueryVersion, ProcDamageCreate, @@ -408,7 +408,7 @@ SProcDamageAdd (ClientPtr client) return (*ProcDamageVector[stuff->damageReqType]) (client); } -int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = { +static int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ SProcDamageQueryVersion, SProcDamageCreate, @@ -478,7 +478,7 @@ FreeDamageExtWin (pointer value, XID wid) return Success; } -void +static void SDamageNotifyEvent (xDamageNotifyEvent *from, xDamageNotifyEvent *to) { diff --git a/damageext/damageextint.h b/damageext/damageextint.h index 6f14e4e97..1ed07de83 100644 --- a/damageext/damageextint.h +++ b/damageext/damageextint.h @@ -44,13 +44,6 @@ #include "damage.h" #include "xfixes.h" -extern unsigned char DamageReqCode; -extern int DamageEventBase; -extern int DamageErrorBase; -extern int DamageClientPrivateIndex; -extern RESTYPE DamageExtType; -extern RESTYPE DamageExtWinType; - typedef struct _DamageClient { CARD32 major_version; CARD32 minor_version; @@ -67,9 +60,6 @@ typedef struct _DamageExt { XID id; } DamageExtRec, *DamageExtPtr; -extern int (*ProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr); -extern int (*SProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr); - #define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \ pDamageExt = SecurityLookupIDByType (client, rid, DamageExtType, mode); \ if (!pDamageExt) { \ @@ -78,10 +68,6 @@ extern int (*SProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr); } \ } -void -SDamageNotifyEvent (xDamageNotifyEvent *from, - xDamageNotifyEvent *to); - void DamageExtSetCritical (ClientPtr pClient, Bool critical); diff --git a/dbe/midbe.c b/dbe/midbe.c index e687b98b7..76f0577cc 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -59,21 +59,12 @@ #include -/* DEFINES */ - - -/* TYPEDEFS */ - - -/* GLOBALS */ - static int miDbePrivPrivGeneration = 0; static int miDbeWindowPrivPrivIndex = -1; -RESTYPE dbeDrawableResType; -RESTYPE dbeWindowPrivResType; -int dbeScreenPrivIndex = -1; -int dbeWindowPrivIndex = -1; - +static RESTYPE dbeDrawableResType; +static RESTYPE dbeWindowPrivResType; +static int dbeScreenPrivIndex = -1; +static int dbeWindowPrivIndex = -1; /****************************************************************************** diff --git a/dix/devices.c b/dix/devices.c index 5996b75cd..f622be756 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -79,7 +79,8 @@ SOFTWARE. #include "exglobals.h" #include "exevents.h" -int CoreDevicePrivatesIndex = 0, CoreDevicePrivatesGeneration = -1; +int CoreDevicePrivatesIndex = 0; +static int CoreDevicePrivatesGeneration = -1; DeviceIntPtr AddInputDevice(DeviceProc deviceProc, Bool autoStart) @@ -926,16 +927,16 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) } -LedCtrl defaultLedControl = { +static LedCtrl defaultLedControl = { DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0}; -BellCtrl defaultBellControl = { +static BellCtrl defaultBellControl = { DEFAULT_BELL, DEFAULT_BELL_PITCH, DEFAULT_BELL_DURATION, 0}; -IntegerCtrl defaultIntegerControl = { +static IntegerCtrl defaultIntegerControl = { DEFAULT_INT_RESOLUTION, DEFAULT_INT_MIN_VALUE, DEFAULT_INT_MAX_VALUE, diff --git a/dix/dispatch.c b/dix/dispatch.c index 32f67886e..02665edea 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -297,8 +297,8 @@ long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE; long SmartScheduleTime; -ClientPtr SmartLastClient; -int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; +static ClientPtr SmartLastClient; +static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; int SmartScheduleClient(int *clientReady, int nready); #ifdef SMART_DEBUG diff --git a/dix/events.c b/dix/events.c index 02598a394..e008e3613 100644 --- a/dix/events.c +++ b/dix/events.c @@ -156,7 +156,7 @@ extern Mask xevieFilters[128]; extern int xevieEventSent; extern int xevieKBEventSent; int xeviegrabState = 0; -xEvent *xeviexE; +static xEvent *xeviexE; #endif #include diff --git a/dix/extension.c b/dix/extension.c index dc1a76f3a..fb4ee6b95 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -66,7 +66,7 @@ SOFTWARE. #define LAST_EVENT 128 #define LAST_ERROR 255 -ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS]; +static ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS]; static ExtensionEntry **extensions = (ExtensionEntry **)NULL; diff --git a/dix/gc.c b/dix/gc.c index 89b246d3c..7b7953db1 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -69,7 +69,7 @@ extern FontPtr defaultFont; static Bool CreateDefaultTile(GCPtr pGC); -unsigned char DefaultDash[2] = {4, 4}; +static unsigned char DefaultDash[2] = {4, 4}; _X_EXPORT void ValidateGC(DrawablePtr pDraw, GC *pGC) diff --git a/dix/resource.c b/dix/resource.c index 7092b2fdb..a5a7eed80 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -246,7 +246,7 @@ CreateNewResourceClass() return next; } -ClientResourceRec clientTable[MAXCLIENTS]; +static ClientResourceRec clientTable[MAXCLIENTS]; /***************** * InitClientResources diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 7617bf78a..e1cbdbb16 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -2847,7 +2847,7 @@ xf86IsListSubsetOf(resPtr list, resPtr BaseList) return TRUE; } -resPtr +static resPtr findIntersect(resRange Range, resPtr list) { resRange range; diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h index b638e9026..225a5c727 100644 --- a/hw/xfree86/common/xf86Bus.h +++ b/hw/xfree86/common/xf86Bus.h @@ -143,7 +143,6 @@ memType ChkConflict(resRange *rgp, resPtr res, xf86State state); Bool xf86IsSubsetOf(resRange range, resPtr list); Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList); resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); -resPtr findIntersect(resRange Range, resPtr list); resPtr xf86FindIntersect(resRange Range, resPtr list); void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated); diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index f71486c9d..4b482dfdc 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -68,7 +68,7 @@ static int nDevToConfig = 0, CurrentDriver; _X_EXPORT xf86MonPtr ConfiguredMonitor; Bool xf86DoConfigurePass1 = TRUE; -Bool foundMouse = FALSE; +static Bool foundMouse = FALSE; #if defined(__UNIXOS2__) #define DFLT_MOUSE_DEV "mouse$" diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 05e62f184..eae6cb199 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -126,9 +126,9 @@ extern Bool noXkbExtension; */ #ifdef USE_VT_SYSREQ -Bool VTSysreqToggle = FALSE; +static Bool VTSysreqToggle = FALSE; #endif /* !USE_VT_SYSREQ */ -Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for +static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for *BSD and for avoiding VT switches when using the DRI automatic full screen mode.*/ diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index 3e908b86a..2b097d2db 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -110,7 +110,7 @@ static void xf86XVAdjustFrame(int index, int x, int y, int flags); static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int); -int XF86XVWindowIndex = -1; +static int XF86XVWindowIndex = -1; int XF86XvScreenIndex = -1; static unsigned long XF86XVGeneration = 0; static unsigned long PortResource = 0; diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c index ddd624c2a..774a4c4a0 100644 --- a/hw/xfree86/loader/loader.c +++ b/hw/xfree86/loader/loader.c @@ -189,101 +189,6 @@ _LoaderListPop(int handle) return 0; } -/* - * _LoaderHandleToName() will return the name of the first module with a - * given handle. This requires getting the last module on the LIFO with - * the given handle. - */ -char * -_LoaderHandleToName(int handle) -{ - loaderPtr item = listHead; - loaderPtr aritem = NULL; - loaderPtr lastitem = NULL; - - if (handle < 0) { - return "(built-in)"; - } - while (item) { - if (item->handle == handle) { - if (strchr(item->name, ':') == NULL) - aritem = item; - else - lastitem = item; - } - item = item->next; - } - - if (aritem) - return aritem->name; - - if (lastitem) - return lastitem->name; - - return 0; -} - -/* - * _LoaderHandleToCanonicalName() will return the cname of the first module - * with a given handle. This requires getting the last module on the LIFO with - * the given handle. - */ -char * -_LoaderHandleToCanonicalName(int handle) -{ - loaderPtr item = listHead; - loaderPtr lastitem = NULL; - - if (handle < 0) { - return "(built-in)"; - } - while (item) { - if (item->handle == handle) { - lastitem = item; - } - item = item->next; - } - - if (lastitem) - return lastitem->cname; - - return NULL; -} - -/* - * _LoaderModuleToName() will return the name of the first module with a - * given handle. This requires getting the last module on the LIFO with - * the given handle. - */ -char * -_LoaderModuleToName(int module) -{ - loaderPtr item = listHead; - loaderPtr aritem = NULL; - loaderPtr lastitem = NULL; - - if (module < 0) { - return "(built-in)"; - } - while (item) { - if (item->module == module) { - if (strchr(item->name, ':') == NULL) - aritem = item; - else - lastitem = item; - } - item = item->next; - } - - if (aritem) - return aritem->name; - - if (lastitem) - return lastitem->name; - - return 0; -} - /* These four are just ABI stubs */ _X_EXPORT void LoaderRefSymbols(const char *sym0, ...) @@ -450,35 +355,14 @@ LoaderUnload(int handle) return 0; } -void -LoaderDuplicateSymbol(const char *symbol, const int handle) -{ - ErrorF("Duplicate symbol %s in %s\n", symbol, - listHead ? listHead->name : "(built-in)"); - ErrorF("Also defined in %s\n", _LoaderHandleToName(handle)); - FatalError("Module load failure\n"); -} - unsigned long LoaderOptions = 0; -void -LoaderResetOptions(void) -{ - LoaderOptions = 0; -} - void LoaderSetOptions(unsigned long opts) { LoaderOptions |= opts; } -void -LoaderClearOptions(unsigned long opts) -{ - LoaderOptions &= ~opts; -} - _X_EXPORT int LoaderGetABIVersion(const char *abiclass) { diff --git a/hw/xfree86/loader/loaderProcs.h b/hw/xfree86/loader/loaderProcs.h index ecbd6762d..b71ad4590 100644 --- a/hw/xfree86/loader/loaderProcs.h +++ b/hw/xfree86/loader/loaderProcs.h @@ -97,9 +97,6 @@ void LoadFont(FontModule *); void UnloadModule(ModuleDescPtr); void UnloadSubModule(ModuleDescPtr); void UnloadDriver(ModuleDescPtr); -void FreeModuleDesc(ModuleDescPtr mod); -ModuleDescPtr NewModuleDesc(const char *); -ModuleDescPtr AddSibling(ModuleDescPtr head, ModuleDescPtr new); void LoaderSetPath(const char *path); void LoaderSortExtensions(void); @@ -108,7 +105,6 @@ unsigned long LoaderGetModuleVersion(ModuleDescPtr mod); void LoaderResetOptions(void); void LoaderSetOptions(unsigned long); -void LoaderClearOptions(unsigned long); /* Options for LoaderSetOptions */ #define LDR_OPT_ABI_MISMATCH_NONFATAL 0x0001 diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index a83b889b8..db12da466 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -745,6 +745,13 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, return TRUE; } +static ModuleDescPtr +AddSibling(ModuleDescPtr head, ModuleDescPtr new) +{ + new->sib = head; + return (new); +} + _X_EXPORT ModuleDescPtr LoadSubModule(ModuleDescPtr parent, const char *module, const char **subdirlist, const char **patternlist, @@ -775,35 +782,28 @@ LoadSubModule(ModuleDescPtr parent, const char *module, return submod; } -ModuleDescPtr -LoadSubModuleLocal(ModuleDescPtr parent, const char *module, - const char **subdirlist, const char **patternlist, - pointer options, const XF86ModReqInfo * modreq, - int *errmaj, int *errmin) +static ModuleDescPtr +NewModuleDesc(const char *name) { - ModuleDescPtr submod; + ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc)); - xf86MsgVerb(X_INFO, 3, "Loading local sub module \"%s\"\n", module); - - if (PathIsAbsolute(module)) - { - xf86Msg(X_ERROR, - "LoadSubModule: Absolute module path not permitted: \"%s\"\n", - module); - if (errmaj) - *errmaj = LDR_BADUSAGE; - if (errmin) - *errmin = 0; - return NULL; + if (mdp) { + mdp->child = NULL; + mdp->sib = NULL; + mdp->parent = NULL; + mdp->demand_next = NULL; + mdp->name = xstrdup(name); + mdp->filename = NULL; + mdp->identifier = NULL; + mdp->client_id = 0; + mdp->in_use = 0; + mdp->handle = -1; + mdp->SetupProc = NULL; + mdp->TearDownProc = NULL; + mdp->TearDownData = NULL; } - submod = doLoadModule(module, NULL, subdirlist, patternlist, options, - modreq, errmaj, errmin, 0); - if (submod && submod != (ModuleDescPtr) 1) { - parent->child = AddSibling(parent->child, submod); - submod->parent = parent; - } - return submod; + return (mdp); } _X_EXPORT ModuleDescPtr @@ -1099,26 +1099,12 @@ LoadModule(const char *module, const char *path, const char **subdirlist, modreq, errmaj, errmin, LD_FLAG_GLOBAL); } -ModuleDescPtr -LoadDriver(const char *module, const char *path, int handle, pointer options, - int *errmaj, int *errmin) -{ - return LoadModule(module, path, NULL, NULL, options, NULL, errmaj, - errmin); -} - void UnloadModule(ModuleDescPtr mod) { UnloadModuleOrDriver(mod); } -void -UnloadDriver(ModuleDescPtr mod) -{ - UnloadModuleOrDriver(mod); -} - static void UnloadModuleOrDriver(ModuleDescPtr mod) { @@ -1168,7 +1154,7 @@ UnloadSubModule(ModuleDescPtr mod) xfree(mod); } -void +static void FreeModuleDesc(ModuleDescPtr head) { ModuleDescPtr sibs, prev; @@ -1177,7 +1163,7 @@ FreeModuleDesc(ModuleDescPtr head) return; /* * only free it if it's not marked as in use. In use means that it may - * be unloaded someday, and UnloadModule or UnloadDriver will free it + * be unloaded someday, and UnloadModule will free it */ if (head->in_use) return; @@ -1192,38 +1178,6 @@ FreeModuleDesc(ModuleDescPtr head) } } -ModuleDescPtr -NewModuleDesc(const char *name) -{ - ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc)); - - if (mdp) { - mdp->child = NULL; - mdp->sib = NULL; - mdp->parent = NULL; - mdp->demand_next = NULL; - mdp->name = xstrdup(name); - mdp->filename = NULL; - mdp->identifier = NULL; - mdp->client_id = 0; - mdp->in_use = 0; - mdp->handle = -1; - mdp->SetupProc = NULL; - mdp->TearDownProc = NULL; - mdp->TearDownData = NULL; - } - - return (mdp); -} - -ModuleDescPtr -AddSibling(ModuleDescPtr head, ModuleDescPtr new) -{ - new->sib = head; - return (new); - -} - static void RemoveChild(ModuleDescPtr child) { diff --git a/hw/xfree86/parser/DRI.c b/hw/xfree86/parser/DRI.c index dc75cd23f..18644bcc7 100644 --- a/hw/xfree86/parser/DRI.c +++ b/hw/xfree86/parser/DRI.c @@ -48,7 +48,21 @@ static xf86ConfigSymTabRec DRITab[] = #define CLEANUP xf86freeBuffersList -XF86ConfBuffersPtr +static void +xf86freeBuffersList (XF86ConfBuffersPtr ptr) +{ + XF86ConfBuffersPtr prev; + + while (ptr) { + TestFree (ptr->buf_flags); + TestFree (ptr->buf_comment); + prev = ptr; + ptr = ptr->list.next; + xf86conffree (prev); + } +} + +static XF86ConfBuffersPtr xf86parseBuffers (void) { int token; @@ -169,18 +183,3 @@ xf86freeDRI (XF86ConfDRIPtr ptr) TestFree (ptr->dri_comment); xf86conffree (ptr); } - -void -xf86freeBuffersList (XF86ConfBuffersPtr ptr) -{ - XF86ConfBuffersPtr prev; - - while (ptr) { - TestFree (ptr->buf_flags); - TestFree (ptr->buf_comment); - prev = ptr; - ptr = ptr->list.next; - xf86conffree (prev); - } -} - diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c index 7ab70d1a8..4adea1ade 100644 --- a/hw/xfree86/parser/Flags.c +++ b/hw/xfree86/parser/Flags.c @@ -441,15 +441,6 @@ xf86uLongToString(unsigned long i) return s; } -void -xf86debugListOptions(XF86OptionPtr Options) -{ - while (Options) { - ErrorF("Option: %s Value: %s\n",Options->opt_name,Options->opt_val); - Options = Options->list.next; - } -} - XF86OptionPtr xf86parseOption(XF86OptionPtr head) { diff --git a/hw/xfree86/parser/Layout.c b/hw/xfree86/parser/Layout.c index b9f4e9e6a..5d1348acb 100644 --- a/hw/xfree86/parser/Layout.c +++ b/hw/xfree86/parser/Layout.c @@ -382,24 +382,7 @@ xf86printLayoutSection (FILE * cf, XF86ConfLayoutPtr ptr) } } -void -xf86freeLayoutList (XF86ConfLayoutPtr ptr) -{ - XF86ConfLayoutPtr prev; - - while (ptr) - { - TestFree (ptr->lay_identifier); - TestFree (ptr->lay_comment); - xf86freeAdjacencyList (ptr->lay_adjacency_lst); - xf86freeInputrefList (ptr->lay_input_lst); - prev = ptr; - ptr = ptr->list.next; - xf86conffree (prev); - } -} - -void +static void xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr) { XF86ConfAdjacencyPtr prev; @@ -419,7 +402,7 @@ xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr) } -void +static void xf86freeInputrefList (XF86ConfInputrefPtr ptr) { XF86ConfInputrefPtr prev; @@ -435,6 +418,23 @@ xf86freeInputrefList (XF86ConfInputrefPtr ptr) } +void +xf86freeLayoutList (XF86ConfLayoutPtr ptr) +{ + XF86ConfLayoutPtr prev; + + while (ptr) + { + TestFree (ptr->lay_identifier); + TestFree (ptr->lay_comment); + xf86freeAdjacencyList (ptr->lay_adjacency_lst); + xf86freeInputrefList (ptr->lay_input_lst); + prev = ptr; + ptr = ptr->list.next; + xf86conffree (prev); + } +} + #define CheckScreen(str, ptr)\ if (str[0] != '\0') \ { \ diff --git a/hw/xfree86/parser/Module.c b/hw/xfree86/parser/Module.c index f3ed9d19f..81eff18ae 100644 --- a/hw/xfree86/parser/Module.c +++ b/hw/xfree86/parser/Module.c @@ -83,7 +83,7 @@ static xf86ConfigSymTabRec ModuleTab[] = #define CLEANUP xf86freeModules -XF86LoadPtr +static XF86LoadPtr xf86parseModuleSubSection (XF86LoadPtr head, char *name) { int token; diff --git a/hw/xfree86/parser/Monitor.c b/hw/xfree86/parser/Monitor.c index 9dd0b1b1c..4bff4b23b 100644 --- a/hw/xfree86/parser/Monitor.c +++ b/hw/xfree86/parser/Monitor.c @@ -124,7 +124,21 @@ static xf86ConfigSymTabRec ModeTab[] = #define CLEANUP xf86freeModeLineList -XF86ConfModeLinePtr +static void +xf86freeModeLineList (XF86ConfModeLinePtr ptr) +{ + XF86ConfModeLinePtr prev; + while (ptr) + { + TestFree (ptr->ml_identifier); + TestFree (ptr->ml_comment); + prev = ptr; + ptr = ptr->list.next; + xf86conffree (prev); + } +} + +static XF86ConfModeLinePtr xf86parseModeLine (void) { int token; @@ -253,7 +267,7 @@ xf86parseModeLine (void) return (ptr); } -XF86ConfModeLinePtr +static XF86ConfModeLinePtr xf86parseVerboseMode (void) { int token, token2; @@ -830,20 +844,6 @@ xf86freeModesList (XF86ConfModesPtr ptr) } } -void -xf86freeModeLineList (XF86ConfModeLinePtr ptr) -{ - XF86ConfModeLinePtr prev; - while (ptr) - { - TestFree (ptr->ml_identifier); - TestFree (ptr->ml_comment); - prev = ptr; - ptr = ptr->list.next; - xf86conffree (prev); - } -} - XF86ConfMonitorPtr xf86findMonitor (const char *ident, XF86ConfMonitorPtr p) { diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h index 0b989054b..e3961a98c 100644 --- a/hw/xfree86/parser/configProcs.h +++ b/hw/xfree86/parser/configProcs.h @@ -49,25 +49,19 @@ int xf86validateInput (XF86ConfigPtr p); XF86ConfLayoutPtr xf86parseLayoutSection(void); void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr); void xf86freeLayoutList(XF86ConfLayoutPtr ptr); -void xf86freeAdjacencyList(XF86ConfAdjacencyPtr ptr); -void xf86freeInputrefList(XF86ConfInputrefPtr ptr); int xf86validateLayout(XF86ConfigPtr p); /* Module.c */ -XF86LoadPtr xf86parseModuleSubSection(XF86LoadPtr head, char *name); XF86ConfModulePtr xf86parseModuleSection(void); void xf86printModuleSection(FILE *cf, XF86ConfModulePtr ptr); XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type, XF86OptionPtr opts); void xf86freeModules(XF86ConfModulePtr ptr); /* Monitor.c */ -XF86ConfModeLinePtr xf86parseModeLine(void); -XF86ConfModeLinePtr xf86parseVerboseMode(void); XF86ConfMonitorPtr xf86parseMonitorSection(void); XF86ConfModesPtr xf86parseModesSection(void); void xf86printMonitorSection(FILE *cf, XF86ConfMonitorPtr ptr); void xf86printModesSection(FILE *cf, XF86ConfModesPtr ptr); void xf86freeMonitorList(XF86ConfMonitorPtr ptr); void xf86freeModesList(XF86ConfModesPtr ptr); -void xf86freeModeLineList(XF86ConfModeLinePtr ptr); int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen); /* Pointer.c */ XF86ConfInputPtr xf86parsePointerSection(void); @@ -92,24 +86,18 @@ XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void); void xf86printVideoAdaptorSection(FILE *cf, XF86ConfVideoAdaptorPtr ptr); void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr); void xf86freeVideoPortList(XF86ConfVideoPortPtr ptr); -/* read.c */ -int xf86validateConfig(XF86ConfigPtr p); /* scan.c */ -unsigned int xf86strToUL(char *str); int xf86getToken(xf86ConfigSymTabRec *tab); int xf86getSubToken(char **comment); int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab); void xf86unGetToken(int token); char *xf86tokenString(void); void xf86parseError(char *format, ...); -void xf86parseWarning(char *format, ...); void xf86validationError(char *format, ...); void xf86setSection(char *section); int xf86getStringToken(xf86ConfigSymTabRec *tab); /* write.c */ /* DRI.c */ -XF86ConfBuffersPtr xf86parseBuffers (void); -void xf86freeBuffersList (XF86ConfBuffersPtr ptr); XF86ConfDRIPtr xf86parseDRISection (void); void xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr); void xf86freeDRI (XF86ConfDRIPtr ptr); diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c index b6b3bc377..9f79696ac 100644 --- a/hw/xfree86/parser/read.c +++ b/hw/xfree86/parser/read.c @@ -73,6 +73,25 @@ static xf86ConfigSymTabRec TopLevelTab[] = #define CLEANUP xf86freeConfig +/* + * This function resolves name references and reports errors if the named + * objects cannot be found. + */ +static int +xf86validateConfig (XF86ConfigPtr p) +{ + if (!xf86validateDevice (p)) + return FALSE; + if (!xf86validateScreen (p)) + return FALSE; + if (!xf86validateInput (p)) + return FALSE; + if (!xf86validateLayout (p)) + return FALSE; + + return (TRUE); +} + XF86ConfigPtr xf86readConfigFile (void) { @@ -218,25 +237,6 @@ xf86readConfigFile (void) #undef CLEANUP -/* - * This function resolves name references and reports errors if the named - * objects cannot be found. - */ -int -xf86validateConfig (XF86ConfigPtr p) -{ - if (!xf86validateDevice (p)) - return FALSE; - if (!xf86validateScreen (p)) - return FALSE; - if (!xf86validateInput (p)) - return FALSE; - if (!xf86validateLayout (p)) - return FALSE; - - return (TRUE); -} - /* * adds an item to the end of the linked list. Any record whose first field * is a GenericListRec can be cast to this type and used with this function. diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index f81c45afe..68e7ec650 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -116,7 +116,7 @@ extern char *__XOS2RedirRoot(char *path); * A portable, but restricted, version of strtoul(). It only understands * hex, octal, and decimal. But it's good enough for our needs. */ -unsigned int +static unsigned int xf86strToUL (char *str) { int base = 10; @@ -921,20 +921,6 @@ xf86parseError (char *format,...) ErrorF ("\n"); } -void -xf86parseWarning (char *format,...) -{ - va_list ap; - - ErrorF ("Parse warning on line %d of section %s in file %s\n\t", - configLineNo, configSection, configPath); - va_start (ap, format); - VErrorF (format, ap); - va_end (ap); - - ErrorF ("\n"); -} - void xf86validationError (char *format,...) { diff --git a/hw/xfree86/xf4bpp/Makefile.am b/hw/xfree86/xf4bpp/Makefile.am index 8fddb6b6a..5eab92f6f 100644 --- a/hw/xfree86/xf4bpp/Makefile.am +++ b/hw/xfree86/xf4bpp/Makefile.am @@ -20,7 +20,6 @@ libxf4bpp_la_SOURCES = \ ppcPixmap.c \ ppcPntWin.c \ ppcPolyPnt.c \ - ppcPolyRec.c \ ppcQuery.c \ ppcRslvC.c \ ppcSetSp.c \ diff --git a/hw/xfree86/xf4bpp/offscreen.c b/hw/xfree86/xf4bpp/offscreen.c index f35bde7dd..654be829d 100644 --- a/hw/xfree86/xf4bpp/offscreen.c +++ b/hw/xfree86/xf4bpp/offscreen.c @@ -300,25 +300,6 @@ DoMono } } -void -xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes ) -WindowPtr pWin; /* GJA */ -unsigned char *data; -int x, y, w, h ; -unsigned long int fg ; -int alu ; -unsigned long int planes; -{ - - if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) ) - return ; - - DoMono( pWin, w, x, y, (const unsigned char *) data, h, - w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0, alu, - (int)planes, (int)fg) ; - -} - void xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc ) WindowPtr pWin; /* GJA */ diff --git a/hw/xfree86/xf4bpp/ppcGC.c b/hw/xfree86/xf4bpp/ppcGC.c index 8153051f0..81441efd7 100644 --- a/hw/xfree86/xf4bpp/ppcGC.c +++ b/hw/xfree86/xf4bpp/ppcGC.c @@ -90,10 +90,9 @@ SOFTWARE. | GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT \ | GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode ) +static void xf4bppValidateGC(GCPtr, unsigned long, DrawablePtr); +static void xf4bppDestroyGC(GC *); -/* GJA -- we modified the following function to get rid of - * the records in file vgaData.c - */ static GCFuncs vgaGCFuncs = { xf4bppValidateGC, (void (*)(GCPtr, unsigned long))NoopDDA, @@ -196,7 +195,7 @@ register GCPtr pGC ; return TRUE ; } -void +static void xf4bppDestroyGC( pGC ) register GC *pGC ; @@ -292,7 +291,7 @@ return 0 ; CT_other ==> pCompositeClip is the pixmap bounding box */ -void +static void xf4bppValidateGC( pGC, changes, pDrawable ) GCPtr pGC; unsigned long changes; diff --git a/hw/xfree86/xf4bpp/xf4bpp.h b/hw/xfree86/xf4bpp/xf4bpp.h index 8d2da35a5..01512a8fb 100644 --- a/hw/xfree86/xf4bpp/xf4bpp.h +++ b/hw/xfree86/xf4bpp/xf4bpp.h @@ -149,14 +149,6 @@ void xf4bppTilePixmapFS( Bool xf4bppCreateGC( GCPtr ); -void xf4bppDestroyGC( - GC * -); -void xf4bppValidateGC( - GCPtr, - unsigned long, - DrawablePtr -); /* ppcGetSp.c */ void xf4bppGetSpans( diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c index 57f3a688f..1ec0609d9 100644 --- a/hw/xnest/Display.c +++ b/hw/xnest/Display.c @@ -39,7 +39,7 @@ XVisualInfo *xnestVisuals; int xnestNumVisuals; int xnestDefaultVisualIndex; Colormap *xnestDefaultColormaps; -int xnestNumDefaultColormaps; +static int xnestNumDefaultColormaps; int *xnestDepths; int xnestNumDepths; XPixmapFormatValues *xnestPixmapFormats; diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index e6870e702..e66b4f743 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -49,7 +49,7 @@ Window xnestScreenSaverWindows[MAXSCREENS]; extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); #endif -int xnestScreenGeneration = -1; +static int xnestScreenGeneration = -1; ScreenPtr xnestScreen(Window window) diff --git a/include/globals.h b/include/globals.h index 821b12bdb..e23ce7798 100644 --- a/include/globals.h +++ b/include/globals.h @@ -44,10 +44,6 @@ extern Bool DPMSCapableFlag; #endif #ifdef PANORAMIX -extern Bool PanoramiXMapped; -extern Bool PanoramiXVisibilityNotifySent; -extern Bool PanoramiXWindowExposureSent; -extern Bool PanoramiXOneExposeRequest; extern Bool PanoramiXExtensionDisabledHack; #endif diff --git a/include/inputstr.h b/include/inputstr.h index ada94e6b4..8f4e9b9d1 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -62,7 +62,7 @@ SOFTWARE. #define EMASKSIZE MAX_DEVICES -extern int CoreDevicePrivatesIndex, CoreDevicePrivatesGeneration; +extern int CoreDevicePrivatesIndex; /* Kludge: OtherClients and InputClients must be compatible, see code */ diff --git a/mi/mioverlay.c b/mi/mioverlay.c index 5724a6fed..9701001d6 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -54,8 +54,8 @@ typedef struct { } miOverlayScreenRec, *miOverlayScreenPtr; static unsigned long miOverlayGeneration = 0; -int miOverlayWindowIndex = -1; -int miOverlayScreenIndex = -1; +static int miOverlayWindowIndex = -1; +static int miOverlayScreenIndex = -1; static void RebuildTree(WindowPtr); static Bool HasUnderlayChildren(WindowPtr); diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 7922cb66e..08cc3f658 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -312,7 +312,7 @@ miAllocateGCPrivateIndex() } _X_EXPORT int miZeroLineScreenIndex; -unsigned int miZeroLineGeneration = 0; +static unsigned int miZeroLineGeneration = 0; _X_EXPORT void miSetZeroLineBias(pScreen, bias) diff --git a/miext/damage/damage.c b/miext/damage/damage.c index cd66b5473..6f1ee2894 100755 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -72,6 +72,12 @@ #define pixmapDamage(pPixmap) damagePixPriv(pPixmap) +static int damageScrPrivateIndex; +static int damagePixPrivateIndex; +static int damageGCPrivateIndex; +static int damageWinPrivateIndex; +static int damageGeneration; + static DamagePtr * getDrawableDamageRef (DrawablePtr pDrawable) { @@ -368,12 +374,12 @@ static void damageChangeClip(GCPtr, int, pointer, int); static void damageDestroyClip(GCPtr); static void damageCopyClip(GCPtr, GCPtr); -GCFuncs damageGCFuncs = { +static GCFuncs damageGCFuncs = { damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC, damageChangeClip, damageDestroyClip, damageCopyClip }; -extern GCOps damageGCOps; +static GCOps damageGCOps; static Bool damageCreateGC(GCPtr pGC) @@ -1686,7 +1692,7 @@ damageCopyWindow(WindowPtr pWindow, wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow); } -GCOps damageGCOps = { +static GCOps damageGCOps = { damageFillSpans, damageSetSpans, damagePutImage, damageCopyArea, damageCopyPlane, damagePolyPoint, @@ -1787,12 +1793,6 @@ damageCloseScreen (int i, ScreenPtr pScreen) return (*pScreen->CloseScreen) (i, pScreen); } -int damageScrPrivateIndex; -int damagePixPrivateIndex; -int damageGCPrivateIndex; -int damageWinPrivateIndex; -int damageGeneration; - Bool DamageSetup (ScreenPtr pScreen) { diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h index 93e213fd1..83a202ba8 100755 --- a/miext/damage/damagestr.h +++ b/miext/damage/damagestr.h @@ -82,11 +82,7 @@ typedef struct _damageGCPriv { GCFuncs *funcs; } DamageGCPrivRec, *DamageGCPrivPtr; -extern int damageScrPrivateIndex; -extern int damagePixPrivateIndex; -extern int damageGCPrivateIndex; -extern int damageWinPrivateIndex; - +/* XXX should move these into damage.c, damageScrPrivateIndex is static */ #define damageGetScrPriv(pScr) \ ((DamageScrPrivPtr) (pScr)->devPrivates[damageScrPrivateIndex].ptr) diff --git a/os/connection.c b/os/connection.c index d0ffb8156..cb3443c5b 100644 --- a/os/connection.c +++ b/os/connection.c @@ -175,7 +175,7 @@ typedef const char *string; # include #endif -int lastfdesc; /* maximum file descriptor */ +static int lastfdesc; /* maximum file descriptor */ fd_set WellKnownConnections; /* Listener mask */ fd_set EnabledDevices; /* mask for input devices that are on */ @@ -189,7 +189,7 @@ int MaxClients = 0; Bool NewOutputPending; /* not yet attempted to write some new output */ Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ -Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ +static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ Bool PartialNetwork; /* continue even if unable to bind all addrs */ static Pid_t ParentProcess; #ifdef __UNIXOS2__ @@ -298,9 +298,9 @@ void ClearConnectionTranslation(void) } #endif -XtransConnInfo *ListenTransConns = NULL; -int *ListenTransFds = NULL; -int ListenTransCount; +static XtransConnInfo *ListenTransConns = NULL; +static int *ListenTransFds = NULL; +static int ListenTransCount; static void ErrorConnMax(XtransConnInfo /* trans_conn */); diff --git a/os/io.c b/os/io.c index f6c666c0f..80a151f6a 100644 --- a/os/io.c +++ b/os/io.c @@ -111,11 +111,11 @@ _X_EXPORT CallbackListPtr FlushCallback; #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK || err == ENOSPC) #endif -Bool CriticalOutputPending; -int timesThisConnection = 0; -ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL; -ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL; -OsCommPtr AvailableInput = (OsCommPtr)NULL; +static Bool CriticalOutputPending; +static int timesThisConnection = 0; +static ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL; +static ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL; +static OsCommPtr AvailableInput = (OsCommPtr)NULL; #define get_req_len(req,cli) ((cli)->swapped ? \ lswaps((req)->length) : (req)->length) diff --git a/os/osdep.h b/os/osdep.h index 5fa1e3918..3d303f913 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -234,12 +234,6 @@ extern void ClearConnectionTranslation(); extern Bool NewOutputPending; extern Bool AnyClientsWriteBlocked; -extern Bool CriticalOutputPending; - -extern int timesThisConnection; -extern ConnectionInputPtr FreeInputs; -extern ConnectionOutputPtr FreeOutputs; -extern OsCommPtr AvailableInput; extern WorkQueuePtr workQueue; diff --git a/os/utils.c b/os/utils.c index 06c9b8807..2fc5cbb3f 100644 --- a/os/utils.c +++ b/os/utils.c @@ -245,10 +245,6 @@ _X_EXPORT Bool noXvExtension = FALSE; Bool CoreDump; #ifdef PANORAMIX -Bool PanoramiXVisibilityNotifySent = FALSE; -Bool PanoramiXMapped = FALSE; -Bool PanoramiXWindowExposureSent = FALSE; -Bool PanoramiXOneExposeRequest = FALSE; Bool PanoramiXExtensionDisabledHack = FALSE; #endif @@ -271,7 +267,7 @@ long Memory_fail = 0; #include /* for random() */ #endif -char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ +static char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ OsSigHandlerPtr OsSignal(sig, handler) diff --git a/os/xdmcp.c b/os/xdmcp.c index fd4be5e81..cfc1005c2 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -411,11 +411,11 @@ XdmcpRegisterAuthentication ( * set by the manager of the host to be connected to. */ -ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0}; -ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0}; -ARRAY8Ptr AuthenticationName = &noAuthenticationName; -ARRAY8Ptr AuthenticationData = &noAuthenticationData; -AuthenticationFuncsPtr AuthenticationFuncs; +static ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0}; +static ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0}; +static ARRAY8Ptr AuthenticationName = &noAuthenticationName; +static ARRAY8Ptr AuthenticationData = &noAuthenticationData; +static AuthenticationFuncsPtr AuthenticationFuncs; void XdmcpSetAuthentication (ARRAY8Ptr name) @@ -547,7 +547,7 @@ XdmcpRegisterAuthorization (char *name, int namelen) * Register the DisplayClass string */ -ARRAY8 DisplayClass; +static ARRAY8 DisplayClass; void XdmcpRegisterDisplayClass (char *name, int length) @@ -565,7 +565,7 @@ XdmcpRegisterDisplayClass (char *name, int length) * Register the Manufacturer display ID */ -ARRAY8 ManufacturerDisplayID; +static ARRAY8 ManufacturerDisplayID; void XdmcpRegisterManufacturerDisplayID (char *name, int length) @@ -776,7 +776,7 @@ XdmcpAddHost( * do the appropriate thing */ -ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" }; +static ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" }; static void receive_packet(int socketfd) diff --git a/render/animcur.c b/render/animcur.c index 8e4f59d1b..1f25e79d0 100644 --- a/render/animcur.c +++ b/render/animcur.c @@ -87,8 +87,8 @@ static CursorBits animCursorBits = { empty, empty, 2, 1, 1, 0, 0, 1 }; -int AnimCurScreenPrivateIndex = -1; -int AnimCurGeneration; +static int AnimCurScreenPrivateIndex = -1; +static int AnimCurGeneration; #define IsAnimCur(c) ((c)->bits == &animCursorBits) #define GetAnimCur(c) ((AnimCurPtr) ((c) + 1)) diff --git a/render/glyph.c b/render/glyph.c index 6d09a0e52..5987cbc70 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -77,11 +77,11 @@ static GlyphHashSetRec glyphHashSets[] = { #define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0])) -const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 }; +static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 }; -GlyphHashRec globalGlyphs[GlyphFormatNum]; +static GlyphHashRec globalGlyphs[GlyphFormatNum]; -int globalTotalGlyphPrivateSize = 0; +static int globalTotalGlyphPrivateSize = 0; static int glyphPrivateCount = 0; diff --git a/render/glyphstr.h b/render/glyphstr.h index 64cedfa16..22150deee 100644 --- a/render/glyphstr.h +++ b/render/glyphstr.h @@ -91,8 +91,6 @@ typedef struct _GlyphList { PictFormatPtr format; } GlyphListRec, *GlyphListPtr; -extern GlyphHashRec globalGlyphs[GlyphFormatNum]; - GlyphHashSetPtr FindGlyphHashSet (CARD32 filled); diff --git a/render/picture.c b/render/picture.c index e7901e873..c30649c6b 100644 --- a/render/picture.c +++ b/render/picture.c @@ -43,7 +43,7 @@ _X_EXPORT int PictureScreenPrivateIndex = -1; int PictureWindowPrivateIndex; -int PictureGeneration; +static int PictureGeneration; RESTYPE PictureType; RESTYPE PictFormatType; RESTYPE GlyphSetType; diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c index cee9e096d..32dee8a18 100755 --- a/xfixes/xfixes.c +++ b/xfixes/xfixes.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright © 2006 Sun Microsystems * * Permission to use, copy, modify, distribute, and sell this software and its @@ -55,10 +53,10 @@ #define SERVER_XFIXES_MAJOR 4 #define SERVER_XFIXES_MINOR 0 -unsigned char XFixesReqCode; +static unsigned char XFixesReqCode; int XFixesEventBase; int XFixesErrorBase; -int XFixesClientPrivateIndex; +static int XFixesClientPrivateIndex; static int ProcXFixesQueryVersion(ClientPtr client) @@ -169,7 +167,7 @@ SProcXFixesQueryVersion(ClientPtr client) return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } -int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { +static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ SProcXFixesQueryVersion, SProcXFixesChangeSaveSet, diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h index 5f08807f9..7f3b119b7 100755 --- a/xfixes/xfixesint.h +++ b/xfixes/xfixesint.h @@ -61,9 +61,7 @@ #include "selection.h" #include "xfixes.h" -extern unsigned char XFixesReqCode; extern int XFixesEventBase; -extern int XFixesClientPrivateIndex; typedef struct _XFixesClient { CARD32 major_version; @@ -73,7 +71,6 @@ typedef struct _XFixesClient { #define GetXFixesClient(pClient) ((XFixesClientPtr) (pClient)->devPrivates[XFixesClientPrivateIndex].ptr) extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr); -extern int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr); /* Initialize extension at server startup time */ From f36bf1a3e4ce9465ea4a6159c209924a3cafbe58 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 12:28:13 -0400 Subject: [PATCH 25/63] Delete a dead file. --- hw/xfree86/xf4bpp/ppcPolyRec.c | 130 --------------------------------- 1 file changed, 130 deletions(-) delete mode 100644 hw/xfree86/xf4bpp/ppcPolyRec.c diff --git a/hw/xfree86/xf4bpp/ppcPolyRec.c b/hw/xfree86/xf4bpp/ppcPolyRec.c deleted file mode 100644 index d7f866232..000000000 --- a/hw/xfree86/xf4bpp/ppcPolyRec.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright IBM Corporation 1987,1988,1989 - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * -*/ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -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 -X CONSORTIUM 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 of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $XConsortium: ppcPolyRec.c /main/4 1996/02/21 17:58:11 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf4bpp.h" - -void -xf4bppPolyRectangle(pDraw, pGC, nrects, pRects) - DrawablePtr pDraw; - GCPtr pGC; - int nrects; - xRectangle *pRects; -{ - int i; - xRectangle *pR = pRects; - xRectangle *tmprects, *tmprectsinit; - int lw, fs, ss; - - if ( ! ( tmprectsinit = tmprects = (xRectangle *)ALLOCATE_LOCAL( ( sizeof ( xRectangle ) * nrects ) << 2 ) ) ) - return; - - lw = pGC->lineWidth; - ss = lw >> 1; /* skinny side of line */ - fs = ( lw + 1 ) >> 1; /* fat side of line */ - - for (i=0; ix = pR->x - ss; - tmprects->y = pR->y - ss; - tmprects->width = pR->width + lw; - tmprects->height = lw; - tmprects++; - - tmprects->x = pR->x - ss; - tmprects->y = pR->y + fs; - tmprects->width = lw; - tmprects->height = pR->height - lw; - tmprects++; - - tmprects->x = pR->x + pR->width - ss; - tmprects->y = pR->y + fs; - tmprects->width = lw; - tmprects->height = pR->height - lw; - tmprects++; - - tmprects->x = pR->x - ss; - tmprects->y = pR->y + pR->height - ss; - tmprects->width = pR->width + lw; - tmprects->height = lw; - tmprects++; - - pR++; - } - - (* pGC->ops->PolyFillRect)( pDraw, pGC, nrects << 2, tmprectsinit ); - - DEALLOCATE_LOCAL( tmprectsinit ); - return ; -} From 70e493d223b1e943e652191150bd0b7e1a6ebcfb Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 14:55:28 -0400 Subject: [PATCH 26/63] Static and dead code cleanup over afb/ --- afb/afb.h | 124 ---------------------- afb/afbbitblt.c | 148 ++++---------------------- afb/afbcmap.c | 18 ---- afb/afbgc.c | 266 +++++++++++++++++++++-------------------------- afb/afbimage.c | 31 ------ afb/afbpixmap.c | 10 +- afb/afbscrinit.c | 50 ++++----- afb/afbsetsp.c | 18 +--- 8 files changed, 176 insertions(+), 489 deletions(-) diff --git a/afb/afb.h b/afb/afb.h index c05cc5511..5aa2b0c92 100644 --- a/afb/afb.h +++ b/afb/afb.h @@ -78,27 +78,6 @@ extern void afbDoBitblt( unsigned long /*planemask*/ ); -extern RegionPtr afbBitBlt( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - GCPtr /*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - void (*doBitBlt)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ - ), - unsigned long /*planemask*/ -); - extern RegionPtr afbCopyArea( DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, @@ -111,27 +90,6 @@ extern RegionPtr afbCopyArea( int /*dsty*/ ); -extern RegionPtr afbCopyPlane( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr/*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - unsigned long /*plane*/ -); - -extern void afbCopy1ToN( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); /* afbbltC.c */ extern void afbDoBitbltCopy( @@ -273,23 +231,6 @@ extern Bool afbInitializeColormap( ColormapPtr /*pmap*/ ); -extern int afbExpandDirectColors( - ColormapPtr /*pmap*/, - int /*ndefs*/, - xColorItem * /*indefs*/, - xColorItem * /*outdefs*/ -); - -extern Bool afbCreateDefColormap( - ScreenPtr /*pScreen*/ -); - -extern Bool afbSetVisualTypes( - int /*depth*/, - int /*visuals*/, - int /*bitsPerRGB*/ -); - extern Bool afbInitVisuals( VisualPtr * /*visualp*/, DepthPtr * /*depthp*/, @@ -410,16 +351,6 @@ extern Bool afbCreateGC( GCPtr /*pGC*/ ); -extern void afbValidateGC( - GCPtr /*pGC*/, - unsigned long /*changes*/, - DrawablePtr /*pDrawable*/ -); - -extern void afbDestroyGC( - GCPtr /*pGC*/ -); - extern void afbReduceRop( int /*alu*/, Pixel /*src*/, @@ -428,19 +359,6 @@ extern void afbReduceRop( unsigned char * /*rrops*/ ); -extern void afbReduceOpaqueStipple ( - Pixel /*fg*/, - Pixel /*bg*/, - unsigned long /*planemask*/, - int /*depth*/, - unsigned char * /*rrops*/ -); - -extern void afbComputeCompositeClip( - GCPtr /*pGC*/, - DrawablePtr /*pDrawable*/ -); - /* afbgetsp.c */ extern void afbGetSpans( @@ -588,14 +506,6 @@ extern Bool afbDestroyPixmap( PixmapPtr /*pPixmap*/ ); -extern PixmapPtr afbCopyPixmap( - PixmapPtr /*pSrc*/ -); - -extern void afbPadPixmap( - PixmapPtr /*pPixmap*/ -); - extern void afbXRotatePixmap( PixmapPtr /*pPix*/, int /*rw*/ @@ -637,20 +547,9 @@ extern void afbPushPixels( int /*xOrg*/, int /*yOrg*/ ); -/* afbscrclse.c */ -extern Bool afbCloseScreen( - int /*index*/, - ScreenPtr /*pScreen*/ -); /* afbscrinit.c */ -extern Bool afbAllocatePrivates( - ScreenPtr /*pScreen*/, - int * /*pWinIndex*/, - int * /*pGCIndex*/ -); - extern Bool afbScreenInit( ScreenPtr /*pScreen*/, pointer /*pbits*/, @@ -661,15 +560,6 @@ extern Bool afbScreenInit( int /*width*/ ); -extern PixmapPtr afbGetWindowPixmap( - WindowPtr /*pWin*/ -); - -extern void afbSetWindowPixmap( - WindowPtr /*pWin*/, - PixmapPtr /*pPix*/ -); - /* afbseg.c */ extern void afbSegmentSS( @@ -687,20 +577,6 @@ extern void afbSegmentSD( ); /* afbsetsp.c */ -extern void afbSetScanline( - int /*y*/, - int /*xOrigin*/, - int /*xStart*/, - int /*xEnd*/, - PixelType * /*psrc*/, - int /*alu*/, - PixelType * /*pdstBase*/, - int /*widthDst*/, - int /*sizeDst*/, - int /*depthDst*/, - int /*sizeSrc*/ -); - extern void afbSetSpans( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, diff --git a/afb/afbbitblt.c b/afb/afbbitblt.c index 594e987a8..2e416e356 100644 --- a/afb/afbbitblt.c +++ b/afb/afbbitblt.c @@ -67,9 +67,6 @@ SOFTWARE. #include "afb.h" #include "maskbits.h" - -static unsigned char afbRropsOS[AFB_MAX_DEPTH]; - /* CopyArea and CopyPlane for a monchrome frame buffer @@ -126,34 +123,7 @@ afbDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXP typedef void (*afb_blit_func) (DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long); -RegionPtr -afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - afb_blit_func doBitBlt; - - switch (pGC->alu) { - case GXcopy: - doBitBlt = afbDoBitbltCopy; - break; - case GXxor: - doBitBlt = afbDoBitbltXor; - break; - case GXcopyInverted: - doBitBlt = afbDoBitbltCopyInverted; - break; - case GXor: - doBitBlt = afbDoBitbltOr; - break; - default: - doBitBlt = afbDoBitbltGeneral; - break; - } - - return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, - width, height, dstx, dsty, doBitBlt, pGC->planemask)); -} - -RegionPtr +static RegionPtr afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, afb_blit_func doBitBlt, long unsigned int planemask) { RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ @@ -346,102 +316,28 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, } RegionPtr -afbCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, long unsigned int plane) +afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { - int alu; - RegionPtr prgnExposed = NULL; - unsigned long old_planemask; + afb_blit_func doBitBlt; - if (pDstDrawable->depth == 1) { - old_planemask = pGC->planemask; - pGC->planemask = plane; - if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0) { - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty); - } else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) { - unsigned char rop; - - afbReduceRop(pGC->alu, pGC->fgPixel, 1, 1, &rop); - alu = pGC->alu; - pGC->alu = rop; - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, - dsty); - pGC->alu = alu; - } else { /* need to invert the src */ - alu = pGC->alu; - pGC->alu = afbInverseAlu[alu]; - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, - dsty); - pGC->alu = alu; - } - pGC->planemask = old_planemask; - } else { - int free_pixmap = FALSE; - PixmapPtr pBitmap = (PixmapPtr)pSrcDrawable; - ScreenPtr pScreen = pSrcDrawable->pScreen; - GCPtr pGC1 = NULL; - - if (pSrcDrawable == pDstDrawable || - pSrcDrawable->type == DRAWABLE_WINDOW || pSrcDrawable->depth != 1) { - /* Copy a plane from source drawable to a tmp 1-bit deep pixmap */ - /* XXX: Range check width and height */ - pBitmap = (*pScreen->CreatePixmap)(pScreen, width, height, 1); - - if (!pBitmap) - return(NULL); - pGC1 = GetScratchGC(1, pScreen); - if (!pGC1) { - (*pScreen->DestroyPixmap)(pBitmap); - return(NULL); - } - ValidateGC((DrawablePtr)pBitmap, pGC1); - (void)afbBitBlt(pSrcDrawable, (DrawablePtr)pBitmap, pGC1, srcx, srcy, - width, height, 0, 0, afbDoBitbltCopy, plane); - free_pixmap = TRUE; - } -#if 0 - else { - /* XXX: could cope with N-deep pixmap source case without using tmp - * src bitmap by setting up a scratch pixmap header and fiddle - * around with the pbits pointer. - */ - } -#endif - afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask, - pGC->depth, afbRropsOS); - (void)afbBitBlt((DrawablePtr)pBitmap, pDstDrawable, pGC, 0, 0, width, - height, dstx, dsty, afbCopy1ToN, pGC->planemask); - if (free_pixmap) { - (*pScreen->DestroyPixmap)(pBitmap); - FreeScratchGC(pGC1); - } - - if (pGC->fExpose) - prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, - srcy, width, height, dstx, dsty, - plane); - } - return prgnExposed; -} - -void -afbCopy1ToN(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, long unsigned int planemask) -{ - int numRects = REGION_NUM_RECTS(prgnDst); - BoxPtr pbox = REGION_RECTS(prgnDst); - int r; - - for (r = 0; r < numRects; r++, pbox++, pptSrc++) { - int dx = pptSrc->x; - int dy = pptSrc->y; - - if (alu == GXcopy) - afbOpaqueStippleAreaCopy(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx, dy, - afbRropsOS, planemask); - else - afbOpaqueStippleAreaGeneral(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx, - dy, afbRropsOS, planemask); + switch (pGC->alu) { + case GXcopy: + doBitBlt = afbDoBitbltCopy; + break; + case GXxor: + doBitBlt = afbDoBitbltXor; + break; + case GXcopyInverted: + doBitBlt = afbDoBitbltCopyInverted; + break; + case GXor: + doBitBlt = afbDoBitbltOr; + break; + default: + doBitBlt = afbDoBitbltGeneral; + break; } + + return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, + width, height, dstx, dsty, doBitBlt, pGC->planemask)); } diff --git a/afb/afbcmap.c b/afb/afbcmap.c index e3b95fbec..9608a3653 100644 --- a/afb/afbcmap.c +++ b/afb/afbcmap.c @@ -70,24 +70,6 @@ afbInitializeColormap(register ColormapPtr pmap) return miInitializeColormap(pmap); } -int -afbExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs) -{ - return miExpandDirectColors(pmap, ndef, indefs, outdefs); -} - -Bool -afbCreateDefColormap(ScreenPtr pScreen) -{ - return miCreateDefColormap(pScreen); -} - -Bool -afbSetVisualTypes(int depth, int visuals, int bitsPerRGB) -{ - return miSetVisualTypes(depth, visuals, bitsPerRGB, -1); -} - /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which correspond to diff --git a/afb/afbgc.c b/afb/afbgc.c index 03475dda5..59c09e097 100644 --- a/afb/afbgc.c +++ b/afb/afbgc.c @@ -69,6 +69,9 @@ SOFTWARE. #include "maskbits.h" +static void afbDestroyGC(GCPtr); +static void afbValidateGC(GCPtr, unsigned long, DrawablePtr); + static GCFuncs afbFuncs = { afbValidateGC, miChangeGC, @@ -102,6 +105,33 @@ static GCOps afbGCOps = { afbPushPixels }; +static void +afbReduceOpaqueStipple(PixelType fg, PixelType bg, unsigned long planemask, + int depth, unsigned char *rop) +{ + register int d; + register Pixel mask = 1; + + bg ^= fg; + + for (d = 0; d < depth; d++, mask <<= 1) { + if (!(planemask & mask)) + rop[d] = RROP_NOP; + else if (!(bg & mask)) { + /* Both fg and bg have a 0 or 1 in this plane */ + if (fg & mask) + rop[d] = RROP_WHITE; + else + rop[d] = RROP_BLACK; + } else { + /* Both fg and bg have different bits on this plane */ + if (fg & mask) + rop[d] = RROP_COPY; + else + rop[d] = RROP_INVERT; + } + } +} Bool afbCreateGC(pGC) @@ -136,6 +166,95 @@ afbCreateGC(pGC) return TRUE; } +static void +afbComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable) +{ + if (pDrawable->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr) pDrawable; + RegionPtr pregWin; + Bool freeTmpClip, freeCompClip; + + if (pGC->subWindowMode == IncludeInferiors) { + pregWin = NotClippedByChildren(pWin); + freeTmpClip = TRUE; + } else { + pregWin = &pWin->clipList; + freeTmpClip = FALSE; + } + freeCompClip = pGC->freeCompClip; + + /* + * if there is no client clip, we can get by with just keeping the + * pointer we got, and remembering whether or not should destroy (or + * maybe re-use) it later. this way, we avoid unnecessary copying of + * regions. (this wins especially if many clients clip by children + * and have no client clip.) + */ + if (pGC->clientClipType == CT_NONE) { + if (freeCompClip) + REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); + pGC->pCompositeClip = pregWin; + pGC->freeCompClip = freeTmpClip; + } else { + /* + * we need one 'real' region to put into the composite clip. if + * pregWin the current composite clip are real, we can get rid of + * one. if pregWin is real and the current composite clip isn't, + * use pregWin for the composite clip. if the current composite + * clip is real and pregWin isn't, use the current composite + * clip. if neither is real, create a new region. + */ + + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, + pDrawable->x + pGC->clipOrg.x, + pDrawable->y + pGC->clipOrg.y); + + if (freeCompClip) { + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin, + pGC->clientClip); + if (freeTmpClip) + REGION_DESTROY(pGC->pScreen, pregWin); + } else if (freeTmpClip) { + REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip); + pGC->pCompositeClip = pregWin; + } else { + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0); + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, + pregWin, pGC->clientClip); + } + pGC->freeCompClip = TRUE; + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, + -(pDrawable->x + pGC->clipOrg.x), + -(pDrawable->y + pGC->clipOrg.y)); + } + } /* end of composite clip for a window */ + else { + BoxRec pixbounds; + + /* XXX should we translate by drawable.x/y here ? */ + pixbounds.x1 = 0; + pixbounds.y1 = 0; + pixbounds.x2 = pDrawable->width; + pixbounds.y2 = pDrawable->height; + + if (pGC->freeCompClip) { + REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds); + } else { + pGC->freeCompClip = TRUE; + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1); + } + + if (pGC->clientClipType == CT_REGION) { + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x, + -pGC->clipOrg.y); + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, + pGC->pCompositeClip, pGC->clientClip); + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x, + pGC->clipOrg.y); + } + } /* end of composite clip for pixmap */ +} /* end afbComputeCompositeClip */ + /* Clipping conventions if the drawable is a window CT_REGION ==> pCompositeClip really is the composite @@ -147,7 +266,7 @@ afbCreateGC(pGC) */ /*ARGSUSED*/ -void +static void afbValidateGC(pGC, changes, pDrawable) register GCPtr pGC; unsigned long changes; @@ -434,7 +553,7 @@ afbValidateGC(pGC, changes, pDrawable) } /* end of new_fill */ } -void +static void afbDestroyGC(pGC) GCPtr pGC; { @@ -445,58 +564,6 @@ afbDestroyGC(pGC) miDestroyGCOps(pGC->ops); } -/* table to map alu(src, dst) to alu(~src, dst) */ -int afbInverseAlu[16] = { - GXclear, - GXandInverted, - GXnor, - GXcopyInverted, - GXand, - GXnoop, - GXequiv, - GXorInverted, - GXandReverse, - GXxor, - GXinvert, - GXnand, - GXcopy, - GXor, - GXorReverse, - GXset -}; - -void -afbReduceOpaqueStipple(fg, bg, planemask, depth, rop) -register PixelType fg; -register PixelType bg; -register unsigned long planemask; -int depth; -register unsigned char *rop; -{ - register int d; - register Pixel mask = 1; - - bg ^= fg; - - for (d = 0; d < depth; d++, mask <<= 1) { - if (!(planemask & mask)) - rop[d] = RROP_NOP; - else if (!(bg & mask)) { - /* Both fg and bg have a 0 or 1 in this plane */ - if (fg & mask) - rop[d] = RROP_WHITE; - else - rop[d] = RROP_BLACK; - } else { - /* Both fg and bg have different bits on this plane */ - if (fg & mask) - rop[d] = RROP_COPY; - else - rop[d] = RROP_INVERT; - } - } -} - void afbReduceRop(alu, src, planemask, depth, rop) register int alu; @@ -615,94 +682,3 @@ afbReduceRop(alu, src, planemask, depth, rop) } } } - -void -afbComputeCompositeClip(pGC, pDrawable) - GCPtr pGC; - DrawablePtr pDrawable; -{ - if (pDrawable->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDrawable; - RegionPtr pregWin; - Bool freeTmpClip, freeCompClip; - - if (pGC->subWindowMode == IncludeInferiors) { - pregWin = NotClippedByChildren(pWin); - freeTmpClip = TRUE; - } else { - pregWin = &pWin->clipList; - freeTmpClip = FALSE; - } - freeCompClip = pGC->freeCompClip; - - /* - * if there is no client clip, we can get by with just keeping the - * pointer we got, and remembering whether or not should destroy (or - * maybe re-use) it later. this way, we avoid unnecessary copying of - * regions. (this wins especially if many clients clip by children - * and have no client clip.) - */ - if (pGC->clientClipType == CT_NONE) { - if (freeCompClip) - REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); - pGC->pCompositeClip = pregWin; - pGC->freeCompClip = freeTmpClip; - } else { - /* - * we need one 'real' region to put into the composite clip. if - * pregWin the current composite clip are real, we can get rid of - * one. if pregWin is real and the current composite clip isn't, - * use pregWin for the composite clip. if the current composite - * clip is real and pregWin isn't, use the current composite - * clip. if neither is real, create a new region. - */ - - REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, - pDrawable->x + pGC->clipOrg.x, - pDrawable->y + pGC->clipOrg.y); - - if (freeCompClip) { - REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin, - pGC->clientClip); - if (freeTmpClip) - REGION_DESTROY(pGC->pScreen, pregWin); - } else if (freeTmpClip) { - REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip); - pGC->pCompositeClip = pregWin; - } else { - pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0); - REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, - pregWin, pGC->clientClip); - } - pGC->freeCompClip = TRUE; - REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, - -(pDrawable->x + pGC->clipOrg.x), - -(pDrawable->y + pGC->clipOrg.y)); - } - } /* end of composite clip for a window */ - else { - BoxRec pixbounds; - - /* XXX should we translate by drawable.x/y here ? */ - pixbounds.x1 = 0; - pixbounds.y1 = 0; - pixbounds.x2 = pDrawable->width; - pixbounds.y2 = pDrawable->height; - - if (pGC->freeCompClip) { - REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds); - } else { - pGC->freeCompClip = TRUE; - pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1); - } - - if (pGC->clientClipType == CT_REGION) { - REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x, - -pGC->clipOrg.y); - REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, - pGC->pCompositeClip, pGC->clientClip); - REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x, - pGC->clipOrg.y); - } - } /* end of composite clip for pixmap */ -} /* end afbComputeCompositeClip */ diff --git a/afb/afbimage.c b/afb/afbimage.c index c82bb3668..81f49730a 100644 --- a/afb/afbimage.c +++ b/afb/afbimage.c @@ -42,39 +42,8 @@ afbPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage) (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, width, height, x, y, 1); else { -#if 0 - /* XXX: bit plane order wronge ! */ - pPixmap->drawable.depth = 1; - pPixmap->drawable.bitsPerPixel = 1; - - switch (pGC->alu) { - case GXcopy: - doBitBlt = afbDoBitbltCopy; - break; - case GXxor: - doBitBlt = afbDoBitbltXor; - break; - case GXcopyInverted: - doBitBlt = afbDoBitbltCopyInverted; - break; - case GXor: - doBitBlt = afbDoBitbltOr; - break; - default: - doBitBlt = afbDoBitbltGeneral; - break; - } - - for (plane = (1L << (pPixmap->drawable.depth - 1)); plane; - plane >>= 1) { - (void)afbBitBlt((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, - width, height, x, y, doBitBlt, plane); - /* pDraw->devKind += sizeDst; */ - } -#else (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, width, height, x, y); -#endif } pGC->fExpose = TRUE; diff --git a/afb/afbpixmap.c b/afb/afbpixmap.c index 6a3a48518..77ba53513 100644 --- a/afb/afbpixmap.c +++ b/afb/afbpixmap.c @@ -118,9 +118,8 @@ afbDestroyPixmap(pPixmap) } -PixmapPtr -afbCopyPixmap(pSrc) - register PixmapPtr pSrc; +static PixmapPtr +afbCopyPixmap(PixmapPtr pSrc) { register PixmapPtr pDst; int size; @@ -148,9 +147,8 @@ afbCopyPixmap(pSrc) zero out area to be filled with replicate left shift and or in original as many times as needed */ -void -afbPadPixmap(pPixmap) - PixmapPtr pPixmap; +static void +afbPadPixmap(PixmapPtr pPixmap) { register int width = pPixmap->drawable.width; register int h; diff --git a/afb/afbscrinit.c b/afb/afbscrinit.c index 2b0867fda..7cb742345 100644 --- a/afb/afbscrinit.c +++ b/afb/afbscrinit.c @@ -77,7 +77,7 @@ int afbScreenPrivateIndex; static unsigned long afbGeneration = 0; -BSFuncRec afbBSFuncRec = { +static BSFuncRec afbBSFuncRec = { afbSaveAreas, afbRestoreAreas, (BackingStoreSetClipmaskRgnProcPtr) 0, @@ -85,7 +85,7 @@ BSFuncRec afbBSFuncRec = { (BackingStoreGetSpansPixmapProcPtr) 0, }; -Bool +static Bool afbCloseScreen(int index, ScreenPtr pScreen) { int d; @@ -119,7 +119,29 @@ afbCreateScreenResources(ScreenPtr pScreen) return(retval); } -Bool +static PixmapPtr +afbGetWindowPixmap(WindowPtr pWin) +{ +#ifdef PIXMAP_PER_WINDOW + return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr); +#else + ScreenPtr pScreen = pWin->drawable.pScreen; + + return (* pScreen->GetScreenPixmap)(pScreen); +#endif +} + +static void +afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix) +{ +#ifdef PIXMAP_PER_WINDOW + pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix; +#else + (* pWin->drawable.pScreen->SetScreenPixmap)(pPix); +#endif +} + +static Bool afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex) { if (afbGeneration != serverGeneration) { @@ -216,25 +238,3 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i return TRUE; } - -PixmapPtr -afbGetWindowPixmap(WindowPtr pWin) -{ -#ifdef PIXMAP_PER_WINDOW - return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr); -#else - ScreenPtr pScreen = pWin->drawable.pScreen; - - return (* pScreen->GetScreenPixmap)(pScreen); -#endif -} - -void -afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix) -{ -#ifdef PIXMAP_PER_WINDOW - pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix; -#else - (* pWin->drawable.pScreen->SetScreenPixmap)(pPix); -#endif -} diff --git a/afb/afbsetsp.c b/afb/afbsetsp.c index adc726620..cb36dba99 100644 --- a/afb/afbsetsp.c +++ b/afb/afbsetsp.c @@ -73,20 +73,10 @@ SOFTWARE. * boxes, we may not want to start grabbing bits at psrc but at some offset * further on.) */ -void -afbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, - sizeDst, depthDst, sizeSrc) - int y; - int xOrigin; /* where this scanline starts */ - int xStart; /* first bit to use from scanline */ - int xEnd; /* last bit to use from scanline + 1 */ - register PixelType *psrc; - register int alu; /* raster op */ - PixelType *pdstBase; /* start of the drawable */ - int widthDst; /* width of drawable in words */ - int sizeDst; - int depthDst; - int sizeSrc; +static void +afbSetScanline(int y, int xOrigin, int xStart, int xEnd, PixelType *psrc, + int alu, PixelType *pdstBase, int widthDst, int sizeDst, + int depthDst, int sizeSrc) { int w; /* width of scanline in bits */ register PixelType *pdst; /* where to put the bits */ From e8bc1988d9ff10b65717574175f70df3c4d6334d Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 15:13:05 -0400 Subject: [PATCH 27/63] Un-staticise VTSwitchEnabled, since kbd wants it apparently. --- hw/xfree86/common/xf86Events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index eae6cb199..3610c17c0 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -128,7 +128,7 @@ extern Bool noXkbExtension; #ifdef USE_VT_SYSREQ static Bool VTSysreqToggle = FALSE; #endif /* !USE_VT_SYSREQ */ -static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for +_X_EXPORT Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for *BSD and for avoiding VT switches when using the DRI automatic full screen mode.*/ From 62224e39727fd6f1cf11a461983662f615a9fea1 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 17:55:15 -0400 Subject: [PATCH 28/63] Static cleanup for xf86 ddx. --- hw/xfree86/common/xf86Bus.c | 29 ++++++------------ hw/xfree86/common/xf86Bus.h | 2 -- hw/xfree86/common/xf86Config.c | 28 ----------------- hw/xfree86/common/xf86Config.h | 1 - hw/xfree86/common/xf86Globals.c | 1 - hw/xfree86/common/xf86Priv.h | 2 -- hw/xfree86/os-support/shared/libc_wrapper.c | 2 +- hw/xfree86/parser/Screen.c | 2 +- hw/xfree86/parser/Vendor.c | 15 +-------- hw/xfree86/parser/Video.c | 34 ++++++++++----------- hw/xfree86/parser/configProcs.h | 4 --- hw/xfree86/parser/xf86Parser.h | 1 - 12 files changed, 29 insertions(+), 92 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index e1cbdbb16..9740b0732 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1791,6 +1791,15 @@ convertRange2Host(int entityIndex, resRange *pRange) } } +static void +xf86ConvertListToHost(int entityIndex, resPtr list) +{ + while (list) { + convertRange2Host(entityIndex, &list->val); + list = list->next; + } +} + /* * xf86RegisterResources() -- attempts to register listed resources. * If list is NULL it tries to obtain resources implicitly. Function @@ -2836,17 +2845,6 @@ xf86IsSubsetOf(resRange range, resPtr list) return ret; } -Bool -xf86IsListSubsetOf(resPtr list, resPtr BaseList) -{ - while (list) { - if (! xf86IsSubsetOf(list->val,BaseList)) - return FALSE; - list = list->next; - } - return TRUE; -} - static resPtr findIntersect(resRange Range, resPtr list) { @@ -3071,15 +3069,6 @@ xf86NoSharedResources(int screenIndex,resType res) return TRUE; } -void -xf86ConvertListToHost(int entityIndex, resPtr list) -{ - while (list) { - convertRange2Host(entityIndex, &list->val); - list = list->next; - } -} - _X_EXPORT void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg) { diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h index 225a5c727..8d7195994 100644 --- a/hw/xfree86/common/xf86Bus.h +++ b/hw/xfree86/common/xf86Bus.h @@ -141,11 +141,9 @@ int xf86AllocateEntity(void); BusType StringToBusType(const char* busID, const char **retID); memType ChkConflict(resRange *rgp, resPtr res, xf86State state); Bool xf86IsSubsetOf(resRange range, resPtr list); -Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList); resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); resPtr xf86FindIntersect(resRange Range, resPtr list); void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated); -void xf86ConvertListToHost(int entityIndex, resPtr list); #endif /* _XF86_BUS_H */ diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 1bd3c62f1..4db844e19 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -538,25 +538,6 @@ xf86DriverlistFromCompile(void) return driverlist; } - -char ** -xf86InputDriverlistFromCompile(void) -{ - static char **driverlist = NULL; - static Bool generated = FALSE; - - /* This string is modified in-place */ - static char drivernames[] = IDRIVERS; - - if (!generated) { - generated = TRUE; - driverlist = GenerateDriverlist("input", drivernames); - } - - return driverlist; -} - - /* * xf86ConfigError -- * Print a READABLE ErrorMessage!!! All information that is @@ -2504,17 +2485,8 @@ xf86HandleConfigFile(Bool autoconfig) return CONFIG_OK; } - -/* These make the equivalent parser functions visible to the common layer. */ -Bool -xf86PathIsAbsolute(const char *path) -{ - return (xf86pathIsAbsolute(path) != 0); -} - Bool xf86PathIsSafe(const char *path) { return (xf86pathIsSafe(path) != 0); } - diff --git a/hw/xfree86/common/xf86Config.h b/hw/xfree86/common/xf86Config.h index 0786ec6fe..3787ba21e 100644 --- a/hw/xfree86/common/xf86Config.h +++ b/hw/xfree86/common/xf86Config.h @@ -53,7 +53,6 @@ char ** xf86ModulelistFromConfig(pointer **); char ** xf86DriverlistFromConfig(void); char ** xf86DriverlistFromCompile(void); char ** xf86InputDriverlistFromConfig(void); -char ** xf86InputDriverlistFromCompile(void); Bool xf86BuiltinInputDriver(const char *); ConfigStatus xf86HandleConfigFile(Bool); diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 9b23710bb..b41fe6e5f 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -146,7 +146,6 @@ _X_EXPORT confDRIRec xf86ConfigDRI = {0, }; XF86ConfigPtr xf86configptr = NULL; Bool xf86Resetting = FALSE; Bool xf86Initialising = FALSE; -Bool xf86ProbeFailed = FALSE; Bool xf86DoProbe = FALSE; Bool xf86DoConfigure = FALSE; DriverPtr *xf86DriverList = NULL; diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 9279dbd7b..59ce8da86 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -100,7 +100,6 @@ extern int xf86NumModuleInfos; extern int xf86NumDrivers; extern Bool xf86Resetting; extern Bool xf86Initialising; -extern Bool xf86ProbeFailed; extern int xf86NumScreens; extern pciVideoPtr *xf86PciVideoInfo; extern xf86CurrentAccessRec xf86CurrentAccess; @@ -155,7 +154,6 @@ extern int pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag); /* xf86Config.c */ -Bool xf86PathIsAbsolute(const char *path); Bool xf86PathIsSafe(const char *path); /* xf86DefaultModes */ diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c index 4c4af4c24..a459d5d70 100644 --- a/hw/xfree86/os-support/shared/libc_wrapper.c +++ b/hw/xfree86/os-support/shared/libc_wrapper.c @@ -628,7 +628,7 @@ typedef struct _xf86_file_ { char* fname; } XF86FILE_priv; -XF86FILE_priv stdhnd[3] = { +static XF86FILE_priv stdhnd[3] = { { 0, XF86FILE_magic, NULL, "$stdinp$" }, { 0, XF86FILE_magic, NULL, "$stdout$" }, { 0, XF86FILE_magic, NULL, "$stderr$" } diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c index b7a64b035..79e1d24ef 100644 --- a/hw/xfree86/parser/Screen.c +++ b/hw/xfree86/parser/Screen.c @@ -83,7 +83,7 @@ static xf86ConfigSymTabRec DisplayTab[] = #define CLEANUP xf86freeDisplayList -XF86ConfDisplayPtr +static XF86ConfDisplayPtr xf86parseDisplaySubSection (void) { int token; diff --git a/hw/xfree86/parser/Vendor.c b/hw/xfree86/parser/Vendor.c index 3e9358b3b..d1e608067 100644 --- a/hw/xfree86/parser/Vendor.c +++ b/hw/xfree86/parser/Vendor.c @@ -75,7 +75,7 @@ static xf86ConfigSymTabRec VendorSubTab[] = #define CLEANUP xf86freeVendorSubList -XF86ConfVendSubPtr +static XF86ConfVendSubPtr xf86parseVendorSubSection (void) { int has_ident = FALSE; @@ -242,16 +242,3 @@ xf86freeVendorSubList (XF86ConfVendSubPtr ptr) xf86conffree (prev); } } - -XF86ConfVendorPtr -xf86findVendor (const char *name, XF86ConfVendorPtr list) -{ - while (list) - { - if (xf86nameCompare (list->vnd_identifier, name) == 0) - return (list); - list = list->list.next; - } - return (NULL); -} - diff --git a/hw/xfree86/parser/Video.c b/hw/xfree86/parser/Video.c index fa0ff7833..a8912cf44 100644 --- a/hw/xfree86/parser/Video.c +++ b/hw/xfree86/parser/Video.c @@ -74,7 +74,23 @@ static xf86ConfigSymTabRec VideoPortTab[] = #define CLEANUP xf86freeVideoPortList -XF86ConfVideoPortPtr +static void +xf86freeVideoPortList (XF86ConfVideoPortPtr ptr) +{ + XF86ConfVideoPortPtr prev; + + while (ptr) + { + TestFree (ptr->vp_identifier); + TestFree (ptr->vp_comment); + xf86optionListFree (ptr->vp_option_lst); + prev = ptr; + ptr = ptr->list.next; + xf86conffree (prev); + } +} + +static XF86ConfVideoPortPtr xf86parseVideoPortSubSection (void) { int has_ident = FALSE; @@ -266,22 +282,6 @@ xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr) } } -void -xf86freeVideoPortList (XF86ConfVideoPortPtr ptr) -{ - XF86ConfVideoPortPtr prev; - - while (ptr) - { - TestFree (ptr->vp_identifier); - TestFree (ptr->vp_comment); - xf86optionListFree (ptr->vp_option_lst); - prev = ptr; - ptr = ptr->list.next; - xf86conffree (prev); - } -} - XF86ConfVideoAdaptorPtr xf86findVideoAdaptor (const char *ident, XF86ConfVideoAdaptorPtr p) { diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h index e3961a98c..3c9ce7a83 100644 --- a/hw/xfree86/parser/configProcs.h +++ b/hw/xfree86/parser/configProcs.h @@ -66,7 +66,6 @@ int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen); /* Pointer.c */ XF86ConfInputPtr xf86parsePointerSection(void); /* Screen.c */ -XF86ConfDisplayPtr xf86parseDisplaySubSection(void); XF86ConfScreenPtr xf86parseScreenSection(void); void xf86printScreenSection(FILE *cf, XF86ConfScreenPtr ptr); void xf86freeScreenList(XF86ConfScreenPtr ptr); @@ -76,16 +75,13 @@ void xf86freeModeList(XF86ModePtr ptr); int xf86validateScreen(XF86ConfigPtr p); /* Vendor.c */ XF86ConfVendorPtr xf86parseVendorSection(void); -XF86ConfVendSubPtr xf86parseVendorSubSection (void); void xf86freeVendorList(XF86ConfVendorPtr p); void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr); void xf86freeVendorSubList (XF86ConfVendSubPtr ptr); /* Video.c */ -XF86ConfVideoPortPtr xf86parseVideoPortSubSection(void); XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void); void xf86printVideoAdaptorSection(FILE *cf, XF86ConfVideoAdaptorPtr ptr); void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr); -void xf86freeVideoPortList(XF86ConfVideoPortPtr ptr); /* scan.c */ int xf86getToken(xf86ConfigSymTabRec *tab); int xf86getSubToken(char **comment); diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h index a6829273c..89de97bbb 100644 --- a/hw/xfree86/parser/xf86Parser.h +++ b/hw/xfree86/parser/xf86Parser.h @@ -469,7 +469,6 @@ XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p); XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p); XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p); XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); -XF86ConfVendorPtr xf86findVendor(const char *name, XF86ConfVendorPtr list); XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, XF86ConfVideoAdaptorPtr p); From af769892a91c9af59de53ca3bcd77fc4967daffb Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 17:56:32 -0400 Subject: [PATCH 29/63] Static and dead code cleanup from mi/ --- mi/mi.h | 51 ------------- mi/miarc.c | 15 +--- mi/mibitblt.c | 10 +-- mi/midash.c | 193 +----------------------------------------------- mi/mifillarc.c | 18 ++--- mi/mifillarc.h | 24 ------ mi/mipointer.c | 47 ++++++------ mi/mipointer.h | 15 ---- mi/mipoly.h | 8 -- mi/mipolytext.c | 51 ------------- mi/mipolyutil.c | 10 +-- mi/miregion.c | 33 +-------- mi/miscrinit.c | 8 +- mi/mispans.c | 30 +------- mi/mispans.h | 16 ---- mi/miwideline.c | 51 ++++--------- mi/miwideline.h | 42 ----------- mi/mizerarc.c | 6 +- mi/mizerarc.h | 6 -- 19 files changed, 61 insertions(+), 573 deletions(-) diff --git a/mi/mi.h b/mi/mi.h index 53b5c4487..c71c9b7c0 100644 --- a/mi/mi.h +++ b/mi/mi.h @@ -85,18 +85,6 @@ extern RegionPtr miCopyArea( int /*yOut*/ ); -extern void miOpqStipDrawable( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - RegionPtr /*prgnSrc*/, - MiBits * /*pbits*/, - int /*srcx*/, - int /*w*/, - int /*h*/, - int /*dstx*/, - int /*dsty*/ -); - extern RegionPtr miCopyPlane( DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, @@ -144,15 +132,6 @@ extern void miRecolorCursor( /* midash.c */ -extern miDashPtr miDashLine( - int /*npt*/, - DDXPointPtr /*ppt*/, - unsigned int /*nDash*/, - unsigned char * /*pDash*/, - unsigned int /*offset*/, - int * /*pnseg*/ -); - extern void miStepDash( int /*dist*/, int * /*pDashIndex*/, @@ -326,16 +305,6 @@ extern void miPolySegment( /* mipolytext.c */ -extern int miPolyText( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - int /*count*/, - char * /*chars*/, - FontEncoding /*fontEncoding*/ -); - extern int miPolyText8( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, @@ -354,16 +323,6 @@ extern int miPolyText16( unsigned short * /*chars*/ ); -extern int miImageText( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - int /*count*/, - char * /*chars*/, - FontEncoding /*fontEncoding*/ -); - extern void miImageText8( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, @@ -403,10 +362,6 @@ extern Bool miRectAlloc( int /*n*/ ); -extern void miSetExtents( - RegionPtr /*pReg*/ -); - extern int miFindMaxBand( RegionPtr /*prgn*/ ); @@ -417,7 +372,6 @@ extern Bool miValidRegion( ); #endif -extern Bool miRegionDataCopy(RegionPtr dst, RegionPtr src); extern Bool miRegionBroken(RegionPtr pReg); /* miscrinit.c */ @@ -432,11 +386,6 @@ extern Bool miModifyPixmapHeader( pointer /*pPixData*/ ); -extern Bool miCloseScreen( - int /*index*/, - ScreenPtr /*pScreen*/ -); - extern Bool miCreateScreenResources( ScreenPtr /*pScreen*/ ); diff --git a/mi/miarc.c b/mi/miarc.c index 8b6d8c0a9..2bbbb0e7f 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -425,15 +425,8 @@ static unsigned long lrustamp; static arcCacheRec *lastCacheHit = &arcCache[0]; static RESTYPE cacheType; -/* - * External so it can be called when low on memory. - * Call with a zero ID in that case. - */ -/*ARGSUSED*/ -int -miFreeArcCache (data, id) - pointer data; - XID id; +static int +miFreeArcCache (pointer data, XID id) { int k; arcCacheRec *cent; @@ -3136,8 +3129,8 @@ struct finalSpanChunk { static struct finalSpanChunk *chunks; -struct finalSpan * -realAllocSpan () +static struct finalSpan * +realAllocSpan (void) { struct finalSpanChunk *newChunk; struct finalSpan *span; diff --git a/mi/mibitblt.c b/mi/mibitblt.c index e4b14078f..e61855a93 100644 --- a/mi/mibitblt.c +++ b/mi/mibitblt.c @@ -400,13 +400,9 @@ miGetPlane( * Note how the clipped out bits of the bitmap are always the background * color so that the stipple never causes FillRect to draw them. */ -void -miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) - DrawablePtr pDraw; - GCPtr pGC; - RegionPtr prgnSrc; - MiBits *pbits; - int srcx, w, h, dstx, dsty; +static void +miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc, + MiBits *pbits, int srcx, int w, int h, int dstx, int dsty) { int oldfill, i; unsigned long oldfg; diff --git a/mi/midash.c b/mi/midash.c index 6dd161a39..912fb0389 100644 --- a/mi/midash.c +++ b/mi/midash.c @@ -54,196 +54,6 @@ SOFTWARE. static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax); -/* return a list of DashRec. there will be an extra -entry at the end holding the last point of the polyline. - this means that the code that actually draws dashes can -get a pair of points for every dash. only the point in the last -dash record is useful; the other fields are not used. - nseg is the number of segments, not the number of points. - -example: - - dash1.start - dash2.start - dash3.start - last-point - -defines a list of segments - (dash1.pt, dash2.pt) - (dash2.pt, dash3.pt) - (dash3.pt, last-point) -and nseg == 3. - -NOTE: - EVEN_DASH == ~ODD_DASH - -NOTE ALSO: - miDashLines may return 0 segments, going from pt[0] to pt[0] with one dash. -*/ - -miDashPtr -miDashLine(npt, ppt, nDash, pDash, offset, pnseg) -int npt; -DDXPointPtr ppt; -unsigned int nDash; -unsigned char *pDash; -unsigned int offset; -int *pnseg; -{ - DDXPointRec pt1, pt2; - int lenCur; /* npt used from this dash */ - int lenMax; /* npt in this dash */ - int iDash = 0; /* index of current dash */ - int which; /* EVEN_DASH or ODD_DASH */ - miDashPtr pseg; /* list of dash segments */ - miDashPtr psegBase; /* start of list */ - int nseg = 0; /* number of dashes so far */ - int nsegMax = 0; /* num segs we can fit in this list */ - - int x, y, len; - int adx, ady, signdx, signdy; - int du, dv, e1, e2, e, base_e = 0; - - lenCur = offset; - which = EVEN_DASH; - while(lenCur >= pDash[iDash]) - { - lenCur -= pDash[iDash]; - iDash++; - if (iDash >= nDash) - iDash = 0; - which = ~which; - } - lenMax = pDash[iDash]; - - psegBase = (miDashPtr)NULL; - pt2 = ppt[0]; /* just in case there is only one point */ - - while(--npt) - { - if (PtEqual(ppt[0], ppt[1])) - { - ppt++; - continue; /* no duplicated points in polyline */ - } - pt1 = *ppt++; - pt2 = *ppt; - - adx = pt2.x - pt1.x; - ady = pt2.y - pt1.y; - signdx = sign(adx); - signdy = sign(ady); - adx = abs(adx); - ady = abs(ady); - - if (adx > ady) - { - du = adx; - dv = ady; - len = adx; - } - else - { - du = ady; - dv = adx; - len = ady; - } - - e1 = dv * 2; - e2 = e1 - 2*du; - e = e1 - du; - x = pt1.x; - y = pt1.y; - - nseg++; - pseg = CheckDashStorage(&psegBase, nseg, &nsegMax); - if (!pseg) - return (miDashPtr)NULL; - pseg->pt = pt1; - pseg->e1 = e1; - pseg->e2 = e2; - base_e = pseg->e = e; - pseg->which = which; - pseg->newLine = 1; - - while (len--) - { - if (adx > ady) - { - /* X_AXIS */ - if (((signdx > 0) && (e < 0)) || - ((signdx <=0) && (e <=0)) - ) - { - e += e1; - } - else - { - y += signdy; - e += e2; - } - x += signdx; - } - else - { - /* Y_AXIS */ - if (((signdx > 0) && (e < 0)) || - ((signdx <=0) && (e <=0)) - ) - { - e +=e1; - } - else - { - x += signdx; - e += e2; - } - y += signdy; - } - - lenCur++; - if (lenCur >= lenMax && (len || npt <= 1)) - { - nseg++; - pseg = CheckDashStorage(&psegBase, nseg, &nsegMax); - if (!pseg) - return (miDashPtr)NULL; - pseg->pt.x = x; - pseg->pt.y = y; - pseg->e1 = e1; - pseg->e2 = e2; - pseg->e = e; - which = ~which; - pseg->which = which; - pseg->newLine = 0; - - /* move on to next dash */ - iDash++; - if (iDash >= nDash) - iDash = 0; - lenMax = pDash[iDash]; - lenCur = 0; - } - } /* while len-- */ - } /* while --npt */ - - if (lenCur == 0 && nseg != 0) - { - nseg--; - which = ~which; - } - *pnseg = nseg; - pseg = CheckDashStorage(&psegBase, nseg+1, &nsegMax); - if (!pseg) - return (miDashPtr)NULL; - pseg->pt = pt2; - pseg->e = base_e; - pseg->which = which; - pseg->newLine = 0; - return psegBase; -} - - #define NSEGDELTA 16 /* returns a pointer to the pseg[nseg-1], growing the storage as @@ -251,8 +61,7 @@ necessary. this interface seems unnecessarily cumbersome. */ -static -miDashPtr +static miDashPtr CheckDashStorage( miDashPtr *ppseg, /* base pointer */ int nseg, /* number of segment we want to write to */ diff --git a/mi/mifillarc.c b/mi/mifillarc.c index 46c073851..c561b1f5b 100644 --- a/mi/mifillarc.c +++ b/mi/mifillarc.c @@ -107,10 +107,8 @@ miFillArcSetup(arc, info) } } -void -miFillArcDSetup(arc, info) - xArc *arc; - miFillArcDRec *info; +static void +miFillArcDSetup(xArc *arc, miFillArcDRec *info) { /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ @@ -188,15 +186,9 @@ miGetArcEdge( } } -void -miEllipseAngleToSlope (angle, width, height, dxp, dyp, d_dxp, d_dyp) - int angle; - int width; - int height; - int *dxp; - int *dyp; - double *d_dxp; - double *d_dyp; +static void +miEllipseAngleToSlope (int angle, int width, int height, int *dxp, int *dyp, + double *d_dxp, double *d_dyp) { int dx, dy; double d_dx, d_dy, scale; diff --git a/mi/mifillarc.h b/mi/mifillarc.h index 53f6f23ea..3e3bb9858 100644 --- a/mi/mifillarc.h +++ b/mi/mifillarc.h @@ -176,35 +176,11 @@ typedef struct _miArcSlice { #define miFillInArcLower(slw) (((iny + dy) != 0) && \ ((slw > 1) || (ine != inxk))) -extern int miFreeArcCache( - pointer /*data*/, - XID /*id*/ -); - -extern struct finalSpan *realAllocSpan( - void -); - extern void miFillArcSetup( xArc * /*arc*/, miFillArcRec * /*info*/ ); -extern void miFillArcDSetup( - xArc * /*arc*/, - miFillArcDRec * /*info*/ -); - -extern void miEllipseAngleToSlope( - int /*angle*/, - int /*width*/, - int /*height*/, - int * /*dxp*/, - int * /*dyp*/, - double * /*d_dxp*/, - double * /*d_dyp*/ -); - extern void miFillArcSliceSetup( xArc * /*arc*/, miArcSliceRec * /*slice*/, diff --git a/mi/mipointer.c b/mi/mipointer.c index b94feaa91..b86a26a97 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -1,8 +1,3 @@ -/* - * mipointer.c - */ - - /* Copyright 1989, 1998 The Open Group @@ -409,6 +404,27 @@ miPointerAbsoluteCursor (int x, int y, unsigned long time) miPointerSetPosition(inputInfo.pointer, &x, &y, time); } +/* Move the pointer on the current screen, and update the sprite. */ +static void +miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, + unsigned long time) +{ + SetupScreen(pScreen); + + if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) && + !pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen) + { + miPointer.devx = x; + miPointer.devy = y; + if(!miPointer.pCursor->bits->emptyMask) + (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y); + } + + miPointer.x = x; + miPointer.y = y; + miPointer.pScreen = pScreen; +} + _X_EXPORT void miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time) { @@ -499,24 +515,3 @@ miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time) for (i = 0; i < nevents; i++) mieqEnqueue(inputInfo.pointer, &events[i]); } - -/* Move the pointer on the current screen, and update the sprite. */ -void -miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, - unsigned long time) -{ - SetupScreen(pScreen); - - if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) && - !pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen) - { - miPointer.devx = x; - miPointer.devy = y; - if(!miPointer.pCursor->bits->emptyMask) - (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y); - } - - miPointer.x = x; - miPointer.y = y; - miPointer.pScreen = pScreen; -} diff --git a/mi/mipointer.h b/mi/mipointer.h index 30e89444b..1bce42c26 100644 --- a/mi/mipointer.h +++ b/mi/mipointer.h @@ -1,9 +1,3 @@ -/* - * mipointer.h - * - */ - - /* Copyright 1989, 1998 The Open Group @@ -172,15 +166,6 @@ extern void miPointerSetPosition( extern void miPointerUpdateSprite( DeviceIntPtr pDev); -/* Moves the sprite to x, y on the current screen, and updates the event - * history. */ -extern void miPointerMoved( - DeviceIntPtr pDev, - ScreenPtr pScreen, - int x, - int y, - unsigned long time); - extern int miPointerScreenIndex; #endif /* MIPOINTER_H */ diff --git a/mi/mipoly.h b/mi/mipoly.h index 8e04f6737..c1bab4943 100644 --- a/mi/mipoly.h +++ b/mi/mipoly.h @@ -180,14 +180,6 @@ typedef struct _ScanLineListBlock { /* mipolyutil.c */ -extern Bool miInsertEdgeInET( - EdgeTable * /*ET*/, - EdgeTableEntry * /*ETE*/, - int /*scanline*/, - ScanLineListBlock ** /*SLLBlock*/, - int * /*iSLLBlock*/ -); - extern Bool miCreateETandAET( int /*count*/, DDXPointPtr /*pts*/, diff --git a/mi/mipolytext.c b/mi/mipolytext.c index 6af02e046..82b16f7d2 100644 --- a/mi/mipolytext.c +++ b/mi/mipolytext.c @@ -66,30 +66,6 @@ SOFTWARE. #include "dixfontstr.h" #include "mi.h" -int -miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding) - DrawablePtr pDraw; - GCPtr pGC; - int x, y; - int count; - char *chars; - FontEncoding fontEncoding; -{ - unsigned long n, i; - int w; - CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ - - GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, - fontEncoding, &n, charinfo); - w = 0; - for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; - if (n != 0) - (*pGC->ops->PolyGlyphBlt)( - pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); - return x+w; -} - - _X_EXPORT int miPolyText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; @@ -112,7 +88,6 @@ miPolyText8(pDraw, pGC, x, y, count, chars) return x+w; } - _X_EXPORT int miPolyText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; @@ -136,31 +111,6 @@ miPolyText16(pDraw, pGC, x, y, count, chars) return x+w; } - -int -miImageText(pDraw, pGC, x, y, count, chars, fontEncoding) - DrawablePtr pDraw; - GCPtr pGC; - int x, y; - int count; - char *chars; - FontEncoding fontEncoding; -{ - unsigned long n, i; - FontPtr font = pGC->font; - int w; - CharInfoPtr charinfo[255]; - - GetGlyphs(font, (unsigned long)count, (unsigned char *)chars, - fontEncoding, &n, charinfo); - w = 0; - for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; - if (n !=0 ) - (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); - return x+w; -} - - _X_EXPORT void miImageText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; @@ -179,7 +129,6 @@ miImageText8(pDraw, pGC, x, y, count, chars) (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); } - _X_EXPORT void miImageText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; diff --git a/mi/mipolyutil.c b/mi/mipolyutil.c index fe72e557f..6ec860a25 100644 --- a/mi/mipolyutil.c +++ b/mi/mipolyutil.c @@ -73,13 +73,9 @@ SOFTWARE. * bucket. Finally, we can insert it. * */ -Bool -miInsertEdgeInET(ET, ETE, scanline, SLLBlock, iSLLBlock) - EdgeTable *ET; - EdgeTableEntry *ETE; - int scanline; - ScanLineListBlock **SLLBlock; - int *iSLLBlock; +static Bool +miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, + ScanLineListBlock **SLLBlock, int *iSLLBlock) { EdgeTableEntry *start, *prev; ScanLineList *pSLL, *pPrevSLL; diff --git a/mi/miregion.c b/mi/miregion.c index 542209982..e980ad18e 100644 --- a/mi/miregion.c +++ b/mi/miregion.c @@ -221,7 +221,7 @@ _X_EXPORT BoxRec miEmptyBox = {0, 0, 0, 0}; _X_EXPORT RegDataRec miEmptyData = {0, 0}; RegDataRec miBrokenData = {0, 0}; -RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData }; +static RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData }; _X_EXPORT void miPrintRegion(rgn) @@ -913,7 +913,7 @@ miRegionOp( * *----------------------------------------------------------------------- */ -void +static void miSetExtents (pReg) RegionPtr pReg; { @@ -2182,35 +2182,6 @@ miTranslateRegion(pReg, x, y) } } -Bool -miRegionDataCopy( - RegionPtr dst, - RegionPtr src) -{ - good(dst); - good(src); - if (dst->data) - return TRUE; - if (dst == src) - return TRUE; - if (!src->data || !src->data->size) - { - xfreeData(dst); - dst->data = (RegDataPtr)NULL; - return TRUE; - } - if (!dst->data || (dst->data->size < src->data->numRects)) - { - xfreeData(dst); - dst->data = xallocData(src->data->numRects); - if (!dst->data) - return miRegionBreak (dst); - } - dst->data->size = src->data->size; - dst->data->numRects = src->data->numRects; - return TRUE; -} - _X_EXPORT void miRegionReset(pReg, pBox) RegionPtr pReg; diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 08cc3f658..cc40cbede 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -126,12 +126,8 @@ miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, return TRUE; } - -/*ARGSUSED*/ -Bool -miCloseScreen (iScreen, pScreen) - int iScreen; - ScreenPtr pScreen; +static Bool +miCloseScreen (int iScreen, ScreenPtr pScreen) { return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate)); } diff --git a/mi/mispans.c b/mi/mispans.c index 61d72e46c..530d9dff2 100644 --- a/mi/mispans.c +++ b/mi/mispans.c @@ -78,9 +78,7 @@ void miInitSpanGroup(spanGroup) #define YMIN(spans) (spans->points[0].y) #define YMAX(spans) (spans->points[spans->count-1].y) -void miSubtractSpans (spanGroup, sub) - SpanGroup *spanGroup; - Spans *sub; +static void miSubtractSpans (SpanGroup *spanGroup, Spans *sub) { int i, subCount, spansCount; int ymin, ymax, xmin, xmax; @@ -364,9 +362,8 @@ static int UniquifySpansX( return (newWidths - startNewWidths) + 1; } /* UniquifySpansX */ -void -miDisposeSpanGroup (spanGroup) - SpanGroup *spanGroup; +static void +miDisposeSpanGroup (SpanGroup *spanGroup) { int i; Spans *spans; @@ -538,24 +535,3 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } - - -void miFillSpanGroup(pDraw, pGC, spanGroup) - DrawablePtr pDraw; - GCPtr pGC; - SpanGroup *spanGroup; -{ - int i; - Spans *spans; - - for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { - (*pGC->ops->FillSpans) - (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE); - xfree(spans->points); - xfree(spans->widths); - } - - spanGroup->count = 0; - spanGroup->ymin = MAXSHORT; - spanGroup->ymax = MINSHORT; -} /* FillSpanGroup */ diff --git a/mi/mispans.h b/mi/mispans.h index 5b141afe2..258b29279 100644 --- a/mi/mispans.h +++ b/mi/mispans.h @@ -71,13 +71,6 @@ extern void miAppendSpans( Spans * /*spans*/ ); -/* Paint a span group, possibly with some overlap */ -extern void miFillSpanGroup( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - SpanGroup * /*spanGroup*/ -); - /* Paint a span group, insuring that each pixel is painted at most once */ extern void miFillUniqueSpanGroup( DrawablePtr /*pDraw*/, @@ -90,15 +83,6 @@ extern void miFreeSpanGroup( SpanGroup * /*spanGroup*/ ); -extern void miSubtractSpans( - SpanGroup * /*spanGroup*/, - Spans * /*sub*/ -); - -extern void miDisposeSpanGroup( - SpanGroup * /*spanGroup*/ -); - extern int miClipSpans( RegionPtr /*prgnDst*/, DDXPointPtr /*ppt*/, diff --git a/mi/miwideline.c b/mi/miwideline.c index 7f99aca51..08e4aa33e 100644 --- a/mi/miwideline.c +++ b/mi/miwideline.c @@ -67,17 +67,11 @@ static void miLineArc(DrawablePtr pDraw, GCPtr pGC, * spans-based polygon filler */ -void -miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height, - left, right, left_count, right_count) - DrawablePtr pDrawable; - GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - int y; /* start y coordinate */ - int overall_height; /* height of entire segment */ - PolyEdgePtr left, right; - int left_count, right_count; +static void +miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, + SpanDataPtr spanData, int y, int overall_height, + PolyEdgePtr left, PolyEdgePtr right, + int left_count, int right_count) { int left_x = 0, left_e = 0; int left_stepx = 0; @@ -873,11 +867,8 @@ miLineArcD ( return (pts - points); } -int -miRoundJoinFace (face, edge, leftEdge) - LineFacePtr face; - PolyEdgePtr edge; - Bool *leftEdge; +static int +miRoundJoinFace (LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge) { int y; int dx, dy; @@ -1114,16 +1105,10 @@ miLineArc ( } } -void -miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg, isInt) - DrawablePtr pDrawable; - GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - LineFacePtr face; - Bool isLeft; - double xorg, yorg; - Bool isInt; +static void +miLineProjectingCap (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, + SpanDataPtr spanData, LineFacePtr face, Bool isLeft, + double xorg, double yorg, Bool isInt) { int xorgi = 0, yorgi = 0; int lw; @@ -1506,11 +1491,8 @@ miWideSegment ( } } -SpanDataPtr -miSetupSpanData (pGC, spanData, npt) - GCPtr pGC; - SpanDataPtr spanData; - int npt; +static SpanDataPtr +miSetupSpanData (GCPtr pGC, SpanDataPtr spanData, int npt) { if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu)) return (SpanDataPtr) NULL; @@ -1520,11 +1502,8 @@ miSetupSpanData (pGC, spanData, npt) return spanData; } -void -miCleanupSpanData (pDrawable, pGC, spanData) - DrawablePtr pDrawable; - GCPtr pGC; - SpanDataPtr spanData; +static void +miCleanupSpanData (DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData) { if (pGC->lineStyle == LineDoubleDash) { diff --git a/mi/miwideline.h b/mi/miwideline.h index 8cfa63008..9d1aa03cb 100644 --- a/mi/miwideline.h +++ b/mi/miwideline.h @@ -153,24 +153,6 @@ typedef struct _LineFace { } \ } -extern void miFillPolyHelper( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - unsigned long /*pixel*/, - SpanDataPtr /*spanData*/, - int /*y*/, - int /*overall_height*/, - PolyEdgePtr /*left*/, - PolyEdgePtr /*right*/, - int /*left_count*/, - int /*right_count*/ -); -extern int miRoundJoinFace( - LineFacePtr /*face*/, - PolyEdgePtr /*edge*/, - Bool * /*leftEdge*/ -); - extern void miRoundJoinClip( LineFacePtr /*pLeft*/, LineFacePtr /*pRight*/, @@ -189,30 +171,6 @@ extern int miRoundCapClip( Bool * /*leftEdge*/ ); -extern void miLineProjectingCap( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - unsigned long /*pixel*/, - SpanDataPtr /*spanData*/, - LineFacePtr /*face*/, - Bool /*isLeft*/, - double /*xorg*/, - double /*yorg*/, - Bool /*isInt*/ -); - -extern SpanDataPtr miSetupSpanData( - GCPtr /*pGC*/, - SpanDataPtr /*spanData*/, - int /*npt*/ -); - -extern void miCleanupSpanData( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - SpanDataPtr /*spanData*/ -); - extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge); extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes, diff --git a/mi/mizerarc.c b/mi/mizerarc.c index f1adc9e2b..9d4715a30 100644 --- a/mi/mizerarc.c +++ b/mi/mizerarc.c @@ -401,10 +401,8 @@ miZeroArcSetup(arc, info, ok360) #define DoPix(idx,xval,yval) if (mask & (1 << idx)) Pixelate(xval, yval); -DDXPointPtr -miZeroArcPts(arc, pts) - xArc *arc; - DDXPointPtr pts; +static DDXPointPtr +miZeroArcPts(xArc *arc, DDXPointPtr pts) { miZeroArcRec info; int x, y, a, b, d, mask; diff --git a/mi/mizerarc.h b/mi/mizerarc.h index 8119d885e..28ebbe030 100644 --- a/mi/mizerarc.h +++ b/mi/mizerarc.h @@ -124,9 +124,3 @@ extern Bool miZeroArcSetup( miZeroArcRec * /*info*/, Bool /*ok360*/ ); - -extern DDXPointPtr miZeroArcPts( - xArc * /*arc*/, - DDXPointPtr /*pts*/ -); - From 04b87d6dfae02e4ecdb5216d12c6cdafd1e8c2b4 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 17:57:22 -0400 Subject: [PATCH 30/63] Static and dead code cleaup for Xext/ --- Xext/appgroup.c | 52 +++++++++++++++++---------------------------- Xext/appgroup.h | 22 ------------------- Xext/panoramiX.c | 48 +++-------------------------------------- Xext/panoramiX.h | 12 ----------- Xext/panoramiXh.h | 5 +---- Xext/panoramiXsrv.h | 3 --- Xext/saver.c | 4 ++-- Xext/security.c | 2 +- Xext/securitysrv.h | 9 -------- Xext/xace.c | 4 ++-- Xext/xace.h | 10 --------- Xext/xevie.c | 2 +- 12 files changed, 29 insertions(+), 144 deletions(-) diff --git a/Xext/appgroup.c b/Xext/appgroup.c index bb7a73ce1..7bd205587 100644 --- a/Xext/appgroup.c +++ b/Xext/appgroup.c @@ -116,8 +116,7 @@ int XagAppGroupFree( return Success; } -/* static */ -void XagClientStateChange( +static void XagClientStateChange( CallbackListPtr* pcbl, pointer nulldata, pointer calldata) @@ -172,21 +171,6 @@ void XagClientStateChange( } } -void -XagExtensionInit(INITARGS) -{ - if (AddExtension (XAGNAME, - 0, - XagNumberErrors, - ProcXagDispatch, - SProcXagDispatch, - XagResetProc, - StandardMinorOpcode)) { - RT_APPGROUP = CreateNewResourceType (XagAppGroupFree); - XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL); - } -} - /*ARGSUSED*/ static void XagResetProc( @@ -393,8 +377,7 @@ int AttrValidate( return client->noClientException; } -/* static */ -int ProcXagCreate ( +static int ProcXagCreate ( register ClientPtr client) { REQUEST (xXagCreateReq); @@ -425,8 +408,7 @@ int ProcXagCreate ( return client->noClientException; } -/* static */ -int ProcXagDestroy( +static int ProcXagDestroy( register ClientPtr client) { AppGroupPtr pAppGrp; @@ -743,18 +725,7 @@ XID XagId( return (client->appgroup ? client->appgroup->appgroupId : 0); } -void XagGetDeltaInfo( - ClientPtr client, - CARD32* buf) -{ - *buf++ = (CARD32) client->appgroup->default_root; - *buf++ = (CARD32) client->appgroup->root_visual; - *buf++ = (CARD32) client->appgroup->default_colormap; - *buf++ = (CARD32) client->appgroup->black_pixel; - *buf = (CARD32) client->appgroup->white_pixel; -} - -void XagCallClientStateChange( +static void XagCallClientStateChange( CallbackListPtr *pcbl, pointer nulldata, pointer calldata) @@ -785,3 +756,18 @@ void XagCallClientStateChange( XagClientStateChange (NULL, NULL, (pointer)&clientinfo); } } + +void +XagExtensionInit(INITARGS) +{ + if (AddExtension (XAGNAME, + 0, + XagNumberErrors, + ProcXagDispatch, + SProcXagDispatch, + XagResetProc, + StandardMinorOpcode)) { + RT_APPGROUP = CreateNewResourceType (XagAppGroupFree); + XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL); + } +} diff --git a/Xext/appgroup.h b/Xext/appgroup.h index a875068fc..778da5de6 100644 --- a/Xext/appgroup.h +++ b/Xext/appgroup.h @@ -50,12 +50,6 @@ extern ClientPtr XagLeader( ClientPtr /* client */ ); -extern void XagCallClientStateChange( - CallbackListPtr * /* pcbl */, - pointer /* nulldata */, - pointer /* calldata */ -); - extern Bool XagIsControlledRoot ( ClientPtr /* client */, WindowPtr /* pParent */ @@ -65,22 +59,6 @@ extern XID XagId ( ClientPtr /* client */ ); -extern void XagGetDeltaInfo ( - ClientPtr /* client */, - CARD32* /* buf */ -); - -extern void XagClientStateChange( - CallbackListPtr* pcbl, - pointer nulldata, - pointer calldata); - -extern int ProcXagCreate ( - register ClientPtr client); - -extern int ProcXagDestroy( - register ClientPtr client); - _XFUNCPROTOEND #endif /* _APPGROUP_SRV_H_ */ diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 85f591356..95df04320 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -77,7 +77,7 @@ int PanoramiXPixHeight = 0; _X_EXPORT int PanoramiXNumScreens = 0; _X_EXPORT PanoramiXData *panoramiXdataPtr = NULL; -RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL}; +static RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL}; static int PanoramiXNumDepths; static DepthPtr PanoramiXDepths; @@ -109,7 +109,6 @@ static void PanoramiXResetProc(ExtensionEntry*); #include "panoramiXh.h" int (* SavedProcVector[256]) (ClientPtr client) = { NULL, }; -ScreenInfo *GlobalScrInfo = NULL; static int PanoramiXGCIndex = -1; static int PanoramiXScreenIndex = -1; @@ -135,7 +134,7 @@ static void XineramaChangeClip(GCPtr, int, pointer, int); static void XineramaDestroyClip(GCPtr); static void XineramaCopyClip(GCPtr, GCPtr); -GCFuncs XineramaGCFuncs = { +static GCFuncs XineramaGCFuncs = { XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC, XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip }; @@ -168,7 +167,7 @@ XineramaCloseScreen (int i, ScreenPtr pScreen) return (*pScreen->CloseScreen) (i, pScreen); } -Bool +static Bool XineramaCreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; @@ -330,8 +329,6 @@ XineramaDestroyClip(GCPtr pGC) Xinerama_GC_FUNC_EPILOGUE (pGC); } - - _X_EXPORT int XineramaDeleteResource(pointer data, XID id) { @@ -339,32 +336,11 @@ XineramaDeleteResource(pointer data, XID id) return 1; } - -static Bool -XineramaFindIDOnAnyScreen(pointer resource, XID id, pointer privdata) -{ - PanoramiXRes *res = (PanoramiXRes*)resource; - int j; - - FOR_NSCREENS(j) - if(res->info[j].id == *((XID*)privdata)) return TRUE; - - return FALSE; -} - -PanoramiXRes * -PanoramiXFindIDOnAnyScreen(RESTYPE type, XID id) -{ - return LookupClientResourceComplex(clients[CLIENT_ID(id)], type, - XineramaFindIDOnAnyScreen, &id); -} - typedef struct { int screen; int id; } PanoramiXSearchData; - static Bool XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata) { @@ -389,23 +365,6 @@ PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen) XineramaFindIDByScrnum, &data); } -WindowPtr -PanoramiXChangeWindow(int ScrnNum, WindowPtr pWin) -{ - int num = pWin->drawable.pScreen->myNum; - - if(num != ScrnNum) { - PanoramiXRes *win; - - win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, num); - - if (win) - pWin = (WindowPtr) LookupIDByType(win->info[ScrnNum].id, RT_WINDOW); - } - - return pWin; -} - typedef struct _connect_callback_list { void (*func)(void); struct _connect_callback_list *next; @@ -496,7 +455,6 @@ void PanoramiXExtensionInit(int argc, char *argv[]) if (noPanoramiXExtension) return; - GlobalScrInfo = &screenInfo; /* For debug visibility */ PanoramiXNumScreens = screenInfo.numScreens; if (PanoramiXNumScreens == 1) { /* Only 1 screen */ noPanoramiXExtension = TRUE; diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h index 7b3339204..3ad90fa84 100644 --- a/Xext/panoramiX.h +++ b/Xext/panoramiX.h @@ -94,18 +94,6 @@ typedef struct { (a).root = WindowTable[0]->drawable.id; \ } -#define FORCE_WIN(a) { \ - if ((win = PanoramiXFindIDOnAnyScreen(XRT_WINDOW, a))) { \ - (a) = win->info[0].id; /* Real ID */ \ - } \ -} - -#define FORCE_CMAP(a) { \ - if ((win = PanoramiXFindIDOnAnyScreen(XRT_COLORMAP, a))) { \ - (a) = win->info[0].id; /* Real ID */ \ - } \ -} - #define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared) #define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return diff --git a/Xext/panoramiXh.h b/Xext/panoramiXh.h index 6cee650ac..1a76a45cd 100644 --- a/Xext/panoramiXh.h +++ b/Xext/panoramiXh.h @@ -19,10 +19,10 @@ extern int PanoramiXGetGeometry(ClientPtr client); extern int PanoramiXTranslateCoords(ClientPtr client); extern int PanoramiXCreatePixmap(ClientPtr client); extern int PanoramiXFreePixmap(ClientPtr client); -extern int PanoramiXCreateGC(ClientPtr client); extern int PanoramiXChangeGC(ClientPtr client); extern int PanoramiXCopyGC(ClientPtr client); extern int PanoramiXCopyColormapAndFree(ClientPtr client); +extern int PanoramiXCreateGC(ClientPtr client); extern int PanoramiXSetDashes(ClientPtr client); extern int PanoramiXSetClipRectangles(ClientPtr client); extern int PanoramiXFreeGC(ClientPtr client); @@ -64,7 +64,6 @@ PROC_EXTERN(ProcPanoramiXGetScreenSize); PROC_EXTERN(ProcXineramaQueryScreens); PROC_EXTERN(ProcXineramaIsActive); -extern Bool XineramaCreateGC(GCPtr pGC); extern int SProcPanoramiXDispatch(ClientPtr client); @@ -72,6 +71,4 @@ extern char *ConnectionInfo; extern int connBlockScreenStart; extern xConnSetupPrefix connSetupPrefix; -extern ScreenInfo *GlobalScrInfo; extern int (* SavedProcVector[256]) (ClientPtr client); - diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h index bb032cfae..ae9024418 100644 --- a/Xext/panoramiXsrv.h +++ b/Xext/panoramiXsrv.h @@ -12,14 +12,11 @@ extern int PanoramiXNumScreens; extern PanoramiXData *panoramiXdataPtr; extern int PanoramiXPixWidth; extern int PanoramiXPixHeight; -extern RegionRec PanoramiXScreenRegion; extern XID *PanoramiXVisualTable; extern void PanoramiXConsolidate(void); extern Bool PanoramiXCreateConnectionBlock(void); extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int); -extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID); -extern WindowPtr PanoramiXChangeWindow(int, WindowPtr); extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void)); extern int XineramaDeleteResource(pointer, XID); diff --git a/Xext/saver.c b/Xext/saver.c index 7e3ebf408..a9f1dd36c 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -66,7 +66,7 @@ static unsigned char ScreenSaverReqCode = 0; #endif static int ScreenSaverEventBase = 0; -extern DISPATCH_PROC(ProcScreenSaverQueryInfo); +static DISPATCH_PROC(ProcScreenSaverQueryInfo); static DISPATCH_PROC(ProcScreenSaverDispatch); static DISPATCH_PROC(ProcScreenSaverQueryVersion); static DISPATCH_PROC(ProcScreenSaverSelectInput); @@ -774,7 +774,7 @@ ProcScreenSaverQueryVersion (client) return (client->noClientException); } -int +static int ProcScreenSaverQueryInfo (client) register ClientPtr client; { diff --git a/Xext/security.c b/Xext/security.c index 7202d3947..c17a438b4 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -77,7 +77,7 @@ typedef struct { #define AUTHID(client) \ (((SecurityClientStateRec*)STATEPTR(client))->authId) -CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */ +static CallbackListPtr SecurityValidateGroupCallback = NULL; RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */ diff --git a/Xext/securitysrv.h b/Xext/securitysrv.h index 7c6f432fe..67d864e2e 100644 --- a/Xext/securitysrv.h +++ b/Xext/securitysrv.h @@ -72,15 +72,6 @@ typedef struct { struct _OtherClients *eventClients; /* clients wanting events */ } SecurityAuthorizationRec, *SecurityAuthorizationPtr; -/* The following callback is called when a GenerateAuthorization request - * is processed to sanity check the group argument. The call data will - * be a pointer to a SecurityValidateGroupInfoRec (below). - * Functions registered on this callback are expected to examine the - * group and set the valid field to TRUE if they recognize the group as a - * legitimate group. If they don't recognize it, they should not change the - * valid field. - */ -extern CallbackListPtr SecurityValidateGroupCallback; typedef struct { XID group; /* the group that was sent in GenerateAuthorization */ Bool valid; /* did anyone recognize it? if so, set to TRUE */ diff --git a/Xext/xace.c b/Xext/xace.c index 6fc5c12ee..63856315c 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -37,10 +37,10 @@ CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0}; * from guessing extension major opcodes and using the extension even though * the extension can't be listed or queried. */ -int (*UntrustedProcVector[256])( +static int (*UntrustedProcVector[256])( ClientPtr /*client*/ ); -int (*SwappedUntrustedProcVector[256])( +static int (*SwappedUntrustedProcVector[256])( ClientPtr /*client*/ ); diff --git a/Xext/xace.h b/Xext/xace.h index 7231b04bc..4143cd42f 100644 --- a/Xext/xace.h +++ b/Xext/xace.h @@ -82,16 +82,6 @@ extern int XaceHook( /* From the original Security extension... */ -/* Proc vectors for untrusted clients, swapped and unswapped versions. - * These are the same as the normal proc vectors except that extensions - * that haven't declared themselves secure will have ProcBadRequest plugged - * in for their major opcode dispatcher. This prevents untrusted clients - * from guessing extension major opcodes and using the extension even though - * the extension can't be listed or queried. - */ -extern int (*UntrustedProcVector[256])(ClientPtr client); -extern int (*SwappedUntrustedProcVector[256])(ClientPtr client); - extern void XaceCensorImage( ClientPtr client, RegionPtr pVisibleRegion, diff --git a/Xext/xevie.c b/Xext/xevie.c index 2fd68f8ce..7922913ba 100644 --- a/Xext/xevie.c +++ b/Xext/xevie.c @@ -105,7 +105,7 @@ typedef struct { } xevieKeycQueueRec, *xevieKeycQueuePtr; #define KEYC_QUEUE_SIZE 100 -xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}}; +static xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}}; static int keycqHead = 0, keycqTail = 0; static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr); From 4b5802ddbd45271be3cadeae0a83a6742df2515b Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 17:57:54 -0400 Subject: [PATCH 31/63] General DIX static and dead code cleanup. --- dix/dispatch.c | 52 +++++++++---------- dix/dixutils.c | 6 +-- dix/extension.c | 81 ----------------------------- dix/gc.c | 11 ---- dix/swaprep.c | 109 +++++++++++++++++++-------------------- dix/window.c | 120 ++++++++++++++++--------------------------- include/dix.h | 21 -------- include/extnsionst.h | 35 ------------- include/gc.h | 5 -- include/os.h | 14 ----- include/swaprep.h | 18 ------- include/window.h | 19 ------- os/access.c | 6 +-- os/auth.c | 20 -------- os/io.c | 13 +++-- os/osdep.h | 8 --- os/xdmcp.c | 58 +++++++++------------ record/set.c | 8 +-- 18 files changed, 166 insertions(+), 438 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index 02665edea..3d8e71fdc 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -299,7 +299,6 @@ long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE; long SmartScheduleTime; static ClientPtr SmartLastClient; static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; -int SmartScheduleClient(int *clientReady, int nready); #ifdef SMART_DEBUG long SmartLastPrint; @@ -308,7 +307,7 @@ long SmartLastPrint; void Dispatch(void); void InitProcVectors(void); -int +static int SmartScheduleClient (int *clientReady, int nready) { ClientPtr pClient; @@ -834,7 +833,7 @@ ProcCirculateWindow(ClientPtr client) return(client->noClientException); } -int +static int GetGeometry(ClientPtr client, xGetGeometryReply *rep) { DrawablePtr pDraw; @@ -2157,8 +2156,7 @@ ProcPutImage(ClientPtr client) return (client->noClientException); } - -int +static int DoGetImage(ClientPtr client, int format, Drawable drawable, int x, int y, int width, int height, Mask planemask, xGetImageReply **im_return) @@ -3383,6 +3381,28 @@ ProcChangeAccessControl(ClientPtr client) return (result); } +/********************* + * CloseDownRetainedResources + * + * Find all clients that are gone and have terminated in RetainTemporary + * and destroy their resources. + *********************/ + +static void +CloseDownRetainedResources(void) +{ + int i; + ClientPtr client; + + for (i=1; icloseDownMode == RetainTemporary) + && (client->clientGone)) + CloseDownClient(client); + } +} + int ProcKillClient(ClientPtr client) { @@ -3651,28 +3671,6 @@ KillAllClients() } } -/********************* - * CloseDownRetainedResources - * - * Find all clients that are gone and have terminated in RetainTemporary - * and destroy their resources. - *********************/ - -void -CloseDownRetainedResources() -{ - int i; - ClientPtr client; - - for (i=1; icloseDownMode == RetainTemporary) - && (client->clientGone)) - CloseDownClient(client); - } -} - extern int clientPrivateLen; extern unsigned *clientPrivateSizes; extern unsigned totalClientSize; diff --git a/dix/dixutils.c b/dix/dixutils.c index c0728da71..44d82c944 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -882,9 +882,7 @@ static CallbackFuncsRec default_cbfuncs = _DeleteCallbackList }; -/* ===== Public Procedures ===== */ - -Bool +static Bool CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) { CallbackListPtr cbl; @@ -916,6 +914,8 @@ CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) return TRUE; } +/* ===== Public Procedures ===== */ + _X_EXPORT Bool AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) { diff --git a/dix/extension.c b/dix/extension.c index fb4ee6b95..88dff15e2 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -66,8 +66,6 @@ SOFTWARE. #define LAST_EVENT 128 #define LAST_ERROR 255 -static ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS]; - static ExtensionEntry **extensions = (ExtensionEntry **)NULL; int lastEvent = EXTENSION_EVENT_BASE; @@ -298,21 +296,8 @@ CloseDownExtensions() extensions = (ExtensionEntry **)NULL; lastEvent = EXTENSION_EVENT_BASE; lastError = FirstExtensionError; - for (i=0; inum) - { - spentry->num--; - xfree(spentry->procList[spentry->num].name); - } - xfree(spentry->procList); - spentry->procList = (ProcEntryPtr)NULL; - } } - int ProcQueryExtension(ClientPtr client) { @@ -406,72 +391,6 @@ ProcListExtensions(ClientPtr client) return(client->noClientException); } - -ExtensionLookupProc -LookupProc(char *name, GCPtr pGC) -{ - int i; - ScreenProcEntry *spentry; - spentry = &AuxillaryScreenProcs[pGC->pScreen->myNum]; - if (spentry->num) - { - for (i = 0; i < spentry->num; i++) - if (strcmp(name, spentry->procList[i].name) == 0) - return(spentry->procList[i].proc); - } - return (ExtensionLookupProc)NULL; -} - -Bool -RegisterProc(char *name, GC *pGC, ExtensionLookupProc proc) -{ - return RegisterScreenProc(name, pGC->pScreen, proc); -} - -Bool -RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc) -{ - ScreenProcEntry *spentry; - ProcEntryPtr procEntry = (ProcEntryPtr)NULL; - char *newname; - int i; - - spentry = &AuxillaryScreenProcs[pScreen->myNum]; - /* first replace duplicates */ - if (spentry->num) - { - for (i = 0; i < spentry->num; i++) - if (strcmp(name, spentry->procList[i].name) == 0) - { - procEntry = &spentry->procList[i]; - break; - } - } - if (procEntry) - procEntry->proc = proc; - else - { - newname = (char *)xalloc(strlen(name)+1); - if (!newname) - return FALSE; - procEntry = (ProcEntryPtr) - xrealloc(spentry->procList, - sizeof(ProcEntryRec) * (spentry->num+1)); - if (!procEntry) - { - xfree(newname); - return FALSE; - } - spentry->procList = procEntry; - procEntry += spentry->num; - procEntry->name = newname; - strcpy(newname, name); - procEntry->proc = proc; - spentry->num++; - } - return TRUE; -} - #ifdef XSERVER_DTRACE void LoadExtensionNames(char **RequestNames) { int i; diff --git a/dix/gc.c b/dix/gc.c index 7b7953db1..7a76dd99d 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -907,17 +907,6 @@ FreeGC(pointer value, XID gid) return(Success); } -void -SetGCMask(GCPtr pGC, Mask selectMask, Mask newDataMask) -{ - pGC->stateChanges = (~selectMask & pGC->stateChanges) | - (selectMask & newDataMask); - if (selectMask & newDataMask) - pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; -} - - - /* CreateScratchGC(pScreen, depth) like CreateGC, but doesn't do the default tile or stipple, since we can't create them without already having a GC. any code diff --git a/dix/swaprep.c b/dix/swaprep.c index 6f4b277d9..7d3251ae3 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -317,7 +317,7 @@ SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep) (void)WriteToClient(pClient, size, (char *) pRep); } -void +static void SwapTimecoord(xTimecoord* pCoord) { char n; @@ -584,7 +584,7 @@ SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep (void)WriteToClient(pClient, size, (char *) pRep); } -void +static void SwapRGB(xrgb *prgb) { char n; @@ -1159,6 +1159,58 @@ SKeymapNotifyEvent(xEvent *from, xEvent *to) *to = *from; } +static void +SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) +{ + cpswapl(pConnSetup->release, pConnSetupT->release); + cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); + cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); + cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); + cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); + cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); + pConnSetupT->minKeyCode = pConnSetup->minKeyCode; + pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; + pConnSetupT->numRoots = pConnSetup->numRoots; + pConnSetupT->numFormats = pConnSetup->numFormats; + pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; + pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; + pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; + pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; +} + +static void +SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) +{ + cpswapl(pRoot->windowId, pRootT->windowId); + cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); + cpswapl(pRoot->whitePixel, pRootT->whitePixel); + cpswapl(pRoot->blackPixel, pRootT->blackPixel); + cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); + cpswaps(pRoot->pixWidth, pRootT->pixWidth); + cpswaps(pRoot->pixHeight, pRootT->pixHeight); + cpswaps(pRoot->mmWidth, pRootT->mmWidth); + cpswaps(pRoot->mmHeight, pRootT->mmHeight); + cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); + cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); + cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); + pRootT->backingStore = pRoot->backingStore; + pRootT->saveUnders = pRoot->saveUnders; + pRootT->rootDepth = pRoot->rootDepth; + pRootT->nDepths = pRoot->nDepths; +} + +static void +SwapVisual(xVisualType *pVis, xVisualType *pVisT) +{ + cpswapl(pVis->visualID, pVisT->visualID); + pVisT->class = pVis->class; + pVisT->bitsPerRGB = pVis->bitsPerRGB; + cpswaps(pVis->colormapEntries, pVisT->colormapEntries); + cpswapl(pVis->redMask, pVisT->redMask); + cpswapl(pVis->greenMask, pVisT->greenMask); + cpswapl(pVis->blueMask, pVisT->blueMask); +} + _X_EXPORT void SwapConnSetupInfo( char *pInfo, @@ -1210,7 +1262,6 @@ SwapConnSetupInfo( } } - void WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) { @@ -1227,58 +1278,6 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) DEALLOCATE_LOCAL(pInfoTBase); } -void -SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) -{ - cpswapl(pConnSetup->release, pConnSetupT->release); - cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); - cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); - cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); - cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); - cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); - pConnSetupT->minKeyCode = pConnSetup->minKeyCode; - pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; - pConnSetupT->numRoots = pConnSetup->numRoots; - pConnSetupT->numFormats = pConnSetup->numFormats; - pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; - pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; - pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; - pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; -} - -void -SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) -{ - cpswapl(pRoot->windowId, pRootT->windowId); - cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); - cpswapl(pRoot->whitePixel, pRootT->whitePixel); - cpswapl(pRoot->blackPixel, pRootT->blackPixel); - cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); - cpswaps(pRoot->pixWidth, pRootT->pixWidth); - cpswaps(pRoot->pixHeight, pRootT->pixHeight); - cpswaps(pRoot->mmWidth, pRootT->mmWidth); - cpswaps(pRoot->mmHeight, pRootT->mmHeight); - cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); - cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); - cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); - pRootT->backingStore = pRoot->backingStore; - pRootT->saveUnders = pRoot->saveUnders; - pRootT->rootDepth = pRoot->rootDepth; - pRootT->nDepths = pRoot->nDepths; -} - -void -SwapVisual(xVisualType *pVis, xVisualType *pVisT) -{ - cpswapl(pVis->visualID, pVisT->visualID); - pVisT->class = pVis->class; - pVisT->bitsPerRGB = pVis->bitsPerRGB; - cpswaps(pVis->colormapEntries, pVisT->colormapEntries); - cpswapl(pVis->redMask, pVisT->redMask); - cpswapl(pVis->greenMask, pVisT->greenMask); - cpswapl(pVis->blueMask, pVisT->blueMask); -} - _X_EXPORT void SwapConnSetupPrefix(xConnSetupPrefix *pcspFrom, xConnSetupPrefix *pcspTo) { diff --git a/dix/window.c b/dix/window.c index 2a82f2e0a..7d99477ce 100644 --- a/dix/window.c +++ b/dix/window.c @@ -539,7 +539,7 @@ InitRootWindow(WindowPtr pWin) * window from which the region came. */ -void +static void ClippedRegionFromBox(WindowPtr pWin, RegionPtr Rgn, int x, int y, int w, int h) @@ -835,6 +835,26 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, return pWin; } +static void +DisposeWindowOptional (WindowPtr pWin) +{ + if (!pWin->optional) + return; + /* + * everything is peachy. Delete the optional record + * and clean up + */ + if (pWin->optional->cursor) + { + FreeCursor (pWin->optional->cursor, (Cursor)0); + pWin->cursorIsNone = FALSE; + } + else + pWin->cursorIsNone = TRUE; + xfree (pWin->optional); + pWin->optional = NULL; +} + static void FreeWindowResources(WindowPtr pWin) { @@ -2703,6 +2723,30 @@ RealizeTree(WindowPtr pWin) } } +static WindowPtr windowDisableMapUnmapEvents; + +void +DisableMapUnmapEvents(WindowPtr pWin) +{ + assert (windowDisableMapUnmapEvents == NULL); + + windowDisableMapUnmapEvents = pWin; +} + +void +EnableMapUnmapEvents(WindowPtr pWin) +{ + assert (windowDisableMapUnmapEvents != NULL); + + windowDisableMapUnmapEvents = NULL; +} + +static Bool +MapUnmapEventsEnabled(WindowPtr pWin) +{ + return pWin != windowDisableMapUnmapEvents; +} + /***** * MapWindow * If some other client has selected SubStructureReDirect on the parent @@ -3201,21 +3245,6 @@ HandleSaveSet(ClientPtr client) client->saveSet = (SaveSetElt *)NULL; } -/** - * - * \param x,y in root - * \param box "return" value - */ -Bool -VisibleBoundingBoxFromPoint(WindowPtr pWin, int x, int y, BoxPtr box) -{ - if (!pWin->realized) - return (FALSE); - if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->clipList, x, y, box)) - return(TRUE); - return(FALSE); -} - /** * * \param x,y in root @@ -3324,30 +3353,6 @@ SendVisibilityNotify(WindowPtr pWin) DeliverEvents(pWin, &event, 1, NullWindow); } -static WindowPtr windowDisableMapUnmapEvents; - -void -DisableMapUnmapEvents(WindowPtr pWin) -{ - assert (windowDisableMapUnmapEvents == NULL); - - windowDisableMapUnmapEvents = pWin; -} - -void -EnableMapUnmapEvents(WindowPtr pWin) -{ - assert (windowDisableMapUnmapEvents != NULL); - - windowDisableMapUnmapEvents = NULL; -} - -Bool -MapUnmapEventsEnabled(WindowPtr pWin) -{ - return pWin != windowDisableMapUnmapEvents; -} - #define RANDOM_WIDTH 32 #ifndef NOLOGOHACK @@ -3700,41 +3705,6 @@ MakeWindowOptional (WindowPtr pWin) return TRUE; } -void -DisposeWindowOptional (WindowPtr pWin) -{ - if (!pWin->optional) - return; - /* - * everything is peachy. Delete the optional record - * and clean up - */ - /* - * TOG changed this code to: - * - * if (pWin->cursorIsNone == FALSE) - * FreeCursor (pWin->optional->cursor, (Cursor)0); - * pWin->cursorIsNone = TRUE; - * - * This is blatently wrong; windows without optionals can have - * two different cursor values, either None or sharing their - * parents cursor. This difference is controlled by the - * cursorIsNone value; when TRUE, the window has no cursor, - * when false, it shares its cursor with its parent; TOG - * made it impossible for a window to have a cursor without - * an optional record. - */ - if (pWin->optional->cursor) - { - FreeCursor (pWin->optional->cursor, (Cursor)0); - pWin->cursorIsNone = FALSE; - } - else - pWin->cursorIsNone = TRUE; - xfree (pWin->optional); - pWin->optional = NULL; -} - #ifndef NOLOGOHACK static void DrawLogo(WindowPtr pWin) diff --git a/include/dix.h b/include/dix.h index 5c2c5b862..b41268398 100644 --- a/include/dix.h +++ b/include/dix.h @@ -220,8 +220,6 @@ extern int dixDestroyPixmap( pointer /*value*/, XID /*pid*/); -extern void CloseDownRetainedResources(void); - extern void InitClient( ClientPtr /*client*/, int /*i*/, @@ -243,25 +241,10 @@ extern void DeleteWindowFromAnySelections( extern void MarkClientException( ClientPtr /*client*/); -extern int GetGeometry( - ClientPtr /*client*/, - xGetGeometryReply* /* wa */); - extern int SendConnSetup( ClientPtr /*client*/, char* /*reason*/); -extern int DoGetImage( - ClientPtr /*client*/, - int /*format*/, - Drawable /*drawable*/, - int /*x*/, - int /*y*/, - int /*width*/, - int /*height*/, - Mask /*planemask*/, - xGetImageReply ** /*im_return*/); - #if defined(DDXBEFORERESET) extern void ddxBeforeReset (void); #endif @@ -632,10 +615,6 @@ typedef struct _CallbackProcs { DeleteCallbackListProcPtr DeleteCallbackList; } CallbackFuncsRec, *CallbackFuncsPtr; -extern Bool CreateCallbackList( - CallbackListPtr * /*pcbl*/, - CallbackFuncsPtr /*cbfuncs*/); - extern Bool AddCallback( CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, diff --git a/include/extnsionst.h b/include/extnsionst.h index 38d4bd7d9..28ae1d539 100644 --- a/include/extnsionst.h +++ b/include/extnsionst.h @@ -85,32 +85,11 @@ extern void NotImplemented ( /* FIXME: this may move to another file... */ xEvent *, xEvent *); -typedef void (* ExtensionLookupProc)( -#ifdef EXTENSION_PROC_ARGS - EXTENSION_PROC_ARGS -#else - /* args no longer indeterminate */ - char *name, - GCPtr pGC -#endif -); - -typedef struct _ProcEntry { - char *name; - ExtensionLookupProc proc; -} ProcEntryRec, *ProcEntryPtr; - -typedef struct _ScreenProcEntry { - int num; - ProcEntryPtr procList; -} ScreenProcEntry; - #define SetGCVector(pGC, VectorElement, NewRoutineAddress, Atom) \ pGC->VectorElement = NewRoutineAddress; #define GetGCValue(pGC, GCElement) (pGC->GCElement) - extern ExtensionEntry *AddExtension( char* /*name*/, int /*NumEvents*/, @@ -128,20 +107,6 @@ extern Bool AddExtensionAlias( extern ExtensionEntry *CheckExtension(const char *extname); extern ExtensionEntry *GetExtensionEntry(int major); -extern ExtensionLookupProc LookupProc( - char* /*name*/, - GCPtr /*pGC*/); - -extern Bool RegisterProc( - char* /*name*/, - GCPtr /*pGC*/, - ExtensionLookupProc /*proc*/); - -extern Bool RegisterScreenProc( - char* /*name*/, - ScreenPtr /*pScreen*/, - ExtensionLookupProc /*proc*/); - extern void DeclareExtensionSecurity( char * /*extname*/, Bool /*secure*/); diff --git a/include/gc.h b/include/gc.h index 6c7add620..3b7e38e02 100644 --- a/include/gc.h +++ b/include/gc.h @@ -126,11 +126,6 @@ extern int FreeGC( pointer /*pGC*/, XID /*gid*/); -extern void SetGCMask( - GCPtr /*pGC*/, - Mask /*selectMask*/, - Mask /*newDataMask*/); - extern GCPtr CreateScratchGC( ScreenPtr /*pScreen*/, unsigned /*depth*/); diff --git a/include/os.h b/include/os.h index d4eed220f..7399436fb 100644 --- a/include/os.h +++ b/include/os.h @@ -348,12 +348,6 @@ extern void InitAuthorization(char * /*filename*/); extern void RegisterAuthorizations(void); -extern XID AuthorizationToID ( - unsigned short name_length, - char *name, - unsigned short data_length, - char *data); - extern int AuthorizationFromID ( XID id, unsigned short *name_lenp, @@ -402,14 +396,6 @@ extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/); extern void ddxUseMsg(void); -/* - * idiom processing stuff - */ - -extern xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore); - -extern void SkipRequests(xReqPtr req, ClientPtr client, int numskipped); - /* int ReqLen(xReq *req, ClientPtr client) * Given a pointer to a *complete* request, return its length in bytes. * Note that if the request is a big request (as defined in the Big diff --git a/include/swaprep.h b/include/swaprep.h index 8a9dcf036..bebd3a814 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -91,9 +91,6 @@ extern void SQueryPointerReply( int /* size */, xQueryPointerReply * /* pRep */); -extern void SwapTimecoord( - xTimecoord * /* pCoord */); - extern void SwapTimeCoordWrite( ClientPtr /* pClient */, int /* size */, @@ -174,9 +171,6 @@ extern void SAllocColorPlanesReply( int /* size */, xAllocColorPlanesReply * /* pRep */); -extern void SwapRGB( - xrgb * /* prgb */); - extern void SQColorsExtend( ClientPtr /* pClient */, int /* size */, @@ -255,18 +249,6 @@ extern void WriteSConnectionInfo( unsigned long /* size */, char * /* pInfo */); -extern void SwapConnSetup( - xConnSetup * /* pConnSetup */, - xConnSetup * /* pConnSetupT */); - -extern void SwapWinRoot( - xWindowRoot * /* pRoot */, - xWindowRoot * /* pRootT */); - -extern void SwapVisual( - xVisualType * /* pVis */, - xVisualType * /* pVisT */); - extern void SwapConnSetupPrefix( xConnSetupPrefix * /* pcspFrom */, xConnSetupPrefix * /* pcspTo */); diff --git a/include/window.h b/include/window.h index bddeb252b..cd8c5b283 100644 --- a/include/window.h +++ b/include/window.h @@ -93,14 +93,6 @@ extern Bool CreateRootWindow( extern void InitRootWindow( WindowPtr /*pWin*/); -extern void ClippedRegionFromBox( - WindowPtr /*pWin*/, - RegionPtr /*Rgn*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/); - typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin); void RegisterRealChildHeadProc (RealChildHeadProc proc); @@ -205,12 +197,6 @@ extern void UnmapSubwindows( extern void HandleSaveSet( ClientPtr /*client*/); -extern Bool VisibleBoundingBoxFromPoint( - WindowPtr /*pWin*/, - int /*x*/, - int /*y*/, - BoxPtr /*box*/); - extern Bool PointInWindowIsVisible( WindowPtr /*pWin*/, int /*x*/, @@ -235,9 +221,6 @@ extern void CheckWindowOptionalNeed( extern Bool MakeWindowOptional( WindowPtr /*pWin*/); -extern void DisposeWindowOptional( - WindowPtr /*pWin*/); - extern WindowPtr MoveWindowInStack( WindowPtr /*pWin*/, WindowPtr /*pNextSib*/); @@ -271,7 +254,5 @@ extern void DisableMapUnmapEvents( WindowPtr /* pWin */ ); extern void EnableMapUnmapEvents( WindowPtr /* pWin */ ); -extern Bool MapUnmapEventsEnabled( - WindowPtr /* pWin */ ); #endif /* WINDOW_H */ diff --git a/os/access.c b/os/access.c index db5ca3135..221b8cbcd 100644 --- a/os/access.c +++ b/os/access.c @@ -234,8 +234,8 @@ static Bool NewHost(int /*family*/, int /*len*/, int /* addingLocalHosts */); -int LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid, - int **pSuppGids, int *nSuppGids); +static int LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid, + int **pSuppGids, int *nSuppGids); /* XFree86 bug #156: To keep track of which hosts were explicitly requested in @@ -1431,7 +1431,7 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid) * * Used by localuser & localgroup ServerInterpreted access control forms below */ -int +static int LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid, int **pSuppGids, int *nSuppGids) { diff --git a/os/auth.c b/os/auth.c index bf33b7ef1..b06333e6b 100644 --- a/os/auth.c +++ b/os/auth.c @@ -255,26 +255,6 @@ ResetAuthorization (void) ShouldLoadAuth = TRUE; } -XID -AuthorizationToID ( - unsigned short name_length, - char *name, - unsigned short data_length, - char *data) -{ - int i; - - for (i = 0; i < NUM_AUTHORIZATION; i++) { - if (protocols[i].name_length == name_length && - memcmp (protocols[i].name, name, (int) name_length) == 0 && - protocols[i].ToID) - { - return (*protocols[i].ToID) (data_length, data); - } - } - return (XID) ~0L; -} - int AuthorizationFromID ( XID id, diff --git a/os/io.c b/os/io.c index 80a151f6a..4e83e682b 100644 --- a/os/io.c +++ b/os/io.c @@ -90,6 +90,11 @@ SOFTWARE. _X_EXPORT CallbackListPtr ReplyCallback; _X_EXPORT CallbackListPtr FlushCallback; +static ConnectionInputPtr AllocateInputBuffer(void); +static ConnectionOutputPtr AllocateOutputBuffer(void); +static xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore); +static void SkipRequests(xReqPtr req, ClientPtr client, int numskipped); + /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ @@ -635,7 +640,7 @@ ResetCurrentRequest(ClientPtr client) * **********************/ -xReqPtr +static xReqPtr PeekNextRequest( xReqPtr req, /* request we're starting from */ ClientPtr client, /* client whose requests we're skipping */ @@ -697,7 +702,7 @@ PeekNextRequest( _X_EXPORT CallbackListPtr SkippedRequestsCallback = NULL; -void +static void SkipRequests( xReqPtr req, /* last request being skipped */ ClientPtr client, /* client whose requests we're skipping */ @@ -1165,7 +1170,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount) return extraCount; /* return only the amount explicitly requested */ } -ConnectionInputPtr +static ConnectionInputPtr AllocateInputBuffer(void) { ConnectionInputPtr oci; @@ -1186,7 +1191,7 @@ AllocateInputBuffer(void) return oci; } -ConnectionOutputPtr +static ConnectionOutputPtr AllocateOutputBuffer(void) { ConnectionOutputPtr oco; diff --git a/os/osdep.h b/os/osdep.h index 3d303f913..0984d51e8 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -210,10 +210,6 @@ extern void FreeOsBuffers( #include "dix.h" -extern ConnectionInputPtr AllocateInputBuffer(void); - -extern ConnectionOutputPtr AllocateOutputBuffer(void); - extern fd_set AllSockets; extern fd_set AllClients; extern fd_set LastSelectMask; @@ -293,14 +289,12 @@ extern XID AuthSecurityCheck (AuthCheckArgs); /* in xdmcp.c */ extern void XdmcpUseMsg (void); extern int XdmcpOptions(int argc, char **argv, int i); -extern void XdmcpSetAuthentication (ARRAY8Ptr name); extern void XdmcpRegisterConnection ( int type, char *address, int addrlen); extern void XdmcpRegisterAuthorizations (void); extern void XdmcpRegisterAuthorization (char *name, int namelen); -extern void XdmcpRegisterDisplayClass (char *name, int length); extern void XdmcpInit (void); extern void XdmcpReset (void); extern void XdmcpOpenDisplay(int sock); @@ -313,8 +307,6 @@ extern void XdmcpRegisterAuthentication ( ValidatorFunc Validator, GeneratorFunc Generator, AddAuthorFunc AddAuth); -extern int XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type); -extern int XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data); struct sockaddr_in; extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr); diff --git a/os/xdmcp.c b/os/xdmcp.c index cfc1005c2..310f33bc0 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -197,8 +197,6 @@ static void receive_packet(int /*socketfd*/); static void send_packet(void); -extern void XdmcpDeadSession(char * /*reason*/); - static void timeout(void); static void restart(void); @@ -213,10 +211,23 @@ static void XdmcpWakeupHandler( int /*i*/, pointer /*LastSelectMask*/); -void XdmcpRegisterManufacturerDisplayID( - char * /*name*/, - int /*length*/); +/* + * Register the Manufacturer display ID + */ +static ARRAY8 ManufacturerDisplayID; + +static void +XdmcpRegisterManufacturerDisplayID (char *name, int length) +{ + int i; + + XdmcpDisposeARRAY8 (&ManufacturerDisplayID); + if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length)) + return; + for (i = 0; i < length; i++) + ManufacturerDisplayID.data[i] = (CARD8) name[i]; +} static unsigned short xdm_udp_port = XDM_UDP_PORT; static Bool OneSession = FALSE; @@ -417,7 +428,7 @@ static ARRAY8Ptr AuthenticationName = &noAuthenticationName; static ARRAY8Ptr AuthenticationData = &noAuthenticationData; static AuthenticationFuncsPtr AuthenticationFuncs; -void +static void XdmcpSetAuthentication (ARRAY8Ptr name) { int i; @@ -549,7 +560,7 @@ XdmcpRegisterAuthorization (char *name, int namelen) static ARRAY8 DisplayClass; -void +static void XdmcpRegisterDisplayClass (char *name, int length) { int i; @@ -561,24 +572,6 @@ XdmcpRegisterDisplayClass (char *name, int length) DisplayClass.data[i] = (CARD8) name[i]; } -/* - * Register the Manufacturer display ID - */ - -static ARRAY8 ManufacturerDisplayID; - -void -XdmcpRegisterManufacturerDisplayID (char *name, int length) -{ - int i; - - XdmcpDisposeARRAY8 (&ManufacturerDisplayID); - if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length)) - return; - for (i = 0; i < length; i++) - ManufacturerDisplayID.data[i] = (CARD8) name[i]; -} - /* * initialize XDMCP; create the socket, compute the display * number, set up the state machine @@ -867,7 +860,7 @@ send_packet(void) * timeouts, or Keepalive failure. */ -void +static void XdmcpDeadSession (char *reason) { ErrorF ("XDM: %s, declaring session dead\n", reason); @@ -960,21 +953,16 @@ restart(void) send_packet(); } -int -XdmcpCheckAuthentication ( - ARRAY8Ptr Name, - ARRAY8Ptr Data, - int packet_type) +static int +XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type) { return (XdmcpARRAY8Equal (Name, AuthenticationName) && (AuthenticationName->length == 0 || (*AuthenticationFuncs->Validator) (AuthenticationData, Data, packet_type))); } -int -XdmcpAddAuthorization ( - ARRAY8Ptr name, - ARRAY8Ptr data) +static int +XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data) { AddAuthorFunc AddAuth; diff --git a/record/set.c b/record/set.c index 0ebb0884d..07a3a63a3 100644 --- a/record/set.c +++ b/record/set.c @@ -164,10 +164,10 @@ BitVectorIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter, return (RecordSetIteratePtr)(long)(pInterval->last + 1); } -RecordSetOperations BitVectorSetOperations = { +static RecordSetOperations BitVectorSetOperations = { BitVectorDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet }; -RecordSetOperations BitVectorNoFreeOperations = { +static RecordSetOperations BitVectorNoFreeOperations = { NoopDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet }; static int @@ -277,10 +277,10 @@ IntervalListIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter, return (RecordSetIteratePtr)NULL; } -RecordSetOperations IntervalListSetOperations = { +static RecordSetOperations IntervalListSetOperations = { IntervalListDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet }; -RecordSetOperations IntervalListNoFreeOperations = { +static RecordSetOperations IntervalListNoFreeOperations = { NoopDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet }; static int From e88fa75c9b468b88bb7b87b1da235c6eb2fe8164 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 18 Mar 2007 17:39:08 -0400 Subject: [PATCH 32/63] Static cleanup on Xi/ --- Xi/chgfctl.c | 261 ++++++++++++++-------------- Xi/chgfctl.h | 42 ----- Xi/chgptr.h | 8 - Xi/closedev.c | 94 +++++----- Xi/closedev.h | 10 -- Xi/exevents.c | 58 +++---- Xi/exglobals.h | 1 - Xi/extinit.c | 382 ++++++++++++++++++++-------------------- Xi/getdctl.c | 293 ++++++++++++++++--------------- Xi/getdctl.h | 24 --- Xi/getfctl.c | 400 +++++++++++++++++++++--------------------- Xi/getfctl.h | 30 ---- Xi/listdev.c | 424 ++++++++++++++++++++++----------------------- Xi/listdev.h | 38 ---- include/exevents.h | 16 -- include/extinit.h | 119 ------------- 16 files changed, 956 insertions(+), 1244 deletions(-) diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c index d0acc593b..82616c694 100644 --- a/Xi/chgfctl.c +++ b/Xi/chgfctl.c @@ -89,137 +89,13 @@ SProcXChangeFeedbackControl(register ClientPtr client) return (ProcXChangeFeedbackControl(client)); } -/*********************************************************************** - * - * Change the control attributes. - * - */ - -int -ProcXChangeFeedbackControl(ClientPtr client) -{ - unsigned len; - DeviceIntPtr dev; - KbdFeedbackPtr k; - PtrFeedbackPtr p; - IntegerFeedbackPtr i; - StringFeedbackPtr s; - BellFeedbackPtr b; - LedFeedbackPtr l; - - REQUEST(xChangeFeedbackControlReq); - REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); - - len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, - BadDevice); - return Success; - } - - switch (stuff->feedbackid) { - case KbdFeedbackClass: - if (len != (sizeof(xKbdFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (k = dev->kbdfeed; k; k = k->next) - if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) { - ChangeKbdFeedback(client, dev, stuff->mask, k, - (xKbdFeedbackCtl *) & stuff[1]); - return Success; - } - break; - case PtrFeedbackClass: - if (len != (sizeof(xPtrFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (p = dev->ptrfeed; p; p = p->next) - if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) { - ChangePtrFeedback(client, dev, stuff->mask, p, - (xPtrFeedbackCtl *) & stuff[1]); - return Success; - } - break; - case StringFeedbackClass: - { - register char n; - xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); - - if (client->swapped) { - swaps(&f->num_keysyms, n); - } - if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (s = dev->stringfeed; s; s = s->next) - if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) { - ChangeStringFeedback(client, dev, stuff->mask, s, - (xStringFeedbackCtl *) & stuff[1]); - return Success; - } - break; - } - case IntegerFeedbackClass: - if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (i = dev->intfeed; i; i = i->next) - if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) { - ChangeIntegerFeedback(client, dev, stuff->mask, i, - (xIntegerFeedbackCtl *) & stuff[1]); - return Success; - } - break; - case LedFeedbackClass: - if (len != (sizeof(xLedFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (l = dev->leds; l; l = l->next) - if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) { - ChangeLedFeedback(client, dev, stuff->mask, l, - (xLedFeedbackCtl *) & stuff[1]); - return Success; - } - break; - case BellFeedbackClass: - if (len != (sizeof(xBellFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (b = dev->bell; b; b = b->next) - if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) { - ChangeBellFeedback(client, dev, stuff->mask, b, - (xBellFeedbackCtl *) & stuff[1]); - return Success; - } - break; - default: - break; - } - - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); - return Success; -} - /****************************************************************************** * * This procedure changes KbdFeedbackClass data. * */ -int +static int ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, KbdFeedbackPtr k, xKbdFeedbackCtl * f) { @@ -351,7 +227,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, * */ -int +static int ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, PtrFeedbackPtr p, xPtrFeedbackCtl * f) { @@ -422,7 +298,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, * */ -int +static int ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, IntegerFeedbackPtr i, xIntegerFeedbackCtl * f) @@ -445,7 +321,7 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, StringFeedbackPtr s, xStringFeedbackCtl * f) @@ -495,7 +371,7 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, BellFeedbackPtr b, xBellFeedbackCtl * f) @@ -560,7 +436,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, LedFeedbackPtr l, xLedFeedbackCtl * f) { @@ -585,3 +461,128 @@ ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, return Success; } + +/*********************************************************************** + * + * Change the control attributes. + * + */ + +int +ProcXChangeFeedbackControl(ClientPtr client) +{ + unsigned len; + DeviceIntPtr dev; + KbdFeedbackPtr k; + PtrFeedbackPtr p; + IntegerFeedbackPtr i; + StringFeedbackPtr s; + BellFeedbackPtr b; + LedFeedbackPtr l; + + REQUEST(xChangeFeedbackControlReq); + REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); + + len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); + dev = LookupDeviceIntRec(stuff->deviceid); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, + BadDevice); + return Success; + } + + switch (stuff->feedbackid) { + case KbdFeedbackClass: + if (len != (sizeof(xKbdFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (k = dev->kbdfeed; k; k = k->next) + if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) { + ChangeKbdFeedback(client, dev, stuff->mask, k, + (xKbdFeedbackCtl *) & stuff[1]); + return Success; + } + break; + case PtrFeedbackClass: + if (len != (sizeof(xPtrFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (p = dev->ptrfeed; p; p = p->next) + if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) { + ChangePtrFeedback(client, dev, stuff->mask, p, + (xPtrFeedbackCtl *) & stuff[1]); + return Success; + } + break; + case StringFeedbackClass: + { + register char n; + xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); + + if (client->swapped) { + swaps(&f->num_keysyms, n); + } + if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (s = dev->stringfeed; s; s = s->next) + if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) { + ChangeStringFeedback(client, dev, stuff->mask, s, + (xStringFeedbackCtl *) & stuff[1]); + return Success; + } + break; + } + case IntegerFeedbackClass: + if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (i = dev->intfeed; i; i = i->next) + if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) { + ChangeIntegerFeedback(client, dev, stuff->mask, i, + (xIntegerFeedbackCtl *) & stuff[1]); + return Success; + } + break; + case LedFeedbackClass: + if (len != (sizeof(xLedFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (l = dev->leds; l; l = l->next) + if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) { + ChangeLedFeedback(client, dev, stuff->mask, l, + (xLedFeedbackCtl *) & stuff[1]); + return Success; + } + break; + case BellFeedbackClass: + if (len != (sizeof(xBellFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (b = dev->bell; b; b = b->next) + if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) { + ChangeBellFeedback(client, dev, stuff->mask, b, + (xBellFeedbackCtl *) & stuff[1]); + return Success; + } + break; + default: + break; + } + + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); + return Success; +} + diff --git a/Xi/chgfctl.h b/Xi/chgfctl.h index 81e1153ec..cfa9fc6b0 100644 --- a/Xi/chgfctl.h +++ b/Xi/chgfctl.h @@ -36,46 +36,4 @@ int SProcXChangeFeedbackControl(ClientPtr /* client */ int ProcXChangeFeedbackControl(ClientPtr /* client */ ); -int ChangeKbdFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - KbdFeedbackPtr /* k */ , - xKbdFeedbackCtl * /* f */ - ); - -int ChangePtrFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - PtrFeedbackPtr /* p */ , - xPtrFeedbackCtl * /* f */ - ); - -int ChangeIntegerFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - IntegerFeedbackPtr /* i */ , - xIntegerFeedbackCtl * /* f */ - ); - -int ChangeStringFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - StringFeedbackPtr /* s */ , - xStringFeedbackCtl * /* f */ - ); - -int ChangeBellFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - BellFeedbackPtr /* b */ , - xBellFeedbackCtl * /* f */ - ); - -int ChangeLedFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - LedFeedbackPtr /* l */ , - xLedFeedbackCtl * /* f */ - ); - #endif /* CHGFCTL_H */ diff --git a/Xi/chgptr.h b/Xi/chgptr.h index fb3b5cc39..2d8ab66e5 100644 --- a/Xi/chgptr.h +++ b/Xi/chgptr.h @@ -45,12 +45,4 @@ void SendEventToAllWindows(DeviceIntPtr /* dev */ , int /* count */ ); -void FindInterestedChildren( /* FIXME: could be static? */ - DeviceIntPtr /* dev */ , - WindowPtr /* p1 */ , - Mask /* mask */ , - xEvent * /* ev */ , - int /* count */ - ); - #endif /* CHGPTR_H */ diff --git a/Xi/closedev.c b/Xi/closedev.c index cc83e6a5b..3d47b5fca 100644 --- a/Xi/closedev.c +++ b/Xi/closedev.c @@ -87,6 +87,53 @@ SProcXCloseDevice(register ClientPtr client) return (ProcXCloseDevice(client)); } +/*********************************************************************** + * + * Clear out event selections and passive grabs from a window for the + * specified device. + * + */ + +static void +DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) +{ + InputClientsPtr others; + OtherInputMasks *pOthers; + GrabPtr grab, next; + + if ((pOthers = wOtherInputMasks(pWin)) != 0) + for (others = pOthers->inputClients; others; others = others->next) + if (SameClient(others, client)) + others->mask[dev->id] = NoEventMask; + + for (grab = wPassiveGrabs(pWin); grab; grab = next) { + next = grab->next; + if ((grab->device == dev) && + (client->clientAsMask == CLIENT_BITS(grab->resource))) + FreeResource(grab->resource, RT_NONE); + } +} + +/*********************************************************************** + * + * Walk througth the window tree, deleting event selections for this client + * from this device from all windows. + * + */ + +static void +DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) +{ + WindowPtr p2; + + while (p1) { + p2 = p1->firstChild; + DeleteDeviceEvents(dev, p1, client); + DeleteEventsFromChildren(dev, p2, client); + p1 = p1->nextSib; + } +} + /*********************************************************************** * * This procedure closes an input device. @@ -126,50 +173,3 @@ ProcXCloseDevice(register ClientPtr client) CloseInputDevice(d, client); return Success; } - -/*********************************************************************** - * - * Walk througth the window tree, deleting event selections for this client - * from this device from all windows. - * - */ - -void -DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) -{ - WindowPtr p2; - - while (p1) { - p2 = p1->firstChild; - DeleteDeviceEvents(dev, p1, client); - DeleteEventsFromChildren(dev, p2, client); - p1 = p1->nextSib; - } -} - -/*********************************************************************** - * - * Clear out event selections and passive grabs from a window for the - * specified device. - * - */ - -void -DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) -{ - InputClientsPtr others; - OtherInputMasks *pOthers; - GrabPtr grab, next; - - if ((pOthers = wOtherInputMasks(pWin)) != 0) - for (others = pOthers->inputClients; others; others = others->next) - if (SameClient(others, client)) - others->mask[dev->id] = NoEventMask; - - for (grab = wPassiveGrabs(pWin); grab; grab = next) { - next = grab->next; - if ((grab->device == dev) && - (client->clientAsMask == CLIENT_BITS(grab->resource))) - FreeResource(grab->resource, RT_NONE); - } -} diff --git a/Xi/closedev.h b/Xi/closedev.h index 6853d5002..400aaa60b 100644 --- a/Xi/closedev.h +++ b/Xi/closedev.h @@ -36,14 +36,4 @@ int SProcXCloseDevice(ClientPtr /* client */ int ProcXCloseDevice(ClientPtr /* client */ ); -void DeleteEventsFromChildren(DeviceIntPtr /* dev */ , - WindowPtr /* p1 */ , - ClientPtr /* client */ - ); - -void DeleteDeviceEvents(DeviceIntPtr /* dev */ , - WindowPtr /* pWin */ , - ClientPtr /* client */ - ); - #endif /* CLOSEDEV_H */ diff --git a/Xi/exevents.c b/Xi/exevents.c index b7645f443..164fce31e 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -994,33 +994,7 @@ ChangeKeyMapping(ClientPtr client, return client->noClientException; } -void -DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) -{ - int i; - DeviceIntPtr dev; - InputClientsPtr ic; - struct _OtherInputMasks *inputMasks; - - for (dev = inputInfo.devices; dev; dev = dev->next) { - if (dev == inputInfo.pointer || dev == inputInfo.keyboard) - continue; - DeleteDeviceFromAnyExtEvents(pWin, dev); - } - - for (dev = inputInfo.off_devices; dev; dev = dev->next) - DeleteDeviceFromAnyExtEvents(pWin, dev); - - if (freeResources) - while ((inputMasks = wOtherInputMasks(pWin)) != 0) { - ic = inputMasks->inputClients; - for (i = 0; i < EMASKSIZE; i++) - inputMasks->dontPropagateMask[i] = 0; - FreeResource(ic->resource, RT_NONE); - } -} - -void +static void DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) { WindowPtr parent; @@ -1085,6 +1059,32 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) dev->valuator->motionHintWindow = NullWindow; } +void +DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) +{ + int i; + DeviceIntPtr dev; + InputClientsPtr ic; + struct _OtherInputMasks *inputMasks; + + for (dev = inputInfo.devices; dev; dev = dev->next) { + if (dev == inputInfo.pointer || dev == inputInfo.keyboard) + continue; + DeleteDeviceFromAnyExtEvents(pWin, dev); + } + + for (dev = inputInfo.off_devices; dev; dev = dev->next) + DeleteDeviceFromAnyExtEvents(pWin, dev); + + if (freeResources) + while ((inputMasks = wOtherInputMasks(pWin)) != 0) { + ic = inputMasks->inputClients; + for (i = 0; i < EMASKSIZE; i++) + inputMasks->dontPropagateMask[i] = 0; + FreeResource(ic->resource, RT_NONE); + } +} + int MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) { @@ -1138,7 +1138,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, } } -Mask +static Mask DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) { register InputClientsPtr other; @@ -1223,7 +1223,7 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents) * */ -void +static void FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, xEvent * ev, int count) { diff --git a/Xi/exglobals.h b/Xi/exglobals.h index 61ebca8c4..50bb33fdc 100644 --- a/Xi/exglobals.h +++ b/Xi/exglobals.h @@ -45,7 +45,6 @@ extern Mask DevicePointerMotionMask; extern Mask DevicePointerMotionHintMask; extern Mask DeviceFocusChangeMask; extern Mask DeviceStateNotifyMask; -extern Mask ChangeDeviceNotifyMask; extern Mask DeviceMappingNotifyMask; extern Mask DeviceOwnerGrabButtonMask; extern Mask DeviceButtonGrabMask; diff --git a/Xi/extinit.c b/Xi/extinit.c index d14e133ba..fed54ab37 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -161,7 +161,7 @@ Mask DevicePointerMotionMask; Mask DevicePointerMotionHintMask; Mask DeviceFocusChangeMask; Mask DeviceStateNotifyMask; -Mask ChangeDeviceNotifyMask; +static Mask ChangeDeviceNotifyMask; Mask DeviceMappingNotifyMask; Mask DeviceOwnerGrabButtonMask; Mask DeviceButtonGrabMask; @@ -208,51 +208,6 @@ static XExtensionVersion thisversion = { XI_Present, XI_Add_DevicePresenceNotify_Minor }; -/********************************************************************** - * - * IExtensionInit - initialize the input extension. - * - * Called from InitExtensions in main() or from QueryExtension() if the - * extension is dynamically loaded. - * - * This extension has several events and errors. - * - */ - -void -XInputExtensionInit(void) -{ - ExtensionEntry *extEntry; - - extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, - SProcIDispatch, IResetProc, StandardMinorOpcode); - if (extEntry) { - IReqCode = extEntry->base; - AllExtensionVersions[IReqCode - 128] = thisversion; - MakeDeviceTypeAtoms(); - RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); - FixExtensionEvents(extEntry); - ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; - EventSwapVector[DeviceValuator] = SEventIDispatch; - EventSwapVector[DeviceKeyPress] = SEventIDispatch; - EventSwapVector[DeviceKeyRelease] = SEventIDispatch; - EventSwapVector[DeviceButtonPress] = SEventIDispatch; - EventSwapVector[DeviceButtonRelease] = SEventIDispatch; - EventSwapVector[DeviceMotionNotify] = SEventIDispatch; - EventSwapVector[DeviceFocusIn] = SEventIDispatch; - EventSwapVector[DeviceFocusOut] = SEventIDispatch; - EventSwapVector[ProximityIn] = SEventIDispatch; - EventSwapVector[ProximityOut] = SEventIDispatch; - EventSwapVector[DeviceStateNotify] = SEventIDispatch; - EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; - EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; - EventSwapVector[DeviceMappingNotify] = SEventIDispatch; - EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; - } else { - FatalError("IExtensionInit: AddExtensions failed\n"); - } -} - /************************************************************************* * * ProcIDispatch - main dispatch routine for requests to this extension. @@ -260,7 +215,7 @@ XInputExtensionInit(void) * */ -int +static int ProcIDispatch(register ClientPtr client) { REQUEST(xReq); @@ -349,7 +304,7 @@ ProcIDispatch(register ClientPtr client) * */ -int +static int SProcIDispatch(register ClientPtr client) { REQUEST(xReq); @@ -441,7 +396,7 @@ SProcIDispatch(register ClientPtr client) if (rep->RepType == X_##code) \ SRepX##code (client, len, (x##code##Reply *) rep) -void +static void SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) /* All we look at is the type field */ { /* This is common to all replies */ @@ -500,68 +455,13 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) } } -/***************************************************************************** - * - * SEventIDispatch - * - * Swap any events defined in this extension. - */ -#define DO_SWAP(func,type) func ((type *)from, (type *)to) - -void -SEventIDispatch(xEvent * from, xEvent * to) -{ - int type = from->u.u.type & 0177; - - if (type == DeviceValuator) - DO_SWAP(SEventDeviceValuator, deviceValuator); - else if (type == DeviceKeyPress) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceKeyRelease) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceButtonPress) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceButtonRelease) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceMotionNotify) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceFocusIn) - DO_SWAP(SEventFocus, deviceFocus); - else if (type == DeviceFocusOut) - DO_SWAP(SEventFocus, deviceFocus); - else if (type == ProximityIn) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == ProximityOut) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceStateNotify) - DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); - else if (type == DeviceKeyStateNotify) - DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); - else if (type == DeviceButtonStateNotify) - DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); - else if (type == DeviceMappingNotify) - DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); - else if (type == ChangeDeviceNotify) - DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); - else { - FatalError("XInputExtension: Impossible event!\n"); - } -} - /************************************************************************ * * This function swaps the DeviceValuator event. * */ -void +static void SEventDeviceValuator(deviceValuator * from, deviceValuator * to) { register char n; @@ -577,7 +477,7 @@ SEventDeviceValuator(deviceValuator * from, deviceValuator * to) } } -void +static void SEventFocus(deviceFocus * from, deviceFocus * to) { register char n; @@ -588,7 +488,7 @@ SEventFocus(deviceFocus * from, deviceFocus * to) swapl(&to->window, n); } -void +static void SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) { register int i; @@ -604,7 +504,7 @@ SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) } } -void +static void SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from, deviceKeyStateNotify * to) { @@ -614,7 +514,7 @@ SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from, swaps(&to->sequenceNumber, n); } -void +static void SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, deviceButtonStateNotify * to) { @@ -624,7 +524,7 @@ SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, swaps(&to->sequenceNumber, n); } -void +static void SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) { register char n; @@ -634,7 +534,7 @@ SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) swapl(&to->time, n); } -void +static void SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) { register char n; @@ -644,7 +544,7 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) swapl(&to->time, n); } -void +static void SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to) { register char n; @@ -655,13 +555,106 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to swaps(&to->control, n); } +/************************************************************************** + * + * Allow the specified event to have its propagation suppressed. + * The default is to not allow suppression of propagation. + * + */ + +static void +AllowPropagateSuppress(Mask mask) +{ + int i; + + for (i = 0; i < MAX_DEVICES; i++) + PropagateMask[i] |= mask; +} + +/************************************************************************** + * + * Return the next available extension event mask. + * + */ + +static Mask +GetNextExtEventMask(void) +{ + int i; + Mask mask = lastExtEventMask; + + if (lastExtEventMask == 0) { + FatalError("GetNextExtEventMask: no more events are available."); + } + lastExtEventMask <<= 1; + + for (i = 0; i < MAX_DEVICES; i++) + ExtValidMasks[i] |= mask; + return mask; +} + +/************************************************************************** + * + * Record an event mask where there is no unique corresponding event type. + * We can't call SetMaskForEvent, since that would clobber the existing + * mask for that event. MotionHint and ButtonMotion are examples. + * + * Since extension event types will never be less than 64, we can use + * 0-63 in the EventInfo array as the "type" to be used to look up this + * mask. This means that the corresponding macros such as + * DevicePointerMotionHint must have access to the same constants. + * + */ + +static void +SetEventInfo(Mask mask, int constant) +{ + EventInfo[ExtEventIndex].mask = mask; + EventInfo[ExtEventIndex++].type = constant; +} + +/************************************************************************** + * + * Allow the specified event to be restricted to being selected by one + * client at a time. + * The default is to allow more than one client to select the event. + * + */ + +static void +SetExclusiveAccess(Mask mask) +{ + int i; + + for (i = 0; i < MAX_DEVICES; i++) + ExtExclusiveMasks[i] |= mask; +} + +/************************************************************************** + * + * Assign the specified mask to the specified event. + * + */ + +static void +SetMaskForExtEvent(Mask mask, int event) +{ + + EventInfo[ExtEventIndex].mask = mask; + EventInfo[ExtEventIndex++].type = event; + + if ((event < LASTEvent) || (event >= 128)) + FatalError("MaskForExtensionEvent: bogus event number"); + SetMaskForEvent(mask, event); +} + /************************************************************************ * * This function sets up extension event types and masks. * */ -void +static void FixExtensionEvents(ExtensionEntry * extEntry) { Mask mask; @@ -767,7 +760,7 @@ FixExtensionEvents(ExtensionEntry * extEntry) * */ -void +static void RestoreExtensionEvents(void) { int i; @@ -815,7 +808,7 @@ RestoreExtensionEvents(void) * */ -void +static void IResetProc(ExtensionEntry * unused) { @@ -859,7 +852,7 @@ AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name) * */ -void +static void MakeDeviceTypeAtoms(void) { int i; @@ -892,95 +885,102 @@ LookupDeviceIntRec(CARD8 id) return NULL; } -/************************************************************************** +/***************************************************************************** * - * Allow the specified event to be restricted to being selected by one - * client at a time. - * The default is to allow more than one client to select the event. + * SEventIDispatch * + * Swap any events defined in this extension. */ +#define DO_SWAP(func,type) func ((type *)from, (type *)to) -void -SetExclusiveAccess(Mask mask) +static void +SEventIDispatch(xEvent * from, xEvent * to) { - int i; + int type = from->u.u.type & 0177; - for (i = 0; i < MAX_DEVICES; i++) - ExtExclusiveMasks[i] |= mask; -} - -/************************************************************************** - * - * Allow the specified event to have its propagation suppressed. - * The default is to not allow suppression of propagation. - * - */ - -void -AllowPropagateSuppress(Mask mask) -{ - int i; - - for (i = 0; i < MAX_DEVICES; i++) - PropagateMask[i] |= mask; -} - -/************************************************************************** - * - * Return the next available extension event mask. - * - */ - -Mask -GetNextExtEventMask(void) -{ - int i; - Mask mask = lastExtEventMask; - - if (lastExtEventMask == 0) { - FatalError("GetNextExtEventMask: no more events are available."); + if (type == DeviceValuator) + DO_SWAP(SEventDeviceValuator, deviceValuator); + else if (type == DeviceKeyPress) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceKeyRelease) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceButtonPress) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceButtonRelease) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceMotionNotify) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceFocusIn) + DO_SWAP(SEventFocus, deviceFocus); + else if (type == DeviceFocusOut) + DO_SWAP(SEventFocus, deviceFocus); + else if (type == ProximityIn) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == ProximityOut) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceStateNotify) + DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); + else if (type == DeviceKeyStateNotify) + DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); + else if (type == DeviceButtonStateNotify) + DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); + else if (type == DeviceMappingNotify) + DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); + else if (type == ChangeDeviceNotify) + DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); + else { + FatalError("XInputExtension: Impossible event!\n"); } - lastExtEventMask <<= 1; - - for (i = 0; i < MAX_DEVICES; i++) - ExtValidMasks[i] |= mask; - return mask; } -/************************************************************************** +/********************************************************************** * - * Assign the specified mask to the specified event. + * IExtensionInit - initialize the input extension. + * + * Called from InitExtensions in main() or from QueryExtension() if the + * extension is dynamically loaded. + * + * This extension has several events and errors. * */ void -SetMaskForExtEvent(Mask mask, int event) +XInputExtensionInit(void) { + ExtensionEntry *extEntry; - EventInfo[ExtEventIndex].mask = mask; - EventInfo[ExtEventIndex++].type = event; - - if ((event < LASTEvent) || (event >= 128)) - FatalError("MaskForExtensionEvent: bogus event number"); - SetMaskForEvent(mask, event); -} - -/************************************************************************** - * - * Record an event mask where there is no unique corresponding event type. - * We can't call SetMaskForEvent, since that would clobber the existing - * mask for that event. MotionHint and ButtonMotion are examples. - * - * Since extension event types will never be less than 64, we can use - * 0-63 in the EventInfo array as the "type" to be used to look up this - * mask. This means that the corresponding macros such as - * DevicePointerMotionHint must have access to the same constants. - * - */ - -void -SetEventInfo(Mask mask, int constant) -{ - EventInfo[ExtEventIndex].mask = mask; - EventInfo[ExtEventIndex++].type = constant; + extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, + SProcIDispatch, IResetProc, StandardMinorOpcode); + if (extEntry) { + IReqCode = extEntry->base; + AllExtensionVersions[IReqCode - 128] = thisversion; + MakeDeviceTypeAtoms(); + RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); + FixExtensionEvents(extEntry); + ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; + EventSwapVector[DeviceValuator] = SEventIDispatch; + EventSwapVector[DeviceKeyPress] = SEventIDispatch; + EventSwapVector[DeviceKeyRelease] = SEventIDispatch; + EventSwapVector[DeviceButtonPress] = SEventIDispatch; + EventSwapVector[DeviceButtonRelease] = SEventIDispatch; + EventSwapVector[DeviceMotionNotify] = SEventIDispatch; + EventSwapVector[DeviceFocusIn] = SEventIDispatch; + EventSwapVector[DeviceFocusOut] = SEventIDispatch; + EventSwapVector[ProximityIn] = SEventIDispatch; + EventSwapVector[ProximityOut] = SEventIDispatch; + EventSwapVector[DeviceStateNotify] = SEventIDispatch; + EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; + EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; + EventSwapVector[DeviceMappingNotify] = SEventIDispatch; + EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; + } else { + FatalError("IExtensionInit: AddExtensions failed\n"); + } } diff --git a/Xi/getdctl.c b/Xi/getdctl.c index d738ef83b..c264d4f8c 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -86,6 +86,152 @@ SProcXGetDeviceControl(register ClientPtr client) return (ProcXGetDeviceControl(client)); } +/*********************************************************************** + * + * This procedure copies DeviceResolution data, swapping if necessary. + * + */ + +static void +CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, + int length) +{ + register char n; + AxisInfoPtr a; + xDeviceResolutionState *r; + int i, *iptr; + + r = (xDeviceResolutionState *) buf; + r->control = DEVICE_RESOLUTION; + r->length = length; + r->num_valuators = v->numAxes; + buf += sizeof(xDeviceResolutionState); + iptr = (int *)buf; + for (i = 0, a = v->axes; i < v->numAxes; i++, a++) + *iptr++ = a->resolution; + for (i = 0, a = v->axes; i < v->numAxes; i++, a++) + *iptr++ = a->min_resolution; + for (i = 0, a = v->axes; i < v->numAxes; i++, a++) + *iptr++ = a->max_resolution; + if (client->swapped) { + swaps(&r->control, n); + swaps(&r->length, n); + swapl(&r->num_valuators, n); + iptr = (int *)buf; + for (i = 0; i < (3 * v->numAxes); i++, iptr++) { + swapl(iptr, n); + } + } +} + +static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, + char *buf) +{ + register char n; + xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf; + + calib->control = DEVICE_ABS_CALIB; + calib->length = sizeof(calib); + calib->min_x = dts->min_x; + calib->max_x = dts->max_x; + calib->min_y = dts->min_y; + calib->max_y = dts->max_y; + calib->flip_x = dts->flip_x; + calib->flip_y = dts->flip_y; + calib->rotation = dts->rotation; + calib->button_threshold = dts->button_threshold; + + if (client->swapped) { + swaps(&calib->control, n); + swaps(&calib->length, n); + swapl(&calib->min_x, n); + swapl(&calib->max_x, n); + swapl(&calib->min_y, n); + swapl(&calib->max_y, n); + swapl(&calib->flip_x, n); + swapl(&calib->flip_y, n); + swapl(&calib->rotation, n); + swapl(&calib->button_threshold, n); + } +} + +static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, + char *buf) +{ + register char n; + xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf; + + area->control = DEVICE_ABS_AREA; + area->length = sizeof(area); + area->offset_x = dts->offset_x; + area->offset_y = dts->offset_y; + area->width = dts->width; + area->height = dts->height; + area->screen = dts->screen; + area->following = dts->following; + + if (client->swapped) { + swaps(&area->control, n); + swaps(&area->length, n); + swapl(&area->offset_x, n); + swapl(&area->offset_y, n); + swapl(&area->width, n); + swapl(&area->height, n); + swapl(&area->screen, n); + swapl(&area->following, n); + } +} + +static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) +{ + register char n; + xDeviceCoreState *c = (xDeviceCoreState *) buf; + + c->control = DEVICE_CORE; + c->length = sizeof(c); + c->status = dev->coreEvents; + c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer); + + if (client->swapped) { + swaps(&c->control, n); + swaps(&c->length, n); + swaps(&c->status, n); + } +} + +static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) +{ + register char n; + xDeviceEnableState *e = (xDeviceEnableState *) buf; + + e->control = DEVICE_ENABLE; + e->length = sizeof(e); + e->enable = dev->enabled; + + if (client->swapped) { + swaps(&e->control, n); + swaps(&e->length, n); + swaps(&e->enable, n); + } +} + +/*********************************************************************** + * + * This procedure writes the reply for the xGetDeviceControl function, + * if the client and server have a different byte ordering. + * + */ + +void +SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep) +{ + register char n; + + swaps(&rep->sequenceNumber, n); + swapl(&rep->length, n); + WriteToClient(client, size, (char *)rep); +} + /*********************************************************************** * * Get the state of the specified device control. @@ -186,150 +332,3 @@ ProcXGetDeviceControl(ClientPtr client) xfree(savbuf); return Success; } - -/*********************************************************************** - * - * This procedure copies DeviceResolution data, swapping if necessary. - * - */ - -void -CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, - int length) -{ - register char n; - AxisInfoPtr a; - xDeviceResolutionState *r; - int i, *iptr; - - r = (xDeviceResolutionState *) buf; - r->control = DEVICE_RESOLUTION; - r->length = length; - r->num_valuators = v->numAxes; - buf += sizeof(xDeviceResolutionState); - iptr = (int *)buf; - for (i = 0, a = v->axes; i < v->numAxes; i++, a++) - *iptr++ = a->resolution; - for (i = 0, a = v->axes; i < v->numAxes; i++, a++) - *iptr++ = a->min_resolution; - for (i = 0, a = v->axes; i < v->numAxes; i++, a++) - *iptr++ = a->max_resolution; - if (client->swapped) { - swaps(&r->control, n); - swaps(&r->length, n); - swapl(&r->num_valuators, n); - iptr = (int *)buf; - for (i = 0; i < (3 * v->numAxes); i++, iptr++) { - swapl(iptr, n); - } - } -} - -void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, - char *buf) -{ - register char n; - xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf; - - calib->control = DEVICE_ABS_CALIB; - calib->length = sizeof(calib); - calib->min_x = dts->min_x; - calib->max_x = dts->max_x; - calib->min_y = dts->min_y; - calib->max_y = dts->max_y; - calib->flip_x = dts->flip_x; - calib->flip_y = dts->flip_y; - calib->rotation = dts->rotation; - calib->button_threshold = dts->button_threshold; - - if (client->swapped) { - swaps(&calib->control, n); - swaps(&calib->length, n); - swapl(&calib->min_x, n); - swapl(&calib->max_x, n); - swapl(&calib->min_y, n); - swapl(&calib->max_y, n); - swapl(&calib->flip_x, n); - swapl(&calib->flip_y, n); - swapl(&calib->rotation, n); - swapl(&calib->button_threshold, n); - } -} - -void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, - char *buf) -{ - register char n; - xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf; - - area->control = DEVICE_ABS_AREA; - area->length = sizeof(area); - area->offset_x = dts->offset_x; - area->offset_y = dts->offset_y; - area->width = dts->width; - area->height = dts->height; - area->screen = dts->screen; - area->following = dts->following; - - if (client->swapped) { - swaps(&area->control, n); - swaps(&area->length, n); - swapl(&area->offset_x, n); - swapl(&area->offset_y, n); - swapl(&area->width, n); - swapl(&area->height, n); - swapl(&area->screen, n); - swapl(&area->following, n); - } -} - -void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) -{ - register char n; - xDeviceCoreState *c = (xDeviceCoreState *) buf; - - c->control = DEVICE_CORE; - c->length = sizeof(c); - c->status = dev->coreEvents; - c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer); - - if (client->swapped) { - swaps(&c->control, n); - swaps(&c->length, n); - swaps(&c->status, n); - } -} - -void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) -{ - register char n; - xDeviceEnableState *e = (xDeviceEnableState *) buf; - - e->control = DEVICE_ENABLE; - e->length = sizeof(e); - e->enable = dev->enabled; - - if (client->swapped) { - swaps(&e->control, n); - swaps(&e->length, n); - swaps(&e->enable, n); - } -} - - -/*********************************************************************** - * - * This procedure writes the reply for the xGetDeviceControl function, - * if the client and server have a different byte ordering. - * - */ - -void -SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep) -{ - register char n; - - swaps(&rep->sequenceNumber, n); - swapl(&rep->length, n); - WriteToClient(client, size, (char *)rep); -} diff --git a/Xi/getdctl.h b/Xi/getdctl.h index 36868d8be..19c189f36 100644 --- a/Xi/getdctl.h +++ b/Xi/getdctl.h @@ -36,30 +36,6 @@ int SProcXGetDeviceControl(ClientPtr /* client */ int ProcXGetDeviceControl(ClientPtr /* client */ ); -void CopySwapDeviceResolution(ClientPtr /* client */ , - ValuatorClassPtr /* v */ , - char * /* buf */ , - int /* length */ - ); - -void CopySwapDeviceAbsCalib (ClientPtr client, - AbsoluteClassPtr dts, - char *buf); - -void CopySwapDeviceAbsArea (ClientPtr client, - AbsoluteClassPtr dts, - char *buf); - -void CopySwapDeviceCore(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - char * /* buf */ - ); - -void CopySwapDeviceEnable(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - char * /* buf */ - ); - void SRepXGetDeviceControl(ClientPtr /* client */ , int /* size */ , xGetDeviceControlReply * /* rep */ diff --git a/Xi/getfctl.c b/Xi/getfctl.c index 870348fbb..28360ee54 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -84,6 +84,206 @@ SProcXGetFeedbackControl(register ClientPtr client) return (ProcXGetFeedbackControl(client)); } +/*********************************************************************** + * + * This procedure copies KbdFeedbackClass data, swapping if necessary. + * + */ + +static void +CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) +{ + int i; + register char n; + xKbdFeedbackState *k2; + + k2 = (xKbdFeedbackState *) * buf; + k2->class = KbdFeedbackClass; + k2->length = sizeof(xKbdFeedbackState); + k2->id = k->ctrl.id; + k2->click = k->ctrl.click; + k2->percent = k->ctrl.bell; + k2->pitch = k->ctrl.bell_pitch; + k2->duration = k->ctrl.bell_duration; + k2->led_mask = k->ctrl.leds; + k2->global_auto_repeat = k->ctrl.autoRepeat; + for (i = 0; i < 32; i++) + k2->auto_repeats[i] = k->ctrl.autoRepeats[i]; + if (client->swapped) { + swaps(&k2->length, n); + swaps(&k2->pitch, n); + swaps(&k2->duration, n); + swapl(&k2->led_mask, n); + swapl(&k2->led_values, n); + } + *buf += sizeof(xKbdFeedbackState); +} + +/*********************************************************************** + * + * This procedure copies PtrFeedbackClass data, swapping if necessary. + * + */ + +static void +CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) +{ + register char n; + xPtrFeedbackState *p2; + + p2 = (xPtrFeedbackState *) * buf; + p2->class = PtrFeedbackClass; + p2->length = sizeof(xPtrFeedbackState); + p2->id = p->ctrl.id; + p2->accelNum = p->ctrl.num; + p2->accelDenom = p->ctrl.den; + p2->threshold = p->ctrl.threshold; + if (client->swapped) { + swaps(&p2->length, n); + swaps(&p2->accelNum, n); + swaps(&p2->accelDenom, n); + swaps(&p2->threshold, n); + } + *buf += sizeof(xPtrFeedbackState); +} + +/*********************************************************************** + * + * This procedure copies IntegerFeedbackClass data, swapping if necessary. + * + */ + +static void +CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) +{ + register char n; + xIntegerFeedbackState *i2; + + i2 = (xIntegerFeedbackState *) * buf; + i2->class = IntegerFeedbackClass; + i2->length = sizeof(xIntegerFeedbackState); + i2->id = i->ctrl.id; + i2->resolution = i->ctrl.resolution; + i2->min_value = i->ctrl.min_value; + i2->max_value = i->ctrl.max_value; + if (client->swapped) { + swaps(&i2->length, n); + swapl(&i2->resolution, n); + swapl(&i2->min_value, n); + swapl(&i2->max_value, n); + } + *buf += sizeof(xIntegerFeedbackState); +} + +/*********************************************************************** + * + * This procedure copies StringFeedbackClass data, swapping if necessary. + * + */ + +static void +CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) +{ + int i; + register char n; + xStringFeedbackState *s2; + KeySym *kptr; + + s2 = (xStringFeedbackState *) * buf; + s2->class = StringFeedbackClass; + s2->length = sizeof(xStringFeedbackState) + + s->ctrl.num_symbols_supported * sizeof(KeySym); + s2->id = s->ctrl.id; + s2->max_symbols = s->ctrl.max_symbols; + s2->num_syms_supported = s->ctrl.num_symbols_supported; + *buf += sizeof(xStringFeedbackState); + kptr = (KeySym *) (*buf); + for (i = 0; i < s->ctrl.num_symbols_supported; i++) + *kptr++ = *(s->ctrl.symbols_supported + i); + if (client->swapped) { + swaps(&s2->length, n); + swaps(&s2->max_symbols, n); + swaps(&s2->num_syms_supported, n); + kptr = (KeySym *) (*buf); + for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) { + swapl(kptr, n); + } + } + *buf += (s->ctrl.num_symbols_supported * sizeof(KeySym)); +} + +/*********************************************************************** + * + * This procedure copies LedFeedbackClass data, swapping if necessary. + * + */ + +static void +CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) +{ + register char n; + xLedFeedbackState *l2; + + l2 = (xLedFeedbackState *) * buf; + l2->class = LedFeedbackClass; + l2->length = sizeof(xLedFeedbackState); + l2->id = l->ctrl.id; + l2->led_values = l->ctrl.led_values; + l2->led_mask = l->ctrl.led_mask; + if (client->swapped) { + swaps(&l2->length, n); + swapl(&l2->led_values, n); + swapl(&l2->led_mask, n); + } + *buf += sizeof(xLedFeedbackState); +} + +/*********************************************************************** + * + * This procedure copies BellFeedbackClass data, swapping if necessary. + * + */ + +static void +CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf) +{ + register char n; + xBellFeedbackState *b2; + + b2 = (xBellFeedbackState *) * buf; + b2->class = BellFeedbackClass; + b2->length = sizeof(xBellFeedbackState); + b2->id = b->ctrl.id; + b2->percent = b->ctrl.percent; + b2->pitch = b->ctrl.pitch; + b2->duration = b->ctrl.duration; + if (client->swapped) { + swaps(&b2->length, n); + swaps(&b2->pitch, n); + swaps(&b2->duration, n); + } + *buf += sizeof(xBellFeedbackState); +} + +/*********************************************************************** + * + * This procedure writes the reply for the xGetFeedbackControl function, + * if the client and server have a different byte ordering. + * + */ + +void +SRepXGetFeedbackControl(ClientPtr client, int size, + xGetFeedbackControlReply * rep) +{ + register char n; + + swaps(&rep->sequenceNumber, n); + swapl(&rep->length, n); + swaps(&rep->num_feedbacks, n); + WriteToClient(client, size, (char *)rep); +} + /*********************************************************************** * * Get the feedback control state. @@ -176,203 +376,3 @@ ProcXGetFeedbackControl(ClientPtr client) xfree(savbuf); return Success; } - -/*********************************************************************** - * - * This procedure copies KbdFeedbackClass data, swapping if necessary. - * - */ - -void -CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) -{ - int i; - register char n; - xKbdFeedbackState *k2; - - k2 = (xKbdFeedbackState *) * buf; - k2->class = KbdFeedbackClass; - k2->length = sizeof(xKbdFeedbackState); - k2->id = k->ctrl.id; - k2->click = k->ctrl.click; - k2->percent = k->ctrl.bell; - k2->pitch = k->ctrl.bell_pitch; - k2->duration = k->ctrl.bell_duration; - k2->led_mask = k->ctrl.leds; - k2->global_auto_repeat = k->ctrl.autoRepeat; - for (i = 0; i < 32; i++) - k2->auto_repeats[i] = k->ctrl.autoRepeats[i]; - if (client->swapped) { - swaps(&k2->length, n); - swaps(&k2->pitch, n); - swaps(&k2->duration, n); - swapl(&k2->led_mask, n); - swapl(&k2->led_values, n); - } - *buf += sizeof(xKbdFeedbackState); -} - -/*********************************************************************** - * - * This procedure copies PtrFeedbackClass data, swapping if necessary. - * - */ - -void -CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) -{ - register char n; - xPtrFeedbackState *p2; - - p2 = (xPtrFeedbackState *) * buf; - p2->class = PtrFeedbackClass; - p2->length = sizeof(xPtrFeedbackState); - p2->id = p->ctrl.id; - p2->accelNum = p->ctrl.num; - p2->accelDenom = p->ctrl.den; - p2->threshold = p->ctrl.threshold; - if (client->swapped) { - swaps(&p2->length, n); - swaps(&p2->accelNum, n); - swaps(&p2->accelDenom, n); - swaps(&p2->threshold, n); - } - *buf += sizeof(xPtrFeedbackState); -} - -/*********************************************************************** - * - * This procedure copies IntegerFeedbackClass data, swapping if necessary. - * - */ - -void -CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) -{ - register char n; - xIntegerFeedbackState *i2; - - i2 = (xIntegerFeedbackState *) * buf; - i2->class = IntegerFeedbackClass; - i2->length = sizeof(xIntegerFeedbackState); - i2->id = i->ctrl.id; - i2->resolution = i->ctrl.resolution; - i2->min_value = i->ctrl.min_value; - i2->max_value = i->ctrl.max_value; - if (client->swapped) { - swaps(&i2->length, n); - swapl(&i2->resolution, n); - swapl(&i2->min_value, n); - swapl(&i2->max_value, n); - } - *buf += sizeof(xIntegerFeedbackState); -} - -/*********************************************************************** - * - * This procedure copies StringFeedbackClass data, swapping if necessary. - * - */ - -void -CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) -{ - int i; - register char n; - xStringFeedbackState *s2; - KeySym *kptr; - - s2 = (xStringFeedbackState *) * buf; - s2->class = StringFeedbackClass; - s2->length = sizeof(xStringFeedbackState) + - s->ctrl.num_symbols_supported * sizeof(KeySym); - s2->id = s->ctrl.id; - s2->max_symbols = s->ctrl.max_symbols; - s2->num_syms_supported = s->ctrl.num_symbols_supported; - *buf += sizeof(xStringFeedbackState); - kptr = (KeySym *) (*buf); - for (i = 0; i < s->ctrl.num_symbols_supported; i++) - *kptr++ = *(s->ctrl.symbols_supported + i); - if (client->swapped) { - swaps(&s2->length, n); - swaps(&s2->max_symbols, n); - swaps(&s2->num_syms_supported, n); - kptr = (KeySym *) (*buf); - for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) { - swapl(kptr, n); - } - } - *buf += (s->ctrl.num_symbols_supported * sizeof(KeySym)); -} - -/*********************************************************************** - * - * This procedure copies LedFeedbackClass data, swapping if necessary. - * - */ - -void -CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) -{ - register char n; - xLedFeedbackState *l2; - - l2 = (xLedFeedbackState *) * buf; - l2->class = LedFeedbackClass; - l2->length = sizeof(xLedFeedbackState); - l2->id = l->ctrl.id; - l2->led_values = l->ctrl.led_values; - l2->led_mask = l->ctrl.led_mask; - if (client->swapped) { - swaps(&l2->length, n); - swapl(&l2->led_values, n); - swapl(&l2->led_mask, n); - } - *buf += sizeof(xLedFeedbackState); -} - -/*********************************************************************** - * - * This procedure copies BellFeedbackClass data, swapping if necessary. - * - */ - -void -CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf) -{ - register char n; - xBellFeedbackState *b2; - - b2 = (xBellFeedbackState *) * buf; - b2->class = BellFeedbackClass; - b2->length = sizeof(xBellFeedbackState); - b2->id = b->ctrl.id; - b2->percent = b->ctrl.percent; - b2->pitch = b->ctrl.pitch; - b2->duration = b->ctrl.duration; - if (client->swapped) { - swaps(&b2->length, n); - swaps(&b2->pitch, n); - swaps(&b2->duration, n); - } - *buf += sizeof(xBellFeedbackState); -} - -/*********************************************************************** - * - * This procedure writes the reply for the xGetFeedbackControl function, - * if the client and server have a different byte ordering. - * - */ - -void -SRepXGetFeedbackControl(ClientPtr client, int size, - xGetFeedbackControlReply * rep) -{ - register char n; - - swaps(&rep->sequenceNumber, n); - swapl(&rep->length, n); - swaps(&rep->num_feedbacks, n); - WriteToClient(client, size, (char *)rep); -} diff --git a/Xi/getfctl.h b/Xi/getfctl.h index 7d2d17ab1..0ad58aa2b 100644 --- a/Xi/getfctl.h +++ b/Xi/getfctl.h @@ -36,36 +36,6 @@ int SProcXGetFeedbackControl(ClientPtr /* client */ int ProcXGetFeedbackControl(ClientPtr /* client */ ); -void CopySwapKbdFeedback(ClientPtr /* client */ , - KbdFeedbackPtr /* k */ , - char ** /* buf */ - ); - -void CopySwapPtrFeedback(ClientPtr /* client */ , - PtrFeedbackPtr /* p */ , - char ** /* buf */ - ); - -void CopySwapIntegerFeedback(ClientPtr /* client */ , - IntegerFeedbackPtr /* i */ , - char ** /* buf */ - ); - -void CopySwapStringFeedback(ClientPtr /* client */ , - StringFeedbackPtr /* s */ , - char ** /* buf */ - ); - -void CopySwapLedFeedback(ClientPtr /* client */ , - LedFeedbackPtr /* l */ , - char ** /* buf */ - ); - -void CopySwapBellFeedback(ClientPtr /* client */ , - BellFeedbackPtr /* b */ , - char ** /* buf */ - ); - void SRepXGetFeedbackControl(ClientPtr /* client */ , int /* size */ , xGetFeedbackControlReply * /* rep */ diff --git a/Xi/listdev.c b/Xi/listdev.c index 02d55ad4c..257ee59bc 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -86,6 +86,218 @@ SProcXListInputDevices(register ClientPtr client) return (ProcXListInputDevices(client)); } +/*********************************************************************** + * + * This procedure calculates the size of the information to be returned + * for an input device. + * + */ + +static void +SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) +{ + int chunks; + + *namesize += 1; + if (d->name) + *namesize += strlen(d->name); + if (d->key != NULL) + *size += sizeof(xKeyInfo); + if (d->button != NULL) + *size += sizeof(xButtonInfo); + if (d->valuator != NULL) { + chunks = ((int)d->valuator->numAxes + 19) / VPC; + *size += (chunks * sizeof(xValuatorInfo) + + d->valuator->numAxes * sizeof(xAxisInfo)); + } +} + +/*********************************************************************** + * + * This procedure copies data to the DeviceInfo struct, swapping if necessary. + * + * We need the extra byte in the allocated buffer, because the trailing null + * hammers one extra byte, which is overwritten by the next name except for + * the last name copied. + * + */ + +static void +CopyDeviceName(char **namebuf, char *name) +{ + char *nameptr = (char *)*namebuf; + + if (name) { + *nameptr++ = strlen(name); + strcpy(nameptr, name); + *namebuf += (strlen(name) + 1); + } else { + *nameptr++ = 0; + *namebuf += 1; + } +} + +/*********************************************************************** + * + * This procedure copies ButtonClass information, swapping if necessary. + * + */ + +static void +CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) +{ + register char n; + xButtonInfoPtr b2; + + b2 = (xButtonInfoPtr) * buf; + b2->class = ButtonClass; + b2->length = sizeof(xButtonInfo); + b2->num_buttons = b->numButtons; + if (client->swapped) { + swaps(&b2->num_buttons, n); /* macro - braces are required */ + } + *buf += sizeof(xButtonInfo); +} + +/*********************************************************************** + * + * This procedure copies data to the DeviceInfo struct, swapping if necessary. + * + */ + +static void +CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, + char **buf) +{ + register char n; + xDeviceInfoPtr dev; + + dev = (xDeviceInfoPtr) * buf; + + dev->id = d->id; + dev->type = d->type; + dev->num_classes = num_classes; + if (d == inputInfo.keyboard) + dev->use = IsXKeyboard; + else if (d == inputInfo.pointer) + dev->use = IsXPointer; + else if (d->key && d->kbdfeed) + dev->use = IsXExtensionKeyboard; + else if (d->valuator && d->button) + dev->use = IsXExtensionPointer; + else + dev->use = IsXExtensionDevice; + if (client->swapped) { + swapl(&dev->type, n); /* macro - braces are required */ + } + *buf += sizeof(xDeviceInfo); +} + +/*********************************************************************** + * + * This procedure copies KeyClass information, swapping if necessary. + * + */ + +static void +CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) +{ + register char n; + xKeyInfoPtr k2; + + k2 = (xKeyInfoPtr) * buf; + k2->class = KeyClass; + k2->length = sizeof(xKeyInfo); + k2->min_keycode = k->curKeySyms.minKeyCode; + k2->max_keycode = k->curKeySyms.maxKeyCode; + k2->num_keys = k2->max_keycode - k2->min_keycode + 1; + if (client->swapped) { + swaps(&k2->num_keys, n); + } + *buf += sizeof(xKeyInfo); +} + +/*********************************************************************** + * + * This procedure copies ValuatorClass information, swapping if necessary. + * + * Devices may have up to 255 valuators. The length of a ValuatorClass is + * defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo). + * The maximum length is therefore (8 + 255 * 12) = 3068. However, the + * length field is one byte. If a device has more than 20 valuators, we + * must therefore return multiple valuator classes to the client. + * + */ + +static int +CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) +{ + int i, j, axes, t_axes; + register char n; + xValuatorInfoPtr v2; + AxisInfo *a; + xAxisInfoPtr a2; + + for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC); + i++, axes -= VPC) { + t_axes = axes < VPC ? axes : VPC; + if (t_axes < 0) + t_axes = v->numAxes % VPC; + v2 = (xValuatorInfoPtr) * buf; + v2->class = ValuatorClass; + v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo); + v2->num_axes = t_axes; + v2->mode = v->mode & DeviceMode; + v2->motion_buffer_size = v->numMotionEvents; + if (client->swapped) { + swapl(&v2->motion_buffer_size, n); + } + *buf += sizeof(xValuatorInfo); + a = v->axes + (VPC * i); + a2 = (xAxisInfoPtr) * buf; + for (j = 0; j < t_axes; j++) { + a2->min_value = a->min_value; + a2->max_value = a->max_value; + a2->resolution = a->resolution; + if (client->swapped) { + swapl(&a2->min_value, n); + swapl(&a2->max_value, n); + swapl(&a2->resolution, n); + } + a2++; + a++; + *buf += sizeof(xAxisInfo); + } + } + return (i); +} + +/*********************************************************************** + * + * This procedure lists information to be returned for an input device. + * + */ + +static void +ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, + char **devbuf, char **classbuf, char **namebuf) +{ + CopyDeviceName(namebuf, d->name); + CopySwapDevice(client, d, 0, devbuf); + if (d->key != NULL) { + CopySwapKeyClass(client, d->key, classbuf); + dev->num_classes++; + } + if (d->button != NULL) { + CopySwapButtonClass(client, d->button, classbuf); + dev->num_classes++; + } + if (d->valuator != NULL) { + dev->num_classes += + CopySwapValuatorClass(client, d->valuator, classbuf); + } +} + /*********************************************************************** * * This procedure lists the input devices available to the server. @@ -145,218 +357,6 @@ ProcXListInputDevices(register ClientPtr client) return Success; } -/*********************************************************************** - * - * This procedure calculates the size of the information to be returned - * for an input device. - * - */ - -void -SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) -{ - int chunks; - - *namesize += 1; - if (d->name) - *namesize += strlen(d->name); - if (d->key != NULL) - *size += sizeof(xKeyInfo); - if (d->button != NULL) - *size += sizeof(xButtonInfo); - if (d->valuator != NULL) { - chunks = ((int)d->valuator->numAxes + 19) / VPC; - *size += (chunks * sizeof(xValuatorInfo) + - d->valuator->numAxes * sizeof(xAxisInfo)); - } -} - -/*********************************************************************** - * - * This procedure lists information to be returned for an input device. - * - */ - -void -ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, - char **devbuf, char **classbuf, char **namebuf) -{ - CopyDeviceName(namebuf, d->name); - CopySwapDevice(client, d, 0, devbuf); - if (d->key != NULL) { - CopySwapKeyClass(client, d->key, classbuf); - dev->num_classes++; - } - if (d->button != NULL) { - CopySwapButtonClass(client, d->button, classbuf); - dev->num_classes++; - } - if (d->valuator != NULL) { - dev->num_classes += - CopySwapValuatorClass(client, d->valuator, classbuf); - } -} - -/*********************************************************************** - * - * This procedure copies data to the DeviceInfo struct, swapping if necessary. - * - * We need the extra byte in the allocated buffer, because the trailing null - * hammers one extra byte, which is overwritten by the next name except for - * the last name copied. - * - */ - -void -CopyDeviceName(char **namebuf, char *name) -{ - char *nameptr = (char *)*namebuf; - - if (name) { - *nameptr++ = strlen(name); - strcpy(nameptr, name); - *namebuf += (strlen(name) + 1); - } else { - *nameptr++ = 0; - *namebuf += 1; - } -} - -/*********************************************************************** - * - * This procedure copies data to the DeviceInfo struct, swapping if necessary. - * - */ - -void -CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, - char **buf) -{ - register char n; - xDeviceInfoPtr dev; - - dev = (xDeviceInfoPtr) * buf; - - dev->id = d->id; - dev->type = d->type; - dev->num_classes = num_classes; - if (d == inputInfo.keyboard) - dev->use = IsXKeyboard; - else if (d == inputInfo.pointer) - dev->use = IsXPointer; - else if (d->key && d->kbdfeed) - dev->use = IsXExtensionKeyboard; - else if (d->valuator && d->button) - dev->use = IsXExtensionPointer; - else - dev->use = IsXExtensionDevice; - if (client->swapped) { - swapl(&dev->type, n); /* macro - braces are required */ - } - *buf += sizeof(xDeviceInfo); -} - -/*********************************************************************** - * - * This procedure copies KeyClass information, swapping if necessary. - * - */ - -void -CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) -{ - register char n; - xKeyInfoPtr k2; - - k2 = (xKeyInfoPtr) * buf; - k2->class = KeyClass; - k2->length = sizeof(xKeyInfo); - k2->min_keycode = k->curKeySyms.minKeyCode; - k2->max_keycode = k->curKeySyms.maxKeyCode; - k2->num_keys = k2->max_keycode - k2->min_keycode + 1; - if (client->swapped) { - swaps(&k2->num_keys, n); - } - *buf += sizeof(xKeyInfo); -} - -/*********************************************************************** - * - * This procedure copies ButtonClass information, swapping if necessary. - * - */ - -void -CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) -{ - register char n; - xButtonInfoPtr b2; - - b2 = (xButtonInfoPtr) * buf; - b2->class = ButtonClass; - b2->length = sizeof(xButtonInfo); - b2->num_buttons = b->numButtons; - if (client->swapped) { - swaps(&b2->num_buttons, n); /* macro - braces are required */ - } - *buf += sizeof(xButtonInfo); -} - -/*********************************************************************** - * - * This procedure copies ValuatorClass information, swapping if necessary. - * - * Devices may have up to 255 valuators. The length of a ValuatorClass is - * defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo). - * The maximum length is therefore (8 + 255 * 12) = 3068. However, the - * length field is one byte. If a device has more than 20 valuators, we - * must therefore return multiple valuator classes to the client. - * - */ - -int -CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) -{ - int i, j, axes, t_axes; - register char n; - xValuatorInfoPtr v2; - AxisInfo *a; - xAxisInfoPtr a2; - - for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC); - i++, axes -= VPC) { - t_axes = axes < VPC ? axes : VPC; - if (t_axes < 0) - t_axes = v->numAxes % VPC; - v2 = (xValuatorInfoPtr) * buf; - v2->class = ValuatorClass; - v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo); - v2->num_axes = t_axes; - v2->mode = v->mode & DeviceMode; - v2->motion_buffer_size = v->numMotionEvents; - if (client->swapped) { - swapl(&v2->motion_buffer_size, n); - } - *buf += sizeof(xValuatorInfo); - a = v->axes + (VPC * i); - a2 = (xAxisInfoPtr) * buf; - for (j = 0; j < t_axes; j++) { - a2->min_value = a->min_value; - a2->max_value = a->max_value; - a2->resolution = a->resolution; - if (client->swapped) { - swapl(&a2->min_value, n); - swapl(&a2->max_value, n); - swapl(&a2->resolution, n); - } - a2++; - a++; - *buf += sizeof(xAxisInfo); - } - } - return (i); -} - /*********************************************************************** * * This procedure writes the reply for the XListInputDevices function, diff --git a/Xi/listdev.h b/Xi/listdev.h index bdd67ce70..db376decf 100644 --- a/Xi/listdev.h +++ b/Xi/listdev.h @@ -36,44 +36,6 @@ int SProcXListInputDevices(ClientPtr /* client */ int ProcXListInputDevices(ClientPtr /* client */ ); -void SizeDeviceInfo(DeviceIntPtr /* d */ , - int * /* namesize */ , - int * /* size */ - ); - -void ListDeviceInfo(ClientPtr /* client */ , - DeviceIntPtr /* d */ , - xDeviceInfoPtr /* dev */ , - char ** /* devbuf */ , - char ** /* classbuf */ , - char ** /* namebuf */ - ); - -void CopyDeviceName(char ** /* namebuf */ , - char * /* name */ - ); - -void CopySwapDevice(ClientPtr /* client */ , - DeviceIntPtr /* d */ , - int /* num_classes */ , - char ** /* buf */ - ); - -void CopySwapKeyClass(ClientPtr /* client */ , - KeyClassPtr /* k */ , - char ** /* buf */ - ); - -void CopySwapButtonClass(ClientPtr /* client */ , - ButtonClassPtr /* b */ , - char ** /* buf */ - ); - -int CopySwapValuatorClass(ClientPtr /* client */ , - ValuatorClassPtr /* v */ , - char ** /* buf */ - ); - void SRepXListInputDevices(ClientPtr /* client */ , int /* size */ , xListInputDevicesReply * /* rep */ diff --git a/include/exevents.h b/include/exevents.h index 7fbaddbb5..69d4abc4c 100644 --- a/include/exevents.h +++ b/include/exevents.h @@ -148,10 +148,6 @@ extern void DeleteWindowFromAnyExtEvents( WindowPtr /* pWin */, Bool /* freeResources */); -extern void DeleteDeviceFromAnyExtEvents( - WindowPtr /* pWin */, - DeviceIntPtr /* dev */); - extern int MaybeSendDeviceMotionNotifyHint ( deviceKeyButtonPointer * /* pEvents */, Mask /* mask */); @@ -164,11 +160,6 @@ extern void CheckDeviceGrabAndHintWindow ( ClientPtr /* client */, Mask /* deliveryMask */); -extern Mask DeviceEventMaskForClient( - DeviceIntPtr /* dev */, - WindowPtr /* pWin */, - ClientPtr /* client */); - extern void MaybeStopDeviceHint( DeviceIntPtr /* dev */, ClientPtr /* client */); @@ -179,13 +170,6 @@ extern int DeviceEventSuppressForWindow( Mask /* mask */, int /* maskndx */); -void FindInterestedChildren( - DeviceIntPtr /* dev */, - WindowPtr /* p1 */, - Mask /* mask */, - xEvent * /* ev */, - int /* count */); - void SendEventToAllWindows( DeviceIntPtr /* dev */, Mask /* mask */, diff --git a/include/extinit.h b/include/extinit.h index 2087d74d6..e616b6d93 100644 --- a/include/extinit.h +++ b/include/extinit.h @@ -37,93 +37,6 @@ XInputExtensionInit( void ); - -int -ProcIDispatch ( - ClientPtr /* client */ - ); - -int -SProcIDispatch( - ClientPtr /* client */ - ); - -void -SReplyIDispatch ( - ClientPtr /* client */, - int /* len */, - xGrabDeviceReply * /* rep */ - ); - -void -SEventIDispatch ( - xEvent * /* from */, - xEvent * /* to */ - ); - -void -SEventDeviceValuator ( - deviceValuator * /* from */, - deviceValuator * /* to */ - ); - -void -SEventFocus ( - deviceFocus * /* from */, - deviceFocus * /* to */ - ); - -void -SDeviceStateNotifyEvent ( - deviceStateNotify * /* from */, - deviceStateNotify * /* to */ - ); - -void -SDeviceKeyStateNotifyEvent ( - deviceKeyStateNotify * /* from */, - deviceKeyStateNotify * /* to */ - ); - -void -SDeviceButtonStateNotifyEvent ( - deviceButtonStateNotify * /* from */, - deviceButtonStateNotify * /* to */ - ); - -void -SChangeDeviceNotifyEvent ( - changeDeviceNotify * /* from */, - changeDeviceNotify * /* to */ - ); - -void -SDeviceMappingNotifyEvent ( - deviceMappingNotify * /* from */, - deviceMappingNotify * /* to */ - ); - -void -SDevicePresenceNotifyEvent ( - devicePresenceNotify * /* from */, - devicePresenceNotify * /* to */ - ); - -void -FixExtensionEvents ( - ExtensionEntry * /* extEntry */ - ); - -void -RestoreExtensionEvents ( - void - ); - -void -IResetProc( - ExtensionEntry * /* unused */ - ); - void AssignTypeAndName ( DeviceIntPtr /* dev */, @@ -131,41 +44,9 @@ AssignTypeAndName ( char * /* name */ ); -void -MakeDeviceTypeAtoms ( - void -); - DeviceIntPtr LookupDeviceIntRec ( CARD8 /* id */ ); -void -SetExclusiveAccess ( - Mask /* mask */ - ); - -void -AllowPropagateSuppress ( - Mask /* mask */ - ); - -Mask -GetNextExtEventMask ( - void -); - -void -SetMaskForExtEvent( - Mask /* mask */, - int /* event */ - ); - -void -SetEventInfo( - Mask /* mask */, - int /* constant */ - ); - #endif /* EXTINIT_H */ From 2e3cc861f90415f200826bc71dab6298d759c42b Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Mar 2007 22:01:34 -0400 Subject: [PATCH 33/63] Since ddc, i2c, and ramdac are in core now, remove their ModuleData stubs. --- hw/xfree86/ddc/xf86DDC.c | 46 ------------------------------- hw/xfree86/i2c/xf86i2cmodule.c | 36 ------------------------ hw/xfree86/ramdac/xf86RamDacMod.c | 46 ------------------------------- 3 files changed, 128 deletions(-) delete mode 100644 hw/xfree86/i2c/xf86i2cmodule.c delete mode 100644 hw/xfree86/ramdac/xf86RamDacMod.c diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 8080c8d2a..21984bc04 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -15,52 +15,6 @@ static const OptionInfoRec *DDCAvailableOptions(void *unused); -#if DDC_MODULE - -static MODULESETUPPROTO(ddcSetup); - -static XF86ModuleVersionInfo ddcVersRec = -{ - "ddc", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -_X_EXPORT XF86ModuleData ddcModuleData = { &ddcVersRec, ddcSetup, NULL }; - -ModuleInfoRec DDC = { - 1, - "DDC", - NULL, - 0, - DDCAvailableOptions, -}; - -static pointer -ddcSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - - if (!setupDone) { - setupDone = TRUE; - xf86AddModuleInfo(&DDC, module); - } - /* - * The return value must be non-NULL on success even though there - * is no TearDownProc. - */ - return (pointer)1; -} - -#endif - #define RETRIES 4 static unsigned char *EDIDRead_DDC1( diff --git a/hw/xfree86/i2c/xf86i2cmodule.c b/hw/xfree86/i2c/xf86i2cmodule.c deleted file mode 100644 index 3c6d313c7..000000000 --- a/hw/xfree86/i2c/xf86i2cmodule.c +++ /dev/null @@ -1,36 +0,0 @@ -/* (c) Itai Nahshon - * - * This code is derived from and inspired by the I2C driver - * from the Linux kernel. - * (c) 1998 Gerd Knorr - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static MODULESETUPPROTO(i2cSetup); - -static XF86ModuleVersionInfo i2cVersRec = -{ - "i2c", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 2, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -_X_EXPORT XF86ModuleData i2cModuleData = { &i2cVersRec, i2cSetup, NULL }; - -static pointer -i2cSetup(pointer module, pointer opts, int *errmaj, int *errmin) { -/* ErrorF("i2cSetup\n"); */ - return (pointer)1; -} diff --git a/hw/xfree86/ramdac/xf86RamDacMod.c b/hw/xfree86/ramdac/xf86RamDacMod.c deleted file mode 100644 index b4187a953..000000000 --- a/hw/xfree86/ramdac/xf86RamDacMod.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 1998 by Alan Hourihane, Wigan, England. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, - * - * Generic RAMDAC module. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo VersRec = { - "ramdac", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 0, 1, 0, - ABI_CLASS_VIDEODRV, - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData ramdacModuleData = { &VersRec, NULL, NULL }; From f7c5aa0dc0fa3569a2ee412c4f996960f936b6ed Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Mon, 26 Mar 2007 10:21:44 -0400 Subject: [PATCH 34/63] Remove dead NEED_DBE_BUF_BITS code. --- dbe/dbe.c | 31 -------------------------- dbe/dbestruct.h | 5 ----- dbe/midbe.c | 8 ------- dix/dispatch.c | 6 ----- dix/window.c | 4 ---- include/dix.h | 54 --------------------------------------------- include/windowstr.h | 6 ----- 7 files changed, 114 deletions(-) diff --git a/dbe/dbe.c b/dbe/dbe.c index 862393b53..d63620d4f 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -79,36 +79,6 @@ static int dbeErrorBase; */ static Bool firstRegistrationPass = TRUE; - -/****************************************************************************** - * - * DBE DIX Procedure: DbeValidateBuffer - * - * Description: - * - * This function is called from VALIDATE_DRAWABLE_AND_GC and from - * various places in dispatch.c if the server has been compiled with - * the flags -DNEED_DBE_BUF_BITS and -DNEED_DBE_BUF_VALIDATE. - * When pWin->dstBuffer changes, this function will be called with pWin - * as the first argument, the drawable ID that was specified as the - * second argument (could be a back buffer id), and True for the third - * argument. - * When pWin->srcBuffer changes, the third argument will be False, and - * the first two arguments are as described for dstBuffer. - * - * This function should prepare the hardware to access the specified - * buffer for reads (if dstbuf is False) or writes (if dstbuf is True). - * - *****************************************************************************/ - -void -DbeValidateBuffer(WindowPtr pWin, XID drawID, Bool dstbuf) -{ - DbeScreenPrivPtr pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin); - if (pDbeScreenPriv->ValidateBuffer) - (*pDbeScreenPriv->ValidateBuffer)(pWin, drawID, dstbuf); -} - /****************************************************************************** * @@ -317,7 +287,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens) pDbeScreenPriv->EndIdiom = NULL; pDbeScreenPriv->WinPrivDelete = NULL; pDbeScreenPriv->ResetProc = NULL; - pDbeScreenPriv->ValidateBuffer = NULL; (*nStubbedScreens)++; diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h index 460cc7564..835074c75 100644 --- a/dbe/dbestruct.h +++ b/dbe/dbestruct.h @@ -221,11 +221,6 @@ typedef struct _DbeScreenPrivRec void (*ResetProc)( ScreenPtr /*pScreen*/ ); - void (*ValidateBuffer)( - WindowPtr /*pWin*/, - XID /*bufId*/, - Bool /*dstbuffer*/ -); /* Device-specific private information. */ diff --git a/dbe/midbe.c b/dbe/midbe.c index 76f0577cc..014e365ce 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -759,11 +759,6 @@ miDbeResetProc(ScreenPtr pScreen) } /* miDbeResetProc() */ -static void -miDbeNopValidateBuffer(WindowPtr pWin, XID bufId, Bool dstbuffer) -{ -} - /****************************************************************************** * @@ -821,9 +816,6 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) pDbeScreenPriv->ResetProc = miDbeResetProc; pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete; - /* The mi implementation doesn't need buffer validation. */ - pDbeScreenPriv->ValidateBuffer = miDbeNopValidateBuffer; - return(TRUE); } /* miDbeInit() */ diff --git a/dix/dispatch.c b/dix/dispatch.c index 3d8e71fdc..490b29c34 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1803,8 +1803,6 @@ ProcCopyArea(ClientPtr client) else pSrc = pDst; - SET_DBE_SRCBUF(pSrc, stuff->srcDrawable); - pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY); @@ -1847,8 +1845,6 @@ ProcCopyPlane(ClientPtr client) else psrcDraw = pdstDraw; - SET_DBE_SRCBUF(psrcDraw, stuff->srcDrawable); - /* Check to see if stuff->bitPlane has exactly ONE good bit set */ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) || (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) @@ -2208,8 +2204,6 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, xgi.visual = None; } - SET_DBE_SRCBUF(pDraw, drawable); - xgi.type = X_Reply; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; diff --git a/dix/window.c b/dix/window.c index 7d99477ce..96002eb1f 100644 --- a/dix/window.c +++ b/dix/window.c @@ -297,10 +297,6 @@ SetWindowToDefaults(WindowPtr pWin) pWin->deliverableEvents = 0; pWin->dontPropagate = 0; pWin->forcedBS = FALSE; -#ifdef NEED_DBE_BUF_BITS - pWin->srcBuffer = DBE_FRONT_BUFFER; - pWin->dstBuffer = DBE_FRONT_BUFFER; -#endif #ifdef COMPOSITE pWin->redirectDraw = 0; #endif diff --git a/include/dix.h b/include/dix.h index b41268398..2d452d1c7 100644 --- a/include/dix.h +++ b/include/dix.h @@ -81,59 +81,6 @@ SOFTWARE. return(BadIDChoice);\ } -/* - * We think that most hardware implementations of DBE will want - * LookupID*(dbe_back_buffer_id) to return the window structure that the - * id is a back buffer for. Since both front and back buffers will - * return the same structure, you need to be able to distinguish - * somewhere what kind of buffer (front/back) was being asked for, so - * that ddx can render to the right place. That's the problem that the - * following code solves. Note: we couldn't embed this in the LookupID* - * functions because the VALIDATE_DRAWABLE_AND_GC macro often circumvents - * those functions by checking a one-element cache. That's why we're - * mucking with VALIDATE_DRAWABLE_AND_GC. - * - * If you put -DNEED_DBE_BUF_BITS into PervasiveDBEDefines, the window - * structure will have two additional bits defined, srcBuffer and - * dstBuffer, and their values will be maintained via the macros - * SET_DBE_DSTBUF and SET_DBE_SRCBUF (below). If you also - * put -DNEED_DBE_BUF_VALIDATE into PervasiveDBEDefines, the function - * DbeValidateBuffer will be called any time the bits change to give you - * a chance to do some setup. See the DBE code for more details on this - * function. We put in these levels of conditionality so that you can do - * just what you need to do, and no more. If neither of these defines - * are used, the bits won't be there, and VALIDATE_DRAWABLE_AND_GC will - * be unchanged. dpw - */ - -#if defined(NEED_DBE_BUF_BITS) -#define SET_DBE_DSTBUF(_pDraw, _drawID) \ - SET_DBE_BUF(_pDraw, _drawID, dstBuffer, TRUE) -#define SET_DBE_SRCBUF(_pDraw, _drawID) \ - SET_DBE_BUF(_pDraw, _drawID, srcBuffer, FALSE) -#if defined (NEED_DBE_BUF_VALIDATE) -#define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ - if (_pDraw->type == DRAWABLE_WINDOW)\ - {\ - int thisbuf = (_pDraw->id == _drawID);\ - if (thisbuf != ((WindowPtr)_pDraw)->_whichBuffer)\ - {\ - ((WindowPtr)_pDraw)->_whichBuffer = thisbuf;\ - DbeValidateBuffer((WindowPtr)_pDraw, _drawID, _dstbuf);\ - }\ - } -#else /* want buffer bits, but don't need to call DbeValidateBuffer */ -#define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ - if (_pDraw->type == DRAWABLE_WINDOW)\ - {\ - ((WindowPtr)_pDraw)->_whichBuffer = (_pDraw->id == _drawID);\ - } -#endif /* NEED_DBE_BUF_VALIDATE */ -#else /* don't want buffer bits in window */ -#define SET_DBE_DSTBUF(_pDraw, _drawID) /**/ -#define SET_DBE_SRCBUF(_pDraw, _drawID) /**/ -#endif /* NEED_DBE_BUF_BITS */ - #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\ if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\ (client->lastDrawableID != drawID))\ @@ -158,7 +105,6 @@ SOFTWARE. pGC = client->lastGC;\ pDraw = client->lastDrawable;\ }\ - SET_DBE_DSTBUF(pDraw, drawID);\ if (pGC->serialNumber != pDraw->serialNumber)\ ValidateGC(pDraw, pGC); diff --git a/include/windowstr.h b/include/windowstr.h index a37dc6b75..9fd6d768c 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -129,12 +129,6 @@ typedef struct _Window { unsigned viewable:1; /* realized && InputOutput */ unsigned dontPropagate:3;/* index into DontPropagateMasks */ unsigned forcedBS:1; /* system-supplied backingStore */ -#ifdef NEED_DBE_BUF_BITS -#define DBE_FRONT_BUFFER 1 -#define DBE_BACK_BUFFER 0 - unsigned dstBuffer:1; /* destination buffer for rendering */ - unsigned srcBuffer:1; /* source buffer for rendering */ -#endif #ifdef COMPOSITE unsigned redirectDraw:1; /* rendering is redirected from here */ #endif From 92ba435bd9aa7b6eca9aef8e5193576ef62fc9db Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Mar 2007 12:44:58 -0700 Subject: [PATCH 35/63] Update xorg.conf manpage for new RandR 1.2 monitor options. --- hw/xfree86/doc/man/xorg.conf.man.pre | 79 +++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index bbba21112..cc60d0754 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -1004,12 +1004,22 @@ The .B Identifier entry specifies the unique name for this monitor. The .B Monitor -section provides information about the specifications of the monitor, -monitor-specific +section may be used to provide information about the specifications of the +monitor, monitor-specific .BR Options , -and information about the video modes to use with the monitor. Specifying -video modes is optional because the server now has a built-in list of -VESA standard modes. When modes are specified explicitly in the +and information about the video modes to use with the monitor. +.PP +With RandR 1.2-enabled drivers, monitor sections are tied to specific outputs +of the video card. Each output has a name, and the server will look for a +Monitor named +.B \*qMonitor-outputname\*q +for configuration of that output (for example, +.B \*qMonitor-VGA\*q +for a VGA output) +.PP +Specifying video modes is optional because the server will use the DDC or other +information provided by the monitor to automatically configure the list of +modes available. When modes are specified explicitly in the .B Monitor section (with the .BR Modes , @@ -1017,7 +1027,8 @@ section (with the or .B UseModes keywords), built-in modes with the same names are not included. Built-in -modes with different names are, however, still implicitly included. +modes with different names are, however, still implicitly included, when they +meet the requirements of the monitor. .PP The entries that may be used in .B Monitor @@ -1214,6 +1225,62 @@ monitors do not require it. The default is off. This optional entry specifies the vertical refresh rate that the server should aim for when selecting video modes. Without this option, the default is to prefer modes with higher refresh rates. +.TP 7 +.BI "Option " "\*qPreferredMode\*q " \*qstring\*q +This optional entry specifies a mode to be marked as the preferred initial mode +of the monitor. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qPosition\*q " "\*qx y\*q" +This optional entry specifies the position of the monitor within the X +screen. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qLeftOf\*q " \*qmonitor\*q +This optional entry specifies that the monitor should be positioned to the +left of the monitor of the given name. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qRightOf\*q " \*qmonitor\*q +This optional entry specifies that the monitor should be positioned to the +right of the monitor of the given name. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qAbove\*q " \*qmonitor\*q +This optional entry specifies that the monitor should be positioned above the +monitor of the given name. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qBelow\*q " \*qmonitor\*q +This optional entry specifies that the monitor should be positioned below the +monitor of the given name. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qEnable\*q " \*qbool\*q +This optional entry specifies whether the monitor should be turned on +at startup. By default, the server will attempt to enable all connected +monitors. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qMinClock\*q " \*qfrequency\*q +This optional entry specifies the minimum dot clock, in kHz, that is supported +by the monitor. +.TP 7 +.BI "Option " "\*qMaxClock\*q " \*qfrequency\*q +This optional entry specifies the maximum dot clock, in kHz, that is supported +by the monitor. +.TP 7 +.BI "Option " "\*qIgnore\*q " \*qbool\*q +This optional entry specifies that the monitor should be ignored entirely, +and not reported through RandR. This is useful if the hardware reports the +presence of outputs that don't exist. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qRotate\*q " \*qrotation\*q +This optional entry specifies the initial rotation of the given monitor. +Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and +\*qinverted\*q. +(RandR 1.2-supporting drivers only) .SH MODES SECTION The config file may have multiple From d387a3ddf76716791e5e8b8f0954ca0df3c579d6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 27 Mar 2007 11:00:13 +1000 Subject: [PATCH 36/63] fix loading of GLcore after recent loading changes --- hw/xfree86/dixmods/glxmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/dixmods/glxmodule.c b/hw/xfree86/dixmods/glxmodule.c index 401707abc..5384f434b 100644 --- a/hw/xfree86/dixmods/glxmodule.c +++ b/hw/xfree86/dixmods/glxmodule.c @@ -95,8 +95,8 @@ __glXMesaProxyScreenProbe(ScreenPtr pScreen) static __GLXprovider *provider; if (provider == NULL) { - GLcore = LoadSubModuleLocal(glxModule, "GLcore", NULL, NULL, NULL, NULL, - NULL, NULL); + GLcore = LoadSubModule(glxModule, "GLcore", NULL, NULL, NULL, NULL, + NULL, NULL); if (GLcore == NULL) return NULL; From a63ee90bc2d490f6c5c1802c164391963cf6c1d9 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 27 Mar 2007 11:05:52 +1000 Subject: [PATCH 37/63] gl: update for latest mesa glsl-compiler merge --- GL/mesa/main/Makefile.am | 1 + GL/mesa/shader/Makefile.am | 13 +++++++++---- GL/mesa/shader/slang/Makefile.am | 23 ++++++++++++----------- GL/mesa/swrast/Makefile.am | 2 -- GL/mesa/tnl/Makefile.am | 1 - 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/GL/mesa/main/Makefile.am b/GL/mesa/main/Makefile.am index 20b79351e..2b838e903 100644 --- a/GL/mesa/main/Makefile.am +++ b/GL/mesa/main/Makefile.am @@ -68,6 +68,7 @@ nodist_libmain_la_SOURCES = accum.c \ rastpos.c \ rbadaptors.c \ renderbuffer.c \ + shaders.c \ state.c \ stencil.c \ texcompress.c \ diff --git a/GL/mesa/shader/Makefile.am b/GL/mesa/shader/Makefile.am index 3519545ed..abde27513 100644 --- a/GL/mesa/shader/Makefile.am +++ b/GL/mesa/shader/Makefile.am @@ -27,8 +27,13 @@ nodist_libshader_la_SOURCES = \ atifragshader.c \ nvfragparse.c \ nvprogram.c \ - nvvertexec.c \ - nvvertparse.c \ + nvvertparse.c \ + prog_debug.c \ + prog_execute.c \ + prog_instruction.c \ + prog_parameter.c \ + prog_print.c \ program.c \ - shaderobjects.c \ - shaderobjects_3dlabs.c + programopt.c \ + prog_statevars.c \ + shader_api.c diff --git a/GL/mesa/shader/slang/Makefile.am b/GL/mesa/shader/slang/Makefile.am index 04001c4ba..479de6308 100644 --- a/GL/mesa/shader/slang/Makefile.am +++ b/GL/mesa/shader/slang/Makefile.am @@ -18,23 +18,24 @@ INCLUDES = -I@MESA_SOURCE@/include \ -I../.. \ -I$(top_srcdir)/hw/xfree86/os-support -nodist_libslang_la_SOURCES = slang_analyse.c \ - slang_assemble_assignment.c \ - slang_assemble.c \ - slang_assemble_conditional.c \ - slang_assemble_constructor.c \ - slang_assemble_typeinfo.c \ +nodist_libslang_la_SOURCES = s + slang_builtin.c \ + slang_codegen.c \ slang_compile.c \ slang_compile_function.c \ slang_compile_operation.c \ slang_compile_struct.c \ slang_compile_variable.c \ - slang_execute.c \ - slang_execute_x86.c \ - slang_export.c \ - slang_library_texsample.c \ + slang_emit.c \ + slang_ir.c \ + slang_label.c \ slang_library_noise.c \ slang_link.c \ + slang_log.c \ slang_preprocess.c \ + slang_print.c \ + slang_simplify.c \ slang_storage.c \ - slang_utility.c + slang_typeinfo.c \ + slang_utility.c \ + slang_variable.c diff --git a/GL/mesa/swrast/Makefile.am b/GL/mesa/swrast/Makefile.am index 5ed657631..9a6aa92fb 100644 --- a/GL/mesa/swrast/Makefile.am +++ b/GL/mesa/swrast/Makefile.am @@ -23,7 +23,6 @@ nodist_libswrast_la_SOURCES = s_aaline.c \ s_aatriangle.c \ s_accum.c \ s_alpha.c \ - s_arbshader.c \ s_atifragshader.c \ s_bitmap.c \ s_blend.c \ @@ -39,7 +38,6 @@ nodist_libswrast_la_SOURCES = s_aaline.c \ s_lines.c \ s_logic.c \ s_masking.c \ - s_nvfragprog.c \ s_points.c \ s_readpix.c \ s_span.c \ diff --git a/GL/mesa/tnl/Makefile.am b/GL/mesa/tnl/Makefile.am index 5d9bdb1e6..84301d3d8 100644 --- a/GL/mesa/tnl/Makefile.am +++ b/GL/mesa/tnl/Makefile.am @@ -23,7 +23,6 @@ nodist_libtnl_la_SOURCES = t_context.c \ t_pipeline.c \ t_vb_arbprogram.c \ t_vb_arbprogram_sse.c \ - t_vb_arbshader.c \ t_vb_cull.c \ t_vb_fog.c \ t_vb_light.c \ From b8f846a9dfc6697d59ad5482ba7c9d738875318e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 27 Mar 2007 14:17:40 +1000 Subject: [PATCH 38/63] gl: oops dodgy s appeared pointed out by jcristau on irc.. --- GL/mesa/shader/slang/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GL/mesa/shader/slang/Makefile.am b/GL/mesa/shader/slang/Makefile.am index 479de6308..4bd48e964 100644 --- a/GL/mesa/shader/slang/Makefile.am +++ b/GL/mesa/shader/slang/Makefile.am @@ -18,8 +18,7 @@ INCLUDES = -I@MESA_SOURCE@/include \ -I../.. \ -I$(top_srcdir)/hw/xfree86/os-support -nodist_libslang_la_SOURCES = s - slang_builtin.c \ +nodist_libslang_la_SOURCES = slang_builtin.c \ slang_codegen.c \ slang_compile.c \ slang_compile_function.c \ From 6a0bed16e80a91891cee6c7033c90875bc2af193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 27 Mar 2007 16:51:12 +0200 Subject: [PATCH 39/63] Fix typo in GL/mesa/shader/slang/Makefile.am. --- GL/mesa/shader/slang/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GL/mesa/shader/slang/Makefile.am b/GL/mesa/shader/slang/Makefile.am index 4bd48e964..7f0cd649e 100644 --- a/GL/mesa/shader/slang/Makefile.am +++ b/GL/mesa/shader/slang/Makefile.am @@ -37,4 +37,4 @@ nodist_libslang_la_SOURCES = slang_builtin.c \ slang_storage.c \ slang_typeinfo.c \ slang_utility.c \ - slang_variable.c + slang_vartable.c From e76b6349516d5d1c8f7167d6f5419e0d06a546c3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Mar 2007 16:04:50 -0700 Subject: [PATCH 40/63] Fix indentation of fakexa help text. --- hw/kdrive/ephyr/ephyrinit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index a77b87e5e..45e2d3067 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -81,7 +81,7 @@ ddxUseMsg (void) ErrorF("-host-cursor Re-use exisiting X host server cursor\n"); ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n"); ErrorF("-grayscale Simulate 8bit grayscale\n"); - ErrorF("-fakexa Simulate acceleration using software rendering\n"); + ErrorF("-fakexa Simulate acceleration using software rendering\n"); ErrorF("\n"); exit(1); From 6ed08949af4f7ac09170d3d9581e4092b24a84ee Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Mar 2007 17:31:28 -0700 Subject: [PATCH 41/63] Move libcw setup to the only renderer requiring it (XAA). Additionally, protect libcw setup behind checks for Render, to avoid segfaulting if Render isn't available (xnest). The previous setup was an ABI-preserving dance, which is better nuked now. Now, anything that needs libcw must explicitly initialize it, and miDisableCompositeWrapper (previously only called by EXA and presumably binary drivers) is gone. --- configure.ac | 4 ---- exa/exa.c | 4 ---- hw/xfree86/loader/misym.c | 3 --- hw/xfree86/xaa/Makefile.am | 1 + hw/xfree86/xaa/xaaInit.c | 8 ++++++++ miext/cw/cw.c | 24 ++++++++++-------------- miext/cw/cw.h | 4 ---- miext/damage/damage.c | 10 ---------- 8 files changed, 19 insertions(+), 39 deletions(-) diff --git a/configure.ac b/configure.ac index 14c4ccbda..fde6a8955 100644 --- a/configure.ac +++ b/configure.ac @@ -853,10 +853,6 @@ AC_DEFINE(DAMAGE,1,[Support Damage extension]) DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la' DAMAGE_INC='-I$(top_srcdir)/damageext' MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la' -dnl damage (may) need the composite wrapper when composite is enabled -if test "$COMPOSITE" = yes; then - MIEXT_DAMAGE_LIB="$MIEXT_DAMAGE_LIB "'$(top_builddir)/miext/cw/libcw.la' -fi MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage' AC_DEFINE(XINPUT, 1, [Support X Input extension]) diff --git a/exa/exa.c b/exa/exa.c index e9f42df45..dd27d5e89 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -668,10 +668,6 @@ exaDriverInit (ScreenPtr pScreen, } #endif -#ifdef COMPOSITE - miDisableCompositeWrapper(pScreen); -#endif - #ifdef MITSHM /* Re-register with the MI funcs, which don't allow shared pixmaps. * Shared pixmaps are almost always a performance loss for us, but this diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c index 46d6a024d..78ae10e02 100644 --- a/hw/xfree86/loader/misym.c +++ b/hw/xfree86/loader/misym.c @@ -208,9 +208,6 @@ _X_HIDDEN void *miLookupTab[] = { #ifdef RENDER SYMFUNC(miGlyphExtents) #endif -#ifdef COMPOSITE - SYMFUNC(miDisableCompositeWrapper) -#endif #ifdef DAMAGE SYMFUNC(DamageDamageRegion) #endif diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am index 5d529b118..6ed8303a4 100644 --- a/hw/xfree86/xaa/Makefile.am +++ b/hw/xfree86/xaa/Makefile.am @@ -9,6 +9,7 @@ MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c POLYSEG = s-xaaLine.c s-xaaDashLine.c libxaa_la_LDFLAGS = -avoid-version +libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la module_LTLIBRARIES = libxaa.la libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \ diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c index 1542fc26e..79a0e4ceb 100644 --- a/hw/xfree86/xaa/xaaInit.c +++ b/hw/xfree86/xaa/xaaInit.c @@ -227,6 +227,14 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS) miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4); +#ifdef COMPOSITE + /* Initialize the composite wrapper. This needs to happen after the + * wrapping above (so it comes before us), but before all other extensions, + * so it doesn't confuse them. (particularly damage). + */ + miInitializeCompositeWrapper(pScreen); +#endif + return TRUE; } diff --git a/miext/cw/cw.c b/miext/cw/cw.c index f60f8cf28..69502711a 100644 --- a/miext/cw/cw.c +++ b/miext/cw/cw.c @@ -50,7 +50,6 @@ int cwWindowIndex; #ifdef RENDER int cwPictureIndex; #endif -static Bool cwDisabled[MAXSCREENS]; static unsigned long cwGeneration = 0; extern GCOps cwGCOps; @@ -619,9 +618,9 @@ void miInitializeCompositeWrapper(ScreenPtr pScreen) { cwScreenPtr pScreenPriv; - - if (cwDisabled[pScreen->myNum]) - return; +#ifdef RENDER + Bool has_render = GetPictureScreenIfSet(pScreen) != NULL; +#endif if (cwGeneration != serverGeneration) { @@ -631,7 +630,8 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) cwGCIndex = AllocateGCPrivateIndex(); cwWindowIndex = AllocateWindowPrivateIndex(); #ifdef RENDER - cwPictureIndex = AllocatePicturePrivateIndex(); + if (has_render) + cwPictureIndex = AllocatePicturePrivateIndex(); #endif cwGeneration = serverGeneration; } @@ -640,8 +640,10 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0)) return; #ifdef RENDER - if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0)) - return; + if (has_render) { + if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0)) + return; + } #endif pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec)); if (!pScreenPriv) @@ -661,17 +663,11 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap); #ifdef RENDER - if (GetPictureScreen (pScreen)) + if (has_render) cwInitializeRender(pScreen); #endif } -_X_EXPORT void -miDisableCompositeWrapper(ScreenPtr pScreen) -{ - cwDisabled[pScreen->myNum] = TRUE; -} - static Bool cwCloseScreen (int i, ScreenPtr pScreen) { diff --git a/miext/cw/cw.h b/miext/cw/cw.h index 09cfc7828..69abbbfed 100644 --- a/miext/cw/cw.h +++ b/miext/cw/cw.h @@ -169,7 +169,3 @@ cwFiniRender (ScreenPtr pScreen); void miInitializeCompositeWrapper(ScreenPtr pScreen); - -/* Must be called before miInitializeCompositeWrapper */ -void -miDisableCompositeWrapper(ScreenPtr pScreen); diff --git a/miext/damage/damage.c b/miext/damage/damage.c index 6f1ee2894..d93074758 100755 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -1831,16 +1831,6 @@ DamageSetup (ScreenPtr pScreen) if (!pScrPriv) return FALSE; -#ifdef COMPOSITE - /* This is a kludge to ensure wrapping order with the composite wrapper. - * If it's done from compinit.c, then DamageSetup may be called before the - * extension init phase, so that cw will be higher in the wrapping chain and - * rewrite drawables before damage gets to it, causing confusion. - */ - if (!noCompositeExtension) - miInitializeCompositeWrapper (pScreen); -#endif - pScrPriv->internalLevel = 0; pScrPriv->pScreenDamage = 0; From 8afc7e2eb3ebec48d3879bf269143259c8bc18c8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Mar 2007 15:55:38 -0700 Subject: [PATCH 42/63] Refuse to initialize Composite if Render is not present. Composite relies on the presence of Render, in particular for the automatic compositing. --- composite/compext.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composite/compext.c b/composite/compext.c index 4c25cc7da..3a9f896df 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -678,6 +678,12 @@ CompositeExtensionInit (void) ExtensionEntry *extEntry; int s; + /* Ensure that Render is initialized on all screens. */ + for (s = 0; s < screenInfo.numScreens; s++) { + if (GetPictureScreenIfSet(screenInfo.screens[s]) == NULL) + return; + } + CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow); if (!CompositeClientWindowType) return; From 5e7936371c9e1ac48e19bf1e9e3f71f037fd9b5d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Mar 2007 20:18:18 -0700 Subject: [PATCH 43/63] Disable Composite when the screen's visual is pseudocolor. Rendering fails badly in this case, and I don't care enough to fix it. --- composite/compext.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/composite/compext.c b/composite/compext.c index 3a9f896df..af05b4a65 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -678,9 +678,22 @@ CompositeExtensionInit (void) ExtensionEntry *extEntry; int s; - /* Ensure that Render is initialized on all screens. */ for (s = 0; s < screenInfo.numScreens; s++) { - if (GetPictureScreenIfSet(screenInfo.screens[s]) == NULL) + ScreenPtr pScreen = screenInfo.screens[s]; + VisualPtr vis; + + /* Composite on 8bpp pseudocolor root windows appears to fail, so + * just disable it on anything pseudocolor for safety. + */ + for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++) + ; + if ((vis->class | DynamicClass) == PseudoColor) + return; + + /* Ensure that Render is initialized, which is required for automatic + * compositing. + */ + if (GetPictureScreenIfSet(pScreen) == NULL) return; } From 0bfc3cc22db94ec6867596606fe93228e315c847 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Mar 2007 13:12:21 -0700 Subject: [PATCH 44/63] Disable composite when Xinerama is active. It will likely take a decent bit of work to make that work right. --- composite/compext.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composite/compext.c b/composite/compext.c index af05b4a65..ba37e7d1f 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -696,6 +696,11 @@ CompositeExtensionInit (void) if (GetPictureScreenIfSet(pScreen) == NULL) return; } + /* Xinerama's rewriting of window drawing before Composite gets to it + * breaks Composite. + */ + if (!noPanoramiXExtension) + return; CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow); if (!CompositeClientWindowType) From 1af2ef0b25fd8017a3271e624a5f1548f02b09f9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Mar 2007 13:13:45 -0700 Subject: [PATCH 45/63] Enable Composite by default now that it disables itself in the known bad cases. --- os/utils.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/os/utils.c b/os/utils.c index 2fc5cbb3f..e605a6c7a 100644 --- a/os/utils.c +++ b/os/utils.c @@ -136,10 +136,7 @@ _X_EXPORT Bool noTestExtensions; _X_EXPORT Bool noBigReqExtension = FALSE; #endif #ifdef COMPOSITE - /* COMPOSITE is disabled by default for now until the - * interface is stable */ - #define COMPOSITE_DEFAULT FALSE -_X_EXPORT Bool noCompositeExtension = !COMPOSITE_DEFAULT; +_X_EXPORT Bool noCompositeExtension = FALSE; #endif #ifdef DAMAGE From 85220446359a75ea2c359b418b4051c04eea739c Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 28 Mar 2007 13:03:32 +0300 Subject: [PATCH 46/63] GL: Update for Mesa changes Added s_fragprog.c to fix the build. --- GL/mesa/swrast/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/GL/mesa/swrast/Makefile.am b/GL/mesa/swrast/Makefile.am index 9a6aa92fb..bffb1e7c1 100644 --- a/GL/mesa/swrast/Makefile.am +++ b/GL/mesa/swrast/Makefile.am @@ -34,6 +34,7 @@ nodist_libswrast_la_SOURCES = s_aaline.c \ s_drawpix.c \ s_feedback.c \ s_fog.c \ + s_fragprog.c \ s_imaging.c \ s_lines.c \ s_logic.c \ From 5ba4d9eedf1b4ce4795bf910cd184872e2d9b3fc Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 28 Mar 2007 12:03:19 -0400 Subject: [PATCH 47/63] Refuse to create tiny modes from EDID detailed timing. --- hw/xfree86/ddc/edid_modes.c | 13 +++++++++++++ hw/xfree86/modes/xf86EdidModes.c | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/hw/xfree86/ddc/edid_modes.c b/hw/xfree86/ddc/edid_modes.c index cfc8ddc13..926bc8921 100644 --- a/hw/xfree86/ddc/edid_modes.c +++ b/hw/xfree86/ddc/edid_modes.c @@ -107,6 +107,19 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, { DisplayModePtr Mode; + /* + * Refuse to create modes that are insufficiently large. 64 is a random + * number, maybe the spec says something about what the minimum is. In + * particular I see this frequently with _old_ EDID, 1.0 or so, so maybe + * our parser is just being too aggresive there. + */ + if (timing->h_active < 64 || timing->v_active < 64) { + xf86DrvMsg(scrnIndex, X_INFO, + "%s: Ignoring tiny %dx%d mode\n", __func__, + timing->h_active, timing->v_active); + return NULL; + } + /* We don't do stereo */ if (timing->stereo) { xf86DrvMsg(scrnIndex, X_INFO, diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index c4cf6870b..7a8ec1935 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -197,6 +197,19 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, { DisplayModePtr Mode; + /* + * Refuse to create modes that are insufficiently large. 64 is a random + * number, maybe the spec says something about what the minimum is. In + * particular I see this frequently with _old_ EDID, 1.0 or so, so maybe + * our parser is just being too aggresive there. + */ + if (timing->h_active < 64 || timing->v_active < 64) { + xf86DrvMsg(scrnIndex, X_INFO, + "%s: Ignoring tiny %dx%d mode\n", __func__, + timing->h_active, timing->v_active); + return NULL; + } + /* We don't do stereo */ if (timing->stereo) { xf86DrvMsg(scrnIndex, X_INFO, From 8c7f56d92d8471ee059c14d322af5f7f555dd5c6 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Wed, 28 Mar 2007 14:46:30 -0400 Subject: [PATCH 48/63] Bug #10296: Fix timer rescheduling. --- os/WaitFor.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/os/WaitFor.c b/os/WaitFor.c index d39964f30..4a606ac7d 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -125,7 +125,7 @@ struct _OsTimerRec { }; static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); -static void CheckAllTimers(CARD32 now); +static void CheckAllTimers(void); static OsTimerPtr timers = NULL; /***************** @@ -204,7 +204,7 @@ WaitForSomething(int *pClientsReady) timeout = timers->expires - now; if (timeout > 0 && timeout > timers->delta + 250) { /* time has rewound. reset the timers. */ - CheckAllTimers(now); + CheckAllTimers(); } if (timers) { @@ -436,11 +436,14 @@ ANYSET(FdMask *src) /* If time has rewound, re-run every affected timer. * Timers might drop out of the list, so we have to restart every time. */ static void -CheckAllTimers(CARD32 now) +CheckAllTimers(void) { OsTimerPtr timer; + CARD32 now; start: + now = GetTimeInMillis(); + for (timer = timers; timer; timer = timer->next) { if (timer->expires - now > timer->delta + 250) { TimerForce(timer); From 82a8b99a6c46018885600011913267d8af9dfe13 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 28 Mar 2007 15:17:02 -0400 Subject: [PATCH 49/63] Move the XAA private indices to be static. Technically this is an ABI break, if you aren't smart enough to be using the getter functions. Cope. --- hw/xfree86/xaa/xaaDashLine.c | 2 +- hw/xfree86/xaa/xaaGC.c | 2 +- hw/xfree86/xaa/xaaGCmisc.c | 2 +- hw/xfree86/xaa/xaaInit.c | 11 +++-------- hw/xfree86/xaa/xaaLineMisc.c | 2 +- hw/xfree86/xaa/xaaWrapper.c | 2 +- hw/xfree86/xaa/xaalocal.h | 3 --- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hw/xfree86/xaa/xaaDashLine.c b/hw/xfree86/xaa/xaaDashLine.c index 2a94a9e6c..1a4732baa 100644 --- a/hw/xfree86/xaa/xaaDashLine.c +++ b/hw/xfree86/xaa/xaaDashLine.c @@ -35,7 +35,7 @@ XAAPolyLinesDashed( #endif ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGCIndex].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; BoxPtr pboxInit = REGION_RECTS(pGC->pCompositeClip); int nboxInit = REGION_NUM_RECTS(pGC->pCompositeClip); unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c index e22081103..f3434c9f4 100644 --- a/hw/xfree86/xaa/xaaGC.c +++ b/hw/xfree86/xaa/xaaGC.c @@ -38,7 +38,7 @@ Bool XAACreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; - XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGCIndex].ptr); + XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr); Bool ret; XAA_SCREEN_PROLOGUE(pScreen,CreateGC); diff --git a/hw/xfree86/xaa/xaaGCmisc.c b/hw/xfree86/xaa/xaaGCmisc.c index f7bd576f1..a7a3f4081 100644 --- a/hw/xfree86/xaa/xaaGCmisc.c +++ b/hw/xfree86/xaa/xaaGCmisc.c @@ -305,7 +305,7 @@ XAAValidatePolylines( DrawablePtr pDraw ) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGCIndex].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; if(pGC->lineStyle == LineSolid) changes &= ~GCDashList; if(!changes) return; diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c index 79a0e4ceb..529dbd151 100644 --- a/hw/xfree86/xaa/xaaInit.c +++ b/hw/xfree86/xaa/xaaInit.c @@ -42,14 +42,9 @@ static int XAASetDGAMode(int index, int num, DGADevicePtr devRet); static void XAAEnableDisableFBAccess (int index, Bool enable); static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask); -/* - * XXX These three should be static, but that breaks ABI compat with XF4.4 - * and Xorg 6.7.0 modules. DO NOT use them in new code, you should never - * be setting them, and you've got Get functions below. - */ -int XAAScreenIndex = -1; -int XAAGCIndex = -1; -int XAAPixmapIndex = -1; +static int XAAScreenIndex = -1; +static int XAAGCIndex = -1; +static int XAAPixmapIndex = -1; static unsigned long XAAGeneration = 0; diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c index d786737af..537b08b97 100644 --- a/hw/xfree86/xaa/xaaLineMisc.c +++ b/hw/xfree86/xaa/xaaLineMisc.c @@ -64,7 +64,7 @@ void XAAComputeDash(GCPtr pGC) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGCIndex].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE; int PatternLength = 0; unsigned char* DashPtr = (unsigned char*)pGC->dash; diff --git a/hw/xfree86/xaa/xaaWrapper.c b/hw/xfree86/xaa/xaaWrapper.c index 5b525684a..6d8107b61 100644 --- a/hw/xfree86/xaa/xaaWrapper.c +++ b/hw/xfree86/xaa/xaaWrapper.c @@ -522,7 +522,7 @@ void XAASync(ScreenPtr pScreen) { XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr) pScreen->devPrivates[XAAGetScreenIndex()].ptr; XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec; if(infoRec->NeedToSync) { diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h index 7210d8492..c365a7de3 100644 --- a/hw/xfree86/xaa/xaalocal.h +++ b/hw/xfree86/xaa/xaalocal.h @@ -1640,9 +1640,6 @@ XAAGetPixelFromRGBA ( extern GCOps XAAFallbackOps; extern GCOps *XAAGetFallbackOps(void); extern GCFuncs XAAGCFuncs; -extern int XAAScreenIndex; /* XXX DONTUSE */ -extern int XAAGCIndex; /* XXX DONTUSE */ -extern int XAAPixmapIndex; /* XXX DONTUSE */ extern int XAAGetScreenIndex(void); extern int XAAGetGCIndex(void); extern int XAAGetPixmapIndex(void); From 307d2b57bbfcc281656011533627bea6ab98189e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 29 Mar 2007 15:23:41 +0930 Subject: [PATCH 50/63] Xi: remove 'register' keywords. --- Xi/allowev.c | 6 +++--- Xi/chgdctl.c | 6 +++--- Xi/chgfctl.c | 20 ++++++++++---------- Xi/chgkbd.c | 6 +++--- Xi/chgkmap.c | 10 +++++----- Xi/chgprop.c | 10 +++++----- Xi/chgptr.c | 6 +++--- Xi/closedev.c | 6 +++--- Xi/devbell.c | 6 +++--- Xi/exevents.c | 32 ++++++++++++++++---------------- Xi/extinit.c | 24 ++++++++++++------------ Xi/getbmap.c | 8 ++++---- Xi/getdctl.c | 18 +++++++++--------- Xi/getfctl.c | 20 ++++++++++---------- Xi/getfocus.c | 6 +++--- Xi/getkmap.c | 8 ++++---- Xi/getmmap.c | 6 +++--- Xi/getprop.c | 8 ++++---- Xi/getselev.c | 8 ++++---- Xi/getvers.c | 8 ++++---- Xi/grabdev.c | 10 +++++----- Xi/grabdevb.c | 8 ++++---- Xi/grabdevk.c | 8 ++++---- Xi/gtmotion.c | 8 ++++---- Xi/listdev.c | 24 ++++++++++++------------ Xi/opendev.c | 8 ++++---- Xi/queryst.c | 10 +++++----- Xi/selectev.c | 10 +++++----- Xi/sendexev.c | 10 +++++----- Xi/setbmap.c | 8 ++++---- Xi/setdval.c | 8 ++++---- Xi/setfocus.c | 8 ++++---- Xi/setmmap.c | 6 +++--- Xi/setmode.c | 8 ++++---- Xi/stubs.c | 6 +++--- Xi/ungrdev.c | 6 +++--- Xi/ungrdevb.c | 4 ++-- Xi/ungrdevk.c | 4 ++-- 38 files changed, 188 insertions(+), 188 deletions(-) diff --git a/Xi/allowev.c b/Xi/allowev.c index ea9c5de08..85b6eaf6b 100644 --- a/Xi/allowev.c +++ b/Xi/allowev.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXAllowDeviceEvents(register ClientPtr client) +SProcXAllowDeviceEvents(ClientPtr client) { - register char n; + char n; REQUEST(xAllowDeviceEventsReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXAllowDeviceEvents(register ClientPtr client) */ int -ProcXAllowDeviceEvents(register ClientPtr client) +ProcXAllowDeviceEvents(ClientPtr client) { TimeStamp time; DeviceIntPtr thisdev; diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index badd93822..9676fb747 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeDeviceControl(register ClientPtr client) +SProcXChangeDeviceControl(ClientPtr client) { - register char n; + char n; REQUEST(xChangeDeviceControlReq); swaps(&stuff->length, n); @@ -287,7 +287,7 @@ void SRepXChangeDeviceControl(ClientPtr client, int size, xChangeDeviceControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c index 82616c694..2e0e13cad 100644 --- a/Xi/chgfctl.c +++ b/Xi/chgfctl.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeFeedbackControl(register ClientPtr client) +SProcXChangeFeedbackControl(ClientPtr client) { - register char n; + char n; REQUEST(xChangeFeedbackControlReq); swaps(&stuff->length, n); @@ -99,7 +99,7 @@ static int ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, KbdFeedbackPtr k, xKbdFeedbackCtl * f) { - register char n; + char n; KeybdCtrl kctrl; int t; int key = DO_ALL; @@ -231,7 +231,7 @@ static int ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, PtrFeedbackPtr p, xPtrFeedbackCtl * f) { - register char n; + char n; PtrCtrl pctrl; /* might get BadValue part way through */ if (client->swapped) { @@ -303,7 +303,7 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, IntegerFeedbackPtr i, xIntegerFeedbackCtl * f) { - register char n; + char n; if (client->swapped) { swaps(&f->length, n); @@ -326,8 +326,8 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, StringFeedbackPtr s, xStringFeedbackCtl * f) { - register char n; - register long *p; + char n; + long *p; int i, j; KeySym *syms, *sup_syms; @@ -376,7 +376,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, BellFeedbackPtr b, xBellFeedbackCtl * f) { - register char n; + char n; int t; BellCtrl bctrl; /* might get BadValue part way through */ @@ -440,7 +440,7 @@ static int ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, LedFeedbackPtr l, xLedFeedbackCtl * f) { - register char n; + char n; LedCtrl lctrl; /* might get BadValue part way through */ if (client->swapped) { @@ -520,7 +520,7 @@ ProcXChangeFeedbackControl(ClientPtr client) break; case StringFeedbackClass: { - register char n; + char n; xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); if (client->swapped) { diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c index 8134b4060..2cf8225b3 100644 --- a/Xi/chgkbd.c +++ b/Xi/chgkbd.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeKeyboardDevice(register ClientPtr client) +SProcXChangeKeyboardDevice(ClientPtr client) { - register char n; + char n; REQUEST(xChangeKeyboardDeviceReq); swaps(&stuff->length, n); @@ -96,7 +96,7 @@ SProcXChangeKeyboardDevice(register ClientPtr client) */ int -ProcXChangeKeyboardDevice(register ClientPtr client) +ProcXChangeKeyboardDevice(ClientPtr client) { REQUEST(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c index 047b899ed..eac520fd4 100644 --- a/Xi/chgkmap.c +++ b/Xi/chgkmap.c @@ -76,11 +76,11 @@ SOFTWARE. */ int -SProcXChangeDeviceKeyMapping(register ClientPtr client) +SProcXChangeDeviceKeyMapping(ClientPtr client) { - register char n; - register long *p; - register int i, count; + char n; + long *p; + int i, count; REQUEST(xChangeDeviceKeyMappingReq); swaps(&stuff->length, n); @@ -101,7 +101,7 @@ SProcXChangeDeviceKeyMapping(register ClientPtr client) */ int -ProcXChangeDeviceKeyMapping(register ClientPtr client) +ProcXChangeDeviceKeyMapping(ClientPtr client) { int ret; unsigned len; diff --git a/Xi/chgprop.c b/Xi/chgprop.c index bab4597b8..59a93c60b 100644 --- a/Xi/chgprop.c +++ b/Xi/chgprop.c @@ -78,11 +78,11 @@ SOFTWARE. */ int -SProcXChangeDeviceDontPropagateList(register ClientPtr client) +SProcXChangeDeviceDontPropagateList(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xChangeDeviceDontPropagateListReq); swaps(&stuff->length, n); @@ -104,7 +104,7 @@ SProcXChangeDeviceDontPropagateList(register ClientPtr client) */ int -ProcXChangeDeviceDontPropagateList(register ClientPtr client) +ProcXChangeDeviceDontPropagateList(ClientPtr client) { int i, rc; WindowPtr pWin; diff --git a/Xi/chgptr.c b/Xi/chgptr.c index 22c8a5f5e..a94906866 100644 --- a/Xi/chgptr.c +++ b/Xi/chgptr.c @@ -82,9 +82,9 @@ SOFTWARE. */ int -SProcXChangePointerDevice(register ClientPtr client) +SProcXChangePointerDevice(ClientPtr client) { - register char n; + char n; REQUEST(xChangePointerDeviceReq); swaps(&stuff->length, n); @@ -99,7 +99,7 @@ SProcXChangePointerDevice(register ClientPtr client) */ int -ProcXChangePointerDevice(register ClientPtr client) +ProcXChangePointerDevice(ClientPtr client) { REQUEST(xChangePointerDeviceReq); REQUEST_SIZE_MATCH(xChangePointerDeviceReq); diff --git a/Xi/closedev.c b/Xi/closedev.c index 3d47b5fca..8d38ec8fd 100644 --- a/Xi/closedev.c +++ b/Xi/closedev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXCloseDevice(register ClientPtr client) +SProcXCloseDevice(ClientPtr client) { - register char n; + char n; REQUEST(xCloseDeviceReq); swaps(&stuff->length, n); @@ -141,7 +141,7 @@ DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) */ int -ProcXCloseDevice(register ClientPtr client) +ProcXCloseDevice(ClientPtr client) { int i; WindowPtr pWin, p1; diff --git a/Xi/devbell.c b/Xi/devbell.c index b11238620..ba873c7c7 100644 --- a/Xi/devbell.c +++ b/Xi/devbell.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXDeviceBell(register ClientPtr client) +SProcXDeviceBell(ClientPtr client) { - register char n; + char n; REQUEST(xDeviceBellReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXDeviceBell(register ClientPtr client) */ int -ProcXDeviceBell(register ClientPtr client) +ProcXDeviceBell(ClientPtr client) { DeviceIntPtr dev; KbdFeedbackPtr k; diff --git a/Xi/exevents.c b/Xi/exevents.c index 164fce31e..9e71a9e4e 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -104,12 +104,12 @@ RegisterOtherDevice(DeviceIntPtr device) } /*ARGSUSED*/ void -ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) +ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count) { - register BYTE *kptr; - register int i; - register CARD16 modifiers; - register CARD16 mask; + BYTE *kptr; + int i; + CARD16 modifiers; + CARD16 mask; GrabPtr grab = other->grab; Bool deactivateDeviceGrab = FALSE; int key = 0, bit = 0, rootX, rootY; @@ -288,7 +288,7 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) _X_EXPORT int InitProximityClassDeviceStruct(DeviceIntPtr dev) { - register ProximityClassPtr proxc; + ProximityClassPtr proxc; proxc = (ProximityClassPtr) xalloc(sizeof(ProximityClassRec)); if (!proxc) @@ -301,7 +301,7 @@ _X_EXPORT void InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval, int resolution, int min_res, int max_res) { - register AxisInfoPtr ax; + AxisInfoPtr ax; if (!dev || !dev->valuator) return; @@ -378,7 +378,7 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, void DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, - register WindowPtr pWin) + WindowPtr pWin) { deviceFocus event; @@ -703,9 +703,9 @@ MakeInputMasks(WindowPtr pWin) void RecalculateDeviceDeliverableEvents(WindowPtr pWin) { - register InputClientsPtr others; + InputClientsPtr others; struct _OtherInputMasks *inputMasks; /* default: NULL */ - register WindowPtr pChild, tmp; + WindowPtr pChild, tmp; int i; pChild = pWin; @@ -739,9 +739,9 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin) } int -InputClientGone(register WindowPtr pWin, XID id) +InputClientGone(WindowPtr pWin, XID id) { - register InputClientsPtr other, prev; + InputClientsPtr other, prev; if (!wOtherInputMasks(pWin)) return (Success); @@ -839,7 +839,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, int SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map) { - register int i; + int i; ButtonClassPtr b = dev->button; if (b == NULL) @@ -865,7 +865,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen, { KeyCode *map = NULL; int inputMapLen; - register int i; + int i; *k = dev->key; if (*k == NULL) @@ -1141,7 +1141,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, static Mask DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) { - register InputClientsPtr other; + InputClientsPtr other; if (!wOtherInputMasks(pWin)) return 0; @@ -1154,7 +1154,7 @@ DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) } void -MaybeStopDeviceHint(register DeviceIntPtr dev, ClientPtr client) +MaybeStopDeviceHint(DeviceIntPtr dev, ClientPtr client) { WindowPtr pWin; GrabPtr grab = dev->grab; diff --git a/Xi/extinit.c b/Xi/extinit.c index fed54ab37..b1ec321c9 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -216,7 +216,7 @@ static XExtensionVersion thisversion = { XI_Present, */ static int -ProcIDispatch(register ClientPtr client) +ProcIDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data == X_GetExtensionVersion) @@ -305,7 +305,7 @@ ProcIDispatch(register ClientPtr client) */ static int -SProcIDispatch(register ClientPtr client) +SProcIDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data == X_GetExtensionVersion) @@ -464,8 +464,8 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) static void SEventDeviceValuator(deviceValuator * from, deviceValuator * to) { - register char n; - register int i; + char n; + int i; INT32 *ip B32; *to = *from; @@ -480,7 +480,7 @@ SEventDeviceValuator(deviceValuator * from, deviceValuator * to) static void SEventFocus(deviceFocus * from, deviceFocus * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); @@ -491,8 +491,8 @@ SEventFocus(deviceFocus * from, deviceFocus * to) static void SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) { - register int i; - register char n; + int i; + char n; INT32 *ip B32; *to = *from; @@ -508,7 +508,7 @@ static void SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from, deviceKeyStateNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); @@ -518,7 +518,7 @@ static void SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, deviceButtonStateNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); @@ -527,7 +527,7 @@ SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, static void SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); @@ -537,7 +537,7 @@ SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) static void SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); @@ -547,7 +547,7 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) static void SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber,n); diff --git a/Xi/getbmap.c b/Xi/getbmap.c index 32874764b..5e8cf07fb 100644 --- a/Xi/getbmap.c +++ b/Xi/getbmap.c @@ -74,9 +74,9 @@ SOFTWARE. */ int -SProcXGetDeviceButtonMapping(register ClientPtr client) +SProcXGetDeviceButtonMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceButtonMappingReq); swaps(&stuff->length, n); @@ -90,7 +90,7 @@ SProcXGetDeviceButtonMapping(register ClientPtr client) */ int -ProcXGetDeviceButtonMapping(register ClientPtr client) +ProcXGetDeviceButtonMapping(ClientPtr client) { DeviceIntPtr dev; xGetDeviceButtonMappingReply rep; @@ -136,7 +136,7 @@ void SRepXGetDeviceButtonMapping(ClientPtr client, int size, xGetDeviceButtonMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getdctl.c b/Xi/getdctl.c index c264d4f8c..88f061ee0 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceControl(register ClientPtr client) +SProcXGetDeviceControl(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceControlReq); swaps(&stuff->length, n); @@ -96,7 +96,7 @@ static void CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, int length) { - register char n; + char n; AxisInfoPtr a; xDeviceResolutionState *r; int i, *iptr; @@ -127,7 +127,7 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, char *buf) { - register char n; + char n; xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf; calib->control = DEVICE_ABS_CALIB; @@ -158,7 +158,7 @@ static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, char *buf) { - register char n; + char n; xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf; area->control = DEVICE_ABS_AREA; @@ -184,7 +184,7 @@ static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) { - register char n; + char n; xDeviceCoreState *c = (xDeviceCoreState *) buf; c->control = DEVICE_CORE; @@ -201,7 +201,7 @@ static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) { - register char n; + char n; xDeviceEnableState *e = (xDeviceEnableState *) buf; e->control = DEVICE_ENABLE; @@ -225,7 +225,7 @@ static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) void SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); @@ -243,7 +243,7 @@ ProcXGetDeviceControl(ClientPtr client) { int total_length = 0; char *buf, *savbuf; - register DeviceIntPtr dev; + DeviceIntPtr dev; xGetDeviceControlReply rep; REQUEST(xGetDeviceControlReq); diff --git a/Xi/getfctl.c b/Xi/getfctl.c index 28360ee54..5ca90dbf0 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetFeedbackControl(register ClientPtr client) +SProcXGetFeedbackControl(ClientPtr client) { - register char n; + char n; REQUEST(xGetFeedbackControlReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ static void CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) { int i; - register char n; + char n; xKbdFeedbackState *k2; k2 = (xKbdFeedbackState *) * buf; @@ -128,7 +128,7 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) static void CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) { - register char n; + char n; xPtrFeedbackState *p2; p2 = (xPtrFeedbackState *) * buf; @@ -156,7 +156,7 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) static void CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) { - register char n; + char n; xIntegerFeedbackState *i2; i2 = (xIntegerFeedbackState *) * buf; @@ -185,7 +185,7 @@ static void CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) { int i; - register char n; + char n; xStringFeedbackState *s2; KeySym *kptr; @@ -221,7 +221,7 @@ CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) static void CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) { - register char n; + char n; xLedFeedbackState *l2; l2 = (xLedFeedbackState *) * buf; @@ -247,7 +247,7 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) static void CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf) { - register char n; + char n; xBellFeedbackState *b2; b2 = (xBellFeedbackState *) * buf; @@ -276,7 +276,7 @@ void SRepXGetFeedbackControl(ClientPtr client, int size, xGetFeedbackControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); @@ -295,7 +295,7 @@ ProcXGetFeedbackControl(ClientPtr client) { int total_length = 0; char *buf, *savbuf; - register DeviceIntPtr dev; + DeviceIntPtr dev; KbdFeedbackPtr k; PtrFeedbackPtr p; IntegerFeedbackPtr i; diff --git a/Xi/getfocus.c b/Xi/getfocus.c index 1bcb67321..245b5f1b4 100644 --- a/Xi/getfocus.c +++ b/Xi/getfocus.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceFocus(register ClientPtr client) +SProcXGetDeviceFocus(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceFocusReq); swaps(&stuff->length, n); @@ -138,7 +138,7 @@ ProcXGetDeviceFocus(ClientPtr client) void SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getkmap.c b/Xi/getkmap.c index 041e2c69f..989f3d57d 100644 --- a/Xi/getkmap.c +++ b/Xi/getkmap.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXGetDeviceKeyMapping(register ClientPtr client) +SProcXGetDeviceKeyMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceKeyMappingReq); swaps(&stuff->length, n); @@ -92,7 +92,7 @@ SProcXGetDeviceKeyMapping(register ClientPtr client) */ int -ProcXGetDeviceKeyMapping(register ClientPtr client) +ProcXGetDeviceKeyMapping(ClientPtr client) { xGetDeviceKeyMappingReply rep; DeviceIntPtr dev; @@ -154,7 +154,7 @@ void SRepXGetDeviceKeyMapping(ClientPtr client, int size, xGetDeviceKeyMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getmmap.c b/Xi/getmmap.c index e664dc910..038937ef7 100644 --- a/Xi/getmmap.c +++ b/Xi/getmmap.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceModifierMapping(register ClientPtr client) +SProcXGetDeviceModifierMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceModifierMappingReq); swaps(&stuff->length, n); @@ -141,7 +141,7 @@ void SRepXGetDeviceModifierMapping(ClientPtr client, int size, xGetDeviceModifierMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getprop.c b/Xi/getprop.c index 058c59514..6fa1986f4 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -79,9 +79,9 @@ extern int ExtEventIndex; */ int -SProcXGetDeviceDontPropagateList(register ClientPtr client) +SProcXGetDeviceDontPropagateList(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceDontPropagateListReq); swaps(&stuff->length, n); @@ -97,7 +97,7 @@ SProcXGetDeviceDontPropagateList(register ClientPtr client) */ int -ProcXGetDeviceDontPropagateList(register ClientPtr client) +ProcXGetDeviceDontPropagateList(ClientPtr client) { CARD16 count = 0; int i, rc; @@ -187,7 +187,7 @@ void SRepXGetDeviceDontPropagateList(ClientPtr client, int size, xGetDeviceDontPropagateListReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getselev.c b/Xi/getselev.c index 533c66cd7..9c5f2191c 100644 --- a/Xi/getselev.c +++ b/Xi/getselev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXGetSelectedExtensionEvents(register ClientPtr client) +SProcXGetSelectedExtensionEvents(ClientPtr client) { - register char n; + char n; REQUEST(xGetSelectedExtensionEventsReq); swaps(&stuff->length, n); @@ -96,7 +96,7 @@ SProcXGetSelectedExtensionEvents(register ClientPtr client) */ int -ProcXGetSelectedExtensionEvents(register ClientPtr client) +ProcXGetSelectedExtensionEvents(ClientPtr client) { int i, rc, total_length = 0; xGetSelectedExtensionEventsReply rep; @@ -177,7 +177,7 @@ void SRepXGetSelectedExtensionEvents(ClientPtr client, int size, xGetSelectedExtensionEventsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getvers.c b/Xi/getvers.c index c5f1750be..b3f4c1c67 100644 --- a/Xi/getvers.c +++ b/Xi/getvers.c @@ -76,9 +76,9 @@ XExtensionVersion AllExtensionVersions[128]; */ int -SProcXGetExtensionVersion(register ClientPtr client) +SProcXGetExtensionVersion(ClientPtr client) { - register char n; + char n; REQUEST(xGetExtensionVersionReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXGetExtensionVersion(register ClientPtr client) */ int -ProcXGetExtensionVersion(register ClientPtr client) +ProcXGetExtensionVersion(ClientPtr client) { xGetExtensionVersionReply rep; @@ -136,7 +136,7 @@ void SRepXGetExtensionVersion(ClientPtr client, int size, xGetExtensionVersionReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/grabdev.c b/Xi/grabdev.c index 3af2346e3..e2809efb1 100644 --- a/Xi/grabdev.c +++ b/Xi/grabdev.c @@ -79,11 +79,11 @@ extern int ExtEventIndex; */ int -SProcXGrabDevice(register ClientPtr client) +SProcXGrabDevice(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceReq); swaps(&stuff->length, n); @@ -202,7 +202,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count, void SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c index 4333550f1..df62d0c69 100644 --- a/Xi/grabdevb.c +++ b/Xi/grabdevb.c @@ -77,11 +77,11 @@ SOFTWARE. */ int -SProcXGrabDeviceButton(register ClientPtr client) +SProcXGrabDeviceButton(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceButtonReq); swaps(&stuff->length, n); diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c index 71e72d56f..b74592f19 100644 --- a/Xi/grabdevk.c +++ b/Xi/grabdevk.c @@ -77,11 +77,11 @@ SOFTWARE. */ int -SProcXGrabDeviceKey(register ClientPtr client) +SProcXGrabDeviceKey(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceKeyReq); swaps(&stuff->length, n); diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index 435ab0bfd..cfc7f89f3 100644 --- a/Xi/gtmotion.c +++ b/Xi/gtmotion.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceMotionEvents(register ClientPtr client) +SProcXGetDeviceMotionEvents(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceMotionEventsReq); swaps(&stuff->length, n); @@ -162,7 +162,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client) WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); if (nEvents) { if (client->swapped) { - register char n; + char n; bufptr = coords; for (i = 0; i < nEvents * (axes + 1); i++) { @@ -188,7 +188,7 @@ void SRepXGetDeviceMotionEvents(ClientPtr client, int size, xGetDeviceMotionEventsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/listdev.c b/Xi/listdev.c index 257ee59bc..160ad02fb 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXListInputDevices(register ClientPtr client) +SProcXListInputDevices(ClientPtr client) { - register char n; + char n; REQUEST(xListInputDevicesReq); swaps(&stuff->length, n); @@ -144,9 +144,9 @@ CopyDeviceName(char **namebuf, char *name) */ static void -CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) +CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf) { - register char n; + char n; xButtonInfoPtr b2; b2 = (xButtonInfoPtr) * buf; @@ -166,10 +166,10 @@ CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) */ static void -CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, +CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf) { - register char n; + char n; xDeviceInfoPtr dev; dev = (xDeviceInfoPtr) * buf; @@ -200,9 +200,9 @@ CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, */ static void -CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) +CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf) { - register char n; + char n; xKeyInfoPtr k2; k2 = (xKeyInfoPtr) * buf; @@ -230,10 +230,10 @@ CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) */ static int -CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) +CopySwapValuatorClass(ClientPtr client, ValuatorClassPtr v, char **buf) { int i, j, axes, t_axes; - register char n; + char n; xValuatorInfoPtr v2; AxisInfo *a; xAxisInfoPtr a2; @@ -305,7 +305,7 @@ ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, */ int -ProcXListInputDevices(register ClientPtr client) +ProcXListInputDevices(ClientPtr client) { xListInputDevicesReply rep; int numdevs = 0; @@ -367,7 +367,7 @@ ProcXListInputDevices(register ClientPtr client) void SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/opendev.c b/Xi/opendev.c index 636106815..4b7b6a64f 100644 --- a/Xi/opendev.c +++ b/Xi/opendev.c @@ -79,9 +79,9 @@ extern CARD8 event_base[]; */ int -SProcXOpenDevice(register ClientPtr client) +SProcXOpenDevice(ClientPtr client) { - register char n; + char n; REQUEST(xOpenDeviceReq); swaps(&stuff->length, n); @@ -95,7 +95,7 @@ SProcXOpenDevice(register ClientPtr client) */ int -ProcXOpenDevice(register ClientPtr client) +ProcXOpenDevice(ClientPtr client) { xInputClassInfo evbase[numInputClasses]; Bool enableit = FALSE; @@ -179,7 +179,7 @@ ProcXOpenDevice(register ClientPtr client) void SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/queryst.c b/Xi/queryst.c index c4cc5a2e6..972cd2c80 100644 --- a/Xi/queryst.c +++ b/Xi/queryst.c @@ -58,9 +58,9 @@ from The Open Group. */ int -SProcXQueryDeviceState(register ClientPtr client) +SProcXQueryDeviceState(ClientPtr client) { - register char n; + char n; REQUEST(xQueryDeviceStateReq); swaps(&stuff->length, n); @@ -74,9 +74,9 @@ SProcXQueryDeviceState(register ClientPtr client) */ int -ProcXQueryDeviceState(register ClientPtr client) +ProcXQueryDeviceState(ClientPtr client) { - register char n; + char n; int i; int num_classes = 0; int total_length = 0; @@ -187,7 +187,7 @@ ProcXQueryDeviceState(register ClientPtr client) void SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/selectev.c b/Xi/selectev.c index 8c893ca1e..d52db1b81 100644 --- a/Xi/selectev.c +++ b/Xi/selectev.c @@ -128,11 +128,11 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win, */ int -SProcXSelectExtensionEvent(register ClientPtr client) +SProcXSelectExtensionEvent(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xSelectExtensionEventReq); swaps(&stuff->length, n); @@ -154,7 +154,7 @@ SProcXSelectExtensionEvent(register ClientPtr client) */ int -ProcXSelectExtensionEvent(register ClientPtr client) +ProcXSelectExtensionEvent(ClientPtr client) { int ret; int i; diff --git a/Xi/sendexev.c b/Xi/sendexev.c index c2763bb22..eac9abe14 100644 --- a/Xi/sendexev.c +++ b/Xi/sendexev.c @@ -80,11 +80,11 @@ extern int lastEvent; /* Defined in extension.c */ */ int -SProcXSendExtensionEvent(register ClientPtr client) +SProcXSendExtensionEvent(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; xEvent eventT; xEvent *eventP; EventSwapPtr proc; @@ -119,7 +119,7 @@ SProcXSendExtensionEvent(register ClientPtr client) */ int -ProcXSendExtensionEvent(register ClientPtr client) +ProcXSendExtensionEvent(ClientPtr client) { int ret; DeviceIntPtr dev; diff --git a/Xi/setbmap.c b/Xi/setbmap.c index 14b1689f5..bdfa513dd 100644 --- a/Xi/setbmap.c +++ b/Xi/setbmap.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXSetDeviceButtonMapping(register ClientPtr client) +SProcXSetDeviceButtonMapping(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceButtonMappingReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXSetDeviceButtonMapping(register ClientPtr client) */ int -ProcXSetDeviceButtonMapping(register ClientPtr client) +ProcXSetDeviceButtonMapping(ClientPtr client) { int ret; xSetDeviceButtonMappingReply rep; @@ -149,7 +149,7 @@ void SRepXSetDeviceButtonMapping(ClientPtr client, int size, xSetDeviceButtonMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setdval.c b/Xi/setdval.c index 958b2ac21..e947a749a 100644 --- a/Xi/setdval.c +++ b/Xi/setdval.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXSetDeviceValuators(register ClientPtr client) +SProcXSetDeviceValuators(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceValuatorsReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXSetDeviceValuators(register ClientPtr client) */ int -ProcXSetDeviceValuators(register ClientPtr client) +ProcXSetDeviceValuators(ClientPtr client) { DeviceIntPtr dev; xSetDeviceValuatorsReply rep; @@ -152,7 +152,7 @@ void SRepXSetDeviceValuators(ClientPtr client, int size, xSetDeviceValuatorsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setfocus.c b/Xi/setfocus.c index 59fe0768c..aaf88ce6f 100644 --- a/Xi/setfocus.c +++ b/Xi/setfocus.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXSetDeviceFocus(register ClientPtr client) +SProcXSetDeviceFocus(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceFocusReq); swaps(&stuff->length, n); @@ -97,10 +97,10 @@ SProcXSetDeviceFocus(register ClientPtr client) */ int -ProcXSetDeviceFocus(register ClientPtr client) +ProcXSetDeviceFocus(ClientPtr client) { int ret; - register DeviceIntPtr dev; + DeviceIntPtr dev; REQUEST(xSetDeviceFocusReq); REQUEST_SIZE_MATCH(xSetDeviceFocusReq); diff --git a/Xi/setmmap.c b/Xi/setmmap.c index 645f246bd..00784995a 100644 --- a/Xi/setmmap.c +++ b/Xi/setmmap.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXSetDeviceModifierMapping(register ClientPtr client) +SProcXSetDeviceModifierMapping(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceModifierMappingReq); swaps(&stuff->length, n); @@ -145,7 +145,7 @@ void SRepXSetDeviceModifierMapping(ClientPtr client, int size, xSetDeviceModifierMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setmode.c b/Xi/setmode.c index 11feb6d32..688f2a226 100644 --- a/Xi/setmode.c +++ b/Xi/setmode.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXSetDeviceMode(register ClientPtr client) +SProcXSetDeviceMode(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceModeReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXSetDeviceMode(register ClientPtr client) */ int -ProcXSetDeviceMode(register ClientPtr client) +ProcXSetDeviceMode(ClientPtr client) { DeviceIntPtr dev; xSetDeviceModeReply rep; @@ -139,7 +139,7 @@ ProcXSetDeviceMode(register ClientPtr client) void SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/stubs.c b/Xi/stubs.c index e2ed1ceff..ed041b815 100644 --- a/Xi/stubs.c +++ b/Xi/stubs.c @@ -168,7 +168,7 @@ OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) */ int -SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode) +SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) { return BadMatch; } @@ -186,7 +186,7 @@ SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode) */ int -SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev, +SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, int *valuators, int first_valuator, int num_valuators) { return BadMatch; @@ -201,7 +201,7 @@ SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev, */ int -ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev, +ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) { switch (control->control) { diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c index 980fa9339..0abbd2e80 100644 --- a/Xi/ungrdev.c +++ b/Xi/ungrdev.c @@ -74,9 +74,9 @@ SOFTWARE. */ int -SProcXUngrabDevice(register ClientPtr client) +SProcXUngrabDevice(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceReq); swaps(&stuff->length, n); @@ -92,7 +92,7 @@ SProcXUngrabDevice(register ClientPtr client) */ int -ProcXUngrabDevice(register ClientPtr client) +ProcXUngrabDevice(ClientPtr client) { DeviceIntPtr dev; GrabPtr grab; diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c index 8db9307ce..b9f236b76 100644 --- a/Xi/ungrdevb.c +++ b/Xi/ungrdevb.c @@ -80,9 +80,9 @@ SOFTWARE. */ int -SProcXUngrabDeviceButton(register ClientPtr client) +SProcXUngrabDeviceButton(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceButtonReq); swaps(&stuff->length, n); diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c index ebb83bce7..d316990b2 100644 --- a/Xi/ungrdevk.c +++ b/Xi/ungrdevk.c @@ -80,9 +80,9 @@ SOFTWARE. */ int -SProcXUngrabDeviceKey(register ClientPtr client) +SProcXUngrabDeviceKey(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceKeyReq); swaps(&stuff->length, n); From 76756f27561c6386cba0d338441e8ec7b98500ce Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Thu, 30 Nov 2006 04:20:32 +0200 Subject: [PATCH 51/63] Make xf86glx.c unaware of Mesa internals Use newly added XMesaCopyContext() and drop the GlxSetRenderTables() call for Xgl, as this is now done inside XMesaForceCurrent(). This leaves xmesaP.h but only for the declarations of the three XMesa/XFree86 functions. Also, GlxSetRenderTables() stays but is only used in hw/xgl/glxext/ . Also drop xf86glxint.h, no longer used. Depends on mesa commit 7439a36785b6a2783e80a40a96c09db8f56dc2bc of 2007-03-30. --- GL/glx/Makefile.am | 1 - GL/mesa/X/Makefile.am | 6 ++---- GL/mesa/X/xf86glx.c | 32 +++++----------------------- GL/mesa/X/xf86glx_util.c | 2 -- GL/mesa/X/xf86glxint.h | 45 ---------------------------------------- 5 files changed, 7 insertions(+), 79 deletions(-) delete mode 100644 GL/mesa/X/xf86glxint.h diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am index 8184f605f..cd1130d61 100644 --- a/GL/glx/Makefile.am +++ b/GL/glx/Makefile.am @@ -14,7 +14,6 @@ AM_CFLAGS = \ -I@MESA_SOURCE@/src/mesa/glapi \ -I@MESA_SOURCE@/src/mesa/main \ -DXFree86Server \ - -DNO_LIBCWRAPPER \ @GLX_DEFINES@ # none yet diff --git a/GL/mesa/X/Makefile.am b/GL/mesa/X/Makefile.am index 45345a7e3..056d31ab5 100644 --- a/GL/mesa/X/Makefile.am +++ b/GL/mesa/X/Makefile.am @@ -20,13 +20,11 @@ INCLUDES = -I@MESA_SOURCE@/include \ AM_CFLAGS = \ $(DIX_CFLAGS) \ -DXFree86Server \ - @GLX_DEFINES@ \ - -DXFree86Server + @GLX_DEFINES@ libX_la_SOURCES = xf86glx.c \ xf86glx_util.c \ - xf86glx_util.h \ - xf86glxint.h + xf86glx_util.h nodist_libX_la_SOURCES = \ xm_api.c \ diff --git a/GL/mesa/X/xf86glx.c b/GL/mesa/X/xf86glx.c index 47c87f6d9..6fffdeb1f 100644 --- a/GL/mesa/X/xf86glx.c +++ b/GL/mesa/X/xf86glx.c @@ -37,40 +37,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif #include -#include -#include -#include -#include -#include -#include -#include -#include + +#include +#include #include #include #include #include -#include #include -#include "context.h" #include "xmesaP.h" -#include "context.h" #include "glcontextmodes.h" #include "os.h" -/* - * This define is for the glcore.h header file. - * If you add it here, then make sure you also add it in - * ../../../glx/Imakefile. - */ -#if 0 -#define DEBUG -#include -#undef DEBUG -#else -#include -#endif - typedef struct __GLXMESAscreen __GLXMESAscreen; typedef struct __GLXMESAcontext __GLXMESAcontext; typedef struct __GLXMESAdrawable __GLXMESAdrawable; @@ -218,8 +197,7 @@ __glXMesaContextCopy(__GLXcontext *baseDst, __GLXMESAcontext *dst = (__GLXMESAcontext *) baseDst; __GLXMESAcontext *src = (__GLXMESAcontext *) baseSrc; - _mesa_copy_context(&src->xmesa->mesa, &dst->xmesa->mesa, mask); - return GL_TRUE; + return XMesaCopyContext(src->xmesa, dst->xmesa, mask); } static int @@ -227,7 +205,7 @@ __glXMesaContextForceCurrent(__GLXcontext *baseContext) { __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext; - GlxSetRenderTables (context->xmesa->mesa.CurrentDispatch); + /* GlxSetRenderTables() call for XGL moved in XMesaForceCurrent() */ return XMesaForceCurrent(context->xmesa); } diff --git a/GL/mesa/X/xf86glx_util.c b/GL/mesa/X/xf86glx_util.c index ffb528003..6af773f53 100644 --- a/GL/mesa/X/xf86glx_util.c +++ b/GL/mesa/X/xf86glx_util.c @@ -37,8 +37,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#include -#include "pixmapstr.h" #include "xf86glx_util.h" #include diff --git a/GL/mesa/X/xf86glxint.h b/GL/mesa/X/xf86glxint.h deleted file mode 100644 index 8c7e91327..000000000 --- a/GL/mesa/X/xf86glxint.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -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: - * Kevin E. Martin - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _XF86GLXINT_H_ -#define _XF86GLXINT_H_ - -#include -#include -#include - -#endif /* _XF86GLXINT_H_ */ From 9f24798af50896cc3262c1201f75c10a688f2a83 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 12:49:34 -0600 Subject: [PATCH 52/63] ompile fbcmap.c w/ -DXFree86Server instead of linking libfbcmap.a. The former works, the later doesn't (DMX blows up on visuals/pixel formats). This undos Daniel's patch, which undid my prev patch. Revisit someday. --- hw/dmx/Makefile.am | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am index 17d27ed39..41dc5d210 100644 --- a/hw/dmx/Makefile.am +++ b/hw/dmx/Makefile.am @@ -2,7 +2,6 @@ DIST_SUBDIRS = input config glxProxy examples doc SUBDIRS = input config examples bin_PROGRAMS = Xdmx -noinst_LIBRARIES = libfbcmap.a if XINERAMA PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c @@ -17,6 +16,9 @@ GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod \ GLX_DEFS = @GL_CFLAGS@ endif +# It's essential that fbcmap.c be compiled with this flag for DMX to work!! +DMX_CFLAGS = -DXFree86Server=1 + if BUILDDOCS SUBDIRS += doc endif @@ -26,11 +28,9 @@ AM_CFLAGS = \ $(DIX_CFLAGS) \ $(GLX_INCS) \ $(GLX_DEFS) \ + $(DMX_CFLAGS) \ @DMXMODULES_CFLAGS@ -libfbcmap_a_SOURCES = libfbcmap.a -libfbcmap_a_CFLAGS = $(AM_CFLAGS) -DXFree86Server - Xdmx_SOURCES = dmx.c \ dmxcb.c \ dmxcb.h \ @@ -76,6 +76,7 @@ Xdmx_SOURCES = dmx.c \ dmxwindow.c \ dmxwindow.h \ $(top_srcdir)/mi/miinitext.c \ + $(top_srcdir)/fb/fbcmap.c \ $(GLX_SRCS) @@ -89,7 +90,6 @@ Xdmx_LDADD = $(XORG_CORE_LIBS) \ $(GLX_LIBS) \ input/libdmxinput.a \ config/libdmxconfig.a \ - libfbcmap.a \ @DMXMODULES_LIBS@ # Man page From 44acb2517d9fb07790d9d799aa9cc727d1b7d35c Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 12:54:22 -0600 Subject: [PATCH 53/63] Fix some bad formatting. Doing this: if (something) stmt; is evil if you're debugging and want to break on stmt! --- hw/dmx/dmxcursor.c | 110 ++++++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 35 deletions(-) diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c index e74a05215..ef49652e2 100644 --- a/hw/dmx/dmxcursor.c +++ b/hw/dmx/dmxcursor.c @@ -198,7 +198,8 @@ static int *dmxSLCreate(void) int *list = malloc(dmxNumScreens * sizeof(*list)); int i; - for (i = 0; i < dmxNumScreens; i++) list[i] = 1; + for (i = 0; i < dmxNumScreens; i++) + list[i] = 1; return list; } @@ -212,7 +213,9 @@ static void dmxSLFree(int *list) static int dmxSLFindNext(int *list) { int i; - for (i = 0; i < dmxNumScreens; i++) if (list[i]) return i; + for (i = 0; i < dmxNumScreens; i++) + if (list[i]) + return i; return -1; } @@ -225,7 +228,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) int changed = 0; for (i = 0; i < dmxNumScreens; i++) { - if (!screensLeft[i]) continue; + if (!screensLeft[i]) + continue; screen = &dmxScreens[i]; switch (screen->where) { case PosAbsolute: @@ -235,14 +239,16 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) break; case PosRelative: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX; dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY; ++changed, screensLeft[i] = 0; break; case PosRightOf: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; pScreen = screenInfo.screens[ref]; dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width; dixScreenOrigins[i].y = dixScreenOrigins[ref].y; @@ -250,7 +256,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) break; case PosLeftOf: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; pScreen = screenInfo.screens[i]; dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width; dixScreenOrigins[i].y = dixScreenOrigins[ref].y; @@ -258,7 +265,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) break; case PosBelow: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; pScreen = screenInfo.screens[ref]; dixScreenOrigins[i].x = dixScreenOrigins[ref].x; dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height; @@ -266,7 +274,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) break; case PosAbove: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; pScreen = screenInfo.screens[i]; dixScreenOrigins[i].x = dixScreenOrigins[ref].x; dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height; @@ -308,8 +317,10 @@ static void dmxComputeScreenOrigins(void) minX = dixScreenOrigins[0].x; minY = dixScreenOrigins[0].y; for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */ - if (dixScreenOrigins[i].x < minX) minX = dixScreenOrigins[i].x; - if (dixScreenOrigins[i].y < minY) minY = dixScreenOrigins[i].y; + if (dixScreenOrigins[i].x < minX) + minX = dixScreenOrigins[i].x; + if (dixScreenOrigins[i].y < minY) + minY = dixScreenOrigins[i].y; } if (minX || minY) { for (i = 0; i < dmxNumScreens; i++) { @@ -411,28 +422,36 @@ int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen) static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b) { if (dmxOnScreen(a->rootXOrigin, - a->rootYOrigin, b)) return 1; + a->rootYOrigin, b)) + return 1; if (dmxOnScreen(a->rootXOrigin, - a->rootYOrigin + a->scrnWidth, b)) return 1; + a->rootYOrigin + a->scrnWidth, b)) + return 1; if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, - a->rootYOrigin, b)) return 1; + a->rootYOrigin, b)) + return 1; if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, - a->rootYOrigin + a->scrnWidth, b)) return 1; + a->rootYOrigin + a->scrnWidth, b)) + return 1; if (dmxOnScreen(b->rootXOrigin, - b->rootYOrigin, a)) return 1; + b->rootYOrigin, a)) + return 1; if (dmxOnScreen(b->rootXOrigin, - b->rootYOrigin + b->scrnWidth, a)) return 1; + b->rootYOrigin + b->scrnWidth, a)) + return 1; if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, - b->rootYOrigin, a)) return 1; + b->rootYOrigin, a)) + return 1; if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, - b->rootYOrigin + b->scrnWidth, a)) return 1; + b->rootYOrigin + b->scrnWidth, a)) + return 1; return 0; } @@ -476,7 +495,8 @@ static void *dmxTestSameDisplay(DMXScreenInfo *a, void *closure) { DMXScreenInfo *b = closure; - if (a == b) return a; + if (a == b) + return a; return NULL; } @@ -489,14 +509,16 @@ void dmxInitOverlap(void) int i, j; DMXScreenInfo *a, *b, *pt; - for (i = 0; i < dmxNumScreens; i++) dmxScreens[i].over = NULL; + for (i = 0; i < dmxNumScreens; i++) + dmxScreens[i].over = NULL; for (i = 0; i < dmxNumScreens; i++) { a = &dmxScreens[i]; for (j = i+1; j < dmxNumScreens; j++) { b = &dmxScreens[j]; - if (b->over) continue; + if (b->over) + continue; if (dmxDoesOverlap(a, b)) { DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n", @@ -510,7 +532,8 @@ void dmxInitOverlap(void) for (i = 0; i < dmxNumScreens; i++) { a = &dmxScreens[i]; - if (!a->over) continue; + if (!a->over) + continue; /* Flag all pairs that are on same display */ for (pt = a->over; pt != a; pt = pt->over) { @@ -521,7 +544,8 @@ void dmxInitOverlap(void) * screens that mutually overlap on the backend display, * so we call dmxDoesOverlap, which is stricter than the * ->over set. */ - if (!dmxDoesOverlap(a, pt)) continue; + if (!dmxDoesOverlap(a, pt)) + continue; a->cursorNotShared = 1; pt->cursorNotShared = 1; dmxLog(dmxInfo, @@ -731,9 +755,11 @@ static Bool dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) return _dmxRealizeCursor(pScreen, pCursor); for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursorNotShared) continue; + if (pt->cursorNotShared) + continue; _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor); - if (pt == start) break; + if (pt == start) + break; } return TRUE; } @@ -747,9 +773,11 @@ static Bool dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) return _dmxUnrealizeCursor(pScreen, pCursor); for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursorNotShared) continue; + if (pt->cursorNotShared) + continue; _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor); - if (pt == start) break; + if (pt == start) + break; } return TRUE; } @@ -758,10 +786,13 @@ static CursorPtr dmxFindCursor(DMXScreenInfo *start) { DMXScreenInfo *pt; - if (!start || !start->over) return GetSpriteCursor(); + if (!start || !start->over) + return GetSpriteCursor(); for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursor) return pt->cursor; - if (pt == start) break; + if (pt->cursor) + return pt->cursor; + if (pt == start) + break; } return GetSpriteCursor(); } @@ -769,7 +800,12 @@ static CursorPtr dmxFindCursor(DMXScreenInfo *start) /** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This * function is usually called via #dmxPointerSpriteFuncs, except during * reconfiguration when the cursor is repositioned to force an update on - * newley overlapping screens and on screens that no longer overlap. */ + * newley overlapping screens and on screens that no longer overlap. + * + * The coords (x,y) are in global coord space. We'll loop over the + * back-end screens and see if they contain the global coord. If so, call + * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen. + */ void dmxMoveCursor(ScreenPtr pScreen, int x, int y) { DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; @@ -783,7 +819,8 @@ void dmxMoveCursor(ScreenPtr pScreen, int x, int y) } for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursorNotShared) continue; + if (pt->cursorNotShared) + continue; if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { if (/* pt != start && */ !pt->cursorVisible) { if (!pt->cursor) { @@ -811,7 +848,8 @@ void dmxMoveCursor(ScreenPtr pScreen, int x, int y) x + start->rootXOrigin - pt->rootXOrigin, y + start->rootYOrigin - pt->rootYOrigin); } - if (pt == start) break; + if (pt == start) + break; } } @@ -851,7 +889,8 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) } for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursorNotShared) continue; + if (pt->cursorNotShared) + continue; if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { _dmxSetCursor(screenInfo.screens[pt->index], pCursor, x + start->rootXOrigin - pt->rootXOrigin, @@ -861,7 +900,8 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) x + start->rootXOrigin - pt->rootXOrigin, y + start->rootYOrigin - pt->rootYOrigin); } - if (pt == start) break; + if (pt == start) + break; } } From d92da3d5f309392ac398c0975ef17bb04312d5e2 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 12:56:34 -0600 Subject: [PATCH 54/63] more formatting fixes --- hw/dmx/dmxcursor.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c index ef49652e2..09b50b8c7 100644 --- a/hw/dmx/dmxcursor.c +++ b/hw/dmx/dmxcursor.c @@ -130,14 +130,16 @@ static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) int globalX; int globalY; - if (screenInfo.numScreens == 1) return FALSE; + if (screenInfo.numScreens == 1) + return FALSE; /* On current screen? */ dmxScreen = &dmxScreens[(*ppScreen)->myNum]; if (localX >= 0 && localX < dmxScreen->rootWidth && localY >= 0 - && localY < dmxScreen->rootHeight) return FALSE; + && localY < dmxScreen->rootHeight) + return FALSE; /* Convert to global coordinate space */ globalX = dmxScreen->rootXOrigin + localX; @@ -162,7 +164,8 @@ static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth && globalY >= dmxScreen->rootYOrigin && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) { - if (dmxScreen->index == (*ppScreen)->myNum) return FALSE; + if (dmxScreen->index == (*ppScreen)->myNum) + return FALSE; *ppScreen = screenInfo.screens[dmxScreen->index]; *x = globalX - dmxScreen->rootXOrigin; *y = globalY - dmxScreen->rootYOrigin; From 92e8cdbd32b0d86cabd4ad88e3240bf90c018b9a Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 13:19:33 -0600 Subject: [PATCH 55/63] Checkpoint fixes to DMX for X input changes. Xdmx builds and runs now. Keyboard seems OK, and mouse pointer moves, but everything else is flakey. Something is still seriously wrong. --- hw/dmx/dmxcursor.c | 12 +++- hw/dmx/dmxinput.c | 3 + hw/dmx/input/dmxbackend.c | 19 +++++++ hw/dmx/input/dmxevents.c | 106 ++++++++++++++++++++++++++++++++++++ hw/dmx/input/dmxinputinit.c | 88 +++++++++++++++++++++++++++++- hw/dmx/input/dmxxinput.c | 6 +- hw/dmx/input/lnx-keyboard.c | 12 ++++ 7 files changed, 242 insertions(+), 4 deletions(-) diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c index 09b50b8c7..11c89d822 100644 --- a/hw/dmx/dmxcursor.c +++ b/hw/dmx/dmxcursor.c @@ -182,7 +182,12 @@ static void dmxCrossScreen(ScreenPtr pScreen, Bool entering) static void dmxWarpCursor(ScreenPtr pScreen, int x, int y) { DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y); +#if 11 /*BP*/ + /* This call is depracated. Replace with???? */ miPointerWarpCursor(pScreen, x, y); +#else + pScreen->SetCursorPosition(pScreen, x, y, FALSE); +#endif } miPointerScreenFuncRec dmxPointerCursorFuncs = @@ -190,7 +195,7 @@ miPointerScreenFuncRec dmxPointerCursorFuncs = dmxCursorOffScreen, dmxCrossScreen, dmxWarpCursor, - dmxeqEnqueue, + dmxeqEnqueue, /*XXX incompatible type/function! */ dmxeqSwitchScreen }; @@ -939,8 +944,13 @@ void dmxCheckCursor(void) pScreen = screenInfo.screens[dmxScreen->index]; if (!dmxOnScreen(x, y, dmxScreen)) { +#if 00 if (firstScreen && i == miPointerCurrentScreen()->myNum) miPointerSetNewScreen(firstScreen->index, x, y); +#else + if (firstScreen && i == miPointerGetScreen(inputInfo.pointer)->myNum) + miPointerSetScreen(inputInfo.pointer, firstScreen->index, x, y); +#endif _dmxSetCursor(pScreen, NULL, x - dmxScreen->rootXOrigin, y - dmxScreen->rootYOrigin); diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c index 37f458356..f47899c2f 100644 --- a/hw/dmx/dmxinput.c +++ b/hw/dmx/dmxinput.c @@ -49,6 +49,7 @@ #include "inputstr.h" #include "input.h" +#include "mi.h" /** Returns TRUE if the key is a valid modifier. For PC-class * keyboards, all keys can be used as modifiers, so return TRUE @@ -75,6 +76,8 @@ void InitInput(int argc, char **argv) dmxLog(dmxWarning, "Use keyboard/mouse pair with the first -input\n"); dmxLog(dmxFatal, "At least one core keyboard/mouse pair required\n"); } + + mieqInit(); } /** Called from dix/dispatch.c in Dispatch() whenever input events diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c index 8985a1b1d..48de4c9a8 100644 --- a/hw/dmx/input/dmxbackend.c +++ b/hw/dmx/input/dmxbackend.c @@ -242,7 +242,11 @@ static int dmxBackendOffscreen(int screen, int x, int y) void dmxBackendUpdatePosition(pointer private, int x, int y) { GETPRIVFROMPRIVATE; +#if 00 /*BP*/ int screen = miPointerCurrentScreen()->myNum; +#else + int screen = miPointerGetScreen(inputInfo.pointer)->myNum; +#endif DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; int oldRelative = priv->relative; int topscreen = dmxBackendFindOverlapping(priv, screen, x, y); @@ -391,6 +395,7 @@ void dmxBackendCollectEvents(DevicePtr pDev, } break; case MotionNotify: +#if 00 /*BP*/ DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)" " newscreen=%d: %d %d (e=%d; last=%d,%d)\n", dmxScreen->index, priv->myScreen, @@ -443,12 +448,26 @@ void dmxBackendCollectEvents(DevicePtr pDev, (dmxScreen->rootYOrigin + X.xmotion.y - dmxScreen->rootY)); } +#else + /* + ErrorF("motion %d, %d, %d\n", + X.xmotion.x, X.xmotion.y, X.xmotion.state); + */ + enqueue(priv->mou, X.type, 0/*X.xbutton.button*/, 0, &X, block); +#endif break; case KeyPress: case KeyRelease: enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); break; +#if 11/*BP*/ + case ButtonPress: + case ButtonRelease: + /* + ErrorF("press/release at %d, %d\n", X.xbutton.x, X.xbutton.y); + */ +#endif default: /* Pass the whole event here, because * this may be an extension event. */ diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 5316f0fdc..90b45a9b9 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -56,6 +56,7 @@ #include "opaque.h" #include "inputstr.h" #include "mipointer.h" +#include "mi.h" #ifdef XINPUT #include "XIstubs.h" @@ -216,11 +217,20 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { localX = dmxGlobalX - dmxScreen->rootXOrigin; localY = dmxGlobalY - dmxScreen->rootYOrigin; +#if 00 /*BP*/ if ((pScreen = miPointerCurrentScreen()) +#else + if ((pScreen = miPointerGetScreen(inputInfo.pointer)) +#endif && pScreen->myNum == dmxScreen->index) { /* Screen is old screen */ if (block) dmxSigioBlock(); +#if 00 /*BP*/ miPointerAbsoluteCursor(localX, localY, GetTimeInMillis()); +#else + miPointerSetPosition(inputInfo.pointer, &localX, &localY, + GetTimeInMillis()); +#endif if (block) dmxSigioUnblock(); } else { /* Screen is new */ @@ -228,13 +238,28 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) pScreen->myNum, dmxScreen->index, localX, localY); if (block) dmxSigioBlock(); dmxeqProcessInputEvents(); +#if 00 /*BP*/ miPointerSetNewScreen(dmxScreen->index, localX, localY); miPointerAbsoluteCursor(localX, localY, GetTimeInMillis()); +#else + miPointerSetScreen(inputInfo.pointer, dmxScreen->index, + localX, localY); + miPointerSetPosition(inputInfo.pointer, &localX, &localY, + GetTimeInMillis()); +#endif if (block) dmxSigioUnblock(); } +#if 00 /*BP*/ miPointerPosition(&localX, &localY); +#else + miPointerGetPosition(inputInfo.pointer, &localX, &localY); +#endif +#if 00 /*BP*/ if ((pScreen = miPointerCurrentScreen())) { +#else + if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { +#endif dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" @@ -604,16 +629,87 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, return; if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) xE.u.u.detail = dmxFixup(pDev, detail, keySym); +#if 11/*BP*/ + { + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents; + xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + nevents = GetKeyboardEvents(events, + /*pDev*/p, + /*KeyPress*/type, + /*n*/detail); + /* + ErrorF("NEW KEY EVENT %d n=%d\n", detail, nevents); + */ + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; + } +#endif break; case ButtonPress: case ButtonRelease: +#if 00 /*BP*/ detail = dmxGetButtonMapping(dmxLocal, detail); +#else + { + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents, valuators[3]; + xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + valuators[0] = e->xbutton.x; + valuators[1] = e->xbutton.y; + valuators[2] = e->xbutton.button; + nevents = GetPointerEvents(events, + /*pDev*/p, + /*KeyPress*/type, + detail, + POINTER_ABSOLUTE, + 0, 0, valuators); + /* + ErrorF("NEW PTR EVENT %d (%d,%d,%d) n=%d\n", + detail, valuators[0], valuators[1], valuators[2], + nevents); + */ + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; + } +#endif break; case MotionNotify: /* All MotionNotify events should be sent via dmxCoreMotion and * dmxExtMotion -- no input driver should build motion events by * hand. */ +#if 00 /*BP*/ dmxLog(dmxError, "dmxEnqueueXEvent: MotionNotify not allowed here\n"); +#else + { + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents, valuators[3]; + xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + valuators[0] = e->xmotion.x; + valuators[1] = e->xmotion.y; + valuators[2] = e->xmotion.state; + nevents = GetPointerEvents(events, + /*pDev*/p, + /*KeyPress*/type, + detail, + POINTER_ABSOLUTE, + 0, 0, valuators); + /* + ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", + detail, e->xmotion.state, + valuators[0], valuators[1], valuators[2], + nevents); + */ + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; + } +#endif break; /* Always ignore these events */ case EnterNotify: @@ -623,6 +719,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, * modifier map on the backend/console * input device so that we have complete * control of the input device LEDs. */ + ErrorF("Enter/Leave/Keymap/Mapping\n"); return; default: #ifdef XINPUT @@ -652,7 +749,16 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, if (!dmxLocal->sendsCore) dmxEnqueueExtEvent(dmxLocal, &xE, block); else #endif +#if 00 /*BP*/ dmxeqEnqueue(&xE); +#else + /* never get here! */ + if (0) { + DeviceIntPtr p = dmxLocal->pDevice; + ErrorF("enque %d\n", type); + mieqEnqueue(p, &xE); + } +#endif } /** A pointer to this routine is passed to low-level input drivers so diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index 0519d2b72..7c0ae58a7 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -72,6 +72,7 @@ #include "input.h" #include "mipointer.h" #include "windowstr.h" +#include "mi.h" #ifdef XINPUT #include @@ -222,6 +223,57 @@ static DMXLocalInputInfoRec DMXLocalDevices[] = { { NULL } /* Must be last */ }; + +#if 11 /*BP*/ +void +DDXRingBell(int volume, int pitch, int duration) +{ + /* NO-OP */ +} + +/* taken from kdrive/src/kinput.c: */ +static void +dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) +{ +#if 0 + KdKeyboardInfo *ki; + + for (ki = kdKeyboards; ki; ki = ki->next) { + if (ki->dixdev && ki->dixdev->id == pDevice->id) + break; + } + + if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver) + return; + + KdSetLeds(ki, ctrl->leds); + ki->bellPitch = ctrl->bell_pitch; + ki->bellDuration = ctrl->bell_duration; +#endif +} + +/* taken from kdrive/src/kinput.c: */ +static void +dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something) +{ +#if 0 + KeybdCtrl *ctrl = arg; + KdKeyboardInfo *ki = NULL; + + for (ki = kdKeyboards; ki; ki = ki->next) { + if (ki->dixdev && ki->dixdev->id == pDev->id) + break; + } + + if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) + return; + + KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); +#endif +} + +#endif /*BP*/ + static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, PtrCtrl *ctrl) { @@ -427,7 +479,15 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) break; } if (info.keyClass) { +#if 00 /*BP*/ InitKeyClassDeviceStruct(pDevice, &info.keySyms, info.modMap); +#else + DevicePtr pDev = (DevicePtr) pDevice; + InitKeyboardDeviceStruct(pDev, + &info.keySyms, + info.modMap, + dmxBell, dmxKbdCtrl); +#endif } if (info.buttonClass) { InitButtonClassDeviceStruct(pDevice, info.numButtons, info.map); @@ -435,8 +495,13 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) if (info.valuatorClass) { if (info.numRelAxes && dmxLocal->sendsCore) { InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, +#if 00 /*BP*/ miPointerGetMotionEvents, miPointerGetMotionBufferSize(), +#else + GetMotionHistory, + GetMaximumEventsNum(), +#endif Relative); #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) @@ -520,12 +585,26 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput) { int i; + /* + ErrorF("%s\n", __FUNCTION__); + */ + dmxeqProcessInputEvents(); +#if 00 /*BP*/ miPointerUpdate(); +#endif if (dmxInput->detached) return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->process_input) + if (dmxInput->devs[i]->process_input) { +#if 11 /*BP*/ + miPointerUpdateSprite(dmxInput->devs[i]->pDevice); +#endif dmxInput->devs[i]->process_input(dmxInput->devs[i]->private); + } + +#if 11 /*BP*/ + mieqProcessInputEvents(); +#endif } static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput, @@ -710,8 +789,13 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) registerProcPtr(pDevice); - if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) + if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) { +#if 00 /*BP*/ miRegisterPointerDevice(screenInfo.screens[0], pDevice); +#else + /* Nothing? dmxDeviceOnOff() should get called to init, right? */ +#endif + } if (dmxLocal->create_private) dmxLocal->private = dmxLocal->create_private(pDevice); diff --git a/hw/dmx/input/dmxxinput.c b/hw/dmx/input/dmxxinput.c index 81d1cfbe6..ad2a77c9c 100644 --- a/hw/dmx/input/dmxxinput.c +++ b/hw/dmx/input/dmxxinput.c @@ -99,9 +99,13 @@ int ChangePointerDevice(DeviceIntPtr old_dev, } dmxLocalNew->savedMotionProc = new_dev->valuator->GetMotionProc; dmxLocalNew->savedMotionEvents = new_dev->valuator->numMotionEvents; +#if 00 /*BP*/ new_dev->valuator->GetMotionProc = miPointerGetMotionEvents; new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize(); - +#else + new_dev->valuator->GetMotionProc = GetMotionHistory; + new_dev->valuator->numMotionEvents = GetMaximumEventsNum(); +#endif /* Switch our notion of core pointer */ dmxLocalOld->isCore = 0; dmxLocalOld->sendsCore = dmxLocalOld->savedSendsCore; diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c index 97cc3077e..b09492b89 100644 --- a/hw/dmx/input/lnx-keyboard.c +++ b/hw/dmx/input/lnx-keyboard.c @@ -164,7 +164,9 @@ #include #include #include "atKeynames.h" +#if 00 #include "xf86Keymap.h" +#endif #include #define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) @@ -800,7 +802,12 @@ static void kbdLinuxReadKernelMapping(int fd, KeySymsPtr pKeySyms) tbl[2] = 8; /* alt */ tbl[3] = tbl[2] | 1; +#if 00/*BP*/ k = map+GLYPHS_PER_KEY; +#else + ErrorF("kbdLinuxReadKernelMapping() is broken/no-op'd\n"); + return; +#endif maxkey = NUM_AT2LNX; for (i = 0; i < maxkey; ++i) { @@ -927,8 +934,13 @@ static void kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) char type; int i; +#if 00/*BP*/ mapCopy = xalloc(sizeof(map)); memcpy(mapCopy, map, sizeof(map)); +#else + ErrorF("kbdLinuxGetMap() is broken/no-op'd\n"); + return; +#endif kbdLinuxReadKernelMapping(priv->fd, pKeySyms); From 1ea842960fddbc6363cc6e7f914d70ba45525a6b Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 13:43:15 -0600 Subject: [PATCH 56/63] more debug --- hw/dmx/input/dmxbackend.c | 3 +-- hw/dmx/input/dmxevents.c | 18 ++++++++++-------- hw/dmx/input/dmxinputinit.c | 7 ++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c index 48de4c9a8..61d1bfe3e 100644 --- a/hw/dmx/input/dmxbackend.c +++ b/hw/dmx/input/dmxbackend.c @@ -464,9 +464,8 @@ void dmxBackendCollectEvents(DevicePtr pDev, #if 11/*BP*/ case ButtonPress: case ButtonRelease: - /* ErrorF("press/release at %d, %d\n", X.xbutton.x, X.xbutton.y); - */ + /* fall-through */ #endif default: /* Pass the whole event here, because diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 90b45a9b9..9a31ba6c0 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -638,9 +638,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, /*pDev*/p, /*KeyPress*/type, /*n*/detail); - /* - ErrorF("NEW KEY EVENT %d n=%d\n", detail, nevents); - */ + ErrorF("KEY %d n=%d\n", detail, nevents); for (i = 0; i < nevents; i++) mieqEnqueue(p, events + i); xfree(events); @@ -659,6 +657,10 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); valuators[0] = e->xbutton.x; valuators[1] = e->xbutton.y; + /* + valuators[0] = dmxGlobalX; + valuators[1] = dmxGlobalY; + */ valuators[2] = e->xbutton.button; nevents = GetPointerEvents(events, /*pDev*/p, @@ -666,11 +668,10 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, detail, POINTER_ABSOLUTE, 0, 0, valuators); - /* - ErrorF("NEW PTR EVENT %d (%d,%d,%d) n=%d\n", - detail, valuators[0], valuators[1], valuators[2], - nevents); - */ + + ErrorF("BUTTON %d, %d %d n=%d\n", + valuators[0], valuators[1], valuators[2], nevents); + for (i = 0; i < nevents; i++) mieqEnqueue(p, events + i); xfree(events); @@ -698,6 +699,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, detail, POINTER_ABSOLUTE, 0, 0, valuators); + ErrorF("MOTION %d, %d n = %d\n", valuators[0], valuators[1], nevents); /* ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", detail, e->xmotion.state, diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index 7c0ae58a7..c098c46e2 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -503,10 +503,11 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) GetMaximumEventsNum(), #endif Relative); + ErrorF("MOTION BUFFER SIZE %d\n", GetMaximumEventsNum()); #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - info.maxval[0], info.res[0], + /*1280*/info.maxval[0], info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numRelAxes) { @@ -517,7 +518,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - info.maxval[0], info.res[0], + /*1280*/info.maxval[0], info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numAbsAxes) { @@ -528,7 +529,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numAbsAxes; i++) InitValuatorAxisStruct(pDevice, i+info.numRelAxes, - info.minval[i+1], info.maxval[i+1], + info.minval[i+1], /*1280*/info.maxval[i+1], info.res[i+1], info.minres[i+1], info.maxres[i+1]); #endif From 7989dacdcb1449b10d7733dda11cd96e260e9fae Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 13:44:24 -0600 Subject: [PATCH 57/63] num_valuators=1 for GetPointerEvents(), hack ButtonPress/Release position --- hw/dmx/input/dmxevents.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 9a31ba6c0..302745760 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -655,19 +655,19 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, DeviceIntPtr p = dmxLocal->pDevice; int i, nevents, valuators[3]; xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + /* valuators[0] = e->xbutton.x; valuators[1] = e->xbutton.y; - /* + */ valuators[0] = dmxGlobalX; valuators[1] = dmxGlobalY; - */ valuators[2] = e->xbutton.button; nevents = GetPointerEvents(events, /*pDev*/p, /*KeyPress*/type, detail, POINTER_ABSOLUTE, - 0, 0, valuators); + 0, 1, valuators); ErrorF("BUTTON %d, %d %d n=%d\n", valuators[0], valuators[1], valuators[2], nevents); @@ -698,7 +698,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, /*KeyPress*/type, detail, POINTER_ABSOLUTE, - 0, 0, valuators); + 0, 1, valuators); ErrorF("MOTION %d, %d n = %d\n", valuators[0], valuators[1], nevents); /* ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", From 3c7413e0c2f87e154aa8aa4a83bd585a6d1091e8 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 14:07:04 -0600 Subject: [PATCH 58/63] Tweak some parameters, etc. Things seem a little better now, but still a ways to go. --- hw/dmx/input/dmxevents.c | 10 ++++++---- hw/dmx/input/dmxinputinit.c | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 302745760..0cc3054ac 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -262,6 +262,7 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) #endif dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; + ErrorF("Global is now %d, %d\n", dmxGlobalX, dmxGlobalY); DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" " on screen index=%d/%d localX=%d localY=%d\n", dmxGlobalX, dmxGlobalY, @@ -655,19 +656,20 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, DeviceIntPtr p = dmxLocal->pDevice; int i, nevents, valuators[3]; xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - /* + valuators[0] = e->xbutton.x; valuators[1] = e->xbutton.y; - */ + /* valuators[0] = dmxGlobalX; valuators[1] = dmxGlobalY; + */ valuators[2] = e->xbutton.button; nevents = GetPointerEvents(events, /*pDev*/p, /*KeyPress*/type, detail, POINTER_ABSOLUTE, - 0, 1, valuators); + 0, 3, valuators); ErrorF("BUTTON %d, %d %d n=%d\n", valuators[0], valuators[1], valuators[2], nevents); @@ -698,7 +700,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, /*KeyPress*/type, detail, POINTER_ABSOLUTE, - 0, 1, valuators); + 0, 3, valuators); ErrorF("MOTION %d, %d n = %d\n", valuators[0], valuators[1], nevents); /* ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index c098c46e2..1465ade27 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -507,7 +507,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - /*1280*/info.maxval[0], info.res[0], + info.maxval[0], info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numRelAxes) { @@ -518,7 +518,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - /*1280*/info.maxval[0], info.res[0], + info.maxval[0], info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numAbsAxes) { @@ -529,7 +529,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numAbsAxes; i++) InitValuatorAxisStruct(pDevice, i+info.numRelAxes, - info.minval[i+1], /*1280*/info.maxval[i+1], + info.minval[i+1], info.maxval[i+1], info.res[i+1], info.minres[i+1], info.maxres[i+1]); #endif From ebdc8ce5c108dc3b6b0004e7c7939d1a5bef8676 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 16:05:46 -0600 Subject: [PATCH 59/63] Checkpoint DMX updates: things are working much better now, but still not 100% right. Use new dmxCoreMotion2() function which enqueues motion events with GetPointerEvents()/mieqEnqueue(). The clipAxis() code in GetPointerEvents() is causing some grief. The limits seem to have always been (0,0) according to the original calls to InitValuatorAxisStruct() in dmxinputinit.c. Terrible hack for now: Call InitValuatorAxisStruct() with hard-coded max values of 1280 (my screen width). --- hw/dmx/dmxcursor.c | 2 +- hw/dmx/dmxinput.h | 2 +- hw/dmx/input/dmxbackend.c | 2 +- hw/dmx/input/dmxevents.c | 159 ++++++++++++++++++++++++++++++++++-- hw/dmx/input/dmxinputinit.c | 6 +- 5 files changed, 157 insertions(+), 14 deletions(-) diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c index 11c89d822..a7d9378b0 100644 --- a/hw/dmx/dmxcursor.c +++ b/hw/dmx/dmxcursor.c @@ -889,7 +889,7 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) gx = start->rootXOrigin + x; gy = start->rootYOrigin + y; if (x && y && (GX != gx || GY != gy)) - dmxCoreMotion(gx, gy, 0, DMX_NO_BLOCK); + dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK); if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) { _dmxSetCursor(pScreen, pCursor, x, y); diff --git a/hw/dmx/dmxinput.h b/hw/dmx/dmxinput.h index 59fa823d3..3fb587086 100644 --- a/hw/dmx/dmxinput.h +++ b/hw/dmx/dmxinput.h @@ -154,7 +154,7 @@ typedef enum { extern void dmxGetGlobalPosition(int *x, int *y); extern DMXScreenInfo *dmxFindFirstScreen(int x, int y); -extern void dmxCoreMotion(int x, int y, int delta, +extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block); /* Support for dynamic addition of inputs. This functions is defined in diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c index 61d1bfe3e..7efb2eebe 100644 --- a/hw/dmx/input/dmxbackend.c +++ b/hw/dmx/input/dmxbackend.c @@ -395,7 +395,7 @@ void dmxBackendCollectEvents(DevicePtr pDev, } break; case MotionNotify: -#if 00 /*BP*/ +#if 001 /*BP*/ DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)" " newscreen=%d: %d %d (e=%d; last=%d,%d)\n", dmxScreen->index, priv->myScreen, diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 0cc3054ac..fae2049b3 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -191,7 +191,42 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y) return NULL; } -void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) + +#if 11/*BP*/ + +static void enqueueMotion(DevicePtr pDev, int x, int y) +{ + GETDMXINPUTFROMPDEV; + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents, valuators[3]; + xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + int detail = 0; + + valuators[0] = x; + valuators[1] = y; + valuators[2] = detail; + nevents = GetPointerEvents(events, + /*pDev*/p, + MotionNotify, + detail, + POINTER_ABSOLUTE, + 0, 2, valuators); + ErrorF("MOTION2 %d, %d n = %d\n", valuators[0], valuators[1], nevents); + /* + ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", + detail, e->xmotion.state, + valuators[0], valuators[1], valuators[2], + nevents); + */ + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; +} + + +static void +dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) { DMXScreenInfo *dmxScreen; DMXInputInfo *dmxInput; @@ -214,6 +249,106 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; + ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY); + + if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { + localX = dmxGlobalX - dmxScreen->rootXOrigin; + localY = dmxGlobalY - dmxScreen->rootYOrigin; + if ((pScreen = miPointerGetScreen(inputInfo.pointer)) + && pScreen->myNum == dmxScreen->index) { + /* Screen is old screen */ + if (block) + dmxSigioBlock(); +#if 000 + miPointerSetPosition(inputInfo.pointer, &localX, &localY, + GetTimeInMillis()); +#else + if (pDev) + enqueueMotion(pDev, localX, localY); +#endif + if (block) + dmxSigioUnblock(); + } else { + /* Screen is new */ + DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n", + pScreen->myNum, dmxScreen->index, localX, localY); + if (block) + dmxSigioBlock(); + dmxeqProcessInputEvents(); + miPointerSetScreen(inputInfo.pointer, dmxScreen->index, + localX, localY); +#if 000 + miPointerSetPosition(inputInfo.pointer, &localX, &localY, + GetTimeInMillis()); +#else + if (pDev) + enqueueMotion(pDev, localX, localY); +#endif + if (block) + dmxSigioUnblock(); + } +#if 00 + miPointerGetPosition(inputInfo.pointer, &localX, &localY); + + if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { + dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; + dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; + ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY, + localX, localY); + DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" + " on screen index=%d/%d localX=%d localY=%d\n", + dmxGlobalX, dmxGlobalY, + dmxScreen ? dmxScreen->index : -1, pScreen->myNum, + localX, localY); + } +#endif + } + /* Send updates down to all core input + * drivers */ + for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { + int j; + + for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding) + if (!dmxInput->detached + && dmxInput->devs[j]->sendsCore + && dmxInput->devs[j]->update_position) + dmxInput->devs[j]->update_position(dmxInput->devs[j]->private, + dmxGlobalX, dmxGlobalY); + } + if (!dmxScreen) ProcessInputEvents(); +} +#endif + +void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) +{ + DMXScreenInfo *dmxScreen; + DMXInputInfo *dmxInput; + ScreenPtr pScreen; + int localX; + int localY; + int i; + +#if 11/*BP*/ + dmxCoreMotion2(pDev, x, y, delta, block); + return; +#endif + + if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return; + + DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", + x, y, delta, dmxGlobalX, dmxGlobalY); + + dmxGlobalInvalid = 0; + dmxGlobalX = x; + dmxGlobalY = y; + + if (dmxGlobalX < 0) dmxGlobalX = 0; + if (dmxGlobalY < 0) dmxGlobalY = 0; + if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; + if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; + + ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY); + if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { localX = dmxGlobalX - dmxScreen->rootXOrigin; localY = dmxGlobalY - dmxScreen->rootYOrigin; @@ -285,6 +420,8 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) if (!dmxScreen) ProcessInputEvents(); } + + #ifdef XINPUT #define DMX_MAX_AXES 32 /* Max axes reported by this routine */ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, @@ -534,12 +671,18 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount, return; } #endif - if (axesCount == 2) switch (type) { - case DMX_RELATIVE: dmxCoreMotion(dmxGlobalX - v[0], - dmxGlobalY - v[1], - 0, block); break; - case DMX_ABSOLUTE: dmxCoreMotion(v[0], v[1], 0, block); break; - case DMX_ABSOLUTE_CONFINED: dmxCoreMotion(v[0], v[1], -1, block); break; + if (axesCount == 2) { + switch (type) { + case DMX_RELATIVE: + dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block); + break; + case DMX_ABSOLUTE: + dmxCoreMotion(pDev, v[0], v[1], 0, block); + break; + case DMX_ABSOLUTE_CONFINED: + dmxCoreMotion(pDev, v[0], v[1], -1, block); + break; + } } } @@ -669,7 +812,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, /*KeyPress*/type, detail, POINTER_ABSOLUTE, - 0, 3, valuators); + 0, 2/*3*/, valuators); ErrorF("BUTTON %d, %d %d n=%d\n", valuators[0], valuators[1], valuators[2], nevents); diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index 1465ade27..d76dd9bc5 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -507,7 +507,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - info.maxval[0], info.res[0], + 1280/*info.maxval[0]*/, info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numRelAxes) { @@ -518,7 +518,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - info.maxval[0], info.res[0], + 1280/*info.maxval[0]*/, info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numAbsAxes) { @@ -529,7 +529,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numAbsAxes; i++) InitValuatorAxisStruct(pDevice, i+info.numRelAxes, - info.minval[i+1], info.maxval[i+1], + info.minval[i+1], 1280/*info.maxval[i+1]*/, info.res[i+1], info.minres[i+1], info.maxres[i+1]); #endif From 73fdc16bc4f4e21ff604b3f9ded23b40398fb1b6 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 30 Mar 2007 16:07:26 -0600 Subject: [PATCH 60/63] formatting fixes --- hw/dmx/input/dmxinputinit.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index d76dd9bc5..cf680517f 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -472,8 +472,10 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) memset(&info, 0, sizeof(info)); switch (what) { case DEVICE_INIT: - if (dmxLocal->init) dmxLocal->init(pDev); - if (dmxLocal->get_info) dmxLocal->get_info(pDev, &info); + if (dmxLocal->init) + dmxLocal->init(pDev); + if (dmxLocal->get_info) + dmxLocal->get_info(pDev, &info); if (info.keyboard) { /* XKEYBOARD makes this a special case */ dmxKeyboardOn(pDevice, &info); break; @@ -594,7 +596,8 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput) #if 00 /*BP*/ miPointerUpdate(); #endif - if (dmxInput->detached) return; + if (dmxInput->detached) + return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->process_input) { #if 11 /*BP*/ @@ -633,7 +636,8 @@ static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput, } #endif - if (dmxInput->detached) return; + if (dmxInput->detached) + return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->update_info) dmxInput->devs[i]->update_info(dmxInput->devs[i]->private, @@ -644,7 +648,8 @@ static void dmxCollectAll(DMXInputInfo *dmxInput) { int i; - if (dmxInput->detached) return; + if (dmxInput->detached) + return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->collect_events) dmxInput->devs[i]->collect_events(&dmxInput->devs[i] @@ -741,7 +746,8 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) char *devname; DMXInputInfo *dmxInput; - if (!dmxLocal) return NULL; + if (!dmxLocal) + return NULL; dmxInput = &dmxInputs[dmxLocal->inputIdx]; if (dmxLocal->sendsCore) { From 5257b32e492bd2082bef6a4cd0fea03ce093c0f8 Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Wed, 28 Mar 2007 15:51:24 -0700 Subject: [PATCH 61/63] Bump video driver ABI to 2.0 for cw change (commit 6ed08949af4f7ac09170d3d9581e4092b24a84ee). --- hw/xfree86/common/xf86Module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 281183960..8e644c433 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -84,7 +84,7 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 2) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(2, 0) #define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 5) From f2808005f4ee72c5fd7f5f3dcca181306485113e Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Sat, 31 Mar 2007 16:51:24 +0200 Subject: [PATCH 62/63] Bug #6620: Fixed a missing 'else' in ATIPseudoDMAInit(). Before this, we'd write some registers twice on R200 hardware and also possibly end up with a bad value in atis->cce_pri_size. --- hw/kdrive/ati/ati_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/kdrive/ati/ati_dma.c b/hw/kdrive/ati/ati_dma.c index f75ff12e7..70b86d36c 100644 --- a/hw/kdrive/ati/ati_dma.c +++ b/hw/kdrive/ati/ati_dma.c @@ -788,7 +788,7 @@ ATIPseudoDMAInit(ScreenPtr pScreen) atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & R200_CSQ_CNT_PRIMARY_MASK; MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN); - } if (atic->is_radeon) { + } else if (atic->is_radeon) { MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, RADEON_CSQ_PRIPIO_INDDIS); atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & From 96ce17aa94413c4b8bcb61cae71167050130a307 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 15 Nov 2006 17:50:02 +1030 Subject: [PATCH 63/63] o fix minor error in comment for GetPointerEvents() --- dix/getevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/getevents.c b/dix/getevents.c index 3f636bc80..219d1a1c8 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -470,7 +470,7 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type, /** - * Generate a series of xEvents (returned in xE) representing pointer + * Generate a series of xEvents (returned in events) representing pointer * motion, or button presses. Xi and XKB-aware. * * events is not NULL-terminated; the return value is the number of events.