Merge branch 'master' of ssh://herrb@git.freedesktop.org/git/xorg/xserver

This commit is contained in:
Matthieu Herrb 2007-04-03 16:04:45 +02:00
commit 1cc8db7281
9 changed files with 186 additions and 311 deletions

View File

@ -242,11 +242,7 @@ static int dmxBackendOffscreen(int screen, int x, int y)
void dmxBackendUpdatePosition(pointer private, int x, int y) void dmxBackendUpdatePosition(pointer private, int x, int y)
{ {
GETPRIVFROMPRIVATE; GETPRIVFROMPRIVATE;
#if 00 /*BP*/
int screen = miPointerCurrentScreen()->myNum;
#else
int screen = miPointerGetScreen(inputInfo.pointer)->myNum; int screen = miPointerGetScreen(inputInfo.pointer)->myNum;
#endif
DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen];
int oldRelative = priv->relative; int oldRelative = priv->relative;
int topscreen = dmxBackendFindOverlapping(priv, screen, x, y); int topscreen = dmxBackendFindOverlapping(priv, screen, x, y);
@ -358,7 +354,8 @@ void dmxBackendCollectEvents(DevicePtr pDev,
switch (X.type) { switch (X.type) {
case EnterNotify: case EnterNotify:
dmxCommonSaveState(priv); dmxCommonSaveState(priv);
if (entered++) continue; if (entered++)
continue;
priv->entered = 1; priv->entered = 1;
ignoreLeave = 1; ignoreLeave = 1;
DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n", DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n",
@ -382,7 +379,8 @@ void dmxBackendCollectEvents(DevicePtr pDev,
continue; continue;
} }
dmxCommonRestoreState(priv); dmxCommonRestoreState(priv);
if (left++) continue; if (left++)
continue;
DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n", DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n",
X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
X.xcrossing.detail, X.xcrossing.focus, X.xcrossing.detail, X.xcrossing.focus,
@ -395,7 +393,6 @@ void dmxBackendCollectEvents(DevicePtr pDev,
} }
break; break;
case MotionNotify: case MotionNotify:
#if 001 /*BP*/
DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)" DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
" newscreen=%d: %d %d (e=%d; last=%d,%d)\n", " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
dmxScreen->index, priv->myScreen, dmxScreen->index, priv->myScreen,
@ -403,7 +400,8 @@ void dmxBackendCollectEvents(DevicePtr pDev,
priv->newscreen, priv->newscreen,
X.xmotion.x, X.xmotion.y, X.xmotion.x, X.xmotion.y,
entered, priv->lastX, priv->lastY); entered, priv->lastX, priv->lastY);
if (dmxBackendPendingMotionEvent(priv, TRUE)) continue; if (dmxBackendPendingMotionEvent(priv, TRUE))
continue;
if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window))) if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window)))
dmxLog(dmxFatal, dmxLog(dmxFatal,
" Event on non-existant window %lu\n", " Event on non-existant window %lu\n",
@ -448,25 +446,15 @@ void dmxBackendCollectEvents(DevicePtr pDev,
(dmxScreen->rootYOrigin + X.xmotion.y (dmxScreen->rootYOrigin + X.xmotion.y
- dmxScreen->rootY)); - 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; break;
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:
enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
break; break;
#if 11/*BP*/
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
ErrorF("press/release at %d, %d\n", X.xbutton.x, X.xbutton.y); /* fall-through */
/* fall-through */
#endif
default: default:
/* Pass the whole event here, because /* Pass the whole event here, because
* this may be an extension event. */ * this may be an extension event. */
@ -589,12 +577,16 @@ void dmxBackendInit(DevicePtr pDev)
/** Get information about the backend pointer (for initialization). */ /** Get information about the backend pointer (for initialization). */
void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{ {
const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev);
info->buttonClass = 1; info->buttonClass = 1;
dmxCommonMouGetMap(pDev, info->map, &info->numButtons); dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
info->valuatorClass = 1; info->valuatorClass = 1;
info->numRelAxes = 2; info->numRelAxes = 2;
info->minval[0] = 0; info->minval[0] = 0;
info->maxval[0] = 0; info->minval[1] = 0;
info->maxval[0] = dmxScreen->beWidth;
info->maxval[1] = dmxScreen->beHeight;
info->res[0] = 1; info->res[0] = 1;
info->minres[0] = 0; info->minres[0] = 0;
info->maxres[0] = 1; info->maxres[0] = 1;

View File

@ -241,13 +241,15 @@ void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
/* Compute pModMap */ /* Compute pModMap */
modifier_mapping = XGetModifierMapping(priv->display); modifier_mapping = XGetModifierMapping(priv->display);
for (i = 0; i < MAP_LENGTH; i++) pModMap[i] = 0; for (i = 0; i < MAP_LENGTH; i++)
pModMap[i] = 0;
for (j = 0; j < 8; j++) { for (j = 0; j < 8; j++) {
int max_keypermod = modifier_mapping->max_keypermod; int max_keypermod = modifier_mapping->max_keypermod;
for (i = 0; i < max_keypermod; i++) { for (i = 0; i < max_keypermod; i++) {
CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i]; CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i];
if (keycode) pModMap[keycode] |= 1 << j; if (keycode)
pModMap[keycode] |= 1 << j;
} }
} }
XFreeModifiermap(modifier_mapping); XFreeModifiermap(modifier_mapping);
@ -611,6 +613,7 @@ void dmxCommonSaveState(pointer private)
&priv->dmxLocal->kctrl); &priv->dmxLocal->kctrl);
priv->savedModMap = XGetModifierMapping(priv->display); priv->savedModMap = XGetModifierMapping(priv->display);
modmap = XNewModifiermap(0); modmap = XNewModifiermap(0);
XSetModifierMapping(priv->display, modmap); XSetModifierMapping(priv->display, modmap);
if (dmxInput->scrnIdx != -1) if (dmxInput->scrnIdx != -1)
@ -627,8 +630,10 @@ void dmxCommonRestoreState(pointer private)
int retcode = -1; int retcode = -1;
CARD32 start; CARD32 start;
if (dmxInput->console) priv = dmxInput->devs[0]->private; if (dmxInput->console)
if (!priv->stateSaved) return; priv = dmxInput->devs[0]->private;
if (!priv->stateSaved)
return;
priv->stateSaved = 0; priv->stateSaved = 0;
DMXDBG0("dmxCommonRestoreState\n"); DMXDBG0("dmxCommonRestoreState\n");
@ -645,7 +650,8 @@ void dmxCommonRestoreState(pointer private)
CARD32 tmp; CARD32 tmp;
retcode = XSetModifierMapping(priv->display, priv->savedModMap); retcode = XSetModifierMapping(priv->display, priv->savedModMap);
if (retcode == MappingSuccess) break; if (retcode == MappingSuccess)
break;
if (retcode == MappingBusy) if (retcode == MappingBusy)
dmxLogInput(dmxInput, "Keyboard busy, waiting\n"); dmxLogInput(dmxInput, "Keyboard busy, waiting\n");
else else

