Merge remote branch 'whot/for-keith'
This commit is contained in:
commit
2307ab5bc9
|
@ -747,7 +747,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
|
|||
KeyClassPtr k = NULL;
|
||||
ButtonClassPtr b = NULL;
|
||||
ValuatorClassPtr v = NULL;
|
||||
BYTE *kptr = NULL;
|
||||
|
||||
/* This event is always the first we get, before the actual events with
|
||||
* the data. However, the way how the DDX is set up, "device" will
|
||||
|
@ -814,32 +813,31 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
|
|||
if (!k)
|
||||
return DONT_PROCESS;
|
||||
|
||||
kptr = &k->down[key >> 3];
|
||||
/* don't allow ddx to generate multiple downs, but repeats are okay */
|
||||
if ((*kptr & bit) && !event->key_repeat)
|
||||
if (key_is_down(device, key, KEY_PROCESSED) && !event->key_repeat)
|
||||
return DONT_PROCESS;
|
||||
|
||||
if (device->valuator)
|
||||
device->valuator->motionHintWindow = NullWindow;
|
||||
*kptr |= bit;
|
||||
set_key_down(device, key, KEY_PROCESSED);
|
||||
} else if (event->type == ET_KeyRelease) {
|
||||
if (!k)
|
||||
return DONT_PROCESS;
|
||||
|
||||
kptr = &k->down[key >> 3];
|
||||
if (!(*kptr & bit)) /* guard against duplicates */
|
||||
if (!key_is_down(device, key, KEY_PROCESSED)) /* guard against duplicates */
|
||||
return DONT_PROCESS;
|
||||
if (device->valuator)
|
||||
device->valuator->motionHintWindow = NullWindow;
|
||||
*kptr &= ~bit;
|
||||
set_key_up(device, key, KEY_PROCESSED);
|
||||
} else if (event->type == ET_ButtonPress) {
|
||||
Mask mask;
|
||||
if (!b)
|
||||
return DONT_PROCESS;
|
||||
|
||||
kptr = &b->down[key >> 3];
|
||||
if ((*kptr & bit) != 0)
|
||||
if (button_is_down(device, key, BUTTON_PROCESSED))
|
||||
return DONT_PROCESS;
|
||||
*kptr |= bit;
|
||||
|
||||
set_button_down(device, key, BUTTON_PROCESSED);
|
||||
if (device->valuator)
|
||||
device->valuator->motionHintWindow = NullWindow;
|
||||
if (!b->map[key])
|
||||
|
@ -859,8 +857,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
|
|||
if (!b)
|
||||
return DONT_PROCESS;
|
||||
|
||||
kptr = &b->down[key>>3];
|
||||
if (!(*kptr & bit))
|
||||
if (!button_is_down(device, key, BUTTON_PROCESSED))
|
||||
return DONT_PROCESS;
|
||||
if (IsMaster(device)) {
|
||||
DeviceIntPtr sd;
|
||||
|
@ -875,11 +872,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
|
|||
continue;
|
||||
if (!sd->button)
|
||||
continue;
|
||||
if ((sd->button->down[key>>3] & bit) != 0)
|
||||
if (button_is_down(sd, key, BUTTON_PROCESSED))
|
||||
return DONT_PROCESS;
|
||||
}
|
||||
}
|
||||
*kptr &= ~bit;
|
||||
set_button_up(device, key, BUTTON_PROCESSED);
|
||||
if (device->valuator)
|
||||
device->valuator->motionHintWindow = NullWindow;
|
||||
if (!b->map[key])
|
||||
|
|
12
dix/events.c
12
dix/events.c
|
@ -3937,13 +3937,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
|||
void
|
||||
FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
|
||||
{
|
||||
int key, bit;
|
||||
BYTE *kptr;
|
||||
KeyClassPtr keyc = keybd->key;
|
||||
|
||||
key = event->detail.key;
|
||||
kptr = &keyc->down[key >> 3];
|
||||
bit = 1 << (key & 7);
|
||||
int key = event->detail.key;
|
||||
|
||||
if (event->type == ET_KeyPress) {
|
||||
DebugF("FixKeyState: Key %d %s\n",key,
|
||||
|
@ -3951,9 +3945,9 @@ FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
|
|||
}
|
||||
|
||||
if (event->type == ET_KeyPress)
|
||||
*kptr |= bit;
|
||||
set_key_down(keybd, key, KEY_PROCESSED);
|
||||
else if (event->type == ET_KeyRelease)
|
||||
*kptr &= ~bit;
|
||||
set_key_up(keybd, key, KEY_PROCESSED);
|
||||
else
|
||||
FatalError("Impossible keyboard event");
|
||||
}
|
||||
|
|
|
@ -90,22 +90,53 @@ GetMotionHistorySize(void)
|
|||
return MOTION_HISTORY_SIZE;
|
||||
}
|
||||
|
||||
void
|
||||
set_button_down(DeviceIntPtr pDev, int button, int type)
|
||||
{
|
||||
if (type == BUTTON_PROCESSED)
|
||||
SetBit(pDev->button->down, button);
|
||||
else
|
||||
SetBit(pDev->button->postdown, button);
|
||||
}
|
||||
|
||||
void
|
||||
set_button_up(DeviceIntPtr pDev, int button, int type)
|
||||
{
|
||||
if (type == BUTTON_PROCESSED)
|
||||
ClearBit(pDev->button->down, button);
|
||||
else
|
||||
ClearBit(pDev->button->postdown, button);
|
||||
}
|
||||
|
||||
Bool
|
||||
button_is_down(DeviceIntPtr pDev, int button, int type)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (type & BUTTON_PROCESSED)
|
||||
ret |= !!BitIsOn(pDev->button->down, button);
|
||||
if (type & BUTTON_POSTED)
|
||||
ret |= !!BitIsOn(pDev->button->postdown, button);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
set_key_down(DeviceIntPtr pDev, int key_code, int type)
|
||||
{
|
||||
if (type == KEY_PROCESSED)
|
||||
pDev->key->down[key_code >> 3] |= (1 << (key_code & 7));
|
||||
SetBit(pDev->key->down, key_code);
|
||||
else
|
||||
pDev->key->postdown[key_code >> 3] |= (1 << (key_code & 7));
|
||||
SetBit(pDev->key->postdown, key_code);
|
||||
}
|
||||
|
||||
void
|
||||
set_key_up(DeviceIntPtr pDev, int key_code, int type)
|
||||
{
|
||||
if (type == KEY_PROCESSED)
|
||||
pDev->key->down[key_code >> 3] &= ~(1 << (key_code & 7));
|
||||
ClearBit(pDev->key->down, key_code);
|
||||
else
|
||||
pDev->key->postdown[key_code >> 3] &= ~(1 << (key_code & 7));
|
||||
ClearBit(pDev->key->postdown, key_code);
|
||||
}
|
||||
|
||||
Bool
|
||||
|
@ -114,9 +145,9 @@ key_is_down(DeviceIntPtr pDev, int key_code, int type)
|
|||
int ret = 0;
|
||||
|
||||
if (type & KEY_PROCESSED)
|
||||
ret |= !!(pDev->key->down[key_code >> 3] & (1 << (key_code & 7)));
|
||||
else if (type & KEY_POSTED)
|
||||
ret |= !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
|
||||
ret |= !!BitIsOn(pDev->key->down, key_code);
|
||||
if (type & KEY_POSTED)
|
||||
ret |= !!BitIsOn(pDev->key->postdown, key_code);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1123,11 +1154,11 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
|
|||
else {
|
||||
if (type == ButtonPress) {
|
||||
event->type = ET_ButtonPress;
|
||||
pDev->button->postdown[buttons >> 3] |= (1 << (buttons & 7));
|
||||
set_button_down(pDev, buttons, BUTTON_POSTED);
|
||||
}
|
||||
else if (type == ButtonRelease) {
|
||||
event->type = ET_ButtonRelease;
|
||||
pDev->button->postdown[buttons >> 3] &= ~(1 << (buttons & 7));
|
||||
set_button_up(pDev, buttons, BUTTON_POSTED);
|
||||
}
|
||||
event->detail.button = buttons;
|
||||
}
|
||||
|
|
|
@ -66,8 +66,6 @@
|
|||
#define KanaMask Mod4Mask
|
||||
#define ScrollLockMask Mod5Mask
|
||||
|
||||
#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
|
||||
|
||||
/*
|
||||
* NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
|
||||
* sets of scancodes. Set3 can only be generated by a MF keyboard.
|
||||
|
|
|
@ -776,13 +776,7 @@ ephyrUpdateModifierState(unsigned int state)
|
|||
|
||||
for (key = 0; key < MAP_LENGTH; key++)
|
||||
if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
|
||||
int bit;
|
||||
BYTE *kptr;
|
||||
|
||||
kptr = &keyc->down[key >> 3];
|
||||
bit = 1 << (key & 7);
|
||||
|
||||
if (*kptr & bit)
|
||||
if (key_is_down(pDev, key, KEY_PROCESSED))
|
||||
KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE);
|
||||
|
||||
if (--count == 0)
|
||||
|
|
|
@ -372,8 +372,6 @@ xf86PrintBacktrace(void)
|
|||
xorg_backtrace();
|
||||
}
|
||||
|
||||
#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
|
||||
|
||||
static void
|
||||
xf86ReleaseKeys(DeviceIntPtr pDev)
|
||||
{
|
||||
|
@ -399,7 +397,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
|
|||
for (i = keyc->xkbInfo->desc->min_key_code;
|
||||
i < keyc->xkbInfo->desc->max_key_code;
|
||||
i++) {
|
||||
if (KeyPressed(i)) {
|
||||
if (key_is_down(pDev, i, KEY_POSTED)) {
|
||||
sigstate = xf86BlockSIGIO ();
|
||||
nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
|
||||
for (j = 0; j < nevents; j++)
|
||||
|
|
|
@ -231,13 +231,7 @@ xnestUpdateModifierState(unsigned int state)
|
|||
|
||||
for (key = 0; key < MAP_LENGTH; key++)
|
||||
if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
|
||||
int bit;
|
||||
BYTE *kptr;
|
||||
|
||||
kptr = &keyc->down[key >> 3];
|
||||
bit = 1 << (key & 7);
|
||||
|
||||
if (*kptr & bit)
|
||||
if (key_is_down(pDev, key, KEY_PROCESSED))
|
||||
xnestQueueKeyEvent(KeyRelease, key);
|
||||
|
||||
if (--count == 0)
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#define KanaMask Mod4Mask
|
||||
#define ScrollLockMask Mod5Mask
|
||||
|
||||
#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7)))
|
||||
#define ModifierDown(k) ((keyc->state & (k)) == (k))
|
||||
|
||||
/*
|
||||
|
|
|
@ -228,14 +228,19 @@ typedef struct _InputAttributes {
|
|||
#define ATTR_TOUCHPAD (1<<4)
|
||||
#define ATTR_TOUCHSCREEN (1<<5)
|
||||
|
||||
/* Key has been run through all input processing and events sent to clients. */
|
||||
/* Key/Button has been run through all input processing and events sent to clients. */
|
||||
#define KEY_PROCESSED 1
|
||||
/* Key has not been fully processed, no events have been sent. */
|
||||
#define BUTTON_PROCESSED 1
|
||||
/* Key/Button has not been fully processed, no events have been sent. */
|
||||
#define KEY_POSTED 2
|
||||
#define BUTTON_POSTED 2
|
||||
|
||||
extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
|
||||
extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
|
||||
extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
|
||||
extern void set_button_down(DeviceIntPtr pDev, int button, int type);
|
||||
extern void set_button_up(DeviceIntPtr pDev, int button, int type);
|
||||
extern int button_is_down(DeviceIntPtr pDev, int button, int type);
|
||||
|
||||
extern void InitCoreDevices(void);
|
||||
extern void InitXTestDevices(void);
|
||||
|
|
|
@ -73,6 +73,7 @@ static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen,
|
|||
static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
|
||||
static void miPointerDeviceCleanup(DeviceIntPtr pDev,
|
||||
ScreenPtr pScreen);
|
||||
static void miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
|
||||
|
||||
static EventList* events; /* for WarpPointer MotionNotifies */
|
||||
|
||||
|
@ -305,24 +306,9 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
|||
}
|
||||
|
||||
if (GenerateEvent)
|
||||
{
|
||||
miPointerMove (pDev, pScreen, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* everything from miPointerMove except the event and history */
|
||||
|
||||
if (!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
|
||||
{
|
||||
pPointer->devx = x;
|
||||
pPointer->devy = y;
|
||||
if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
|
||||
(*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
|
||||
}
|
||||
pPointer->x = x;
|
||||
pPointer->y = y;
|
||||
pPointer->pScreen = pScreen;
|
||||
}
|
||||
miPointerMoveNoEvent(pDev, pScreen, x, y);
|
||||
|
||||
/* Don't call USFS if we use Xinerama, otherwise the root window is
|
||||
* updated to the second screen, and we never receive any events.
|
||||
|
@ -470,7 +456,7 @@ miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait)
|
|||
|
||||
/* Move the pointer on the current screen, and update the sprite. */
|
||||
static void
|
||||
miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||
miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||
int x, int y)
|
||||
{
|
||||
miPointerPtr pPointer;
|
||||
|
@ -546,7 +532,7 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
|
|||
pPointer->pScreen == pScreen)
|
||||
return;
|
||||
|
||||
miPointerMoved(pDev, pScreen, *x, *y);
|
||||
miPointerMoveNoEvent(pDev, pScreen, *x, *y);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -568,7 +554,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
|||
int i, nevents;
|
||||
int valuators[2];
|
||||
|
||||
miPointerMoved(pDev, pScreen, x, y);
|
||||
miPointerMoveNoEvent(pDev, pScreen, x, y);
|
||||
|
||||
/* generate motion notify */
|
||||
valuators[0] = x;
|
||||
|
|
Loading…
Reference in New Issue