diff options
Diffstat (limited to 'hw/dmx')
-rw-r--r-- | hw/dmx/Makefile.am | 10 | ||||
-rw-r--r-- | hw/dmx/dmxclient.h | 4 | ||||
-rw-r--r-- | hw/dmx/dmxcursor.c | 133 | ||||
-rw-r--r-- | hw/dmx/dmxinput.c | 3 | ||||
-rw-r--r-- | hw/dmx/dmxinput.h | 2 | ||||
-rw-r--r-- | hw/dmx/input/dmxbackend.c | 18 | ||||
-rw-r--r-- | hw/dmx/input/dmxevents.c | 267 | ||||
-rw-r--r-- | hw/dmx/input/dmxinputinit.c | 113 | ||||
-rw-r--r-- | hw/dmx/input/dmxxinput.c | 6 | ||||
-rw-r--r-- | hw/dmx/input/lnx-keyboard.c | 12 |
10 files changed, 501 insertions, 67 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 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 <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #undef XPointer #endif #include <X11/extensions/XIproto.h> diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c index e74a05215..a7d9378b0 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; @@ -179,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 = @@ -187,7 +195,7 @@ miPointerScreenFuncRec dmxPointerCursorFuncs = dmxCursorOffScreen, dmxCrossScreen, dmxWarpCursor, - dmxeqEnqueue, + dmxeqEnqueue, /*XXX incompatible type/function! */ dmxeqSwitchScreen }; @@ -198,7 +206,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 +221,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 +236,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 +247,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 +264,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 +273,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 +282,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 +325,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 +430,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 +503,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 +517,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 +540,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 +552,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 +763,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 +781,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 +794,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 +808,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 +827,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 +856,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; } } @@ -843,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); @@ -851,7 +897,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 +908,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; } } @@ -896,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/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 8985a1b1d..7efb2eebe 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 001 /*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,25 @@ 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); + /* fall-through */ +#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..fae2049b3 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" @@ -190,7 +191,135 @@ 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; + ScreenPtr pScreen; + int localX; + int localY; + int i; + + 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 ((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; @@ -199,6 +328,11 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) 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", @@ -213,14 +347,25 @@ 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 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,15 +373,31 @@ 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; + 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, @@ -259,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, @@ -508,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; + } } } @@ -604,16 +773,90 @@ 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("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 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[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: /* 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, 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: @@ -623,6 +866,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 +896,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..cf680517f 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) { @@ -420,14 +472,24 @@ 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; } 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,13 +497,19 @@ 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); + 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) { @@ -452,7 +520,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) { @@ -463,7 +531,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 @@ -520,12 +588,27 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput) { int i; + /* + ErrorF("%s\n", __FUNCTION__); + */ + dmxeqProcessInputEvents(); +#if 00 /*BP*/ miPointerUpdate(); - if (dmxInput->detached) return; +#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, @@ -553,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, @@ -564,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] @@ -661,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) { @@ -710,8 +796,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); |