View File

@ -860,12 +860,17 @@ void dmxConsoleInit(DevicePtr pDev)
* for pointers. */ * for pointers. */
void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{ {
GETPRIVFROMPDEV;
info->buttonClass = 1; info->buttonClass = 1;
dmxCommonMouGetMap(pDev, info->map, &info->numButtons); dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
info->valuatorClass = 1; info->valuatorClass = 1;
info->numRelAxes = 2; info->numRelAxes = 2;
info->minval[0] = 0; info->minval[0] = 0;
info->maxval[0] = 0; info->minval[1] = 0;
/* max possible console window size: */
info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display));
info->maxval[1] = DisplayHeight(priv->display, DefaultScreen(priv->display));
info->res[0] = 1; info->res[0] = 1;
info->minres[0] = 0; info->minres[0] = 0;
info->maxres[0] = 1; info->maxres[0] = 1;

View File

@ -79,7 +79,9 @@ void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
info->valuatorClass = 1; info->valuatorClass = 1;
info->numRelAxes = 2; info->numRelAxes = 2;
info->minval[0] = 0; info->minval[0] = 0;
info->minval[1] = 0;
info->maxval[0] = 0; info->maxval[0] = 0;
info->maxval[1] = 0;
info->res[0] = 1; info->res[0] = 1;
info->minres[0] = 0; info->minres[0] = 0;
info->maxres[0] = 1; info->maxres[0] = 1;

