aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/events.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix/events.c')
-rw-r--r--xorg-server/dix/events.c161
1 files changed, 82 insertions, 79 deletions
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 2682ecd46..f895365d6 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -747,7 +747,10 @@ CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents,
(new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)) {
#ifdef PANORAMIX
if (!noPanoramiXExtension)
- XineramaSetCursorPosition(pDev, new.x, new.y, generateEvents);
+ {
+ if (pScreen && ((new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)))
+ XineramaSetCursorPosition(pDev, new.x, new.y, generateEvents);
+ }
else
#endif
{
@@ -1172,7 +1175,7 @@ void
PlayReleasedEvents(void)
{
QdEventPtr tmp;
- QdEventPtr qe;
+ QdEventPtr qe=NULL;
DeviceIntPtr dev;
DeviceIntPtr pDev;
@@ -1506,7 +1509,7 @@ void
DeactivatePointerGrab(DeviceIntPtr mouse)
{
GrabPtr grab = mouse->deviceGrab.grab;
- DeviceIntPtr dev;
+ DeviceIntPtr dev=mouse;
Bool wasPassive = mouse->deviceGrab.fromPassiveGrab;
Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
mouse->deviceGrab.implicitGrab);
@@ -2280,7 +2283,7 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
rc = EventToXI2((InternalEvent *) ev, (xEvent **) &xi);
if (rc != Success) {
ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n",
- __func__, device->name, rc);
+ __FUNCTION__, device->name, rc);
return;
}
@@ -2864,15 +2867,14 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
if (win == NoneWin || win == PointerRootWin)
return FALSE;
- event = (DeviceEvent) {
- .header = ET_Internal,
- .type = ET_FocusIn,
- .length = sizeof(DeviceEvent),
- .time = GetTimeInMillis(),
- .deviceid = dev->id,
- .sourceid = dev->id,
- .detail.button = 0
- };
+ memset(&event, 0, sizeof(DeviceEvent));
+ event.header = ET_Internal;
+ event.type = ET_FocusIn;
+ event.length = sizeof(DeviceEvent);
+ event.time = GetTimeInMillis();
+ event.deviceid = dev->id;
+ event.sourceid = dev->id;
+ event.detail.button = 0;
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
TRUE) != NULL);
if (rc)
@@ -2902,15 +2904,14 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
(*dev->deviceGrab.DeactivateGrab) (dev);
}
- event = (DeviceEvent) {
- .header = ET_Internal,
- .type = ET_Enter,
- .length = sizeof(DeviceEvent),
- .time = GetTimeInMillis(),
- .deviceid = dev->id,
- .sourceid = dev->id,
- .detail.button = 0
- };
+ memset(&event, 0, sizeof(DeviceEvent));
+ event.header = ET_Internal;
+ event.type = ET_Enter;
+ event.length = sizeof(DeviceEvent);
+ event.time = GetTimeInMillis();
+ event.deviceid = dev->id;
+ event.sourceid = dev->id;
+ event.detail.button = 0;
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
TRUE) != NULL);
if (rc)
@@ -2937,6 +2938,9 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
verify_internal_event((InternalEvent *) ev);
+ if (!pSprite)
+ return FALSE;
+
prevSpriteWin = pSprite->win;
if (ev && !syncEvents.playingEvents) {
@@ -4358,6 +4362,7 @@ OtherClientGone(pointer value, XID id)
prev = other;
}
FatalError("client not on event list");
+ return BadValue; // to avoid warning
}
int
@@ -4489,10 +4494,7 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
int type,
int mode, int detail, WindowPtr pWin, Window child)
{
- xEvent event = {
- .u.u.type = type,
- .u.u.detail = detail
- };
+ xEvent event;
WindowPtr focus;
DeviceIntPtr keybd;
GrabPtr grab = mouse->deviceGrab.grab;
@@ -4512,6 +4514,9 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
mask = pWin->eventMask | wOtherEventMasks(pWin);
}
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = type;
+ event.u.u.detail = detail;
event.u.enterLeave.time = currentTime.milliseconds;
event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x;
event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y;
@@ -4542,16 +4547,17 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
}
if ((type == EnterNotify) && (mask & KeymapStateMask)) {
- xKeymapEvent ke = {
- .type = KeymapNotify
- };
+ xKeymapEvent ke;
ClientPtr client = grab ? rClient(grab) : wClient(pWin);
int rc;
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
if (rc == Success)
memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
+ else
+ memset((char *) &ke.map[0], 0, 31);
+ ke.type = KeymapNotify;
if (grab)
TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1,
mask, KeymapStateMask, grab);
@@ -4642,10 +4648,10 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
void
CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
{
- xEvent event = {
- .u.u.type = type,
- .u.u.detail = detail
- };
+ xEvent event; memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = type;
+ event.u.u.detail = detail;
+
event.u.focus.mode = mode;
event.u.focus.window = pWin->drawable.id;
@@ -4653,16 +4659,17 @@ CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
GetEventFilter(dev, &event), NullGrab);
if ((type == FocusIn) &&
((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) {
- xKeymapEvent ke = {
- .type = KeymapNotify
- };
+ xKeymapEvent ke;
ClientPtr client = wClient(pWin);
int rc;
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
if (rc == Success)
memcpy((char *) &ke.map[0], (char *) &dev->key->down[1], 31);
+ else
+ memset((char *) &ke.map[0], 0, 31);
+ ke.type = KeymapNotify;
DeliverEventsToWindow(dev, pWin, (xEvent *) &ke, 1,
KeymapStateMask, NullGrab);
}
@@ -4804,12 +4811,11 @@ ProcGetInputFocus(ClientPtr client)
if (rc != Success)
return rc;
- rep = (xGetInputFocusReply) {
- .type = X_Reply,
- .length = 0,
- .sequenceNumber = client->sequence,
- .revertTo = focus->revert
- };
+ memset(&rep, 0, sizeof(xGetInputFocusReply));
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.revertTo = focus->revert;
if (focus->win == NoneWin)
rep.focus = None;
@@ -4880,12 +4886,11 @@ ProcGrabPointer(ClientPtr client)
if (oldCursor && status == GrabSuccess)
FreeCursor(oldCursor, (Cursor) 0);
- rep = (xGrabPointerReply) {
- .type = X_Reply,
- .status = status,
- .sequenceNumber = client->sequence,
- .length = 0
- };
+ memset(&rep, 0, sizeof(xGrabPointerReply));
+ rep.type = X_Reply;
+ rep.status = status;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
return Success;
}
@@ -5121,12 +5126,11 @@ ProcGrabKeyboard(ClientPtr client)
if (result != Success)
return result;
- rep = (xGrabKeyboardReply) {
- .type = X_Reply,
- .status = status,
- .sequenceNumber = client->sequence,
- .length = 0
- };
+ memset(&rep, 0, sizeof(xGrabKeyboardReply));
+ rep.type = X_Reply;
+ rep.status = status,
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
return Success;
}
@@ -5189,16 +5193,16 @@ ProcQueryPointer(ClientPtr client)
pSprite = mouse->spriteInfo->sprite;
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
- rep = (xQueryPointerReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .mask = event_get_corestate(mouse, keyboard),
- .root = (GetCurrentRootWindow(mouse))->drawable.id,
- .rootX = pSprite->hot.x,
- .rootY = pSprite->hot.y,
- .child = None
- };
+ memset(&rep, 0, sizeof(xQueryPointerReply));
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.mask = event_get_corestate(mouse, keyboard);
+ rep.root = (GetCurrentRootWindow(mouse))->drawable.id;
+ rep.rootX = pSprite->hot.x;
+ rep.rootY = pSprite->hot.y;
+ rep.child = None;
+
if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
rep.sameScreen = xTrue;
rep.winX = pSprite->hot.x - pWin->drawable.x;
@@ -5248,7 +5252,8 @@ void
InitEvents(void)
{
int i;
- QdEventPtr qe, tmp;
+ QdEventPtr qe=NULL;
+ QdEventPtr tmp;
inputInfo.numDevices = 0;
inputInfo.devices = (DeviceIntPtr) NULL;
@@ -5466,13 +5471,12 @@ ProcGrabKey(ClientPtr client)
REQUEST_SIZE_MATCH(xGrabKeyReq);
- param = (GrabParameters) {
- .grabtype = CORE,
- .ownerEvents = stuff->ownerEvents,
- .this_device_mode = stuff->keyboardMode,
- .other_devices_mode = stuff->pointerMode,
- .modifiers = stuff->modifiers
- };
+ memset(&param, 0, sizeof(param));
+ param.grabtype = CORE;
+ param.ownerEvents = stuff->ownerEvents;
+ param.this_device_mode = stuff->keyboardMode;
+ param.other_devices_mode = stuff->pointerMode;
+ param.modifiers = stuff->modifiers;
rc = CheckGrabValues(client, &param);
if (rc != Success)
@@ -5573,13 +5577,12 @@ ProcGrabButton(ClientPtr client)
if (rc != Success)
return rc;
- param = (GrabParameters) {
- .grabtype = CORE,
- .ownerEvents = stuff->ownerEvents,
- .this_device_mode = stuff->keyboardMode,
- .other_devices_mode = stuff->pointerMode,
- .modifiers = stuff->modifiers
- };
+ memset(&param, 0, sizeof(param));
+ param.grabtype = CORE;
+ param.ownerEvents = stuff->ownerEvents;
+ param.this_device_mode = stuff->keyboardMode;
+ param.other_devices_mode = stuff->pointerMode;
+ param.modifiers = stuff->modifiers;
mask.core = stuff->eventMask;