diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/kdrive/ati/ati_cursor.c | 20 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyr.c | 2 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrinit.c | 8 | ||||
-rw-r--r-- | hw/kdrive/i810/i810_cursor.c | 11 | ||||
-rw-r--r-- | hw/kdrive/src/kinput.c | 6 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Config.c | 2 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Cursor.c | 61 | ||||
-rw-r--r-- | hw/xfree86/common/xf86DGA.c | 37 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Events.c | 24 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Priv.h | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86RandR.c | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 113 | ||||
-rw-r--r-- | hw/xfree86/dixmods/extmod/dgaproc.h | 7 | ||||
-rw-r--r-- | hw/xfree86/dri/dri.c | 3 | ||||
-rw-r--r-- | hw/xfree86/loader/xf86sym.c | 3 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Cursors.c | 3 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86RandR12.c | 7 | ||||
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_agp.c | 1 | ||||
-rw-r--r-- | hw/xfree86/rac/xf86RAC.c | 74 | ||||
-rw-r--r-- | hw/xfree86/ramdac/xf86Cursor.c | 67 | ||||
-rw-r--r-- | hw/xfree86/ramdac/xf86HWCurs.c | 4 | ||||
-rw-r--r-- | hw/xnest/Events.c | 3 | ||||
-rwxr-xr-x | hw/xwin/winwin32rootlesswndproc.c | 8 |
23 files changed, 307 insertions, 163 deletions
diff --git a/hw/kdrive/ati/ati_cursor.c b/hw/kdrive/ati/ati_cursor.c index d2ce686df..0e9715118 100644 --- a/hw/kdrive/ati/ati_cursor.c +++ b/hw/kdrive/ati/ati_cursor.c @@ -27,9 +27,10 @@ #include "ati_reg.h" #include "cursorstr.h" #include "ati_draw.h" +#include "inputstr.h" static void -ATIMoveCursor(ScreenPtr pScreen, int x, int y) +ATIMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { KdScreenPriv(pScreen); ATICardInfo(pScreenPriv); @@ -359,7 +360,7 @@ ATIUnloadCursor(ScreenPtr pScreen) } static Bool -ATIRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +ATIRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { KdScreenPriv(pScreen); ATICardInfo(pScreenPriv); @@ -374,26 +375,26 @@ ATIRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { int x, y; - miPointerPosition(&x, &y); + miPointerGetPosition(pDev, &x, &y); if (atic->is_radeon) RadeonLoadCursor (pScreen); else ClassicLoadCursor(pScreen); /* Move to new position */ - ATIMoveCursor(pScreen, x, y); + ATIMoveCursor(pDev, pScreen, x, y); } return TRUE; } static Bool -ATIUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +ATIUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } static void -ATISetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +ATISetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { KdScreenPriv(pScreen); ATICardInfo(pScreenPriv); @@ -412,7 +413,7 @@ ATISetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) else ClassicLoadCursor(pScreen); /* Move to new position */ - ATIMoveCursor(pScreen, x, y); + ATIMoveCursor(pDev, pScreen, x, y); } else ATIUnloadCursor(pScreen); @@ -464,6 +465,7 @@ ATICursorSave(ScreenPtr pScreen, KdOffscreenArea *area) void ATICursorEnable(ScreenPtr pScreen) { + DeviceIntPtr pDev = inputInfo.pointer; KdScreenPriv(pScreen); ATICardInfo(pScreenPriv); ATIScreenInfo(pScreenPriv); @@ -488,13 +490,13 @@ ATICursorEnable(ScreenPtr pScreen) if (pCurPriv->pCursor) { int x, y; - miPointerPosition(&x, &y); + miPointerGetPosition(pDev, &x, &y); if (atic->is_radeon) RadeonLoadCursor(pScreen); else ClassicLoadCursor(pScreen); /* Move to new position */ - ATIMoveCursor(pScreen, x, y); + ATIMoveCursor(pDev, pScreen, x, y); } else ATIUnloadCursor(pScreen); diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index a4d995cb8..7df8651cb 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -827,7 +827,7 @@ ephyrWarpCursor (ScreenPtr pScreen, int x, int y) { ephyrBlockSigio (); ephyrCurScreen = pScreen->myNum; - miPointerWarpCursor (pScreen, x, y); + miPointerWarpCursor (inputInfo.pointer, pScreen, x, y); ephyrUnblockSigio (); } diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 6196996a9..0d01fb425 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -248,25 +248,25 @@ OsVendorInit (void) /* 'Fake' cursor stuff, could be improved */ static Bool -ephyrRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +ephyrRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } static Bool -ephyrUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +ephyrUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } static void -ephyrSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +ephyrSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { ; } static void -ephyrMoveCursor(ScreenPtr pScreen, int x, int y) +ephyrMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { ; } diff --git a/hw/kdrive/i810/i810_cursor.c b/hw/kdrive/i810/i810_cursor.c index 434fc4087..fcd89deff 100644 --- a/hw/kdrive/i810/i810_cursor.c +++ b/hw/kdrive/i810/i810_cursor.c @@ -74,6 +74,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "kxv.h" #include "i810.h" #include "cursorstr.h" +#include "inputstr.h" #define SetupCursor(s) KdScreenPriv(pScreen); \ i810CardInfo(pScreenPriv); \ @@ -125,7 +126,7 @@ _i810MoveCursor(ScreenPtr pScreen, int x, int y) static void i810LoadCursor(ScreenPtr pScreen, int x, int y); static void -i810MoveCursor (ScreenPtr pScreen, int x, int y) +i810MoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { KdScreenPriv(pScreen); i810ScreenInfo(pScreenPriv); @@ -277,7 +278,7 @@ i810UnloadCursor(ScreenPtr pScreen) static Bool -i810RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +i810RealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { KdScreenPriv(pScreen); i810ScreenInfo(pScreenPriv); @@ -293,7 +294,7 @@ i810RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) { int x, y; - miPointerPosition (&x, &y); + miPointerGetPosition (pDev, &x, &y); i810LoadCursor (pScreen, x, y); } } @@ -301,13 +302,13 @@ i810RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) } static Bool -i810UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +i810UnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } static void -i810SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +i810SetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { KdScreenPriv(pScreen); i810ScreenInfo(pScreenPriv); diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 6c247c185..e4cee6c42 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -2314,11 +2314,11 @@ KdCrossScreen(ScreenPtr pScreen, Bool entering) int KdCurScreen; /* current event screen */ static void -KdWarpCursor (ScreenPtr pScreen, int x, int y) +KdWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { KdBlockSigio (); KdCurScreen = pScreen->myNum; - miPointerWarpCursor (pScreen, x, y); + miPointerWarpCursor(pDev, pScreen, x, y); KdUnblockSigio (); } @@ -2333,7 +2333,7 @@ void ProcessInputEvents () { mieqProcessInputEvents(); - miPointerUpdate(); + miPointerUpdateSprite(inputInfo.pointer); if (kdSwitchPending) KdProcessSwitch (); KdCheckLock (); diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 622c31850..a6bc5dbe3 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -2583,8 +2583,6 @@ xf86HandleConfigFile(Bool autoconfig) configDRI(xf86configptr->conf_dri); #endif - checkInput(&xf86ConfigLayout); - /* * Handle some command line options that can override some of the * ServerFlags settings. diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 3ea1b4d91..725fcb296 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -67,7 +67,7 @@ typedef struct { static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y); static void xf86CrossScreen(ScreenPtr pScreen, Bool entering); -static void xf86WarpCursor(ScreenPtr pScreen, int x, int y); +static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static void xf86PointerMoved(int scrnIndex, int x, int y); @@ -206,6 +206,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) ScreenPtr pCursorScreen; Bool Switched; int px, py; + DeviceIntPtr dev, it; if (!pScr->vtSema || !mode || !pScr->SwitchMode) return FALSE; @@ -221,9 +222,20 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY) return FALSE; - pCursorScreen = miPointerGetScreen(inputInfo.pointer); + /* Let's take an educated guess for which pointer to take here. And about as + educated as it gets is to take the first pointer we find. + */ + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (IsPointerDevice(dev) && dev->spriteInfo->spriteOwner) + break; + } + if (!dev) + dev = inputInfo.pointer; + + pCursorScreen = miPointerGetScreen(dev); if (pScreen == pCursorScreen) - miPointerGetPosition(inputInfo.pointer, &px, &py); + miPointerGetPosition(dev, &px, &py); xf86EnterServerState(SETUP); Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0); @@ -232,6 +244,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) /* * Adjust frame for new display size. + * Frame is centered around cursor position if cursor is on same screen. */ if (pScreen == pCursorScreen) pScr->frameX0 = px - (mode->HDisplay / 2) + 1; @@ -266,8 +279,42 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) if (pScr->AdjustFrame) (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); + /* The original code centered the frame around the cursor if possible. + * Since this is hard to achieve with multiple cursors, we do the following: + * - center around the first pointer + * - move all other pointers to the nearest edge on the screen (or leave + * them unmodified if they are within the boundaries). + */ if (pScreen == pCursorScreen) - xf86WarpCursor(pScreen, px, py); + { + xf86WarpCursor(dev, pScreen, px, py); + } + + for (it = inputInfo.devices; it; it = it->next) + { + if (it == dev) + continue; + + if (IsPointerDevice(it) && it->spriteInfo->spriteOwner) + { + pCursorScreen = miPointerGetScreen(it); + if (pScreen == pCursorScreen) + { + miPointerGetPosition(it, &px, &py); + if (px < pScr->frameX0) + px = pScr->frameX0; + else if (px > pScr->frameX1) + px = pScr->frameX1; + + if(py < pScr->frameY0) + py = pScr->frameY0; + else if(py > pScr->frameY1) + py = pScr->frameY1; + + xf86WarpCursor(it, pScreen, px, py); + } + } + } return Switched; } @@ -424,13 +471,13 @@ xf86CrossScreen (ScreenPtr pScreen, Bool entering) /* ARGSUSED */ static void -xf86WarpCursor (ScreenPtr pScreen, int x, int y) +xf86WarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { int sigstate; sigstate = xf86BlockSIGIO (); - miPointerWarpCursor(pScreen,x,y); + miPointerWarpCursor(pDev, pScreen, x, y); - xf86Info.currentScreen = pScreen; + xf86Info.currentScreen = pScreen; xf86UnblockSIGIO (sigstate); } diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 0daf1de44..dfec4b1ae 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -912,7 +912,7 @@ DGAVTSwitch(void) } Bool -DGAStealKeyEvent(int index, int key_code, int is_down) +DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down) { DGAScreenPtr pScreenPriv; dgaEvent de; @@ -928,7 +928,7 @@ DGAStealKeyEvent(int index, int key_code, int is_down) de.u.u.type = *XDGAEventBase + (is_down ? KeyPress : KeyRelease); de.u.u.detail = key_code; de.u.event.time = GetTimeInMillis(); - mieqEnqueue (inputInfo.keyboard, (xEvent *) &de); + mieqEnqueue (dev, (xEvent *) &de); return TRUE; } @@ -936,7 +936,7 @@ DGAStealKeyEvent(int index, int key_code, int is_down) static int DGAMouseX, DGAMouseY; Bool -DGAStealMotionEvent(int index, int dx, int dy) +DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy) { DGAScreenPtr pScreenPriv; dgaEvent de; @@ -966,12 +966,12 @@ DGAStealMotionEvent(int index, int dx, int dy) de.u.event.dy = dy; de.u.event.pad1 = DGAMouseX; de.u.event.pad2 = DGAMouseY; - mieqEnqueue (inputInfo.pointer, (xEvent *) &de); + mieqEnqueue (dev, (xEvent *) &de); return TRUE; } Bool -DGAStealButtonEvent(int index, int button, int is_down) +DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down) { DGAScreenPtr pScreenPriv; dgaEvent de; @@ -991,7 +991,7 @@ DGAStealButtonEvent(int index, int button, int is_down) de.u.event.dy = 0; de.u.event.pad1 = DGAMouseX; de.u.event.pad2 = DGAMouseY; - mieqEnqueue (inputInfo.pointer, (xEvent *) &de); + mieqEnqueue (dev, (xEvent *) &de); return TRUE; } @@ -1034,6 +1034,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd) xEvent core; KeyClassPtr keyc = keybd->key; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + DeviceIntPtr pointer = GetPairedDevice(keybd); coreEquiv = de->u.u.type - *XDGAEventBase; @@ -1043,7 +1044,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd) de->u.event.dx = 0; de->u.event.dy = 0; de->u.event.screen = pScreen->myNum; - de->u.event.state = keyc->state | (inputInfo.pointer)->button->state; + de->u.event.state = keyc->state | pointer->button->state; /* * Keep the core state in sync by duplicating what @@ -1056,7 +1057,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd) switch (coreEquiv) { case KeyPress: - inputInfo.pointer->valuator->motionHintWindow = NullWindow; + pointer->valuator->motionHintWindow = NullWindow; *kptr |= bit; keyc->prev_state = keyc->state; #ifdef XKB @@ -1077,7 +1078,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd) } break; case KeyRelease: - inputInfo.pointer->valuator->motionHintWindow = NullWindow; + pointer->valuator->motionHintWindow = NullWindow; *kptr &= ~bit; keyc->prev_state = keyc->state; #ifdef XKB @@ -1110,9 +1111,11 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd) else { /* If the keyboard is actively grabbed, deliver a grabbed core event */ - if (keybd->grab && !keybd->fromPassiveGrab) + if (keybd->deviceGrab.grab && !keybd->deviceGrab.fromPassiveGrab) { - core.u.u.type = coreEquiv; + /* I've got no clue if that is correct but only working on core + * grabs seems the right thing here. (whot) */ + core.u.u.type = coreEquiv; core.u.u.detail = de->u.u.detail; core.u.keyButtonPointer.time = de->u.event.time; core.u.keyButtonPointer.eventX = de->u.event.dx; @@ -1138,15 +1141,15 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse) * Fill in remaining event state */ de->u.event.screen = pScreen->myNum; - de->u.event.state = butc->state | inputInfo.keyboard->key->state; + de->u.event.state = butc->state | GetPairedDevice(mouse)->key->state; /* * Keep the core state in sync by duplicating what * CoreProcessPointerEvent does */ if (coreEquiv != MotionNotify) { - register int key; - register BYTE *kptr; + int key; + BYTE *kptr; int bit; key = de->u.u.detail; @@ -1189,7 +1192,7 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse) else { /* If the pointer is actively grabbed, deliver a grabbed core event */ - if (mouse->grab && !mouse->fromPassiveGrab) + if (mouse->deviceGrab.grab && !mouse->deviceGrab.fromPassiveGrab) { core.u.u.type = coreEquiv; core.u.u.detail = de->u.u.detail; @@ -1287,10 +1290,10 @@ DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents) switch (coreEquiv) { case KeyPress: case KeyRelease: - DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard); + DGAProcessKeyboardEvent (pScreen, de, device); break; default: - DGAProcessPointerEvent (pScreen, de, inputInfo.pointer); + DGAProcessPointerEvent (pScreen, de, device); break; } } diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 2b7cb121d..d1e4393fd 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -239,8 +239,8 @@ ProcessInputEvents () xf86Info.inputPending = FALSE; mieqProcessInputEvents(); - miPointerUpdateSprite(inputInfo.pointer); + /* FIXME: This is a problem if we have multiple pointers */ miPointerGetPosition(inputInfo.pointer, &x, &y); xf86SetViewport(xf86Info.currentScreen, x, y); } @@ -283,12 +283,13 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) break; case ACTION_DISABLEGRAB: if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) { - if (inputInfo.pointer && inputInfo.pointer->grab != NULL && - inputInfo.pointer->DeactivateGrab) - inputInfo.pointer->DeactivateGrab(inputInfo.pointer); - if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL && - inputInfo.keyboard->DeactivateGrab) - inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard); + if (inputInfo.pointer && inputInfo.pointer->deviceGrab.grab != NULL && + inputInfo.pointer->deviceGrab.DeactivateGrab) + inputInfo.pointer->deviceGrab.DeactivateGrab(inputInfo.pointer); + if (inputInfo.keyboard && + inputInfo.keyboard->deviceGrab.grab != NULL && + inputInfo.keyboard->deviceGrab.DeactivateGrab) + inputInfo.keyboard->deviceGrab.DeactivateGrab(inputInfo.keyboard); } break; case ACTION_CLOSECLIENT: @@ -296,10 +297,11 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) ClientPtr pointer, keyboard, server; pointer = keyboard = server = NULL; - if (inputInfo.pointer && inputInfo.pointer->grab != NULL) - pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)]; - if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) { - keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)]; + if (inputInfo.pointer && inputInfo.pointer->deviceGrab.grab != NULL) + pointer = clients[CLIENT_ID(inputInfo.pointer->deviceGrab.grab->resource)]; + if (inputInfo.keyboard && inputInfo.keyboard->deviceGrab.grab != NULL) + { + keyboard = clients[CLIENT_ID(inputInfo.keyboard->deviceGrab.grab->resource)]; if (keyboard == pointer) keyboard = NULL; } diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 4723f5aba..5d650aa4c 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -40,6 +40,7 @@ #include "xf86Privstr.h" #include "propertyst.h" +#include "input.h" /* * Parameters set ONLY from the command line options @@ -198,7 +199,7 @@ void xf86UnlockServer(void); void xf86InitXkb(void); /* xf86Xinput.c */ -extern xEvent *xf86Events; +extern EventList *xf86Events; #endif /* _NO_XF86_PROTOTYPES */ diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c index 4432ad96b..f6157518e 100644 --- a/hw/xfree86/common/xf86RandR.c +++ b/hw/xfree86/common/xf86RandR.c @@ -34,6 +34,7 @@ #include "xf86DDC.h" #include "mipointer.h" #include <randrstr.h> +#include "inputstr.h" typedef struct _xf86RandRInfo { CreateScreenResourcesProcPtr CreateScreenResources; @@ -290,7 +291,7 @@ xf86RandRSetConfig (ScreenPtr pScreen, xf86SetViewport(pScreen, px, py); - (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); + (*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE); } return TRUE; diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index cd0c30ac1..92298e187 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -46,6 +46,15 @@ * authorization from the copyright holder(s) and author(s). */ + /* + * MPX additions: + * Copyright © 2006 Peter Hutterer + * License see above. + * Author: Peter Hutterer <peter@cs.unisa.edu.au> + * + */ + + #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif @@ -90,7 +99,7 @@ #include "dgaproc.h" #endif -xEvent *xf86Events = NULL; +EventListPtr xf86Events = NULL; static Bool xf86SendDragEvents(DeviceIntPtr device) @@ -161,9 +170,21 @@ xf86ActivateDevice(LocalDevicePtr local) dev->public.devicePrivate = (pointer) local; local->dev = dev; - dev->coreEvents = local->flags & XI86_ALWAYS_CORE; - RegisterOtherDevice(dev); + dev->coreEvents = local->flags & XI86_ALWAYS_CORE; + dev->isMaster = FALSE; + dev->spriteInfo->spriteOwner = FALSE; + + if (DeviceIsPointerType(dev)) + { + dev->deviceGrab.ActivateGrab = ActivatePointerGrab; + dev->deviceGrab.DeactivateGrab = DeactivatePointerGrab; + } else + { + dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab; + dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab; + } + RegisterOtherDevice(dev); #ifdef XKB if (!noXkbExtension) XkbSetExtension(dev, ProcessKeyboardEvent); @@ -377,6 +398,16 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) goto unwind; } + if (!drv) { + xf86Msg(X_ERROR, "No input driver specified (ignoring)\n"); + return BadMatch; + } + + if (!idev->identifier) { + xf86Msg(X_ERROR, "No device identifier specified (ignoring)\n"); + return BadMatch; + } + if (!drv->PreInit) { xf86Msg(X_ERROR, "Input driver `%s' has no PreInit function (ignoring)\n", @@ -418,6 +449,9 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) (!is_auto || xf86Info.autoEnableDevices)) EnableDevice(dev); + /* send enter/leave event, update sprite window */ + CheckMotion(NULL, dev); + *pdev = dev; return Success; @@ -499,7 +533,7 @@ xf86PostMotionEventP(DeviceIntPtr device, int *valuators) { int i = 0, nevents = 0; - int dx, dy; + int dx = 0, dy = 0; Bool drag = xf86SendDragEvents(device); xEvent *xE = NULL; int index; @@ -511,25 +545,32 @@ xf86PostMotionEventP(DeviceIntPtr device, flags = POINTER_RELATIVE | POINTER_ACCELERATE; #if XFreeXDGA - if (first_valuator == 0 && num_valuators >= 2) { - if (miPointerGetScreen(inputInfo.pointer)) { - index = miPointerGetScreen(inputInfo.pointer)->myNum; - if (is_absolute) { - dx = valuators[0] - device->valuator->lastx; - dy = valuators[1] - device->valuator->lasty; - } - else { + /* The evdev driver may not always send all axes across. */ + if (num_valuators >= 1 && first_valuator <= 1) { + if (miPointerGetScreen(device)) { + index = miPointerGetScreen(device)->myNum; + if (first_valuator == 0) + { dx = valuators[0]; - dy = valuators[1]; + if (is_absolute) + dx -= device->lastx; } - if (DGAStealMotionEvent(index, dx, dy)) + + if (first_valuator == 1 || num_valuators >= 2) + { + dy = valuators[1 - first_valuator]; + if (is_absolute) + dy -= device->lasty; + } + + if (DGAStealMotionEvent(device, index, dx, dy)) return; } } #endif if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + xf86Events = InitEventList(GetMaximumEventsNum()); if (!xf86Events) FatalError("Couldn't allocate event store\n"); @@ -538,11 +579,11 @@ xf86PostMotionEventP(DeviceIntPtr device, valuators); for (i = 0; i < nevents; i++) { - xE = xf86Events + i; + xE = (xf86Events + i)->event; /* Don't post core motion events for devices not registered to send * drag events. */ if (xE->u.u.type != MotionNotify || drag) { - mieqEnqueue(device, xf86Events + i); + mieqEnqueue(device, (xf86Events + i)->event); } } } @@ -565,7 +606,7 @@ xf86PostProximityEvent(DeviceIntPtr device, va_end(var); if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + xf86Events = InitEventList(GetMaximumEventsNum()); if (!xf86Events) FatalError("Couldn't allocate event store\n"); @@ -573,7 +614,7 @@ xf86PostProximityEvent(DeviceIntPtr device, is_in ? ProximityIn : ProximityOut, first_valuator, num_valuators, valuators); for (i = 0; i < nevents; i++) - mieqEnqueue(device, xf86Events + i); + mieqEnqueue(device, (xf86Events + i)->event); xfree(valuators); } @@ -593,13 +634,12 @@ xf86PostButtonEvent(DeviceIntPtr device, int index; #if XFreeXDGA - if (miPointerGetScreen(inputInfo.pointer)) { - index = miPointerGetScreen(inputInfo.pointer)->myNum; - if (DGAStealButtonEvent(index, button, is_down)) + if (miPointerGetScreen(device)) { + index = miPointerGetScreen(device)->myNum; + if (DGAStealButtonEvent(device, index, button, is_down)) return; } #endif - valuators = xcalloc(sizeof(int), num_valuators); va_start(var, num_valuators); @@ -608,18 +648,17 @@ xf86PostButtonEvent(DeviceIntPtr device, va_end(var); if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + xf86Events = InitEventList(GetMaximumEventsNum()); if (!xf86Events) FatalError("Couldn't allocate event store\n"); nevents = GetPointerEvents(xf86Events, device, is_down ? ButtonPress : ButtonRelease, button, - is_absolute ? POINTER_ABSOLUTE : - POINTER_RELATIVE, + (is_absolute) ? POINTER_ABSOLUTE : POINTER_RELATIVE, first_valuator, num_valuators, valuators); for (i = 0; i < nevents; i++) - mieqEnqueue(device, xf86Events + i); + mieqEnqueue(device, (xf86Events + i)->event); xfree(valuators); } @@ -642,7 +681,7 @@ xf86PostKeyEvent(DeviceIntPtr device, "broken.\n"); if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + xf86Events = InitEventList(GetMaximumEventsNum()); if (!xf86Events) FatalError("Couldn't allocate event store\n"); @@ -666,7 +705,7 @@ xf86PostKeyEvent(DeviceIntPtr device, } for (i = 0; i < nevents; i++) - mieqEnqueue(device, xf86Events + i); + mieqEnqueue(device, (xf86Events + i)->event); } _X_EXPORT void @@ -678,15 +717,17 @@ xf86PostKeyboardEvent(DeviceIntPtr device, int index; #if XFreeXDGA - if (miPointerGetScreen(inputInfo.pointer)) { - index = miPointerGetScreen(inputInfo.pointer)->myNum; - if (DGAStealKeyEvent(index, key_code, is_down)) + DeviceIntPtr pointer = GetPairedDevice(device); + + if (miPointerGetScreen(pointer)) { + index = miPointerGetScreen(pointer)->myNum; + if (DGAStealKeyEvent(device, index, key_code, is_down)) return; } #endif if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + xf86Events = InitEventList(GetMaximumEventsNum()); if (!xf86Events) FatalError("Couldn't allocate event store\n"); @@ -694,7 +735,7 @@ xf86PostKeyboardEvent(DeviceIntPtr device, is_down ? KeyPress : KeyRelease, key_code); for (i = 0; i < nevents; i++) - mieqEnqueue(device, xf86Events + i); + mieqEnqueue(device, (xf86Events + i)->event); } _X_EXPORT LocalDevicePtr @@ -783,11 +824,11 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) { if (axnum == 0) { dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2; - dev->valuator->lastx = dev->valuator->axisVal[0]; + dev->lastx = dev->valuator->axisVal[0]; } else if (axnum == 1) { dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2; - dev->valuator->lasty = dev->valuator->axisVal[1]; + dev->lasty = dev->valuator->axisVal[1]; } } diff --git a/hw/xfree86/dixmods/extmod/dgaproc.h b/hw/xfree86/dixmods/extmod/dgaproc.h index aaea4e20c..f4d3fe45b 100644 --- a/hw/xfree86/dixmods/extmod/dgaproc.h +++ b/hw/xfree86/dixmods/extmod/dgaproc.h @@ -120,9 +120,10 @@ int DGAGetOldDGAMode(int Index); int DGAGetModeInfo(int Index, XDGAModePtr mode, int num); Bool DGAVTSwitch(void); -Bool DGAStealButtonEvent(int Index, int button, int is_down); -Bool DGAStealMotionEvent(int Index, int dx, int dy); -Bool DGAStealKeyEvent(int Index, int key_code, int is_down); +Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index, int button, + int is_down); +Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx, int dy); +Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index, int key_code, int is_down); Bool DGAIsDgaEvent (xEvent *e); Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e); diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index b736c6ae0..263cc52cc 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -70,6 +70,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mi.h" #include "mipointer.h" #include "xf86_OSproc.h" +#include "inputstr.h" #define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu) @@ -2305,7 +2306,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags) if (px > pScrn->frameX1) px = pScrn->frameX1; if (py < pScrn->frameY0) py = pScrn->frameY0; if (py > pScrn->frameY1) py = pScrn->frameY1; - pScreen->SetCursorPosition(pScreen, px, py, TRUE); + pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE); return; } diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 623e87ab5..417a3508f 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -98,6 +98,9 @@ #include "IBM.h" #include "TI.h" +#include "xf86RamDac.h" +#include "BT.h" + #ifndef HAS_GLIBC_SIGSETJMP #if defined(setjmp) && defined(__GNU_LIBRARY__) && \ (!defined(__GLIBC__) || (__GLIBC__ < 2) || \ diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index acf34c1d1..f3b1ebb7a 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -45,6 +45,7 @@ #include "picturestr.h" #endif #include "cursorstr.h" +#include "inputstr.h" /* * Given a screen coordinate, rotate back to a cursor source coordinate @@ -601,7 +602,7 @@ xf86_reload_cursors (ScreenPtr screen) return; cursor = xf86_config->cursor; - GetSpritePosition (&x, &y); + GetSpritePosition (inputInfo.pointer, &x, &y); if (!(cursor_info->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) (*cursor_info->HideCursor)(scrn); diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index e2668fbbc..1c20082ce 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -37,6 +37,7 @@ #include "xf86DDC.h" #include "mipointer.h" #include "windowstr.h" +#include "inputstr.h" #include <randrstr.h> #include <X11/extensions/render.h> @@ -266,7 +267,7 @@ xf86RandR12SetConfig (ScreenPtr pScreen, randrp->virtualY = scrp->virtualY; } - miPointerPosition (&px, &py); + miPointerGetPosition (inputInfo.pointer, &px, &py); for (mode = scrp->modes; ; mode = mode->next) { if (randrp->maxX == 0 || randrp->maxY == 0) @@ -313,14 +314,14 @@ xf86RandR12SetConfig (ScreenPtr pScreen, /* * Move the cursor back where it belongs; SwitchMode repositions it */ - if (pScreen == miPointerCurrentScreen ()) + if (pScreen == miPointerGetScreen(inputInfo.pointer)) { px = (px >= pScreen->width ? (pScreen->width - 1) : px); py = (py >= pScreen->height ? (pScreen->height - 1) : py); xf86SetViewport(pScreen, px, py); - (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); + (*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE); } return TRUE; diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c index ded9e0fae..300b08df6 100644 --- a/hw/xfree86/os-support/linux/lnx_agp.c +++ b/hw/xfree86/os-support/linux/lnx_agp.c @@ -10,6 +10,7 @@ #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> +#include <linux/types.h> #endif #include <X11/X.h> diff --git a/hw/xfree86/rac/xf86RAC.c b/hw/xfree86/rac/xf86RAC.c index 8985f38b0..8215f9827 100644 --- a/hw/xfree86/rac/xf86RAC.c +++ b/hw/xfree86/rac/xf86RAC.c @@ -144,13 +144,16 @@ static PixmapPtr RACCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, static Bool RACCreateGC(GCPtr pGC); static Bool RACSaveScreen(ScreenPtr pScreen, Bool unblank); static void RACStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs); -static void RACRecolorCursor (ScreenPtr pScreen, CursorPtr pCurs, - Bool displayed); -static Bool RACRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor); -static Bool RACUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor); -static Bool RACDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor); -static Bool RACSetCursorPosition (ScreenPtr pScreen, int x, int y, - Bool generateEvent); +static void RACRecolorCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCurs, Bool displayed); +static Bool RACRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool RACUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool RACDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool RACSetCursorPosition (DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y, Bool generateEvent); static void RACAdjustFrame(int index, int x, int y, int flags); static Bool RACSwitchMode(int index, DisplayModePtr mode, int flags); static Bool RACEnterVT(int index, int flags); @@ -214,11 +217,14 @@ static void RACPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit, static void RACPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg ); /* miSpriteFuncs */ -static Bool RACSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCur); -static Bool RACSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCur); -static void RACSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCur, - int x, int y); -static void RACSpriteMoveCursor(ScreenPtr pScreen, int x, int y); +static Bool RACSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCur); +static Bool RACSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCur); +static void RACSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCur, int x, int y); +static void RACSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y); #ifdef RENDER static void RACComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, @@ -486,6 +492,7 @@ RACStoreColors ( static void RACRecolorCursor ( + DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, Bool displayed @@ -494,15 +501,16 @@ RACRecolorCursor ( DPRINT_S("RACRecolorCursor",pScreen->myNum); SCREEN_PROLOG (RecolorCursor); ENABLE; - (*pScreen->RecolorCursor) (pScreen,pCurs,displayed); + (*pScreen->RecolorCursor) (pDev, pScreen,pCurs,displayed); SCREEN_EPILOG ( RecolorCursor, RACRecolorCursor); } static Bool RACRealizeCursor ( - ScreenPtr pScreen, - CursorPtr pCursor + DeviceIntPtr pDev, + ScreenPtr pScreen, + CursorPtr pCursor ) { Bool val; @@ -510,7 +518,7 @@ RACRealizeCursor ( DPRINT_S("RACRealizeCursor",pScreen->myNum); SCREEN_PROLOG (RealizeCursor); ENABLE; - val = (*pScreen->RealizeCursor) (pScreen,pCursor); + val = (*pScreen->RealizeCursor) (pDev, pScreen,pCursor); SCREEN_EPILOG ( RealizeCursor, RACRealizeCursor); return val; @@ -518,8 +526,9 @@ RACRealizeCursor ( static Bool RACUnrealizeCursor ( - ScreenPtr pScreen, - CursorPtr pCursor + DeviceIntPtr pDev, + ScreenPtr pScreen, + CursorPtr pCursor ) { Bool val; @@ -527,7 +536,7 @@ RACUnrealizeCursor ( DPRINT_S("RACUnrealizeCursor",pScreen->myNum); SCREEN_PROLOG (UnrealizeCursor); ENABLE; - val = (*pScreen->UnrealizeCursor) (pScreen,pCursor); + val = (*pScreen->UnrealizeCursor) (pDev, pScreen,pCursor); SCREEN_EPILOG ( UnrealizeCursor, RACUnrealizeCursor); return val; @@ -535,8 +544,9 @@ RACUnrealizeCursor ( static Bool RACDisplayCursor ( - ScreenPtr pScreen, - CursorPtr pCursor + DeviceIntPtr pDev, + ScreenPtr pScreen, + CursorPtr pCursor ) { Bool val; @@ -544,7 +554,7 @@ RACDisplayCursor ( DPRINT_S("RACDisplayCursor",pScreen->myNum); SCREEN_PROLOG (DisplayCursor); ENABLE; - val = (*pScreen->DisplayCursor) (pScreen,pCursor); + val = (*pScreen->DisplayCursor) (pDev, pScreen,pCursor); SCREEN_EPILOG ( DisplayCursor, RACDisplayCursor); return val; @@ -552,6 +562,7 @@ RACDisplayCursor ( static Bool RACSetCursorPosition ( + DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent) @@ -561,7 +572,7 @@ RACSetCursorPosition ( DPRINT_S("RACSetCursorPosition",pScreen->myNum); SCREEN_PROLOG (SetCursorPosition); ENABLE; - val = (*pScreen->SetCursorPosition) (pScreen,x,y,generateEvent); + val = (*pScreen->SetCursorPosition) (pDev, pScreen,x,y,generateEvent); SCREEN_EPILOG ( SetCursorPosition, RACSetCursorPosition); return val; @@ -1061,46 +1072,47 @@ RACPushPixels( /* miSpriteFuncs */ static Bool -RACSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCur) +RACSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur) { Bool val; SPRITE_PROLOG; DPRINT_S("RACSpriteRealizeCursor",pScreen->myNum); ENABLE; - val = PointPriv->spriteFuncs->RealizeCursor(pScreen, pCur); + val = PointPriv->spriteFuncs->RealizeCursor(pDev, pScreen, pCur); SPRITE_EPILOG; return val; } static Bool -RACSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCur) +RACSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur) { Bool val; SPRITE_PROLOG; DPRINT_S("RACSpriteUnrealizeCursor",pScreen->myNum); ENABLE; - val = PointPriv->spriteFuncs->UnrealizeCursor(pScreen, pCur); + val = PointPriv->spriteFuncs->UnrealizeCursor(pDev, pScreen, pCur); SPRITE_EPILOG; return val; } static void -RACSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCur, int x, int y) +RACSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCur, int x, int y) { SPRITE_PROLOG; DPRINT_S("RACSpriteSetCursor",pScreen->myNum); ENABLE; - PointPriv->spriteFuncs->SetCursor(pScreen, pCur, x, y); + PointPriv->spriteFuncs->SetCursor(pDev, pScreen, pCur, x, y); SPRITE_EPILOG; } static void -RACSpriteMoveCursor(ScreenPtr pScreen, int x, int y) +RACSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { SPRITE_PROLOG; DPRINT_S("RACSpriteMoveCursor",pScreen->myNum); ENABLE; - PointPriv->spriteFuncs->MoveCursor(pScreen, x, y); + PointPriv->spriteFuncs->MoveCursor(pDev, pScreen, x, y); SPRITE_EPILOG; } diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c index 5b1ce5e1f..5c909c7c4 100644 --- a/hw/xfree86/ramdac/xf86Cursor.c +++ b/hw/xfree86/ramdac/xf86Cursor.c @@ -8,14 +8,24 @@ #include "colormapst.h" #include "cursorstr.h" +/* FIXME: This was added with the ABI change of the miPointerSpriteFuncs for + * MPX. + * inputInfo is needed to pass the core pointer as the default argument into + * the cursor functions. + * + * Externing inputInfo is not the nice way to do it but it works. + */ +#include "inputstr.h" +extern InputInfo inputInfo; + DevPrivateKey xf86CursorScreenKey = &xf86CursorScreenKey; /* sprite functions */ -static Bool xf86CursorRealizeCursor(ScreenPtr, CursorPtr); -static Bool xf86CursorUnrealizeCursor(ScreenPtr, CursorPtr); -static void xf86CursorSetCursor(ScreenPtr, CursorPtr, int, int); -static void xf86CursorMoveCursor(ScreenPtr, int, int); +static Bool xf86CursorRealizeCursor(DeviceIntPtr, ScreenPtr, CursorPtr); +static Bool xf86CursorUnrealizeCursor(DeviceIntPtr, ScreenPtr, CursorPtr); +static void xf86CursorSetCursor(DeviceIntPtr, ScreenPtr, CursorPtr, int, int); +static void xf86CursorMoveCursor(DeviceIntPtr, ScreenPtr, int, int); static miPointerSpriteFuncRec xf86CursorSpriteFuncs = { xf86CursorRealizeCursor, @@ -27,7 +37,7 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = { /* Screen functions */ static void xf86CursorInstallColormap(ColormapPtr); -static void xf86CursorRecolorCursor(ScreenPtr, CursorPtr, Bool); +static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr, Bool); static Bool xf86CursorCloseScreen(int, ScreenPtr); static void xf86CursorQueryBestSize(int, unsigned short*, unsigned short*, ScreenPtr); @@ -164,6 +174,7 @@ xf86CursorInstallColormap(ColormapPtr pMap) static void xf86CursorRecolorCursor( + DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) @@ -175,7 +186,7 @@ xf86CursorRecolorCursor( return; if (ScreenPriv->SWCursor) - (*ScreenPriv->RecolorCursor)(pScreen, pCurs, displayed); + (*ScreenPriv->RecolorCursor)(pDev, pScreen, pCurs, displayed); else xf86RecolorCursor(pScreen, pCurs, displayed); } @@ -187,14 +198,17 @@ xf86CursorEnableDisableFBAccess( int index, Bool enable) { + DeviceIntPtr pDev = inputInfo.pointer; + ScreenPtr pScreen = screenInfo.screens[index]; xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( &pScreen->devPrivates, xf86CursorScreenKey); if (!enable && ScreenPriv->CurrentCursor != NullCursor) { - CursorPtr currentCursor = ScreenPriv->CurrentCursor; - xf86CursorSetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); - ScreenPriv->isUp = FALSE; + CursorPtr currentCursor = ScreenPriv->CurrentCursor; + xf86CursorSetCursor(pDev, pScreen, NullCursor, ScreenPriv->x, + ScreenPriv->y); + ScreenPriv->isUp = FALSE; ScreenPriv->SWCursor = TRUE; ScreenPriv->SavedCursor = currentCursor; } @@ -208,7 +222,7 @@ xf86CursorEnableDisableFBAccess( * Re-set current cursor so drivers can react to FB access having been * temporarily disabled. */ - xf86CursorSetCursor(pScreen, ScreenPriv->SavedCursor, + xf86CursorSetCursor(pDev, pScreen, ScreenPriv->SavedCursor, ScreenPriv->x, ScreenPriv->y); ScreenPriv->SavedCursor = NULL; } @@ -245,7 +259,7 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) /****** miPointerSpriteFunctions *******/ static Bool -xf86CursorRealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) +xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( &pScreen->devPrivates, xf86CursorScreenKey); @@ -253,11 +267,12 @@ xf86CursorRealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) if (pCurs->refcnt <= 1) dixSetPrivate(&pCurs->devPrivates, pScreen, NULL); - return (*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCurs); + return (*ScreenPriv->spriteFuncs->RealizeCursor)(pDev, pScreen, pCurs); } static Bool -xf86CursorUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) +xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCurs) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( &pScreen->devPrivates, xf86CursorScreenKey); @@ -267,11 +282,12 @@ xf86CursorUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) dixSetPrivate(&pCurs->devPrivates, pScreen, NULL); } - return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCurs); + return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pDev, pScreen, pCurs); } static void -xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) +xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, + int x, int y) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( &pScreen->devPrivates, xf86CursorScreenKey); @@ -288,8 +304,10 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */ if (ScreenPriv->SWCursor) - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, NullCursor, x, y); - else if (ScreenPriv->isUp) { + (*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, NullCursor, + x, y); + else if + (ScreenPriv->isUp) { xf86SetCursor(pScreen, NullCursor, x, y); ScreenPriv->isUp = FALSE; } @@ -313,7 +331,7 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { if (ScreenPriv->SWCursor) /* remove the SW cursor */ - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, NullCursor, x, y); + (*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, NullCursor, x, y); xf86SetCursor(pScreen, pCurs, x, y); ScreenPriv->SWCursor = FALSE; @@ -338,11 +356,11 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) if (pCurs->bits->emptyMask && !ScreenPriv->showTransparent) pCurs = NullCursor; - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCurs, x, y); + (*ScreenPriv->spriteFuncs->SetCursor)(pDev, pScreen, pCurs, x, y); } static void -xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y) +xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( &pScreen->devPrivates, xf86CursorScreenKey); @@ -351,10 +369,10 @@ xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y) ScreenPriv->y = y; if (ScreenPriv->CursorToRestore) - xf86CursorSetCursor(pScreen, ScreenPriv->CursorToRestore, + xf86CursorSetCursor(pDev, pScreen, ScreenPriv->CursorToRestore, ScreenPriv->x, ScreenPriv->y); else if (ScreenPriv->SWCursor) - (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y); + (*ScreenPriv->spriteFuncs->MoveCursor)(pDev, pScreen, x, y); else if (ScreenPriv->isUp) xf86MoveCursor(pScreen, x, y); } @@ -362,6 +380,7 @@ xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y) void xf86ForceHWCursor (ScreenPtr pScreen, Bool on) { + DeviceIntPtr pDev = inputInfo.pointer; xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( &pScreen->devPrivates, xf86CursorScreenKey); @@ -372,7 +391,7 @@ xf86ForceHWCursor (ScreenPtr pScreen, Bool on) if (ScreenPriv->SWCursor && ScreenPriv->CurrentCursor) { ScreenPriv->HWCursorForced = TRUE; - xf86CursorSetCursor (pScreen, ScreenPriv->CurrentCursor, + xf86CursorSetCursor (pDev, pScreen, ScreenPriv->CurrentCursor, ScreenPriv->x, ScreenPriv->y); } else @@ -384,7 +403,7 @@ xf86ForceHWCursor (ScreenPtr pScreen, Bool on) if (--ScreenPriv->ForceHWCursorCount == 0) { if (ScreenPriv->HWCursorForced && ScreenPriv->CurrentCursor) - xf86CursorSetCursor (pScreen, ScreenPriv->CurrentCursor, + xf86CursorSetCursor (pDev, pScreen, ScreenPriv->CurrentCursor, ScreenPriv->x, ScreenPriv->y); } } diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c index d10e283d7..4c5ef4039 100644 --- a/hw/xfree86/ramdac/xf86HWCurs.c +++ b/hw/xfree86/ramdac/xf86HWCurs.c @@ -73,6 +73,10 @@ static unsigned char* RealizeCursorInterleave64(xf86CursorInfoPtr, CursorPtr); Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) { + /* Graphics cards cannot render multiple cursors in hardware. We have to + software render them. */ + return FALSE; + if ((infoPtr->MaxWidth <= 0) || (infoPtr->MaxHeight <= 0)) return FALSE; diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c index 38fefa7a2..abd6bcb73 100644 --- a/hw/xnest/Events.c +++ b/hw/xnest/Events.c @@ -25,6 +25,7 @@ is" without express or implied warranty. #include "scrnintstr.h" #include "windowstr.h" #include "servermd.h" +#include "inputstr.h" #include "mi.h" @@ -183,7 +184,7 @@ xnestCollectEvents(void) if (X.xcrossing.detail != NotifyInferior) { pScreen = xnestScreen(X.xcrossing.window); if (pScreen) { - NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y); + NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x, X.xcrossing.y); valuators[0] = X.xcrossing.x; valuators[1] = X.xcrossing.y; lastEventTime = GetTimeInMillis(); diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c index 859aafd29..32db6621b 100755 --- a/hw/xwin/winwin32rootlesswndproc.c +++ b/hw/xwin/winwin32rootlesswndproc.c @@ -300,7 +300,9 @@ IsRaiseOnClick (WindowPtr pWin) struct _Window *pwin; struct _Property *prop; - WindowPtr pRoot = GetCurrentRootWindow (); + /* XXX We're getting inputInfo.poniter here, but this might be really wrong. + * Which pointer's current window do we want? */ + WindowPtr pRoot = GetCurrentRootWindow (inputInfo.pointer); if (!pWin) { @@ -353,7 +355,9 @@ IsMouseActive (WindowPtr pWin) struct _Window *pwin; struct _Property *prop; - WindowPtr pRoot = GetCurrentRootWindow (); + /* XXX We're getting inputInfo.poniter here, but this might be really wrong. + * Which pointer's current window do we want? */ + WindowPtr pRoot = GetCurrentRootWindow (inputInfo.pointer); if (!pWin) { |