diff options
author | Brian <brian@yutani.localnet.net> | 2007-03-30 13:19:33 -0600 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-03-30 13:19:33 -0600 |
commit | 92e8cdbd32b0d86cabd4ad88e3240bf90c018b9a (patch) | |
tree | b84873460aa2203c2c629f930810c156f2ecf2a0 /hw/dmx | |
parent | d92da3d5f309392ac398c0975ef17bb04312d5e2 (diff) |
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.
Diffstat (limited to 'hw/dmx')
-rw-r--r-- | hw/dmx/dmxcursor.c | 12 | ||||
-rw-r--r-- | hw/dmx/dmxinput.c | 3 | ||||
-rw-r--r-- | hw/dmx/input/dmxbackend.c | 19 | ||||
-rw-r--r-- | hw/dmx/input/dmxevents.c | 106 | ||||
-rw-r--r-- | hw/dmx/input/dmxinputinit.c | 88 | ||||
-rw-r--r-- | hw/dmx/input/dmxxinput.c | 6 | ||||
-rw-r--r-- | 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 <X11/extensions/XI.h> @@ -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 <sys/kd.h> #include <termios.h> #include "atKeynames.h" +#if 00 #include "xf86Keymap.h" +#endif #include <linux/keyboard.h> #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); |