Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~whot/xserver into server-1.13-branch

This commit is contained in:
Matt Dew 2012-11-07 23:24:53 -07:00
commit 7914986fb8
7 changed files with 62 additions and 12 deletions

View file

@ -1559,6 +1559,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
uint32_t touchid;
int type = ev->any.type;
int emulate_pointer = ! !(ev->device_event.flags & TOUCH_POINTER_EMULATED);
DeviceIntPtr kbd;
if (!t)
return;
@ -1568,9 +1569,6 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
else
touchid = ev->device_event.touchid;
if (emulate_pointer)
UpdateDeviceState(dev, &ev->device_event);
if (type == ET_TouchBegin) {
ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
emulate_pointer);
@ -1617,9 +1615,14 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
* events which _only_ emulate motion just work normally */
if (emulate_pointer && ev->any.type != ET_TouchUpdate)
DeliverEmulatedMotionEvent(dev, ti, ev);
if (emulate_pointer && IsMaster(dev))
CheckMotion(&ev->device_event, dev);
kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
event_set_state(NULL, kbd, &ev->device_event);
ev->device_event.corestate = event_get_corestate(NULL, kbd);
/* Make sure we have a valid window trace for event delivery; must be
* called after event type mutation. Touch end events are always processed
* in order to end touch records. */
@ -1641,6 +1644,9 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
if (ev->any.type == ET_TouchEnd)
TouchEndTouch(dev, ti);
}
if (emulate_pointer)
UpdateDeviceState(dev, &ev->device_event);
}
/**
@ -1862,6 +1868,11 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
goto out;
}
if (listener->state == LISTENER_AWAITING_BEGIN) {
listener->state = LISTENER_HAS_END;
goto out;
}
/* Event in response to reject */
if (ev->device_event.flags & TOUCH_REJECT) {
if (listener->state != LISTENER_HAS_END)

View file

@ -443,6 +443,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
if (*prev != dev)
return FALSE;
TouchEndPhysicallyActiveTouches(dev);
ReleaseButtonsAndKeys(dev);
SyncRemoveDeviceIdleTime(dev->idle_counter);
dev->idle_counter = NULL;

View file

@ -1593,13 +1593,10 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
{
GrabPtr grab = keybd->deviceGrab.grab;
DeviceIntPtr dev;
WindowPtr focusWin = keybd->focus ? keybd->focus->win
: keybd->spriteInfo->sprite->win;
WindowPtr focusWin;
Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab &&
keybd->deviceGrab.implicitGrab);
if (focusWin == FollowKeyboardWin)
focusWin = inputInfo.keyboard->focus->win;
if (keybd->valuator)
keybd->valuator->motionHintWindow = NullWindow;
keybd->deviceGrab.grab = NullGrab;
@ -1610,6 +1607,17 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
if (dev->deviceGrab.sync.other == grab)
dev->deviceGrab.sync.other = NullGrab;
}
if (keybd->focus)
focusWin = keybd->focus->win;
else if (keybd->spriteInfo->sprite)
focusWin = keybd->spriteInfo->sprite->win;
else
focusWin = NullWindow;
if (focusWin == FollowKeyboardWin)
focusWin = inputInfo.keyboard->focus->win;
DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
if (!wasImplicit && grab->grabtype == XI2)

View file

@ -1400,8 +1400,9 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
coordinates were.
*/
if (flags & POINTER_SCREEN) {
screenx = sx;
screeny = sy;
scr = miPointerGetScreen(pDev);
screenx = sx + scr->x;
screeny = sy + scr->y;
}
scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,

View file

@ -572,8 +572,8 @@ TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
return FALSE;
/* Mark which grabs/event selections we're delivering to: max one grab per
* window plus the bottom-most event selection. */
ti->listeners = calloc(sprite->spriteTraceGood + 1, sizeof(*ti->listeners));
* window plus the bottom-most event selection, plus any active grab. */
ti->listeners = calloc(sprite->spriteTraceGood + 2, sizeof(*ti->listeners));
if (!ti->listeners) {
sprite->spriteTraceGood = 0;
return FALSE;
@ -1029,3 +1029,31 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
return TouchListenerAcceptReject(dev, ti, i, mode);
}
/**
* End physically active touches for a device.
*/
void
TouchEndPhysicallyActiveTouches(DeviceIntPtr dev)
{
InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
int i;
OsBlockSignals();
mieqProcessInputEvents();
for (i = 0; i < dev->last.num_touches; i++) {
DDXTouchPointInfoPtr ddxti = dev->last.touches + i;
if (ddxti->active) {
int j;
int nevents = GetTouchEvents(eventlist, dev, ddxti->ddx_id,
XI_TouchEnd, 0, NULL);
for (j = 0; j < nevents; j++)
mieqProcessDeviceEvent(dev, eventlist + j, NULL);
}
}
OsReleaseSignals();
FreeEventList(eventlist, GetMaximumEventsNum());
}

View file

@ -579,6 +579,7 @@ extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti,
int listener, int mode);
extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
uint32_t touchid, Window grab_window, XID *error);
extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev);
/* misc event helpers */
extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr clients);

View file

@ -709,7 +709,7 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
DeviceEvent *event = &ev->device_event;
dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
dev = (IsMaster(mouse) || IsFloating(mouse)) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
if (dev && dev->key) {
xkbi = dev->key->xkbInfo;