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;
|
case ODEV_ATTRIB_FD: fd = iter->attrib_value; break;
|
||||||
}
|
}
|
||||||
xorg_list_del(&iter->member);
|
xorg_list_del(&iter->member);
|
||||||
free(iter->attrib_name);
|
if (iter->attrib_type == ODEV_ATTRIB_STRING)
|
||||||
|
free(iter->attrib_name);
|
||||||
free(iter);
|
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");
|
parent = get_prop_string(hal_ctx, udi, "info.parent");
|
||||||
if (parent) {
|
if (parent) {
|
||||||
int usb_vendor, usb_product;
|
int usb_vendor, usb_product;
|
||||||
|
char *old_parent;
|
||||||
attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
|
|
||||||
|
|
||||||
/* construct USB ID in lowercase - "0000:ffff" */
|
/* construct USB ID in lowercase - "0000:ffff" */
|
||||||
usb_vendor = libhal_device_get_property_int(hal_ctx, parent,
|
usb_vendor = libhal_device_get_property_int(hal_ctx, parent,
|
||||||
|
@ -204,7 +203,18 @@ device_added(LibHalContext * hal_ctx, const char *udi)
|
||||||
== -1)
|
== -1)
|
||||||
attrs.usb_id = NULL;
|
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");
|
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);
|
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" */
|
/* construct USB ID in lowercase hex - "0000:ffff" */
|
||||||
if (product &&
|
if (product &&
|
||||||
sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
|
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);
|
LOG_PROPERTY(ppath, "PRODUCT", product);
|
||||||
attrs.usb_id = usb_id;
|
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)
|
if (!name)
|
||||||
name = "(unnamed)";
|
name = "(unnamed)";
|
||||||
|
|
|
@ -416,6 +416,8 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
XISendDeviceHierarchyEvent(flags);
|
XISendDeviceHierarchyEvent(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!IsMaster(dev))
|
||||||
|
XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0);
|
||||||
RecalculateMasterButtons(dev);
|
RecalculateMasterButtons(dev);
|
||||||
|
|
||||||
/* initialise an idle timer for this device*/
|
/* initialise an idle timer for this device*/
|
||||||
|
@ -2649,6 +2651,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
dev->spriteInfo->paired = master;
|
dev->spriteInfo->paired = master;
|
||||||
dev->spriteInfo->spriteOwner = FALSE;
|
dev->spriteInfo->spriteOwner = FALSE;
|
||||||
|
|
||||||
|
XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0);
|
||||||
RecalculateMasterButtons(master);
|
RecalculateMasterButtons(master);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdint.h> /* for int64_t */
|
#include <stdint.h> /* for int64_t */
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "mi.h"
|
#include "mi.h"
|
||||||
|
@ -804,6 +805,18 @@ xf86InputDevicePostInit(DeviceIntPtr dev)
|
||||||
return Success;
|
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.
|
* Create a new input device, activate and enable it.
|
||||||
*
|
*
|
||||||
|
@ -828,6 +841,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
|
||||||
DeviceIntPtr dev = NULL;
|
DeviceIntPtr dev = NULL;
|
||||||
Bool paused;
|
Bool paused;
|
||||||
int rval;
|
int rval;
|
||||||
|
const char *path;
|
||||||
|
|
||||||
/* Memory leak for every attached device if we don't
|
/* Memory leak for every attached device if we don't
|
||||||
* test if the module is already loaded first */
|
* test if the module is already loaded first */
|
||||||
|
@ -841,9 +855,13 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
|
||||||
goto unwind;
|
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,
|
int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor,
|
||||||
pInfo->attrs->device, &paused);
|
path, &paused);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
if (paused) {
|
if (paused) {
|
||||||
/* Put on new_input_devices list for delayed probe */
|
/* Put on new_input_devices list for delayed probe */
|
||||||
|
|
|
@ -638,6 +638,10 @@ extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* dev */ ,
|
||||||
DeviceEvent * /* event */
|
DeviceEvent * /* event */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
extern void XkbPushLockedStateToSlaves(DeviceIntPtr /* master */,
|
||||||
|
int /* evtype */,
|
||||||
|
int /* key */);
|
||||||
|
|
||||||
extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ ,
|
extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ ,
|
||||||
unsigned long /* change */ ,
|
unsigned long /* change */ ,
|
||||||
unsigned long /* newValues */ ,
|
unsigned long /* newValues */ ,
|
||||||
|
|
102
xkb/xkbActions.c
102
xkb/xkbActions.c
|
@ -1127,13 +1127,78 @@ _XkbApplyFilters(XkbSrvInfoPtr xkbi, unsigned kc, XkbAction *pAction)
|
||||||
return send;
|
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
|
void
|
||||||
XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
|
XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
|
||||||
{
|
{
|
||||||
int key, bit, i;
|
int key, bit, i;
|
||||||
XkbSrvInfoPtr xkbi;
|
XkbSrvInfoPtr xkbi;
|
||||||
KeyClassPtr keyc;
|
KeyClassPtr keyc;
|
||||||
int changed, sendEvent;
|
int sendEvent;
|
||||||
Bool genStateNotify;
|
Bool genStateNotify;
|
||||||
XkbAction act;
|
XkbAction act;
|
||||||
XkbFilterPtr filter;
|
XkbFilterPtr filter;
|
||||||
|
@ -1146,15 +1211,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
|
||||||
keyc = kbd->key;
|
keyc = kbd->key;
|
||||||
xkbi = keyc->xkbInfo;
|
xkbi = keyc->xkbInfo;
|
||||||
key = event->detail.key;
|
key = event->detail.key;
|
||||||
/* The state may change, so if we're not in the middle of sending a state
|
|
||||||
* notify, prepare for it */
|
genStateNotify = _XkbEnsureStateChange(xkbi);
|
||||||
if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
|
|
||||||
xkbi->prev_state = xkbi->state;
|
|
||||||
xkbi->flags |= _XkbStateNotifyInProgress;
|
|
||||||
genStateNotify = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
genStateNotify = FALSE;
|
|
||||||
|
|
||||||
xkbi->clearMods = xkbi->setMods = 0;
|
xkbi->clearMods = xkbi->setMods = 0;
|
||||||
xkbi->groupChange = 0;
|
xkbi->groupChange = 0;
|
||||||
|
@ -1287,28 +1345,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
|
||||||
FixKeyState(event, dev);
|
FixKeyState(event, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
XkbComputeDerivedState(xkbi);
|
_XkbApplyState(dev, genStateNotify, event->type, key);
|
||||||
changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state);
|
XkbPushLockedStateToSlaves(dev, event->type, key);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue