Merge remote-tracking branch 'whot/for-keith'
This commit is contained in:
commit
81a4952d3d
|
@ -257,7 +257,8 @@ config_odev_free_attributes(struct OdevAttributes *attribs)
|
|||
case ODEV_ATTRIB_FD: fd = iter->attrib_value; break;
|
||||
}
|
||||
xorg_list_del(&iter->member);
|
||||
free(iter->attrib_name);
|
||||
if (iter->attrib_type == ODEV_ATTRIB_STRING)
|
||||
free(iter->attrib_name);
|
||||
free(iter);
|
||||
}
|
||||
|
||||
|
|
16
config/hal.c
16
config/hal.c
|
@ -185,8 +185,7 @@ device_added(LibHalContext * hal_ctx, const char *udi)
|
|||
parent = get_prop_string(hal_ctx, udi, "info.parent");
|
||||
if (parent) {
|
||||
int usb_vendor, usb_product;
|
||||
|
||||
attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
|
||||
char *old_parent;
|
||||
|
||||
/* construct USB ID in lowercase - "0000:ffff" */
|
||||
usb_vendor = libhal_device_get_property_int(hal_ctx, parent,
|
||||
|
@ -204,7 +203,18 @@ device_added(LibHalContext * hal_ctx, const char *udi)
|
|||
== -1)
|
||||
attrs.usb_id = NULL;
|
||||
|
||||
free(parent);
|
||||
attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
|
||||
old_parent = parent;
|
||||
|
||||
while (!attrs.pnp_id &&
|
||||
(parent = get_prop_string(hal_ctx, parent, "info.parent"))) {
|
||||
attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
|
||||
|
||||
free(old_parent);
|
||||
old_parent = parent;
|
||||
}
|
||||
|
||||
free(old_parent);
|
||||
}
|
||||
|
||||
input_options = input_option_new(NULL, "_source", "server/hal");
|
||||
|
|
|
@ -149,10 +149,6 @@ device_added(struct udev_device *udev_device)
|
|||
LOG_PROPERTY(ppath, "NAME", name);
|
||||
}
|
||||
|
||||
if (pnp_id)
|
||||
attrs.pnp_id = strdup(pnp_id);
|
||||
LOG_SYSATTR(ppath, "id", pnp_id);
|
||||
|
||||
/* construct USB ID in lowercase hex - "0000:ffff" */
|
||||
if (product &&
|
||||
sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
|
||||
|
@ -164,6 +160,17 @@ device_added(struct udev_device *udev_device)
|
|||
LOG_PROPERTY(ppath, "PRODUCT", product);
|
||||
attrs.usb_id = usb_id;
|
||||
}
|
||||
|
||||
while (!pnp_id && (parent = udev_device_get_parent(parent))) {
|
||||
pnp_id = udev_device_get_sysattr_value(parent, "id");
|
||||
if (!pnp_id)
|
||||
continue;
|
||||
|
||||
attrs.pnp_id = strdup(pnp_id);
|
||||
ppath = udev_device_get_devnode(parent);
|
||||
LOG_SYSATTR(ppath, "id", pnp_id);
|
||||
}
|
||||
|
||||
}
|
||||
if (!name)
|
||||
name = "(unnamed)";
|
||||
|
|
|
@ -416,6 +416,8 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
XISendDeviceHierarchyEvent(flags);
|
||||
}
|
||||
|
||||
if (!IsMaster(dev))
|
||||
XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0);
|
||||
RecalculateMasterButtons(dev);
|
||||
|
||||
/* initialise an idle timer for this device*/
|
||||
|
@ -2649,6 +2651,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
|||
dev->spriteInfo->paired = master;
|
||||
dev->spriteInfo->spriteOwner = FALSE;
|
||||
|
||||
XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0);
|
||||
RecalculateMasterButtons(master);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h> /* for int64_t */
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mi.h"
|
||||
|
@ -804,6 +805,18 @@ xf86InputDevicePostInit(DeviceIntPtr dev)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
xf86stat(const char *path, int *maj, int *min)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(path, &st) == -1)
|
||||
return;
|
||||
|
||||
*maj = major(st.st_rdev);
|
||||
*min = minor(st.st_rdev);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new input device, activate and enable it.
|
||||
*
|
||||
|
@ -828,6 +841,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
|
|||
DeviceIntPtr dev = NULL;
|
||||
Bool paused;
|
||||
int rval;
|
||||
const char *path;
|
||||
|
||||
/* Memory leak for every attached device if we don't
|
||||
* test if the module is already loaded first */
|
||||
|
@ -841,9 +855,13 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
|
|||
goto unwind;
|
||||
}
|
||||
|
||||
if (drv->capabilities & XI86_DRV_CAP_SERVER_FD) {
|
||||
path = xf86CheckStrOption(pInfo->options, "Device", NULL);
|
||||
if (path && pInfo->major == 0 && pInfo->minor == 0)
|
||||
xf86stat(path, &pInfo->major, &pInfo->minor);
|
||||
|
||||
if (path && (drv->capabilities & XI86_DRV_CAP_SERVER_FD)){
|
||||
int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor,
|
||||
pInfo->attrs->device, &paused);
|
||||
path, &paused);
|
||||
if (fd != -1) {
|
||||
if (paused) {
|
||||
/* Put on new_input_devices list for delayed probe */
|
||||
|
|
|
@ -638,6 +638,10 @@ extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* dev */ ,
|
|||
DeviceEvent * /* event */
|
||||
);
|
||||
|
||||
extern void XkbPushLockedStateToSlaves(DeviceIntPtr /* master */,
|
||||
int /* evtype */,
|
||||
int /* key */);
|
||||
|
||||
extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ ,
|
||||
unsigned long /* change */ ,
|
||||
unsigned long /* newValues */ ,
|
||||
|
|
102
xkb/xkbActions.c
102
xkb/xkbActions.c
|
@ -1127,13 +1127,78 @@ _XkbApplyFilters(XkbSrvInfoPtr xkbi, unsigned kc, XkbAction *pAction)
|
|||
return send;
|
||||
}
|
||||
|
||||
static int
|
||||
_XkbEnsureStateChange(XkbSrvInfoPtr xkbi)
|
||||
{
|
||||
Bool genStateNotify = FALSE;
|
||||
|
||||
/* The state may change, so if we're not in the middle of sending a state
|
||||
* notify, prepare for it */
|
||||
if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
|
||||
xkbi->prev_state = xkbi->state;
|
||||
xkbi->flags |= _XkbStateNotifyInProgress;
|
||||
genStateNotify = TRUE;
|
||||
}
|
||||
|
||||
return genStateNotify;
|
||||
}
|
||||
|
||||
static void
|
||||
_XkbApplyState(DeviceIntPtr dev, Bool genStateNotify, int evtype, int key)
|
||||
{
|
||||
XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
|
||||
int changed;
|
||||
|
||||
XkbComputeDerivedState(xkbi);
|
||||
|
||||
changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state);
|
||||
if (genStateNotify) {
|
||||
if (changed) {
|
||||
xkbStateNotify sn;
|
||||
|
||||
sn.keycode = key;
|
||||
sn.eventType = evtype;
|
||||
sn.requestMajor = sn.requestMinor = 0;
|
||||
sn.changed = changed;
|
||||
XkbSendStateNotify(dev, &sn);
|
||||
}
|
||||
xkbi->flags &= ~_XkbStateNotifyInProgress;
|
||||
}
|
||||
|
||||
changed = XkbIndicatorsToUpdate(dev, changed, FALSE);
|
||||
if (changed) {
|
||||
XkbEventCauseRec cause;
|
||||
XkbSetCauseKey(&cause, key, evtype);
|
||||
XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XkbPushLockedStateToSlaves(DeviceIntPtr master, int evtype, int key)
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
Bool genStateNotify;
|
||||
|
||||
nt_list_for_each_entry(dev, inputInfo.devices, next) {
|
||||
if (!dev->key || GetMaster(dev, MASTER_KEYBOARD) != master)
|
||||
continue;
|
||||
|
||||
genStateNotify = _XkbEnsureStateChange(dev->key->xkbInfo);
|
||||
|
||||
dev->key->xkbInfo->state.locked_mods =
|
||||
master->key->xkbInfo->state.locked_mods;
|
||||
|
||||
_XkbApplyState(dev, genStateNotify, evtype, key);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
|
||||
{
|
||||
int key, bit, i;
|
||||
XkbSrvInfoPtr xkbi;
|
||||
KeyClassPtr keyc;
|
||||
int changed, sendEvent;
|
||||
int sendEvent;
|
||||
Bool genStateNotify;
|
||||
XkbAction act;
|
||||
XkbFilterPtr filter;
|
||||
|
@ -1146,15 +1211,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
|
|||
keyc = kbd->key;
|
||||
xkbi = keyc->xkbInfo;
|
||||
key = event->detail.key;
|
||||
/* The state may change, so if we're not in the middle of sending a state
|
||||
* notify, prepare for it */
|
||||
if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
|
||||
xkbi->prev_state = xkbi->state;
|
||||
xkbi->flags |= _XkbStateNotifyInProgress;
|
||||
genStateNotify = TRUE;
|
||||
}
|
||||
else
|
||||
genStateNotify = FALSE;
|
||||
|
||||
genStateNotify = _XkbEnsureStateChange(xkbi);
|
||||
|
||||
xkbi->clearMods = xkbi->setMods = 0;
|
||||
xkbi->groupChange = 0;
|
||||
|
@ -1287,28 +1345,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
|
|||
FixKeyState(event, dev);
|
||||
}
|
||||
|
||||
XkbComputeDerivedState(xkbi);
|
||||
changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state);
|
||||
if (genStateNotify) {
|
||||
if (changed) {
|
||||
xkbStateNotify sn;
|
||||
|
||||
sn.keycode = key;
|
||||
sn.eventType = event->type;
|
||||
sn.requestMajor = sn.requestMinor = 0;
|
||||
sn.changed = changed;
|
||||
XkbSendStateNotify(dev, &sn);
|
||||
}
|
||||
xkbi->flags &= ~_XkbStateNotifyInProgress;
|
||||
}
|
||||
changed = XkbIndicatorsToUpdate(dev, changed, FALSE);
|
||||
if (changed) {
|
||||
XkbEventCauseRec cause;
|
||||
|
||||
XkbSetCauseKey(&cause, key, event->type);
|
||||
XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause);
|
||||
}
|
||||
return;
|
||||
_XkbApplyState(dev, genStateNotify, event->type, key);
|
||||
XkbPushLockedStateToSlaves(dev, event->type, key);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue