Merge branch 'next' into for-keith

Conflicts:
	dix/devices.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2011-02-28 11:26:09 +10:00
commit c2207d11f2
40 changed files with 649 additions and 428 deletions

View file

@ -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) {

View file

@ -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;

View file

@ -584,10 +584,12 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
int px, py;
int pos[MAXDEVICES][2];
Bool useVirtual = FALSE;
int maxX = 0, maxY = 0;
Rotation oldRotation = randrp->rotation;
DeviceIntPtr dev;
Bool view_adjusted = FALSE;
randrp->rotation = rotation;
@ -597,7 +599,14 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
randrp->virtualY = scrp->virtualY;
}
miPointerGetPosition (inputInfo.pointer, &px, &py);
for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (!IsMaster(dev) && !IsFloating(dev))
continue;
miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
}
for (mode = scrp->modes; ; mode = mode->next)
{
if (randrp->maxX == 0 || randrp->maxY == 0)
@ -643,15 +652,28 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
/*
* Move the cursor back where it belongs; SwitchMode repositions it
* FIXME: duplicated code, see modes/xf86RandR12.c
*/
if (pScreen == miPointerGetScreen(inputInfo.pointer))
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;

View file

@ -317,8 +317,7 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
/* only update for VCP, otherwise we get cursor jumps when removing a
sprite. The second cursor is never HW rendered anyway. */
if (pDev == inputInfo.pointer ||
(!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
{
pCurs->refcnt++;
if (ScreenPriv->CurrentCursor)
@ -386,8 +385,7 @@ xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
/* only update coordinate state for first sprite, otherwise we get jumps
when removing a sprite. The second sprite is never HW rendered anyway */
if (pDev == inputInfo.pointer ||
(!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
{
ScreenPriv->x = x;
ScreenPriv->y = y;