aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-15 08:55:18 +0200
committermarha <marha@users.sourceforge.net>2012-06-15 08:55:18 +0200
commitd6f64084b9bc07d0bdd527f9354f2d1d962ed16d (patch)
tree81b2652d421992fd63143a04885e332e83e18d07 /xorg-server/dix
parent669b562a737c9418c53bfae69c0dbf1aabe318b4 (diff)
parent7a2af605c2c2b0d2e9bbb0b161eba8842acefbcb (diff)
downloadvcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.tar.gz
vcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.tar.bz2
vcxsrv-d6f64084b9bc07d0bdd527f9354f2d1d962ed16d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: fontconfig/src/fcint.h fontconfig/src/fcstat.c mesalib/src/mapi/glapi/gen/GL3x.xml xorg-server/glx/glxext.h
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/devices.c61
-rw-r--r--xorg-server/dix/events.c12
-rw-r--r--xorg-server/dix/getevents.c5
-rw-r--r--xorg-server/dix/main.c4
-rw-r--r--xorg-server/dix/touch.c23
5 files changed, 64 insertions, 41 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 7f70ca69a..02c560216 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -182,12 +182,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;
@@ -369,13 +366,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)
@@ -436,6 +432,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)
@@ -462,18 +461,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();
@@ -505,6 +505,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.
@@ -927,12 +947,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++) {
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 47c61d42b..009e21b5d 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -3198,6 +3198,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
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 7242c2c79..e1b26783f 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -1842,10 +1842,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) ||
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 92f5dcb49..217117eb0 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -104,6 +104,7 @@ Equipment Corporation.
#include "privates.h"
#include "registry.h"
#include "client.h"
+#include "exevents.h"
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#else
@@ -344,6 +345,7 @@ main(int argc, char *argv[], char *envp[])
#endif
UndisplayDevices();
+ DisableAllDevices();
/* Now free up whatever must be freed */
if (screenIsSaved == SCREEN_SAVER_ON)
@@ -367,7 +369,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--) {
diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c
index 401cb981a..aa17faf28 100644
--- a/xorg-server/dix/touch.c
+++ b/xorg-server/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);