Merge remote branch 'whot/for-keith'

This commit is contained in:
Keith Packard 2011-02-02 15:19:55 -08:00
commit ea1ffd3e60
6 changed files with 44 additions and 48 deletions

View File

@ -53,7 +53,7 @@
static DevPrivateKeyRec DGAScreenKeyRec; static DevPrivateKeyRec DGAScreenKeyRec;
#define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec) #define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec)
static int mieq_installed = 0; static Bool mieq_installed;
static Bool DGACloseScreen(int i, ScreenPtr pScreen); static Bool DGACloseScreen(int i, ScreenPtr pScreen);
static void DGADestroyColormap(ColormapPtr pmap); static void DGADestroyColormap(ColormapPtr pmap);
@ -250,9 +250,10 @@ DGACloseScreen(int i, ScreenPtr pScreen)
{ {
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
if (XDGAEventBase) { if (mieq_installed) {
mieqSetHandler(ET_DGAEvent, NULL); mieqSetHandler(ET_DGAEvent, NULL);
} mieq_installed = FALSE;
}
FreeMarkedVisuals(pScreen); FreeMarkedVisuals(pScreen);
@ -446,6 +447,11 @@ xf86SetDGAMode(
pScreenPriv->grabMouse = TRUE; pScreenPriv->grabMouse = TRUE;
pScreenPriv->grabKeyboard = TRUE; pScreenPriv->grabKeyboard = TRUE;
if (!mieq_installed) {
mieqSetHandler(ET_DGAEvent, DGAHandleEvent);
mieq_installed = TRUE;
}
return Success; return Success;
} }
@ -466,7 +472,7 @@ DGASetInputMode(int index, Bool keyboard, Bool mouse)
if (!mieq_installed) { if (!mieq_installed) {
mieqSetHandler(ET_DGAEvent, DGAHandleEvent); 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; return TRUE;
} }
static int DGAMouseX, DGAMouseY;
Bool Bool
DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy) 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 */ if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
return FALSE; 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)); memset(&event, 0, sizeof(event));
event.header = ET_Internal; event.header = ET_Internal;
event.type = ET_DGAEvent; 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 */ /* 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 */ #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
static Mask filters[] = static Mask filters[] =
{ {
@ -1039,6 +1020,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd)
DeviceEvent ev; DeviceEvent ev;
memset(&ev, 0, sizeof(ev)); memset(&ev, 0, sizeof(ev));
ev.header = ET_Internal;
ev.length = sizeof(ev); ev.length = sizeof(ev);
ev.detail.key = event->detail; ev.detail.key = event->detail;
ev.type = event->subtype; 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.type = *XDGAEventBase + GetCoreType((InternalEvent*)&ev);
de.u.u.detail = event->detail; de.u.u.detail = event->detail;
de.u.event.time = event->time; de.u.event.time = event->time;
de.u.event.dx = 0; de.u.event.dx = event->dx;
de.u.event.dy = 0; de.u.event.dy = event->dy;
de.u.event.screen = pScreen->myNum; de.u.event.screen = pScreen->myNum;
de.u.event.state = ev.corestate; 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.type = *XDGAEventBase + coreEquiv;
de.u.u.detail = event->detail; de.u.u.detail = event->detail;
de.u.event.time = event->time; de.u.event.time = event->time;
de.u.event.dx = 0; de.u.event.dx = event->dx;
de.u.event.dy = 0; de.u.event.dy = event->dy;
de.u.event.screen = pScreen->myNum; de.u.event.screen = pScreen->myNum;
de.u.event.state = ev.corestate; de.u.event.state = ev.corestate;
@ -1216,6 +1198,9 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device)
if (!pScreenPriv) if (!pScreenPriv)
return; return;
if (!IsMaster(device))
return;
switch (event->subtype) { switch (event->subtype) {
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:

View File

@ -83,7 +83,7 @@ typedef enum {
*/ */
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(9, 0) #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_EXTENSION_VERSION SET_ABI_VERSION(5, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)

View File

@ -1011,11 +1011,6 @@ xf86PostMotionEventM(DeviceIntPtr device,
DeviceEvent *event; DeviceEvent *event;
int flags = 0; int flags = 0;
#if XFreeXDGA
int index;
int dx = 0, dy = 0;
#endif
if (valuator_mask_num_valuators(mask) > 0) if (valuator_mask_num_valuators(mask) > 0)
{ {
if (is_absolute) if (is_absolute)
@ -1029,7 +1024,9 @@ xf86PostMotionEventM(DeviceIntPtr device,
if (valuator_mask_isset(mask, 0) || if (valuator_mask_isset(mask, 0) ||
valuator_mask_isset(mask, 1)) valuator_mask_isset(mask, 1))
if (miPointerGetScreen(device)) { if (miPointerGetScreen(device)) {
index = miPointerGetScreen(device)->myNum; int index = miPointerGetScreen(device)->myNum;
int dx = 0, dy = 0;
if (valuator_mask_isset(mask, 0)) if (valuator_mask_isset(mask, 0))
{ {
dx = valuator_mask_get(mask, 0); dx = valuator_mask_get(mask, 0);
@ -1160,10 +1157,6 @@ xf86PostButtonEventM(DeviceIntPtr device,
int i = 0, nevents = 0; int i = 0, nevents = 0;
int flags = 0; int flags = 0;
#if XFreeXDGA
int index;
#endif
if (valuator_mask_num_valuators(mask) > 0) if (valuator_mask_num_valuators(mask) > 0)
{ {
if (is_absolute) if (is_absolute)
@ -1174,7 +1167,8 @@ xf86PostButtonEventM(DeviceIntPtr device,
#if XFreeXDGA #if XFreeXDGA
if (miPointerGetScreen(device)) { if (miPointerGetScreen(device)) {
index = miPointerGetScreen(device)->myNum; int index = miPointerGetScreen(device)->myNum;
if (DGAStealButtonEvent(device, index, button, is_down)) if (DGAStealButtonEvent(device, index, button, is_down))
return; return;
} }
@ -1240,6 +1234,19 @@ xf86PostKeyEventM(DeviceIntPtr device,
{ {
int i = 0, nevents = 0; 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) { if (is_absolute) {
nevents = GetKeyboardValuatorEvents(xf86Events, device, nevents = GetKeyboardValuatorEvents(xf86Events, device,
is_down ? KeyPress : KeyRelease, is_down ? KeyPress : KeyRelease,

View File

@ -124,7 +124,6 @@ extern _X_EXPORT Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index, int butto
int is_down); int is_down);
extern _X_EXPORT Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx, int dy); 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 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, extern _X_EXPORT Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem,
int *size, int *offset, int *flags); int *size, int *offset, int *flags);

View File

@ -177,7 +177,7 @@ struct _DGAEvent
Time time; /**< Time in ms */ Time time; /**< Time in ms */
int subtype; /**< KeyPress, KeyRelease, ButtonPress, int subtype; /**< KeyPress, KeyRelease, ButtonPress,
ButtonRelease, MotionNotify */ ButtonRelease, MotionNotify */
int detail; /**< Relative x coordinate */ int detail; /**< Button number or key code */
int dx; /**< Relative x coordinate */ int dx; /**< Relative x coordinate */
int dy; /**< Relative y coordinate */ int dy; /**< Relative y coordinate */
int screen; /**< Screen number this event applies to */ int screen; /**< Screen number this event applies to */

View File

@ -915,9 +915,14 @@ ProcXkbSetControls(ClientPtr client)
stuff->axtOptsMask); stuff->axtOptsMask);
} }
if (stuff->changeCtrls & XkbPerKeyRepeatMask) if (stuff->changeCtrls & XkbPerKeyRepeatMask) {
memcpy(new.per_key_repeat, stuff->perKeyRepeat, memcpy(new.per_key_repeat, stuff->perKeyRepeat,
XkbPerKeyBitArraySize); XkbPerKeyBitArraySize);
if (xkbi->repeatKey &&
!BitIsOn(new.per_key_repeat, xkbi->repeatKey)) {
AccessXCancelRepeatKey(xkbi, xkbi->repeatKey);
}
}
old= *ctrl; old= *ctrl;
*ctrl= new; *ctrl= new;