diff options
author | Keith Packard <keithp@keithp.com> | 2011-03-03 14:41:44 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-03-03 14:41:44 -0800 |
commit | 6c90e839d9872a37d371578c9c423e8213922044 (patch) | |
tree | 72148d81e7c54d16afeccab026caf8faf8db3b6e /hw/xfree86/common | |
parent | 0bc95d5b06dcea65a1aa193ea907b50f7dd168b5 (diff) | |
parent | edcceedbd35df576929685767d0b619659e5b020 (diff) |
Merge remote branch 'whot/for-keith'
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r-- | hw/xfree86/common/xf86Config.c | 6 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Option.c | 77 | ||||
-rw-r--r-- | hw/xfree86/common/xf86RandR.c | 37 |
3 files changed, 83 insertions, 37 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 49d8fa84a..9602e899f 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -1224,7 +1224,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) devs[count - 1] = xnfalloc(sizeof(InputInfoRec)); *devs[count - 1] = Pointer; devs[count - 1]->options = - xf86addNewOption(NULL, xnfstrdup("CorePointer"), NULL); + xf86addNewOption(devs[count -1]->options, + xnfstrdup("CorePointer"), NULL); devs[count] = NULL; servlayoutp->inputs = devs; } @@ -1364,7 +1365,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) devs[count - 1] = xnfalloc(sizeof(InputInfoRec)); *devs[count - 1] = Keyboard; devs[count - 1]->options = - xf86addNewOption(NULL, xnfstrdup("CoreKeyboard"), NULL); + xf86addNewOption(devs[count - 1]->options, + xnfstrdup("CoreKeyboard"), NULL); devs[count] = NULL; servlayoutp->inputs = devs; } diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c index 16c27e5ee..480f38694 100644 --- a/hw/xfree86/common/xf86Option.c +++ b/hw/xfree86/common/xf86Option.c @@ -212,7 +212,7 @@ LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed) return deflt; } -static int +static double LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUsed) { OptionInfoRec o; @@ -496,27 +496,33 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, switch (p->type) { case OPTV_INTEGER: if (*s == '\0') { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an integer value\n", - p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires an integer value\n", + p->name); + } p->found = FALSE; } else { p->value.num = strtoul(s, &end, 0); if (*end == '\0') { p->found = TRUE; } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an integer value\n", - p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires an integer value\n", + p->name); + } p->found = FALSE; } } break; case OPTV_STRING: if (*s == '\0') { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an string value\n", - p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires an string value\n", + p->name); + } p->found = FALSE; } else { p->value.str = s; @@ -529,18 +535,22 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, break; case OPTV_REAL: if (*s == '\0') { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a floating point value\n", - p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires a floating point " + "value\n", p->name); + } p->found = FALSE; } else { p->value.realnum = strtod(s, &end); if (*end == '\0') { p->found = TRUE; } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a floating point value\n", - p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires a floating point " + "value\n", p->name); + } p->found = FALSE; } } @@ -549,8 +559,11 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, if (GetBoolValue(p, s)) { p->found = TRUE; } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a boolean value\n", p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires a boolean value\n", + p->name); + } p->found = FALSE; } break; @@ -561,8 +574,10 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, * hence 100 looks the same as 100% to the caller of sccanf */ if (sscanf(s, "%lf%c", &p->value.realnum, &tmp) != 2 || tmp != '%') { - xf86DrvMsg(scrnIndex, X_WARNING, + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" requires a percent value\n", p->name); + } p->found = FALSE; } else { p->found = TRUE; @@ -571,9 +586,11 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, break; case OPTV_FREQ: if (*s == '\0') { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a frequency value\n", - p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires a frequency value\n", + p->name); + } p->found = FALSE; } else { double freq = strtod(s, &end); @@ -590,17 +607,21 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, !xf86NameCmp(end, "M")) units = 1000000; else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a frequency value\n", - p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires a frequency value\n", + p->name); + } p->found = FALSE; } if (p->found) freq *= (double)units; } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a frequency value\n", - p->name); + if (markUsed) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Option \"%s\" requires a frequency value\n", + p->name); + } p->found = FALSE; } if (p->found) { diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c index d7ffff4ca..4663d0366 100644 --- a/hw/xfree86/common/xf86RandR.c +++ b/hw/xfree86/common/xf86RandR.c @@ -242,11 +242,20 @@ xf86RandRSetConfig (ScreenPtr pScreen, ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; - int px, py; + int pos[MAXDEVICES][2]; Bool useVirtual = FALSE; Rotation oldRotation = randrp->rotation; + DeviceIntPtr dev; + Bool view_adjusted = FALSE; + + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (!IsMaster(dev) && !IsFloating(dev)) + continue; + + miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]); + } - miPointerGetPosition(inputInfo.pointer, &px, &py); for (mode = scrp->modes; ; mode = mode->next) { if (mode->HDisplay == pSize->width && @@ -303,17 +312,31 @@ xf86RandRSetConfig (ScreenPtr pScreen, } return FALSE; } + /* * Move the cursor back where it belongs; SwitchMode repositions it + * FIXME: duplicated code, see modes/xf86RandR12.c */ - if (pScreen == miPointerCurrentScreen ()) + for (dev = inputInfo.devices; dev; dev = dev->next) { - px = (px >= pScreen->width ? (pScreen->width - 1) : px); - py = (py >= pScreen->height ? (pScreen->height - 1) : py); + if (!IsMaster(dev) && !IsFloating(dev)) + continue; - xf86SetViewport(pScreen, px, py); + if (pScreen == miPointerGetScreen(dev)) { + int px = pos[dev->id][0]; + int py = pos[dev->id][1]; - (*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE); + px = (px >= pScreen->width ? (pScreen->width - 1) : px); + py = (py >= pScreen->height ? (pScreen->height - 1) : py); + + /* Setting the viewpoint makes only sense on one device */ + if (!view_adjusted && IsMaster(dev)) { + xf86SetViewport(pScreen, px, py); + view_adjusted = TRUE; + } + + (*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE); + } } return TRUE; |