aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/devices.c23
-rw-r--r--xorg-server/dix/eventconvert.c9
-rw-r--r--xorg-server/dix/extension.c6
-rw-r--r--xorg-server/dix/inpututils.c24
-rw-r--r--xorg-server/dix/privates.c1
-rw-r--r--xorg-server/dix/property.c1
-rw-r--r--xorg-server/dix/selection.c3
7 files changed, 40 insertions, 27 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index ec43f294a..860a61867 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -2018,8 +2018,9 @@ ProcChangeKeyboardControl (ClientPtr client)
keyboard = PickKeyboard(client);
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
- if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) &&
- pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ if ((pDev == keyboard ||
+ (!IsMaster(pDev) && GetMaster(pDev, MASTER_KEYBOARD) == keyboard))
+ && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
if (ret != Success)
return ret;
@@ -2027,8 +2028,9 @@ ProcChangeKeyboardControl (ClientPtr client)
}
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
- if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) &&
- pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ if ((pDev == keyboard ||
+ (!IsMaster(pDev) && GetMaster(pDev, MASTER_KEYBOARD) == keyboard))
+ && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
if (ret != Success)
error = ret;
@@ -2088,7 +2090,8 @@ ProcBell(ClientPtr client)
newpercent = base - newpercent + stuff->percent;
for (dev = inputInfo.devices; dev; dev = dev->next) {
- if ((dev == keybd || (!IsMaster(dev) && dev->u.master == keybd)) &&
+ if ((dev == keybd ||
+ (!IsMaster(dev) && GetMaster(dev, MASTER_KEYBOARD) == keybd)) &&
dev->kbdfeed && dev->kbdfeed->BellProc) {
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixBellAccess);
@@ -2157,7 +2160,8 @@ ProcChangePointerControl(ClientPtr client)
}
for (dev = inputInfo.devices; dev; dev = dev->next) {
- if ((dev == mouse || (!IsMaster(dev) && dev->u.master == mouse)) &&
+ if ((dev == mouse ||
+ (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) == mouse)) &&
dev->ptrfeed) {
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
if (rc != Success)
@@ -2166,7 +2170,8 @@ ProcChangePointerControl(ClientPtr client)
}
for (dev = inputInfo.devices; dev; dev = dev->next) {
- if ((dev == mouse || (!IsMaster(dev) && dev->u.master == mouse)) &&
+ if ((dev == mouse ||
+ (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) == mouse)) &&
dev->ptrfeed) {
dev->ptrfeed->ctrl = ctrl;
}
@@ -2336,7 +2341,7 @@ RecalculateMasterButtons(DeviceIntPtr slave)
maxbuttons = max(maxbuttons, dev->button->numButtons);
}
- if (master->button->numButtons != maxbuttons)
+ if (master->button && master->button->numButtons != maxbuttons)
{
int i;
DeviceChangedEvent event;
@@ -2347,7 +2352,7 @@ RecalculateMasterButtons(DeviceIntPtr slave)
event.header = ET_Internal;
event.type = ET_DeviceChanged;
- event.time = CurrentTime;
+ event.time = GetTimeInMillis();
event.deviceid = master->id;
event.flags = DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE;
event.buttons.num_buttons = maxbuttons;
diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c
index aa72708ed..e891f0698 100644
--- a/xorg-server/dix/eventconvert.c
+++ b/xorg-server/dix/eventconvert.c
@@ -102,6 +102,15 @@ EventToCore(InternalEvent *event, xEvent *core)
switch(event->any.type)
{
case ET_Motion:
+ {
+ DeviceEvent *e = &event->device_event;
+ /* Don't create core motion event if neither x nor y are
+ * present */
+ if (!BitIsOn(e->valuators.mask, 0) &&
+ !BitIsOn(e->valuators.mask, 1))
+ return BadMatch;
+ }
+ /* fallthrough */
case ET_ButtonPress:
case ET_ButtonRelease:
case ET_KeyPress:
diff --git a/xorg-server/dix/extension.c b/xorg-server/dix/extension.c
index f6b33d64c..b7f5c9c8c 100644
--- a/xorg-server/dix/extension.c
+++ b/xorg-server/dix/extension.c
@@ -96,7 +96,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
free(ext);
return NULL;
}
- ext->name = malloc(strlen(name) + 1);
+ ext->name = strdup(name);
ext->num_aliases = 0;
ext->aliases = (char **)NULL;
if (!ext->name)
@@ -105,7 +105,6 @@ AddExtension(char *name, int NumEvents, int NumErrors,
free(ext);
return((ExtensionEntry *) NULL);
}
- strcpy(ext->name, name);
i = NumExtensions;
newexts = (ExtensionEntry **) realloc(extensions,
(i + 1) * sizeof(ExtensionEntry *));
@@ -164,10 +163,9 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
if (!aliases)
return FALSE;
ext->aliases = aliases;
- name = malloc(strlen(alias) + 1);
+ name = strdup(alias);
if (!name)
return FALSE;
- strcpy(name, alias);
ext->aliases[ext->num_aliases] = name;
ext->num_aliases++;
return TRUE;
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index 9e6ba0325..39e65064a 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -286,7 +286,7 @@ int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
{
CARD8 keys_per_mod[8];
int max_keys_per_mod;
- KeyCode *modkeymap;
+ KeyCode *modkeymap = NULL;
int i, j, ret;
ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGetAttrAccess);
@@ -310,18 +310,20 @@ int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
}
}
- modkeymap = calloc(max_keys_per_mod * 8, sizeof(KeyCode));
- if (!modkeymap)
- return BadAlloc;
+ if (max_keys_per_mod != 0) {
+ modkeymap = calloc(max_keys_per_mod * 8, sizeof(KeyCode));
+ if (!modkeymap)
+ return BadAlloc;
- for (i = 0; i < 8; i++)
- keys_per_mod[i] = 0;
+ for (i = 0; i < 8; i++)
+ keys_per_mod[i] = 0;
- for (i = 8; i < MAP_LENGTH; i++) {
- for (j = 0; j < 8; j++) {
- if (dev->key->xkbInfo->desc->map->modmap[i] & (1 << j)) {
- modkeymap[(j * max_keys_per_mod) + keys_per_mod[j]] = i;
- keys_per_mod[j]++;
+ for (i = 8; i < MAP_LENGTH; i++) {
+ for (j = 0; j < 8; j++) {
+ if (dev->key->xkbInfo->desc->map->modmap[i] & (1 << j)) {
+ modkeymap[(j * max_keys_per_mod) + keys_per_mod[j]] = i;
+ keys_per_mod[j]++;
+ }
}
}
}
diff --git a/xorg-server/dix/privates.c b/xorg-server/dix/privates.c
index 6d76ccff2..a7366447a 100644
--- a/xorg-server/dix/privates.c
+++ b/xorg-server/dix/privates.c
@@ -71,6 +71,7 @@ static struct {
} keys[PRIVATE_LAST];
static const Bool xselinux_private[PRIVATE_LAST] = {
+ [PRIVATE_SCREEN] = TRUE,
[PRIVATE_CLIENT] = TRUE,
[PRIVATE_WINDOW] = TRUE,
[PRIVATE_PIXMAP] = TRUE,
diff --git a/xorg-server/dix/property.c b/xorg-server/dix/property.c
index 9d30e726d..2ba3f4419 100644
--- a/xorg-server/dix/property.c
+++ b/xorg-server/dix/property.c
@@ -284,7 +284,6 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
pProp->format = format;
pProp->data = data;
pProp->size = len;
- pProp->devPrivates = NULL;
rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
DixCreateAccess|DixWriteAccess);
if (rc != Success) {
diff --git a/xorg-server/dix/selection.c b/xorg-server/dix/selection.c
index 428408f8e..732ba34e5 100644
--- a/xorg-server/dix/selection.c
+++ b/xorg-server/dix/selection.c
@@ -196,12 +196,11 @@ ProcSetSelectionOwner(ClientPtr client)
/*
* It doesn't exist, so add it...
*/
- pSel = malloc(sizeof(Selection));
+ pSel = dixAllocateObjectWithPrivates(Selection, PRIVATE_SELECTION);
if (!pSel)
return BadAlloc;
pSel->selection = stuff->selection;
- pSel->devPrivates = NULL;
/* security creation/labeling check */
rc = XaceHookSelectionAccess(client, &pSel,