diff options
author | Keith Packard <keithp@keithp.com> | 2011-02-02 15:19:55 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-02-02 15:19:55 -0800 |
commit | ea1ffd3e60bdcedbec5a6f28929f8677bf45d450 (patch) | |
tree | 5064b9aec3acb191622b95713fcc344d93e30689 /hw/xfree86 | |
parent | 12b0f7df2caa78d68b453aaa91248bb3577fd724 (diff) | |
parent | 53602c36217487e0a80880e8328f89ab302d85c8 (diff) |
Merge remote branch 'whot/for-keith'
Diffstat (limited to 'hw/xfree86')
-rw-r--r-- | hw/xfree86/common/xf86DGA.c | 51 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Module.h | 2 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 29 | ||||
-rw-r--r-- | hw/xfree86/dixmods/extmod/dgaproc.h | 1 |
4 files changed, 37 insertions, 46 deletions
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 1058a466c..74eb739e4 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -53,7 +53,7 @@ static DevPrivateKeyRec DGAScreenKeyRec; #define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec) -static int mieq_installed = 0; +static Bool mieq_installed; static Bool DGACloseScreen(int i, ScreenPtr pScreen); static void DGADestroyColormap(ColormapPtr pmap); @@ -250,9 +250,10 @@ DGACloseScreen(int i, ScreenPtr pScreen) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - if (XDGAEventBase) { + if (mieq_installed) { mieqSetHandler(ET_DGAEvent, NULL); - } + mieq_installed = FALSE; + } FreeMarkedVisuals(pScreen); @@ -446,6 +447,11 @@ xf86SetDGAMode( pScreenPriv->grabMouse = TRUE; pScreenPriv->grabKeyboard = TRUE; + if (!mieq_installed) { + mieqSetHandler(ET_DGAEvent, DGAHandleEvent); + mieq_installed = TRUE; + } + return Success; } @@ -466,7 +472,7 @@ DGASetInputMode(int index, Bool keyboard, Bool mouse) if (!mieq_installed) { mieqSetHandler(ET_DGAEvent, DGAHandleEvent); - mieq_installed = 1; + mieq_installed = TRUE; } } } @@ -936,8 +942,6 @@ DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down) return TRUE; } -static int DGAMouseX, DGAMouseY; - Bool DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy) { @@ -952,17 +956,6 @@ DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy) if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */ return FALSE; - DGAMouseX += dx; - if (DGAMouseX < 0) - DGAMouseX = 0; - else if (DGAMouseX > screenInfo.screens[index]->width) - DGAMouseX = screenInfo.screens[index]->width; - DGAMouseY += dy; - if (DGAMouseY < 0) - DGAMouseY = 0; - else if (DGAMouseY > screenInfo.screens[index]->height) - DGAMouseY = screenInfo.screens[index]->height; - memset(&event, 0, sizeof(event)); event.header = ET_Internal; event.type = ET_DGAEvent; @@ -1006,18 +999,6 @@ DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down) /* We have the power to steal or modify events that are about to get queued */ -Bool -DGAIsDgaEvent (xEvent *e) -{ - int coreEquiv; - if (!DGAScreenKeyRegistered || XDGAEventBase == 0) - return FALSE; - coreEquiv = e->u.u.type - *XDGAEventBase; - if (KeyPress <= coreEquiv && coreEquiv <= MotionNotify) - return TRUE; - return FALSE; -} - #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ static Mask filters[] = { @@ -1039,6 +1020,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd) DeviceEvent ev; memset(&ev, 0, sizeof(ev)); + ev.header = ET_Internal; ev.length = sizeof(ev); ev.detail.key = event->detail; ev.type = event->subtype; @@ -1058,8 +1040,8 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd) de.u.u.type = *XDGAEventBase + GetCoreType((InternalEvent*)&ev); de.u.u.detail = event->detail; de.u.event.time = event->time; - de.u.event.dx = 0; - de.u.event.dy = 0; + de.u.event.dx = event->dx; + de.u.event.dy = event->dy; de.u.event.screen = pScreen->myNum; de.u.event.state = ev.corestate; @@ -1114,8 +1096,8 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse) de.u.u.type = *XDGAEventBase + coreEquiv; de.u.u.detail = event->detail; de.u.event.time = event->time; - de.u.event.dx = 0; - de.u.event.dy = 0; + de.u.event.dx = event->dx; + de.u.event.dy = event->dy; de.u.event.screen = pScreen->myNum; de.u.event.state = ev.corestate; @@ -1216,6 +1198,9 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) if (!pScreenPriv) return; + if (!IsMaster(device)) + return; + switch (event->subtype) { case KeyPress: case KeyRelease: diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 609819b52..49a98bd05 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -83,7 +83,7 @@ typedef enum { */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(9, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(12, 1) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(12, 2) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(5, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index b9006ab07..74365e10b 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -1011,11 +1011,6 @@ xf86PostMotionEventM(DeviceIntPtr device, DeviceEvent *event; int flags = 0; -#if XFreeXDGA - int index; - int dx = 0, dy = 0; -#endif - if (valuator_mask_num_valuators(mask) > 0) { if (is_absolute) @@ -1029,7 +1024,9 @@ xf86PostMotionEventM(DeviceIntPtr device, if (valuator_mask_isset(mask, 0) || valuator_mask_isset(mask, 1)) if (miPointerGetScreen(device)) { - index = miPointerGetScreen(device)->myNum; + int index = miPointerGetScreen(device)->myNum; + int dx = 0, dy = 0; + if (valuator_mask_isset(mask, 0)) { dx = valuator_mask_get(mask, 0); @@ -1160,10 +1157,6 @@ xf86PostButtonEventM(DeviceIntPtr device, int i = 0, nevents = 0; int flags = 0; -#if XFreeXDGA - int index; -#endif - if (valuator_mask_num_valuators(mask) > 0) { if (is_absolute) @@ -1174,7 +1167,8 @@ xf86PostButtonEventM(DeviceIntPtr device, #if XFreeXDGA if (miPointerGetScreen(device)) { - index = miPointerGetScreen(device)->myNum; + int index = miPointerGetScreen(device)->myNum; + if (DGAStealButtonEvent(device, index, button, is_down)) return; } @@ -1240,6 +1234,19 @@ xf86PostKeyEventM(DeviceIntPtr device, { int i = 0, nevents = 0; +#if XFreeXDGA + DeviceIntPtr pointer; + + /* Some pointers send key events, paired device is wrong then. */ + pointer = IsPointerDevice(device) ? device : GetPairedDevice(device); + if (miPointerGetScreen(pointer)) { + int index = miPointerGetScreen(pointer)->myNum; + + if (DGAStealKeyEvent(device, index, key_code, is_down)) + return; + } +#endif + if (is_absolute) { nevents = GetKeyboardValuatorEvents(xf86Events, device, is_down ? KeyPress : KeyRelease, diff --git a/hw/xfree86/dixmods/extmod/dgaproc.h b/hw/xfree86/dixmods/extmod/dgaproc.h index 6745a6e7a..a13a51794 100644 --- a/hw/xfree86/dixmods/extmod/dgaproc.h +++ b/hw/xfree86/dixmods/extmod/dgaproc.h @@ -124,7 +124,6 @@ extern _X_EXPORT Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index, int butto int is_down); extern _X_EXPORT Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx, int dy); extern _X_EXPORT Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index, int key_code, int is_down); -extern _X_EXPORT Bool DGAIsDgaEvent (xEvent *e); extern _X_EXPORT Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem, int *size, int *offset, int *flags); |