Merge remote-tracking branch 'whot/for-keith'
This commit is contained in:
commit
6d86b64dba
|
@ -926,10 +926,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
|
|||
else if (event->type == ET_ProximityOut)
|
||||
device->proximity->in_proximity = FALSE;
|
||||
else if (event->type == ET_TouchBegin) {
|
||||
BUG_WARN(!b || !v);
|
||||
BUG_WARN(!t);
|
||||
BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
|
||||
BUG_RETURN_VAL(!t, DONT_PROCESS);
|
||||
|
||||
if (!b || !t || !b->map[key])
|
||||
if (!b->map[key])
|
||||
return DONT_PROCESS;
|
||||
|
||||
if (!(event->flags & TOUCH_POINTER_EMULATED) ||
|
||||
|
@ -941,10 +941,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
|
|||
UpdateDeviceMotionMask(device, t->state, DeviceButtonMotionMask);
|
||||
}
|
||||
else if (event->type == ET_TouchEnd) {
|
||||
BUG_WARN(!b || !v);
|
||||
BUG_WARN(!t);
|
||||
BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
|
||||
BUG_RETURN_VAL(!t, DONT_PROCESS);
|
||||
|
||||
if (!b || !t || t->buttonsDown <= 0 || !b->map[key])
|
||||
if (t->buttonsDown <= 0 || !b->map[key])
|
||||
return DONT_PROCESS;
|
||||
|
||||
if (!(event->flags & TOUCH_POINTER_EMULATED))
|
||||
|
@ -1356,9 +1356,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
wOtherInputMasks(*win)->inputClients, next)
|
||||
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
|
||||
break;
|
||||
BUG_WARN(!iclients);
|
||||
if (!iclients)
|
||||
return FALSE;
|
||||
|
||||
BUG_RETURN_VAL(!iclients, FALSE);
|
||||
|
||||
*mask = iclients->xi2mask;
|
||||
*client = rClient(iclients);
|
||||
|
@ -1371,9 +1370,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
wOtherInputMasks(*win)->inputClients, next)
|
||||
if (iclients->mask[dev->id] & xi_filter)
|
||||
break;
|
||||
BUG_WARN(!iclients);
|
||||
if (!iclients)
|
||||
return FALSE;
|
||||
BUG_RETURN_VAL(!iclients, FALSE);
|
||||
|
||||
*client = rClient(iclients);
|
||||
}
|
||||
|
@ -1414,9 +1411,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
return Success;
|
||||
|
||||
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
|
||||
BUG_WARN(nevents == 0);
|
||||
if (nevents == 0)
|
||||
return BadValue;
|
||||
BUG_RETURN_VAL(nevents == 0, BadValue);
|
||||
|
||||
if (nevents > 1)
|
||||
ptrev = &button;
|
||||
|
|
|
@ -293,12 +293,6 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
|
|||
}
|
||||
}
|
||||
|
||||
/* can't disable until we removed pairing */
|
||||
keybd->spriteInfo->paired = NULL;
|
||||
ptr->spriteInfo->paired = NULL;
|
||||
XTestptr->spriteInfo->paired = NULL;
|
||||
XTestkeybd->spriteInfo->paired = NULL;
|
||||
|
||||
/* disable the remove the devices, XTest devices must be done first
|
||||
else the sprites they rely on will be destroyed */
|
||||
DisableDevice(XTestptr, FALSE);
|
||||
|
|
|
@ -178,12 +178,9 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
|
|||
|
||||
/* Pair the keyboard to the pointer device. Keyboard events will follow the
|
||||
* pointer sprite. Only applicable for master devices.
|
||||
* If the client is set, the request to pair comes from some client. In this
|
||||
* case, we need to check for access. If the client is NULL, it's from an
|
||||
* internal automatic pairing, we must always permit this.
|
||||
*/
|
||||
static int
|
||||
PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
|
||||
PairDevices(DeviceIntPtr ptr, DeviceIntPtr kbd)
|
||||
{
|
||||
if (!ptr)
|
||||
return BadDevice;
|
||||
|
@ -365,13 +362,12 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
/* mode doesn't matter */
|
||||
EnterWindow(dev, screenInfo.screens[0]->root, NotifyAncestor);
|
||||
}
|
||||
else if ((other = NextFreePointerDevice()) == NULL) {
|
||||
ErrorF("[dix] cannot find pointer to pair with. "
|
||||
"This is a bug.\n");
|
||||
return FALSE;
|
||||
else {
|
||||
other = NextFreePointerDevice();
|
||||
BUG_RETURN_VAL_MSG(other == NULL, FALSE,
|
||||
"[dix] cannot find pointer to pair with.\n");
|
||||
PairDevices(other, dev);
|
||||
}
|
||||
else
|
||||
PairDevices(NULL, other, dev);
|
||||
}
|
||||
else {
|
||||
if (dev->coreEvents)
|
||||
|
@ -432,6 +428,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
BOOL enabled;
|
||||
int flags[MAXDEVICES] = { 0 };
|
||||
|
||||
if (!dev->enabled)
|
||||
return TRUE;
|
||||
|
||||
for (prev = &inputInfo.devices;
|
||||
*prev && (*prev != dev); prev = &(*prev)->next);
|
||||
if (*prev != dev)
|
||||
|
@ -458,18 +457,19 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
}
|
||||
|
||||
if (IsMaster(dev) && dev->spriteInfo->sprite) {
|
||||
for (other = inputInfo.devices; other; other = other->next) {
|
||||
if (other->spriteInfo->paired == dev) {
|
||||
ErrorF("[dix] cannot disable device, still paired. "
|
||||
"This is a bug. \n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
for (other = inputInfo.devices; other; other = other->next)
|
||||
if (other->spriteInfo->paired == dev && !other->spriteInfo->spriteOwner)
|
||||
DisableDevice(other, sendevent);
|
||||
}
|
||||
|
||||
if (dev->spriteInfo->paired)
|
||||
dev->spriteInfo->paired = NULL;
|
||||
|
||||
(void) (*dev->deviceProc) (dev, DEVICE_OFF);
|
||||
dev->enabled = FALSE;
|
||||
|
||||
FreeSprite(dev);
|
||||
|
||||
/* now that the device is disabled, we can reset the signal handler's
|
||||
* last.slave */
|
||||
OsBlockSignals();
|
||||
|
@ -501,6 +501,26 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
DisableAllDevices(void)
|
||||
{
|
||||
DeviceIntPtr dev, tmp;
|
||||
|
||||
nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
|
||||
if (!IsMaster(dev))
|
||||
DisableDevice(dev, FALSE);
|
||||
}
|
||||
/* master keyboards need to be disabled first */
|
||||
nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
|
||||
if (dev->enabled && IsMaster(dev) && IsKeyboardDevice(dev))
|
||||
DisableDevice(dev, FALSE);
|
||||
}
|
||||
nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
|
||||
if (dev->enabled)
|
||||
DisableDevice(dev, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise a new device through the driver and tell all clients about the
|
||||
* new device.
|
||||
|
@ -923,12 +943,7 @@ CloseDevice(DeviceIntPtr dev)
|
|||
free(classes);
|
||||
}
|
||||
|
||||
if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
|
||||
if (dev->spriteInfo->sprite->current)
|
||||
FreeCursor(dev->spriteInfo->sprite->current, None);
|
||||
free(dev->spriteInfo->sprite->spriteTrace);
|
||||
free(dev->spriteInfo->sprite);
|
||||
}
|
||||
FreeSprite(dev);
|
||||
|
||||
/* a client may have the device set as client pointer */
|
||||
for (j = 0; j < currentMaxClients; j++) {
|
||||
|
|
12
dix/events.c
12
dix/events.c
|
@ -3192,6 +3192,18 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
|
|||
#endif
|
||||
}
|
||||
|
||||
void FreeSprite(DeviceIntPtr dev)
|
||||
{
|
||||
if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
|
||||
if (dev->spriteInfo->sprite->current)
|
||||
FreeCursor(dev->spriteInfo->sprite->current, None);
|
||||
free(dev->spriteInfo->sprite->spriteTrace);
|
||||
free(dev->spriteInfo->sprite);
|
||||
}
|
||||
dev->spriteInfo->sprite = NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the mouse sprite info when the server switches from a pScreen to another.
|
||||
* Otherwise, the pScreen of the mouse sprite is never updated when we switch
|
||||
|
|
|
@ -1821,10 +1821,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
|
|||
|
||||
if (flags & TOUCH_CLIENT_ID) { /* A DIX-submitted TouchEnd */
|
||||
touchpoint.dix_ti = TouchFindByClientID(dev, ddx_touchid);
|
||||
BUG_WARN(!touchpoint.dix_ti);
|
||||
|
||||
if (!touchpoint.dix_ti)
|
||||
return 0;
|
||||
BUG_RETURN_VAL(!touchpoint.dix_ti, 0);
|
||||
|
||||
if (!mask_in ||
|
||||
!valuator_mask_isset(mask_in, 0) ||
|
||||
|
|
|
@ -104,6 +104,7 @@ Equipment Corporation.
|
|||
#include "privates.h"
|
||||
#include "registry.h"
|
||||
#include "client.h"
|
||||
#include "exevents.h"
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiXsrv.h"
|
||||
#else
|
||||
|
@ -295,6 +296,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
#endif
|
||||
|
||||
UndisplayDevices();
|
||||
DisableAllDevices();
|
||||
|
||||
/* Now free up whatever must be freed */
|
||||
if (screenIsSaved == SCREEN_SAVER_ON)
|
||||
|
@ -318,7 +320,9 @@ main(int argc, char *argv[], char *envp[])
|
|||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
screenInfo.screens[i]->root = NullWindow;
|
||||
|
||||
CloseDownDevices();
|
||||
|
||||
CloseDownEvents();
|
||||
|
||||
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
|
||||
|
|
23
dix/touch.c
23
dix/touch.c
|
@ -103,11 +103,11 @@ TouchResizeQueue(ClientPtr client, pointer closure)
|
|||
|
||||
tmp = realloc(dev->last.touches, size * sizeof(*dev->last.touches));
|
||||
if (tmp) {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
dev->last.touches = tmp;
|
||||
for (i = dev->last.num_touches; i < size; i++)
|
||||
TouchInitDDXTouchPoint(dev, &dev->last.touches[i]);
|
||||
for (j = dev->last.num_touches; j < size; j++)
|
||||
TouchInitDDXTouchPoint(dev, &dev->last.touches[j]);
|
||||
dev->last.num_touches = size;
|
||||
}
|
||||
|
||||
|
@ -598,8 +598,8 @@ TouchConvertToPointerEvent(const InternalEvent *event,
|
|||
int ptrtype;
|
||||
int nevents = 0;
|
||||
|
||||
BUG_WARN(!event);
|
||||
BUG_WARN(!motion_event);
|
||||
BUG_RETURN_VAL(!event, 0);
|
||||
BUG_RETURN_VAL(!motion_event, 0);
|
||||
|
||||
switch (event->any.type) {
|
||||
case ET_TouchUpdate:
|
||||
|
@ -627,7 +627,7 @@ TouchConvertToPointerEvent(const InternalEvent *event,
|
|||
motion_event->device_event.flags = XIPointerEmulated;
|
||||
|
||||
if (nevents > 1) {
|
||||
BUG_WARN(!button_event);
|
||||
BUG_RETURN_VAL(!button_event, 0);
|
||||
*button_event = *event;
|
||||
button_event->any.type = ptrtype;
|
||||
button_event->device_event.flags = XIPointerEmulated;
|
||||
|
@ -966,10 +966,8 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
|
|||
int nev;
|
||||
int i;
|
||||
|
||||
BUG_WARN(listener < 0);
|
||||
BUG_WARN(listener >= ti->num_listeners);
|
||||
if (listener < 0 || listener >= ti->num_listeners)
|
||||
return BadMatch;
|
||||
BUG_RETURN_VAL(listener < 0, BadMatch);
|
||||
BUG_RETURN_VAL(listener >= ti->num_listeners, BadMatch);
|
||||
|
||||
if (listener > 0) {
|
||||
if (mode == XIRejectTouch)
|
||||
|
@ -981,10 +979,7 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
|
|||
}
|
||||
|
||||
events = InitEventList(GetMaximumEventsNum());
|
||||
if (!events) {
|
||||
BUG_WARN_MSG(TRUE, "Failed to allocate touch ownership events\n");
|
||||
return BadAlloc;
|
||||
}
|
||||
BUG_RETURN_VAL_MSG(!events, BadAlloc, "Failed to allocate touch ownership events\n");
|
||||
|
||||
nev = GetTouchOwnershipEvents(events, dev, ti, mode,
|
||||
ti->listeners[0].listener, 0);
|
||||
|
|
|
@ -395,6 +395,8 @@ DeliverTouchEvents(DeviceIntPtr /* dev */ ,
|
|||
extern void
|
||||
InitializeSprite(DeviceIntPtr /* pDev */ ,
|
||||
WindowPtr /* pWin */ );
|
||||
extern void
|
||||
FreeSprite(DeviceIntPtr pDev);
|
||||
|
||||
extern void
|
||||
UpdateSpriteForScreen(DeviceIntPtr /* pDev */ ,
|
||||
|
|
|
@ -264,7 +264,7 @@ extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device */ ,
|
|||
|
||||
extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ ,
|
||||
BOOL /* sendevent */ );
|
||||
|
||||
extern void DisableAllDevices(void);
|
||||
extern int InitAndStartDevices(void);
|
||||
|
||||
extern void CloseDownDevices(void);
|
||||
|
|
|
@ -381,4 +381,16 @@ extern _X_EXPORT unsigned long serverGeneration;
|
|||
|
||||
#define BUG_WARN(cond) __BUG_WARN_MSG(cond, 0, NULL)
|
||||
|
||||
#define BUG_RETURN(cond) \
|
||||
do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return; } } while(0)
|
||||
|
||||
#define BUG_RETURN_MSG(cond, ...) \
|
||||
do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return; } } while(0)
|
||||
|
||||
#define BUG_RETURN_VAL(cond, val) \
|
||||
do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return (val); } } while(0)
|
||||
|
||||
#define BUG_RETURN_VAL_MSG(cond, val, ...) \
|
||||
do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return (val); } } while(0)
|
||||
|
||||
#endif /* MISC_H */
|
||||
|
|
|
@ -40,6 +40,7 @@ touch_grow_queue(void)
|
|||
int i;
|
||||
|
||||
memset(&dev, 0, sizeof(dev));
|
||||
dev.name = "test device";
|
||||
dev.id = 2;
|
||||
dev.valuator = &val;
|
||||
val.numAxes = 5;
|
||||
|
@ -94,6 +95,7 @@ touch_find_ddxid(void)
|
|||
int i;
|
||||
|
||||
memset(&dev, 0, sizeof(dev));
|
||||
dev.name = "test device";
|
||||
dev.id = 2;
|
||||
dev.valuator = &val;
|
||||
val.numAxes = 5;
|
||||
|
@ -162,6 +164,7 @@ touch_begin_ddxtouch(void)
|
|||
int size = 5;
|
||||
|
||||
memset(&dev, 0, sizeof(dev));
|
||||
dev.name = "test device";
|
||||
dev.id = 2;
|
||||
dev.valuator = &val;
|
||||
val.numAxes = 5;
|
||||
|
@ -209,6 +212,7 @@ touch_begin_touch(void)
|
|||
screenInfo.screens[0] = &screen;
|
||||
|
||||
memset(&dev, 0, sizeof(dev));
|
||||
dev.name = "test device";
|
||||
dev.id = 2;
|
||||
|
||||
memset(&sprite, 0, sizeof(sprite));
|
||||
|
@ -247,6 +251,7 @@ touch_init(void)
|
|||
screenInfo.screens[0] = &screen;
|
||||
|
||||
memset(&dev, 0, sizeof(dev));
|
||||
dev.name = "test device";
|
||||
|
||||
memset(&sprite, 0, sizeof(sprite));
|
||||
dev.spriteInfo = &sprite;
|
||||
|
|
|
@ -295,10 +295,15 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
|
|||
cn.eventType = 0;
|
||||
cn.requestMajor = 0;
|
||||
cn.requestMinor = 0;
|
||||
if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask)
|
||||
if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask) {
|
||||
AccessXKRGTurnOff((DeviceIntPtr) arg, &cn);
|
||||
else
|
||||
LogMessage(X_INFO, "XKB SlowKeys are disabled.\n");
|
||||
}
|
||||
else {
|
||||
AccessXKRGTurnOn((DeviceIntPtr) arg, XkbSlowKeysMask, &cn);
|
||||
LogMessage(X_INFO, "XKB SlowKeys are now enabled. Hold shift to disable.\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user