View File

@ -109,10 +109,11 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
else if (dmxLocal->pDevice->key) else if (dmxLocal->pDevice->key)
state = dmxLocal->pDevice->key->state; state = dmxLocal->pDevice->key->state;
DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n", ErrorF/*DMXDBG3*/("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
keySym, type == KeyPress ? "press" : "release", state); keySym, type == KeyPress ? "press" : "release", state);
if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0; if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
return 0;
switch (keySym) { switch (keySym) {
case XK_g: case XK_g:
@ -147,16 +148,25 @@ static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e,
int type = e->u.u.type; int type = e->u.u.type;
switch (e->u.u.type) { switch (e->u.u.type) {
case KeyPress: type = DeviceKeyPress; break; case KeyPress:
case KeyRelease: type = DeviceKeyRelease; break; type = DeviceKeyPress;
case ButtonPress: type = DeviceButtonPress; break; break;
case ButtonRelease: type = DeviceButtonRelease; break; case KeyRelease:
type = DeviceKeyRelease;
break;
case ButtonPress:
type = DeviceButtonPress;
break;
case ButtonRelease:
type = DeviceButtonRelease;
break;
case MotionNotify: case MotionNotify:
dmxLog(dmxError, dmxLog(dmxError,
"dmxEnqueueExtEvent: MotionNotify not allowed here\n"); "dmxEnqueueExtEvent: MotionNotify not allowed here\n");
return; return;
default: default:
if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut) break; if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut)
break;
dmxLogInput(dmxInput, dmxLogInput(dmxInput,
"dmxEnqueueExtEvent: Unhandled %s event (%d)\n", "dmxEnqueueExtEvent: Unhandled %s event (%d)\n",
e->u.u.type >= LASTEvent ? "extension" : "non-extension", e->u.u.type >= LASTEvent ? "extension" : "non-extension",
@ -174,9 +184,11 @@ static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e,
xv->num_valuators = 0; xv->num_valuators = 0;
xv->first_valuator = 0; xv->first_valuator = 0;
if (block) dmxSigioBlock(); if (block)
dmxSigioBlock();
dmxeqEnqueue(xE); dmxeqEnqueue(xE);
if (block) dmxSigioUnblock(); if (block)
dmxSigioUnblock();
} }
#endif #endif
@ -186,38 +198,27 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y)
for (i = 0; i < dmxNumScreens; i++) { for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i]; DMXScreenInfo *dmxScreen = &dmxScreens[i];
if (dmxOnScreen(x, y, dmxScreen)) return dmxScreen; if (dmxOnScreen(x, y, dmxScreen))
return dmxScreen;
} }
return NULL; return NULL;
} }
#if 11/*BP*/ /**
* Enqueue a motion event.
*/
static void enqueueMotion(DevicePtr pDev, int x, int y) static void enqueueMotion(DevicePtr pDev, int x, int y)
{ {
GETDMXINPUTFROMPDEV; GETDMXLOCALFROMPDEV;
DeviceIntPtr p = dmxLocal->pDevice; DeviceIntPtr p = dmxLocal->pDevice;
int i, nevents, valuators[3]; int i, nevents, valuators[3];
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
int detail = 0; int detail = 0; /* XXX should this be mask of pressed buttons? */
valuators[0] = x; valuators[0] = x;
valuators[1] = y; valuators[1] = y;
valuators[2] = detail; nevents = GetPointerEvents(events, p, MotionNotify, detail,
nevents = GetPointerEvents(events, POINTER_ABSOLUTE, 0, 2, valuators);
/*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++) for (i = 0; i < nevents; i++)
mieqEnqueue(p, events + i); mieqEnqueue(p, events + i);
xfree(events); xfree(events);
@ -225,8 +226,8 @@ static void enqueueMotion(DevicePtr pDev, int x, int y)
} }
static void void
dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
{ {
DMXScreenInfo *dmxScreen; DMXScreenInfo *dmxScreen;
DMXInputInfo *dmxInput; DMXInputInfo *dmxInput;
@ -235,7 +236,8 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
int localY; int localY;
int i; int i;
if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return; if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
return;
DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
x, y, delta, dmxGlobalX, dmxGlobalY); x, y, delta, dmxGlobalX, dmxGlobalY);
@ -244,12 +246,14 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
dmxGlobalX = x; dmxGlobalX = x;
dmxGlobalY = y; dmxGlobalY = y;
if (dmxGlobalX < 0) dmxGlobalX = 0; if (dmxGlobalX < 0)
if (dmxGlobalY < 0) dmxGlobalY = 0; dmxGlobalX = 0;
if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; if (dmxGlobalY < 0)
if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; dmxGlobalY = 0;
if (dmxGlobalX >= dmxGlobalWidth)
ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY); dmxGlobalX = dmxGlobalWidth + delta -1;
if (dmxGlobalY >= dmxGlobalHeight)
dmxGlobalY = dmxGlobalHeight + delta -1;
if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
localX = dmxGlobalX - dmxScreen->rootXOrigin; localX = dmxGlobalX - dmxScreen->rootXOrigin;
@ -259,13 +263,8 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
/* Screen is old screen */ /* Screen is old screen */
if (block) if (block)
dmxSigioBlock(); dmxSigioBlock();
#if 000
miPointerSetPosition(inputInfo.pointer, &localX, &localY,
GetTimeInMillis());
#else
if (pDev) if (pDev)
enqueueMotion(pDev, localX, localY); enqueueMotion(pDev, localX, localY);
#endif
if (block) if (block)
dmxSigioUnblock(); dmxSigioUnblock();
} else { } else {
@ -277,13 +276,8 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
dmxeqProcessInputEvents(); dmxeqProcessInputEvents();
miPointerSetScreen(inputInfo.pointer, dmxScreen->index, miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
localX, localY); localX, localY);
#if 000
miPointerSetPosition(inputInfo.pointer, &localX, &localY,
GetTimeInMillis());
#else
if (pDev) if (pDev)
enqueueMotion(pDev, localX, localY); enqueueMotion(pDev, localX, localY);
#endif
if (block) if (block)
dmxSigioUnblock(); dmxSigioUnblock();
} }
@ -307,109 +301,6 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
* drivers */ * drivers */
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
int j; 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;
#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 */
DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
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;
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,
dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
localX, localY);
}
}
/* 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) for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
if (!dmxInput->detached if (!dmxInput->detached
&& dmxInput->devs[j]->sendsCore && dmxInput->devs[j]->sendsCore
@ -512,10 +403,12 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
} }
} }
if (block) dmxSigioBlock(); if (block)
dmxSigioBlock();
dmxPointerPutMotionEvent(pDevice, firstAxis, axesCount, v, xev->time); dmxPointerPutMotionEvent(pDevice, firstAxis, axesCount, v, xev->time);
dmxeqEnqueue(xE); dmxeqEnqueue(xE);
if (block) dmxSigioUnblock(); if (block)
dmxSigioUnblock();
} }
static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
@ -529,7 +422,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e; XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e;
XDeviceMotionEvent *me = (XDeviceMotionEvent *)e; XDeviceMotionEvent *me = (XDeviceMotionEvent *)e;
if (!e) return -1; /* No extended event passed, cannot handle */ if (!e)
return -1; /* No extended event passed, cannot handle */
if ((XID)dmxLocal->deviceId != ke->deviceid) { if ((XID)dmxLocal->deviceId != ke->deviceid) {
/* Search for the correct dmxLocal, /* Search for the correct dmxLocal,
@ -540,7 +434,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
for (i = 0; i < dmxInput->numDevs; i++) { for (i = 0; i < dmxInput->numDevs; i++) {
dmxLocal = dmxInput->devs[i]; dmxLocal = dmxInput->devs[i];
if ((XID)dmxLocal->deviceId == ke->deviceid) break; if ((XID)dmxLocal->deviceId == ke->deviceid)
break;
} }
} }
@ -589,9 +484,11 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
xv->valuator4 = ke->axis_data[4]; xv->valuator4 = ke->axis_data[4];
xv->valuator5 = ke->axis_data[5]; xv->valuator5 = ke->axis_data[5];
if (block) dmxSigioBlock(); if (block)
dmxSigioBlock();
dmxeqEnqueue(xE); dmxeqEnqueue(xE);
if (block) dmxSigioUnblock(); if (block)
dmxSigioUnblock();
break; break;
case XI_DeviceMotionNotify: case XI_DeviceMotionNotify:
@ -694,7 +591,8 @@ static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key) if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
return NoSymbol; return NoSymbol;
pKeySyms = &dmxLocal->pDevice->key->curKeySyms; pKeySyms = &dmxLocal->pDevice->key->curKeySyms;
if (!pKeySyms) return NoSymbol; if (!pKeySyms)
return NoSymbol;
if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) { if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) {
DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n", DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
@ -743,14 +641,16 @@ static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
dmxLocal->pDevice->name); dmxLocal->pDevice->name);
return NoSymbol; return NoSymbol;
} }
if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail); if (!keySym)
if (keySym == NoSymbol) return detail; keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
if (keySym == NoSymbol)
return detail;
keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail); keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail);
return keyCode ? keyCode : detail; return keyCode ? keyCode : detail;
} }
/** Enqueue a non-motion event from the \a pDev device with the /** Enqueue an event from the \a pDev device with the
* specified \a type and \a detail. If the event is a KeyPress or * specified \a type and \a detail. If the event is a KeyPress or
* KeyRelease event, then the \a keySym is also specified. * KeyRelease event, then the \a keySym is also specified.
* *
@ -762,103 +662,56 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
{ {
GETDMXINPUTFROMPDEV; GETDMXINPUTFROMPDEV;
xEvent xE; xEvent xE;
DeviceIntPtr p = dmxLocal->pDevice;
int i, nevents, valuators[3];
xEvent *events;
DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail); DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail);
switch (type) { switch (type) {
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:
if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail); if (!keySym)
keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
if (dmxCheckFunctionKeys(dmxLocal, type, keySym)) if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
return; return;
if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
xE.u.u.detail = dmxFixup(pDev, detail, keySym); xE.u.u.detail = dmxFixup(pDev, detail, keySym);
#if 11/*BP*/
{ events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
DeviceIntPtr p = dmxLocal->pDevice; ErrorF("KEY %d sym %d\n", detail, (int) keySym);
int i, nevents; nevents = GetKeyboardEvents(events, p, type, detail);
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); for (i = 0; i < nevents; i++)
nevents = GetKeyboardEvents(events, mieqEnqueue(p, events + i);
/*pDev*/p, xfree(events);
/*KeyPress*/type, return;
/*n*/detail);
ErrorF("KEY %d n=%d\n", detail, nevents);
for (i = 0; i < nevents; i++)
mieqEnqueue(p, events + i);
xfree(events);
return;
}
#endif
break;
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
#if 00 /*BP*/
detail = dmxGetButtonMapping(dmxLocal, detail); detail = dmxGetButtonMapping(dmxLocal, detail);
#else events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
{ nevents = GetPointerEvents(events, p, type, detail,
DeviceIntPtr p = dmxLocal->pDevice; POINTER_ABSOLUTE,
int i, nevents, valuators[3]; 0, /* first_valuator = 0 */
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); 0, /* num_valuators = 0 */
valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(p, events + i);
xfree(events);
return;
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, 2/*3*/, valuators);
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);
return;
}
#endif
break;
case MotionNotify: case MotionNotify:
/* All MotionNotify events should be sent via dmxCoreMotion and events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
* dmxExtMotion -- no input driver should build motion events by valuators[0] = e->xmotion.x;
* hand. */ valuators[1] = e->xmotion.y;
#if 00 /*BP*/ valuators[2] = e->xmotion.state;
dmxLog(dmxError, "dmxEnqueueXEvent: MotionNotify not allowed here\n"); nevents = GetPointerEvents(events, p, type, detail,
#else POINTER_ABSOLUTE, 0, 3, valuators);
{ for (i = 0; i < nevents; i++)
DeviceIntPtr p = dmxLocal->pDevice; mieqEnqueue(p, events + i);
int i, nevents, valuators[3]; xfree(events);
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); return;
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, 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",
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: case EnterNotify:
case LeaveNotify: case LeaveNotify:
case KeymapNotify: case KeymapNotify:
@ -866,12 +719,12 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
* modifier map on the backend/console * modifier map on the backend/console
* input device so that we have complete * input device so that we have complete
* control of the input device LEDs. */ * control of the input device LEDs. */
ErrorF("Enter/Leave/Keymap/Mapping\n");
return; return;
default: default:
#ifdef XINPUT #ifdef XINPUT
if (type == ProximityIn || type == ProximityOut) { if (type == ProximityIn || type == ProximityOut) {
if (dmxLocal->sendsCore) return; /* Not a core event */ if (dmxLocal->sendsCore)
return; /* Not a core event */
break; break;
} }
#endif #endif
@ -887,25 +740,19 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
return; return;
} }
#if 00 /* dead code? */
memset(&xE, 0, sizeof(xE)); memset(&xE, 0, sizeof(xE));
xE.u.u.type = type; xE.u.u.type = type;
xE.u.u.detail = detail; xE.u.u.detail = detail;
xE.u.keyButtonPointer.time = GetTimeInMillis(); xE.u.keyButtonPointer.time = GetTimeInMillis();
#ifdef XINPUT #ifdef XINPUT
if (!dmxLocal->sendsCore) dmxEnqueueExtEvent(dmxLocal, &xE, block); if (!dmxLocal->sendsCore)
dmxEnqueueExtEvent(dmxLocal, &xE, block);
else else
#endif #endif
#if 00 /*BP*/
dmxeqEnqueue(&xE); dmxeqEnqueue(&xE);
#else #endif /*00*/
/* 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 /** A pointer to this routine is passed to low-level input drivers so

View File

@ -505,11 +505,10 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
GetMaximumEventsNum(), GetMaximumEventsNum(),
#endif #endif
Relative); Relative);
ErrorF("MOTION BUFFER SIZE %d\n", GetMaximumEventsNum());
#ifdef XINPUT #ifdef XINPUT
for (i = 0; i < info.numRelAxes; i++) for (i = 0; i < info.numRelAxes; i++)
InitValuatorAxisStruct(pDevice, i, info.minval[0], 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]); info.minres[0], info.maxres[0]);
#endif #endif
} else if (info.numRelAxes) { } else if (info.numRelAxes) {
@ -520,7 +519,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
#ifdef XINPUT #ifdef XINPUT
for (i = 0; i < info.numRelAxes; i++) for (i = 0; i < info.numRelAxes; i++)
InitValuatorAxisStruct(pDevice, i, info.minval[0], 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]); info.minres[0], info.maxres[0]);
#endif #endif
} else if (info.numAbsAxes) { } else if (info.numAbsAxes) {
@ -531,7 +530,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
#ifdef XINPUT #ifdef XINPUT
for (i = 0; i < info.numAbsAxes; i++) for (i = 0; i < info.numAbsAxes; i++)
InitValuatorAxisStruct(pDevice, i+info.numRelAxes, 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.res[i+1], info.minres[i+1],
info.maxres[i+1]); info.maxres[i+1]);
#endif #endif
@ -588,10 +587,6 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput)
{ {
int i; int i;
/*
ErrorF("%s\n", __FUNCTION__);
*/
dmxeqProcessInputEvents(); dmxeqProcessInputEvents();
#if 00 /*BP*/ #if 00 /*BP*/
miPointerUpdate(); miPointerUpdate();

