summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-09-10 11:55:34 -0700
committerKeith Packard <keithp@keithp.com>2010-09-10 11:55:34 -0700
commitbbffb85461eb63bfb1e01e2cb9674607b9221604 (patch)
treeb6937f51d6cbd332eace94957334e0d7963513de
parent9a1a4ccbe026f34beca5db3b2243874906961b49 (diff)
parent71972c2534d490284d3d42b456c2f34b964b2894 (diff)
Merge remote branch 'whot/for-keith'
-rw-r--r--config/udev.c26
-rw-r--r--dix/devices.c23
-rw-r--r--dix/eventconvert.c9
-rw-r--r--dix/inpututils.c24
-rw-r--r--hw/xfree86/common/xf86DGA.c2
-rw-r--r--hw/xfree86/common/xf86Xinput.c1
-rw-r--r--hw/xfree86/doc/man/Xorg.man.pre10
-rw-r--r--hw/xfree86/os-support/linux/lnx_init.c5
-rw-r--r--xkb/ddxList.c8
-rw-r--r--xkb/xkb.c7
-rw-r--r--xkb/xkbActions.c1
-rw-r--r--xkb/xkbEvents.c9
-rw-r--r--xkb/xkbLEDs.c13
-rw-r--r--xkb/xkmread.c9
14 files changed, 85 insertions, 62 deletions
diff --git a/config/udev.c b/config/udev.c
index 993449075..b7717c96d 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -58,7 +58,6 @@ device_added(struct udev_device *udev_device)
char *config_info = NULL;
const char *syspath;
const char *tags_prop;
- const char *usb_vendor = NULL, *usb_model = NULL;
const char *key, *value, *tmp;
InputOption *options = NULL, *tmpo;
InputAttributes attrs = {};
@@ -94,6 +93,8 @@ device_added(struct udev_device *udev_device)
parent = udev_device_get_parent(udev_device);
if (parent) {
const char *ppath = udev_device_get_devnode(parent);
+ const char *product = udev_device_get_property_value(parent, "PRODUCT");
+ unsigned int usb_vendor, usb_model;
name = udev_device_get_sysattr_value(parent, "name");
LOG_SYSATTR(ppath, "name", name);
@@ -104,6 +105,13 @@ device_added(struct udev_device *udev_device)
attrs.pnp_id = udev_device_get_sysattr_value(parent, "id");
LOG_SYSATTR(ppath, "id", attrs.pnp_id);
+
+ /* construct USB ID in lowercase hex - "0000:ffff" */
+ if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
+ attrs.usb_id = Xprintf("%04x:%04x", usb_vendor, usb_model);
+ if (attrs.usb_id)
+ LOG_PROPERTY(path, "PRODUCT", product);
+ }
}
if (!name)
name = "(unnamed)";
@@ -152,12 +160,6 @@ device_added(struct udev_device *udev_device)
} else if (!strcmp(key, "ID_VENDOR")) {
LOG_PROPERTY(path, key, value);
attrs.vendor = value;
- } else if (!strcmp(key, "ID_VENDOR_ID")) {
- LOG_PROPERTY(path, key, value);
- usb_vendor = value;
- } else if (!strcmp(key, "ID_VENDOR_MODEL")) {
- LOG_PROPERTY(path, key, value);
- usb_model = value;
} else if (!strcmp(key, "ID_INPUT_KEY")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_KEYBOARD;
@@ -179,16 +181,6 @@ device_added(struct udev_device *udev_device)
}
}
- /* construct USB ID in lowercase hex - "0000:ffff" */
- if (usb_vendor && usb_model) {
- attrs.usb_id = Xprintf("%s:%s", usb_vendor, usb_model);
- if (attrs.usb_id) {
- char *cur;
- for (cur = attrs.usb_id; *cur; cur++)
- *cur = tolower(*cur);
- }
- }
-
LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n",
name, path);
rc = NewInputDeviceRequest(options, &attrs, &dev);
diff --git a/dix/devices.c b/dix/devices.c
index 2e65a041d..e506f6ac1 100644
--- a/dix/devices.c
+++ b/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/dix/eventconvert.c b/dix/eventconvert.c
index 4e3de0b46..0f747c1a0 100644
--- a/dix/eventconvert.c
+++ b/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/dix/inpututils.c b/dix/inpututils.c
index 8ec80b5e8..6693c67b3 100644
--- a/dix/inpututils.c
+++ b/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/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 82fb52a05..c468c6038 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -1095,7 +1095,7 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
ev.header = ET_Internal;
ev.length = sizeof(ev);
ev.type = event->subtype;
- ev.corestate = butc->state;
+ ev.corestate = butc ? butc->state : 0;
if (master && master->key)
ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state);
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index bd77fe663..877eb0382 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -66,6 +66,7 @@
#include "xf86InPriv.h"
#include "compiler.h"
#include "extinit.h"
+#include "loaderProcs.h"
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
index 46d0e4468..805f3a3e2 100644
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ b/hw/xfree86/doc/man/Xorg.man.pre
@@ -1,4 +1,6 @@
.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
.TH __xservername__ __appmansuffix__ __vendorversion__
.SH NAME
__xservername__ - X11R7 X server
@@ -440,6 +442,14 @@ Immediately kills the server -- no questions asked. It can be disabled by
setting the
.B DontZap
__xconfigfile__(__filemansuffix__) file option to a TRUE value.
+.PP
+.RS 8
+It should be noted that zapping is triggered by the
+.B Terminate_Server
+action in the keyboard map. This action is not part of the default keymaps
+but can be enabled with the XKB option
+.B \*qterminate:ctrl_alt_bksp\*q.
+.RE
.TP 8
.B Ctrl+Alt+Keypad-Plus
Change video mode to next one specified in the configuration file.
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index c8cec2ecb..92bfde48f 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -277,8 +277,9 @@ xf86OpenConsole(void)
tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
/* need to keep the buffer clean, else the kernel gets angry */
- console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
- drain_console, NULL);
+ if (xf86Info.allowEmptyInput)
+ console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
+ drain_console, NULL);
/* we really should have a InitOSInputDevices() function instead
* of Init?$#*&Device(). So I just place it here */
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 2256424d0..c1ada5c6d 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -161,6 +161,7 @@ char tmpname[PATH_MAX];
}
if (!in) {
haveDir= FALSE;
+ free(buf);
buf = Xprintf(
"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long)
@@ -176,6 +177,7 @@ char tmpname[PATH_MAX];
}
if (!in) {
haveDir= FALSE;
+ free(buf);
buf = Xprintf(
"xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
componentDirs[what],(long)
@@ -200,8 +202,7 @@ char tmpname[PATH_MAX];
}
if (!in)
{
- if (buf != NULL)
- free(buf);
+ free(buf);
#ifdef WIN32
unlink(tmpname);
#endif
@@ -264,8 +265,7 @@ char tmpname[PATH_MAX];
fclose(in);
unlink(tmpname);
#endif
- if (buf != NULL)
- free(buf);
+ free(buf);
return status;
}
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 935f5ea6a..4105c1c6b 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -224,7 +224,8 @@ ProcXkbSelectEvents(ClientPtr client)
masks = XkbFindClientResource((DevicePtr)dev,client);
if (!masks){
XID id = FakeClientID(client->index);
- AddResource(id,RT_XKBCLIENT,dev);
+ if (!AddResource(id,RT_XKBCLIENT,dev))
+ return BadAlloc;
masks= XkbAddClientResource((DevicePtr)dev,client,id);
}
if (masks) {
@@ -3019,6 +3020,7 @@ register unsigned bit;
to = (CARD8 *)wire;
if ((to-map)!=length) {
client->errorValue = _XkbErrCode2(0xff,length);
+ free(map);
return BadLength;
}
}
@@ -5377,7 +5379,8 @@ ProcXkbPerClientFlags(ClientPtr client)
}
else if (want && (!interest)) {
XID id = FakeClientID(client->index);
- AddResource(id,RT_XKBCLIENT,dev);
+ if (!AddResource(id,RT_XKBCLIENT,dev))
+ return BadAlloc;
interest= XkbAddClientResource((DevicePtr)dev,client,id);
if (!interest)
return BadAlloc;
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 8c75301b0..c0204441f 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -806,6 +806,7 @@ ProcessInputProc backupproc;
/* never actually used uninitialised, but gcc isn't smart enough
* to work that out. */
memset(&old, 0, sizeof(old));
+ memset(&ev, 0, sizeof(ev));
if ((filter->keycode!=0)&&(filter->keycode!=keycode))
return 1;
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 8028502b9..c020e5e2a 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -1045,15 +1045,6 @@ XkbInterestPtr interest;
interest->dev = dev;
interest->client = client;
interest->resource = id;
- interest->stateNotifyMask= 0;
- interest->ctrlsNotifyMask= 0;
- interest->namesNotifyMask= 0;
- interest->compatNotifyMask= 0;
- interest->bellNotifyMask= FALSE;
- interest->accessXNotifyMask= 0;
- interest->iStateNotifyMask= 0;
- interest->iMapNotifyMask= 0;
- interest->altSymsNotifyMask= 0;
interest->next = dev->xkb_interest;
dev->xkb_interest= interest;
return interest;
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index f617537cf..515e9b701 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -556,6 +556,7 @@ Bool checkNames;
else if ((kf!=NULL)&&((kf->xkb_sli->flags&XkbSLI_IsDefault)!=0)) {
XkbDescPtr xkb;
xkb= dev->key->xkbInfo->desc;
+ sli= kf->xkb_sli;
sli->physIndicators= xkb->indicators->phys_indicators;
if (xkb->names->indicators!=sli->names) {
checkNames= TRUE;
@@ -584,6 +585,8 @@ Bool checkNames;
sli->maps= NULL;
sli->names= NULL;
}
+ else
+ return NULL;
if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
sli->names= calloc(XkbNumIndicators, sizeof(Atom));
if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
@@ -714,10 +717,12 @@ XkbSrvLedInfoPtr sli;
}
}
}
- if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
- sli->names= calloc(XkbNumIndicators, sizeof(Atom));
- if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
- sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
+ if (sli) {
+ if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
+ sli->names= calloc(XkbNumIndicators, sizeof(Atom));
+ if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
+ sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
+ }
return sli;
}
diff --git a/xkb/xkmread.c b/xkb/xkmread.c
index 814bb1d41..b564195bc 100644
--- a/xkb/xkmread.c
+++ b/xkb/xkmread.c
@@ -534,8 +534,7 @@ XkbAction *act;
case XkbSA_XFree86Private:
/* copy the kind of action */
- strncpy((char*)act->any.data, (char*)wire.actionData,
- XkbAnyActionDataSize);
+ memcpy(act->any.data, wire.actionData, XkbAnyActionDataSize);
break ;
case XkbSA_Terminate:
@@ -687,7 +686,11 @@ int nRead=0;
if ((tmp=XkmGetCountedString(file,buf,100))<1)
return -1;
nRead+= tmp;
- if ((buf[0]!='\0')&&(xkb->names)) {
+
+ if (!xkb->names)
+ continue;
+
+ if (buf[0]!='\0') {
Atom name;
name= XkbInternAtom(buf,0);
xkb->names->groups[i]= name;