View File

@ -958,6 +958,10 @@ the driver-specific documentation recommends it.
This optional entry specifies the pixel clock frequency that is used This optional entry specifies the pixel clock frequency that is used
for the regular text mode. The frequency is specified in MHz. This is for the regular text mode. The frequency is specified in MHz. This is
rarely used. rarely used.
.TP 7
.BI "Option \*qModeDebug\*q \*q" boolean \*q
Enable printing of additional debugging information about modesetting to
the server log.
.ig .ig
.TP 7 .TP 7
This optional entry allows an IRQ number to be specified. This optional entry allows an IRQ number to be specified.

View File

@ -377,6 +377,15 @@ static OptionInfoRec xf86OutputOptions[] = {
{-1, NULL, OPTV_NONE, {0}, FALSE }, {-1, NULL, OPTV_NONE, {0}, FALSE },
}; };
enum {
OPTION_MODEDEBUG,
};
static OptionInfoRec xf86DeviceOptions[] = {
{OPTION_MODEDEBUG, "ModeDebug", OPTV_STRING, {0}, FALSE },
{-1, NULL, OPTV_NONE, {0}, FALSE },
};
static void static void
xf86OutputSetMonitor (xf86OutputPtr output) xf86OutputSetMonitor (xf86OutputPtr output)
{ {
@ -589,7 +598,6 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen)
{ {
xf86OutputPtr output = config->output[o]; xf86OutputPtr output = config->output[o];
output->crtc = NULL;
output->randr_output = NULL; output->randr_output = NULL;
} }
for (c = 0; c < config->num_crtc; c++) for (c = 0; c < config->num_crtc; c++)
@ -1160,8 +1168,6 @@ xf86SortModes (DisplayModePtr input)
return output; return output;
} }
#define DEBUG_REPROBE 1
void void
xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
{ {
@ -1330,7 +1336,8 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
if (mode->status == MODE_OK) if (mode->status == MODE_OK)
mode->status = (*output->funcs->mode_valid)(output, mode); mode->status = (*output->funcs->mode_valid)(output, mode);
xf86PruneInvalidModes(scrn, &output->probed_modes, TRUE); xf86PruneInvalidModes(scrn, &output->probed_modes,
config->debug_modes);
output->probed_modes = xf86SortModes (output->probed_modes); output->probed_modes = xf86SortModes (output->probed_modes);
@ -1363,17 +1370,17 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
output->initial_rotation = xf86OutputInitialRotation (output); output->initial_rotation = xf86OutputInitialRotation (output);
#ifdef DEBUG_REPROBE if (config->debug_modes) {
if (output->probed_modes != NULL) { if (output->probed_modes != NULL) {
xf86DrvMsg(scrn->scrnIndex, X_INFO, xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Printing probed modes for output %s\n", "Printing probed modes for output %s\n",
output->name); output->name);
} else { } else {
xf86DrvMsg(scrn->scrnIndex, X_INFO, xf86DrvMsg(scrn->scrnIndex, X_INFO,
"No remaining probed modes for output %s\n", "No remaining probed modes for output %s\n",
output->name); output->name);
}
} }
#endif
for (mode = output->probed_modes; mode != NULL; mode = mode->next) for (mode = output->probed_modes; mode != NULL; mode = mode->next)
{ {
/* The code to choose the best mode per pipe later on will require /* The code to choose the best mode per pipe later on will require
@ -1382,9 +1389,8 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
mode->VRefresh = xf86ModeVRefresh(mode); mode->VRefresh = xf86ModeVRefresh(mode);
xf86SetModeCrtc(mode, INTERLACE_HALVE_V); xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
#ifdef DEBUG_REPROBE if (config->debug_modes)
xf86PrintModeline(scrn->scrnIndex, mode); xf86PrintModeline(scrn->scrnIndex, mode);
#endif
} }
} }
} }
@ -1479,6 +1485,15 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
int width; int width;
int height; int height;
/* Set up the device options */
config->options = xnfalloc (sizeof (xf86DeviceOptions));
memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions));
xf86ProcessOptions (scrn->scrnIndex,
scrn->options,
config->options);
config->debug_modes = xf86ReturnOptValBool (config->options,
OPTION_MODEDEBUG, FALSE);
if (scrn->display->virtualX) if (scrn->display->virtualX)
width = scrn->display->virtualX; width = scrn->display->virtualX;
else else
@ -1962,9 +1977,11 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
output->MonInfo = edid_mon; output->MonInfo = edid_mon;
/* Debug info for now, at least */ if (config->debug_modes) {
xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n", output->name); xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
xf86PrintEDID(edid_mon); output->name);
xf86PrintEDID(edid_mon);
}
/* Set the DDC properties for the 'compat' output */ /* Set the DDC properties for the 'compat' output */
if (output == config->output[config->compat_output]) if (output == config->output[config->compat_output])

View File

@ -552,6 +552,13 @@ typedef struct _xf86CrtcConfig {
CARD8 *cursor_image; CARD8 *cursor_image;
Bool cursor_on; Bool cursor_on;
CARD32 cursor_fg, cursor_bg; CARD32 cursor_fg, cursor_bg;
/**
* Options parsed from the related device section
*/
OptionInfoPtr options;
Bool debug_modes;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr; } xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern int xf86CrtcConfigPrivateIndex; extern int xf86CrtcConfigPrivateIndex;