Merge remote-tracking branch 'whot/next'
This commit is contained in:
commit
afb1fe695d
|
@ -716,7 +716,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int key = 0,
|
int key = 0,
|
||||||
bit = 0,
|
|
||||||
last_valuator;
|
last_valuator;
|
||||||
|
|
||||||
KeyClassPtr k = NULL;
|
KeyClassPtr k = NULL;
|
||||||
|
@ -750,7 +749,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
|
||||||
b = device->button;
|
b = device->button;
|
||||||
|
|
||||||
key = event->detail.key;
|
key = event->detail.key;
|
||||||
bit = 1 << (key & 7);
|
|
||||||
|
|
||||||
/* Update device axis */
|
/* Update device axis */
|
||||||
/* Check valuators first */
|
/* Check valuators first */
|
||||||
|
@ -888,8 +886,6 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
|
||||||
Bool deactivateDeviceGrab = FALSE;
|
Bool deactivateDeviceGrab = FALSE;
|
||||||
int key = 0, rootX, rootY;
|
int key = 0, rootX, rootY;
|
||||||
ButtonClassPtr b;
|
ButtonClassPtr b;
|
||||||
KeyClassPtr k;
|
|
||||||
ValuatorClassPtr v;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int state, i;
|
int state, i;
|
||||||
DeviceIntPtr mouse = NULL, kbd = NULL;
|
DeviceIntPtr mouse = NULL, kbd = NULL;
|
||||||
|
@ -953,9 +949,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
|
||||||
if (ret == DONT_PROCESS)
|
if (ret == DONT_PROCESS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
v = device->valuator;
|
|
||||||
b = device->button;
|
b = device->button;
|
||||||
k = device->key;
|
|
||||||
|
|
||||||
if (IsMaster(device) || IsFloating(device))
|
if (IsMaster(device) || IsFloating(device))
|
||||||
CheckMotion(event, device);
|
CheckMotion(event, device);
|
||||||
|
|
|
@ -256,9 +256,16 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
||||||
REQUEST(xXIPassiveUngrabDeviceReq);
|
REQUEST(xXIPassiveUngrabDeviceReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
|
REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
|
||||||
|
|
||||||
|
if (stuff->deviceid == XIAllDevices)
|
||||||
|
dev = inputInfo.all_devices;
|
||||||
|
else if (stuff->deviceid == XIAllMasterDevices)
|
||||||
|
dev = inputInfo.all_master_devices;
|
||||||
|
else
|
||||||
|
{
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
if (stuff->grab_type != XIGrabtypeButton &&
|
if (stuff->grab_type != XIGrabtypeButton &&
|
||||||
stuff->grab_type != XIGrabtypeKeycode &&
|
stuff->grab_type != XIGrabtypeKeycode &&
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
void remove_devices(const char *backend, const char *config_info);
|
void remove_devices(const char *backend, const char *config_info);
|
||||||
BOOL device_is_duplicate(const char *config_info);
|
BOOL device_is_duplicate(const char *config_info);
|
||||||
void add_option(InputOption **options, const char *key, const char *value);
|
|
||||||
|
|
||||||
#ifdef CONFIG_UDEV
|
#ifdef CONFIG_UDEV
|
||||||
int config_udev_init(void);
|
int config_udev_init(void);
|
||||||
|
|
|
@ -122,18 +122,3 @@ device_is_duplicate(const char *config_info)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
add_option(InputOption **options, const char *key, const char *value)
|
|
||||||
{
|
|
||||||
if (!value || *value == '\0')
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (; *options; options = &(*options)->next)
|
|
||||||
;
|
|
||||||
*options = calloc(sizeof(**options), 1);
|
|
||||||
if (!*options) /* Yeesh. */
|
|
||||||
return;
|
|
||||||
(*options)->key = strdup(key);
|
|
||||||
(*options)->value = strdup(value);
|
|
||||||
(*options)->next = NULL;
|
|
||||||
}
|
|
||||||
|
|
|
@ -68,8 +68,7 @@ static int
|
||||||
add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
||||||
{
|
{
|
||||||
DBusMessageIter iter, reply_iter, subiter;
|
DBusMessageIter iter, reply_iter, subiter;
|
||||||
InputOption *tmpo = NULL, *options = NULL;
|
InputOption *input_options = NULL;
|
||||||
char *tmp = NULL;
|
|
||||||
int ret, err;
|
int ret, err;
|
||||||
DeviceIntPtr dev = NULL;
|
DeviceIntPtr dev = NULL;
|
||||||
|
|
||||||
|
@ -80,15 +79,8 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
}
|
}
|
||||||
|
|
||||||
options = calloc(sizeof(*options), 1);
|
input_options = input_option_new(input_options, "_source", "client/dbus");
|
||||||
if (!options) {
|
if (!input_options) {
|
||||||
ErrorF("[config/dbus] couldn't allocate option\n");
|
|
||||||
return BadAlloc;
|
|
||||||
}
|
|
||||||
|
|
||||||
options->key = strdup("_source");
|
|
||||||
options->value = strdup("client/dbus");
|
|
||||||
if (!options->key || !options->value) {
|
|
||||||
ErrorF("[config/dbus] couldn't allocate first key/value pair\n");
|
ErrorF("[config/dbus] couldn't allocate first key/value pair\n");
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
@ -96,36 +88,22 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
||||||
|
|
||||||
/* signature should be [ss][ss]... */
|
/* signature should be [ss][ss]... */
|
||||||
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
|
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
|
||||||
tmpo = calloc(sizeof(*tmpo), 1);
|
char *key, *value;
|
||||||
if (!tmpo) {
|
|
||||||
ErrorF("[config/dbus] couldn't allocate option\n");
|
|
||||||
ret = BadAlloc;
|
|
||||||
goto unwind;
|
|
||||||
}
|
|
||||||
tmpo->next = options;
|
|
||||||
options = tmpo;
|
|
||||||
|
|
||||||
dbus_message_iter_recurse(&iter, &subiter);
|
dbus_message_iter_recurse(&iter, &subiter);
|
||||||
|
|
||||||
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
|
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
|
|
||||||
dbus_message_iter_get_basic(&subiter, &tmp);
|
dbus_message_iter_get_basic(&subiter, &key);
|
||||||
if (!tmp)
|
if (!key)
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
/* The _ prefix refers to internal settings, and may not be given by
|
/* The _ prefix refers to internal settings, and may not be given by
|
||||||
* the client. */
|
* the client. */
|
||||||
if (tmp[0] == '_') {
|
if (key[0] == '_') {
|
||||||
ErrorF("[config/dbus] attempted subterfuge: option name %s given\n",
|
ErrorF("[config/dbus] attempted subterfuge: option name %s given\n",
|
||||||
tmp);
|
key);
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
}
|
}
|
||||||
options->key = strdup(tmp);
|
|
||||||
if (!options->key) {
|
|
||||||
ErrorF("[config/dbus] couldn't duplicate key!\n");
|
|
||||||
ret = BadAlloc;
|
|
||||||
goto unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dbus_message_iter_has_next(&subiter))
|
if (!dbus_message_iter_has_next(&subiter))
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
|
@ -133,20 +111,16 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
||||||
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
|
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
|
|
||||||
dbus_message_iter_get_basic(&subiter, &tmp);
|
dbus_message_iter_get_basic(&subiter, &value);
|
||||||
if (!tmp)
|
if (!value)
|
||||||
MALFORMED_MESSAGE();
|
MALFORMED_MESSAGE();
|
||||||
options->value = strdup(tmp);
|
|
||||||
if (!options->value) {
|
input_options = input_option_new(input_options, key, value);
|
||||||
ErrorF("[config/dbus] couldn't duplicate option!\n");
|
|
||||||
ret = BadAlloc;
|
|
||||||
goto unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
dbus_message_iter_next(&iter);
|
dbus_message_iter_next(&iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = NewInputDeviceRequest(options, NULL, &dev);
|
ret = NewInputDeviceRequest(input_options, NULL, &dev);
|
||||||
if (ret != Success) {
|
if (ret != Success) {
|
||||||
DebugF("[config/dbus] NewInputDeviceRequest failed\n");
|
DebugF("[config/dbus] NewInputDeviceRequest failed\n");
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
@ -180,13 +154,7 @@ unwind:
|
||||||
dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
|
dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (options) {
|
input_option_free_list(&input_options);
|
||||||
tmpo = options;
|
|
||||||
options = options->next;
|
|
||||||
free(tmpo->key);
|
|
||||||
free(tmpo->value);
|
|
||||||
free(tmpo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
44
config/hal.c
44
config/hal.c
|
@ -128,7 +128,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
{
|
{
|
||||||
char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL;
|
char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL;
|
||||||
char *hal_tags, *parent;
|
char *hal_tags, *parent;
|
||||||
InputOption *options = NULL, *tmpo = NULL;
|
InputOption *input_options = NULL;
|
||||||
InputAttributes attrs = {0};
|
InputAttributes attrs = {0};
|
||||||
DeviceIntPtr dev = NULL;
|
DeviceIntPtr dev = NULL;
|
||||||
DBusError error;
|
DBusError error;
|
||||||
|
@ -205,26 +205,19 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
free(parent);
|
free(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
options = calloc(sizeof(*options), 1);
|
input_options = input_option_new(NULL, "_source", "server/hal");
|
||||||
if (!options){
|
if (!input_options) {
|
||||||
LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
|
|
||||||
goto unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
options->key = strdup("_source");
|
|
||||||
options->value = strdup("server/hal");
|
|
||||||
if (!options->key || !options->value) {
|
|
||||||
LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
|
LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* most drivers use device.. not path. evdev uses both however, but the
|
/* most drivers use device.. not path. evdev uses both however, but the
|
||||||
* path version isn't documented apparently. support both for now. */
|
* path version isn't documented apparently. support both for now. */
|
||||||
add_option(&options, "path", path);
|
input_options = input_option_new(input_options, "path", path);
|
||||||
add_option(&options, "device", path);
|
input_options = input_option_new(input_options, "device", path);
|
||||||
|
|
||||||
add_option(&options, "driver", driver);
|
input_options = input_option_new(input_options, "driver", driver);
|
||||||
add_option(&options, "name", name);
|
input_options = input_option_new(input_options, "name", name);
|
||||||
|
|
||||||
if (asprintf (&config_info, "hal:%s", udi) == -1) {
|
if (asprintf (&config_info, "hal:%s", udi) == -1) {
|
||||||
config_info = NULL;
|
config_info = NULL;
|
||||||
|
@ -298,7 +291,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
/* all others */
|
/* all others */
|
||||||
add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
|
input_options = input_option_new(input_options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
|
||||||
free(tmp_val);
|
free(tmp_val);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -366,20 +359,20 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
|
|
||||||
/* Now add xkb options */
|
/* Now add xkb options */
|
||||||
if (xkb_opts.layout)
|
if (xkb_opts.layout)
|
||||||
add_option(&options, "xkb_layout", xkb_opts.layout);
|
input_options = input_option_new(input_options, "xkb_layout", xkb_opts.layout);
|
||||||
if (xkb_opts.rules)
|
if (xkb_opts.rules)
|
||||||
add_option(&options, "xkb_rules", xkb_opts.rules);
|
input_options = input_option_new(input_options, "xkb_rules", xkb_opts.rules);
|
||||||
if (xkb_opts.variant)
|
if (xkb_opts.variant)
|
||||||
add_option(&options, "xkb_variant", xkb_opts.variant);
|
input_options = input_option_new(input_options, "xkb_variant", xkb_opts.variant);
|
||||||
if (xkb_opts.model)
|
if (xkb_opts.model)
|
||||||
add_option(&options, "xkb_model", xkb_opts.model);
|
input_options = input_option_new(input_options, "xkb_model", xkb_opts.model);
|
||||||
if (xkb_opts.options)
|
if (xkb_opts.options)
|
||||||
add_option(&options, "xkb_options", xkb_opts.options);
|
input_options = input_option_new(input_options, "xkb_options", xkb_opts.options);
|
||||||
add_option(&options, "config_info", config_info);
|
input_options = input_option_new(input_options, "config_info", config_info);
|
||||||
|
|
||||||
/* this isn't an error, but how else do you output something that the user can see? */
|
/* this isn't an error, but how else do you output something that the user can see? */
|
||||||
LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
|
LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
|
||||||
if ((rc = NewInputDeviceRequest(options, &attrs, &dev)) != Success) {
|
if ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) {
|
||||||
LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n", rc);
|
LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n", rc);
|
||||||
dev = NULL;
|
dev = NULL;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
@ -392,12 +385,7 @@ unwind:
|
||||||
free(driver);
|
free(driver);
|
||||||
free(name);
|
free(name);
|
||||||
free(config_info);
|
free(config_info);
|
||||||
while ((tmpo = options)) {
|
input_option_free_list(&input_options);
|
||||||
options = tmpo->next;
|
|
||||||
free(tmpo->key); /* NULL if dev != NULL */
|
|
||||||
free(tmpo->value); /* NULL if dev != NULL */
|
|
||||||
free(tmpo);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(attrs.product);
|
free(attrs.product);
|
||||||
free(attrs.vendor);
|
free(attrs.vendor);
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "hotplug.h"
|
#include "hotplug.h"
|
||||||
#include "config-backends.h"
|
#include "config-backends.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
#define UDEV_XKB_PROP_KEY "xkb"
|
#define UDEV_XKB_PROP_KEY "xkb"
|
||||||
|
|
||||||
|
@ -59,12 +60,13 @@ device_added(struct udev_device *udev_device)
|
||||||
const char *syspath;
|
const char *syspath;
|
||||||
const char *tags_prop;
|
const char *tags_prop;
|
||||||
const char *key, *value, *tmp;
|
const char *key, *value, *tmp;
|
||||||
InputOption *options = NULL, *tmpo;
|
InputOption *input_options;
|
||||||
InputAttributes attrs = {};
|
InputAttributes attrs = {};
|
||||||
DeviceIntPtr dev = NULL;
|
DeviceIntPtr dev = NULL;
|
||||||
struct udev_list_entry *set, *entry;
|
struct udev_list_entry *set, *entry;
|
||||||
struct udev_device *parent;
|
struct udev_device *parent;
|
||||||
int rc;
|
int rc;
|
||||||
|
const char *dev_seat;
|
||||||
|
|
||||||
path = udev_device_get_devnode(udev_device);
|
path = udev_device_get_devnode(udev_device);
|
||||||
|
|
||||||
|
@ -73,6 +75,16 @@ device_added(struct udev_device *udev_device)
|
||||||
if (!path || !syspath)
|
if (!path || !syspath)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
dev_seat = udev_device_get_property_value(udev_device, "ID_SEAT");
|
||||||
|
if (!dev_seat)
|
||||||
|
dev_seat = "seat0";
|
||||||
|
|
||||||
|
if (SeatId && strcmp(dev_seat, SeatId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!SeatId && strcmp(dev_seat, "seat0"))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!udev_device_get_property_value(udev_device, "ID_INPUT")) {
|
if (!udev_device_get_property_value(udev_device, "ID_INPUT")) {
|
||||||
LogMessageVerb(X_INFO, 10,
|
LogMessageVerb(X_INFO, 10,
|
||||||
"config/udev: ignoring device %s without "
|
"config/udev: ignoring device %s without "
|
||||||
|
@ -81,15 +93,10 @@ device_added(struct udev_device *udev_device)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
options = calloc(sizeof(*options), 1);
|
input_options = input_option_new(NULL, "_source", "server/udev");
|
||||||
if (!options)
|
if (!input_options)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
options->key = strdup("_source");
|
|
||||||
options->value = strdup("server/udev");
|
|
||||||
if (!options->key || !options->value)
|
|
||||||
goto unwind;
|
|
||||||
|
|
||||||
parent = udev_device_get_parent(udev_device);
|
parent = udev_device_get_parent(udev_device);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
const char *ppath = udev_device_get_devnode(parent);
|
const char *ppath = udev_device_get_devnode(parent);
|
||||||
|
@ -114,17 +121,16 @@ device_added(struct udev_device *udev_device)
|
||||||
== -1)
|
== -1)
|
||||||
attrs.usb_id = NULL;
|
attrs.usb_id = NULL;
|
||||||
else
|
else
|
||||||
LOG_PROPERTY(path, "PRODUCT", product);
|
LOG_PROPERTY(ppath, "PRODUCT", product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!name)
|
if (!name)
|
||||||
name = "(unnamed)";
|
name = "(unnamed)";
|
||||||
else
|
else
|
||||||
attrs.product = strdup(name);
|
attrs.product = strdup(name);
|
||||||
add_option(&options, "name", name);
|
input_options = input_option_new(input_options, "name", name);
|
||||||
|
input_options = input_option_new(input_options, "path", path);
|
||||||
add_option(&options, "path", path);
|
input_options = input_option_new(input_options, "device", path);
|
||||||
add_option(&options, "device", path);
|
|
||||||
if (path)
|
if (path)
|
||||||
attrs.device = strdup(path);
|
attrs.device = strdup(path);
|
||||||
|
|
||||||
|
@ -154,15 +160,15 @@ device_added(struct udev_device *udev_device)
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;
|
tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;
|
||||||
if (!strcasecmp(tmp, "rules"))
|
if (!strcasecmp(tmp, "rules"))
|
||||||
add_option(&options, "xkb_rules", value);
|
input_options = input_option_new(input_options, "xkb_rules", value);
|
||||||
else if (!strcasecmp(tmp, "layout"))
|
else if (!strcasecmp(tmp, "layout"))
|
||||||
add_option(&options, "xkb_layout", value);
|
input_options = input_option_new(input_options, "xkb_layout", value);
|
||||||
else if (!strcasecmp(tmp, "variant"))
|
else if (!strcasecmp(tmp, "variant"))
|
||||||
add_option(&options, "xkb_variant", value);
|
input_options = input_option_new(input_options, "xkb_variant", value);
|
||||||
else if (!strcasecmp(tmp, "model"))
|
else if (!strcasecmp(tmp, "model"))
|
||||||
add_option(&options, "xkb_model", value);
|
input_options = input_option_new(input_options, "xkb_model", value);
|
||||||
else if (!strcasecmp(tmp, "options"))
|
else if (!strcasecmp(tmp, "options"))
|
||||||
add_option(&options, "xkb_options", value);
|
input_options = input_option_new(input_options, "xkb_options", value);
|
||||||
} else if (!strcmp(key, "ID_VENDOR")) {
|
} else if (!strcmp(key, "ID_VENDOR")) {
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
attrs.vendor = strdup(value);
|
attrs.vendor = strdup(value);
|
||||||
|
@ -187,22 +193,17 @@ device_added(struct udev_device *udev_device)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_option(&options, "config_info", config_info);
|
input_options = input_option_new(input_options, "config_info", config_info);
|
||||||
|
|
||||||
LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n",
|
LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n",
|
||||||
name, path);
|
name, path);
|
||||||
rc = NewInputDeviceRequest(options, &attrs, &dev);
|
rc = NewInputDeviceRequest(input_options, &attrs, &dev);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
unwind:
|
unwind:
|
||||||
free(config_info);
|
free(config_info);
|
||||||
while ((tmpo = options)) {
|
input_option_free_list(&input_options);
|
||||||
options = tmpo->next;
|
|
||||||
free(tmpo->key); /* NULL if dev != NULL */
|
|
||||||
free(tmpo->value); /* NULL if dev != NULL */
|
|
||||||
free(tmpo);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(attrs.usb_id);
|
free(attrs.usb_id);
|
||||||
free(attrs.pnp_id);
|
free(attrs.pnp_id);
|
||||||
|
@ -284,6 +285,9 @@ config_udev_init(void)
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
|
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
|
||||||
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
|
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
|
||||||
|
|
||||||
|
if (SeatId && strcmp(SeatId, "seat0"))
|
||||||
|
udev_monitor_filter_add_match_tag(udev_monitor, SeatId);
|
||||||
|
|
||||||
if (udev_monitor_enable_receiving(udev_monitor)) {
|
if (udev_monitor_enable_receiving(udev_monitor)) {
|
||||||
ErrorF("config/udev: failed to bind the udev monitor\n");
|
ErrorF("config/udev: failed to bind the udev monitor\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -296,6 +300,9 @@ config_udev_init(void)
|
||||||
udev_enumerate_add_match_subsystem(enumerate, "input");
|
udev_enumerate_add_match_subsystem(enumerate, "input");
|
||||||
udev_enumerate_add_match_subsystem(enumerate, "tty");
|
udev_enumerate_add_match_subsystem(enumerate, "tty");
|
||||||
|
|
||||||
|
if (SeatId && strcmp(SeatId, "seat0"))
|
||||||
|
udev_enumerate_add_match_tag(enumerate, SeatId);
|
||||||
|
|
||||||
udev_enumerate_scan_devices(enumerate);
|
udev_enumerate_scan_devices(enumerate);
|
||||||
devices = udev_enumerate_get_list_entry(enumerate);
|
devices = udev_enumerate_get_list_entry(enumerate);
|
||||||
udev_list_entry_foreach(device, devices) {
|
udev_list_entry_foreach(device, devices) {
|
||||||
|
|
|
@ -2406,7 +2406,6 @@ int
|
||||||
AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
{
|
{
|
||||||
ScreenPtr screen;
|
ScreenPtr screen;
|
||||||
DeviceIntPtr oldmaster;
|
|
||||||
if (!dev || IsMaster(dev))
|
if (!dev || IsMaster(dev))
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
|
@ -2425,7 +2424,6 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
free(dev->spriteInfo->sprite);
|
free(dev->spriteInfo->sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldmaster = GetMaster(dev, MASTER_ATTACHED);
|
|
||||||
dev->master = master;
|
dev->master = master;
|
||||||
|
|
||||||
/* If device is set to floating, we need to create a sprite for it,
|
/* If device is set to floating, we need to create a sprite for it,
|
||||||
|
@ -2484,16 +2482,22 @@ GetPairedDevice(DeviceIntPtr dev)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the right master for the type of event needed. If the event is a
|
* Returns the requested master for this device.
|
||||||
* keyboard event.
|
* The return values are:
|
||||||
* This function may be called with a master device as argument. If so, the
|
* - MASTER_ATTACHED: the master for this device or NULL for a floating
|
||||||
* returned master is either the device itself or the paired master device.
|
* slave.
|
||||||
* If dev is a floating slave device, NULL is returned.
|
* - MASTER_KEYBOARD: the master keyboard for this device or NULL for a
|
||||||
|
* floating slave
|
||||||
|
* - MASTER_POINTER: the master keyboard for this device or NULL for a
|
||||||
|
* floating slave
|
||||||
|
* - POINTER_OR_FLOAT: the master pointer for this device or the device for
|
||||||
|
* a floating slave
|
||||||
|
* - KEYBOARD_OR_FLOAT: the master keyboard for this device or the device for
|
||||||
|
* a floating slave
|
||||||
*
|
*
|
||||||
* @type ::MASTER_KEYBOARD or ::MASTER_POINTER or ::MASTER_ATTACHED
|
* @param which ::MASTER_KEYBOARD or ::MASTER_POINTER, ::MASTER_ATTACHED,
|
||||||
* @return The requested master device. In the case of MASTER_ATTACHED, this
|
* ::POINTER_OR_FLOAT or ::KEYBOARD_OR_FLOAT.
|
||||||
* is the directly attached master to this device, regardless of the type.
|
* @return The requested master device
|
||||||
* Otherwise, it is either the master keyboard or pointer for this device.
|
|
||||||
*/
|
*/
|
||||||
DeviceIntPtr
|
DeviceIntPtr
|
||||||
GetMaster(DeviceIntPtr dev, int which)
|
GetMaster(DeviceIntPtr dev, int which)
|
||||||
|
@ -2502,12 +2506,15 @@ GetMaster(DeviceIntPtr dev, int which)
|
||||||
|
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev))
|
||||||
master = dev;
|
master = dev;
|
||||||
else
|
else {
|
||||||
master = dev->master;
|
master = dev->master;
|
||||||
|
if (!master && (which == POINTER_OR_FLOAT || which == KEYBOARD_OR_FLOAT))
|
||||||
|
return dev;
|
||||||
|
}
|
||||||
|
|
||||||
if (master && which != MASTER_ATTACHED)
|
if (master && which != MASTER_ATTACHED)
|
||||||
{
|
{
|
||||||
if (which == MASTER_KEYBOARD)
|
if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT)
|
||||||
{
|
{
|
||||||
if (master->type != MASTER_KEYBOARD)
|
if (master->type != MASTER_KEYBOARD)
|
||||||
master = GetPairedDevice(master);
|
master = GetPairedDevice(master);
|
||||||
|
|
137
dix/events.c
137
dix/events.c
|
@ -408,6 +408,24 @@ static const Mask default_filter[128] =
|
||||||
CantBeFiltered /* MappingNotify */
|
CantBeFiltered /* MappingNotify */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline Mask
|
||||||
|
GetEventFilterMask(DeviceIntPtr dev, int evtype)
|
||||||
|
{
|
||||||
|
return filters[dev ? dev->id : 0][evtype];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline Mask
|
||||||
|
GetXI2EventFilterMask(int evtype)
|
||||||
|
{
|
||||||
|
return (1 << (evtype % 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
GetXI2EventFilterOffset(int evtype)
|
||||||
|
{
|
||||||
|
return (evtype / 8);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the given event, return the matching event filter. This filter may then
|
* For the given event, return the matching event filter. This filter may then
|
||||||
* be AND'ed with the selected event mask.
|
* be AND'ed with the selected event mask.
|
||||||
|
@ -429,13 +447,27 @@ GetEventFilter(DeviceIntPtr dev, xEvent *event)
|
||||||
int evtype = 0;
|
int evtype = 0;
|
||||||
|
|
||||||
if (event->u.u.type != GenericEvent)
|
if (event->u.u.type != GenericEvent)
|
||||||
return filters[dev ? dev->id : 0][event->u.u.type];
|
return GetEventFilterMask(dev, event->u.u.type);
|
||||||
else if ((evtype = xi2_get_type(event)))
|
else if ((evtype = xi2_get_type(event)))
|
||||||
return (1 << (evtype % 8));
|
return GetXI2EventFilterMask(evtype);
|
||||||
ErrorF("[dix] Unknown event type %d. No filter\n", event->u.u.type);
|
ErrorF("[dix] Unknown event type %d. No filter\n", event->u.u.type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the single byte of the device's XI2 mask that contains the mask
|
||||||
|
* for the event_type.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
GetXI2MaskByte(unsigned char xi2mask[][XI2MASKSIZE], DeviceIntPtr dev, int event_type)
|
||||||
|
{
|
||||||
|
int byte = GetXI2EventFilterOffset(event_type);
|
||||||
|
return xi2mask[dev->id][byte] |
|
||||||
|
xi2mask[XIAllDevices][byte] |
|
||||||
|
(IsMaster(dev) ? xi2mask[XIAllMasterDevices][byte] : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the windows complete XI2 mask for the given XI2 event type.
|
* Return the windows complete XI2 mask for the given XI2 event type.
|
||||||
*/
|
*/
|
||||||
|
@ -452,9 +484,7 @@ GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
|
||||||
evtype = ((xGenericEvent*)ev)->evtype;
|
evtype = ((xGenericEvent*)ev)->evtype;
|
||||||
filter = GetEventFilter(dev, ev);
|
filter = GetEventFilter(dev, ev);
|
||||||
|
|
||||||
return ((inputMasks->xi2mask[dev->id][evtype/8] & filter) ||
|
return (GetXI2MaskByte(inputMasks->xi2mask, dev, evtype) & filter);
|
||||||
inputMasks->xi2mask[XIAllDevices][evtype/8] ||
|
|
||||||
(inputMasks->xi2mask[XIAllMasterDevices][evtype/8] && IsMaster(dev)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Mask
|
Mask
|
||||||
|
@ -465,10 +495,7 @@ GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients* other)
|
||||||
/* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */
|
/* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */
|
||||||
if ((evtype = xi2_get_type(event)))
|
if ((evtype = xi2_get_type(event)))
|
||||||
{
|
{
|
||||||
int byte = evtype / 8;
|
return GetXI2MaskByte(other->xi2mask, dev, evtype);
|
||||||
return (other->xi2mask[dev->id][byte] |
|
|
||||||
other->xi2mask[XIAllDevices][byte] |
|
|
||||||
(IsMaster(dev)? other->xi2mask[XIAllMasterDevices][byte] : 0));
|
|
||||||
} else if (core_get_type(event) != 0)
|
} else if (core_get_type(event) != 0)
|
||||||
return other->mask[XIAllDevices];
|
return other->mask[XIAllDevices];
|
||||||
else
|
else
|
||||||
|
@ -680,9 +707,7 @@ ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py)
|
||||||
BoxRec box;
|
BoxRec box;
|
||||||
int x = *px, y = *py;
|
int x = *px, y = *py;
|
||||||
int incx = 1, incy = 1;
|
int incx = 1, incy = 1;
|
||||||
SpritePtr pSprite;
|
|
||||||
|
|
||||||
pSprite = pDev->spriteInfo->sprite;
|
|
||||||
if (RegionContainsPoint(shape, x, y, &box))
|
if (RegionContainsPoint(shape, x, y, &box))
|
||||||
return;
|
return;
|
||||||
box = *RegionExtents(shape);
|
box = *RegionExtents(shape);
|
||||||
|
@ -2478,44 +2503,45 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
|
||||||
int filter = 0;
|
int filter = 0;
|
||||||
int type;
|
int type;
|
||||||
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
||||||
xEvent ev;
|
|
||||||
|
|
||||||
/* XXX: this makes me gag */
|
if ((type = GetXI2Type(event)) != 0)
|
||||||
type = GetXI2Type(event);
|
{
|
||||||
ev.u.u.type = GenericEvent; /* GetEventFilter only cares about type and evtype*/
|
filter = GetXI2EventFilterMask(type);
|
||||||
((xGenericEvent*)&ev)->extension = IReqCode;
|
|
||||||
((xGenericEvent*)&ev)->evtype = type;
|
if (inputMasks &&
|
||||||
filter = GetEventFilter(dev, &ev);
|
(GetXI2MaskByte(inputMasks->xi2mask, dev, type) & filter))
|
||||||
if (type && inputMasks &&
|
|
||||||
((inputMasks->xi2mask[XIAllDevices][type/8] & filter) ||
|
|
||||||
((inputMasks->xi2mask[XIAllMasterDevices][type/8] & filter) && IsMaster(dev)) ||
|
|
||||||
(inputMasks->xi2mask[dev->id][type/8] & filter)))
|
|
||||||
rc |= EVENT_XI2_MASK;
|
rc |= EVENT_XI2_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
type = GetXIType(event);
|
if ((type = GetXIType(event)) != 0)
|
||||||
ev.u.u.type = type;
|
{
|
||||||
filter = GetEventFilter(dev, &ev);
|
filter = GetEventFilterMask(dev, type);
|
||||||
|
|
||||||
/* Check for XI mask */
|
/* Check for XI mask */
|
||||||
if (type && inputMasks &&
|
if (inputMasks &&
|
||||||
(inputMasks->deliverableEvents[dev->id] & filter) &&
|
(inputMasks->deliverableEvents[dev->id] & filter) &&
|
||||||
(inputMasks->inputEvents[dev->id] & filter))
|
(inputMasks->inputEvents[dev->id] & filter))
|
||||||
rc |= EVENT_XI1_MASK;
|
rc |= EVENT_XI1_MASK;
|
||||||
|
|
||||||
/* Check for XI DontPropagate mask */
|
/* Check for XI DontPropagate mask */
|
||||||
if (type && inputMasks &&
|
if (inputMasks && (inputMasks->dontPropagateMask[dev->id] & filter))
|
||||||
(inputMasks->dontPropagateMask[dev->id] & filter))
|
|
||||||
rc |= EVENT_DONT_PROPAGATE_MASK;
|
rc |= EVENT_DONT_PROPAGATE_MASK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((type = GetCoreType(event)) != 0)
|
||||||
|
{
|
||||||
|
filter = GetEventFilterMask(dev, type);
|
||||||
|
|
||||||
/* Check for core mask */
|
/* Check for core mask */
|
||||||
type = GetCoreType(event);
|
if ((win->deliverableEvents & filter) &&
|
||||||
if (type && (win->deliverableEvents & filter) &&
|
|
||||||
((wOtherEventMasks(win) | win->eventMask) & filter))
|
((wOtherEventMasks(win) | win->eventMask) & filter))
|
||||||
rc |= EVENT_CORE_MASK;
|
rc |= EVENT_CORE_MASK;
|
||||||
|
|
||||||
/* Check for core DontPropagate mask */
|
/* Check for core DontPropagate mask */
|
||||||
if (type && (filter & wDontPropagateMask(win)))
|
if (filter & wDontPropagateMask(win))
|
||||||
rc |= EVENT_DONT_PROPAGATE_MASK;
|
rc |= EVENT_DONT_PROPAGATE_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -3351,16 +3377,21 @@ XineramaWarpPointer(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr dest = NULL;
|
WindowPtr dest = NULL;
|
||||||
int x, y, rc;
|
int x, y, rc;
|
||||||
SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite;
|
DeviceIntPtr dev;
|
||||||
|
SpritePtr pSprite;
|
||||||
|
|
||||||
REQUEST(xWarpPointerReq);
|
REQUEST(xWarpPointerReq);
|
||||||
|
|
||||||
|
|
||||||
if (stuff->dstWid != None) {
|
if (stuff->dstWid != None) {
|
||||||
rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
|
rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Post through the XTest device */
|
||||||
|
dev = PickPointer(client);
|
||||||
|
dev = GetXTestDevice(dev);
|
||||||
|
pSprite = dev->spriteInfo->sprite;
|
||||||
x = pSprite->hotPhys.x;
|
x = pSprite->hotPhys.x;
|
||||||
y = pSprite->hotPhys.y;
|
y = pSprite->hotPhys.y;
|
||||||
|
|
||||||
|
@ -3410,9 +3441,9 @@ XineramaWarpPointer(ClientPtr client)
|
||||||
else if (y >= pSprite->physLimits.y2)
|
else if (y >= pSprite->physLimits.y2)
|
||||||
y = pSprite->physLimits.y2 - 1;
|
y = pSprite->physLimits.y2 - 1;
|
||||||
if (pSprite->hotShape)
|
if (pSprite->hotShape)
|
||||||
ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
|
ConfineToShape(dev, pSprite->hotShape, &x, &y);
|
||||||
|
|
||||||
XineramaSetCursorPosition(PickPointer(client), x, y, TRUE);
|
XineramaSetCursorPosition(dev, x, y, TRUE);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -3430,7 +3461,7 @@ ProcWarpPointer(ClientPtr client)
|
||||||
WindowPtr dest = NULL;
|
WindowPtr dest = NULL;
|
||||||
int x, y, rc;
|
int x, y, rc;
|
||||||
ScreenPtr newScreen;
|
ScreenPtr newScreen;
|
||||||
DeviceIntPtr dev, tmp;
|
DeviceIntPtr dev, tmp, xtest_dev = NULL;
|
||||||
SpritePtr pSprite;
|
SpritePtr pSprite;
|
||||||
|
|
||||||
REQUEST(xWarpPointerReq);
|
REQUEST(xWarpPointerReq);
|
||||||
|
@ -3443,11 +3474,13 @@ ProcWarpPointer(ClientPtr client)
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
if (IsXTestDevice(tmp, dev))
|
||||||
|
xtest_dev = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->lastSlave)
|
/* Use the XTest device to actually move the pointer */
|
||||||
dev = dev->lastSlave;
|
dev = xtest_dev;
|
||||||
pSprite = dev->spriteInfo->sprite;
|
pSprite = dev->spriteInfo->sprite;
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
|
@ -3678,7 +3711,7 @@ CheckPassiveGrabsOnWindow(
|
||||||
if (tempGrab.type < GenericEvent)
|
if (tempGrab.type < GenericEvent)
|
||||||
{
|
{
|
||||||
grab->device = device;
|
grab->device = device;
|
||||||
grab->modifierDevice = GetPairedDevice(device);
|
grab->modifierDevice = GetMaster(device, MASTER_KEYBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (other = inputInfo.devices; other; other = other->next)
|
for (other = inputInfo.devices; other; other = other->next)
|
||||||
|
@ -4063,9 +4096,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
if (rc == Success)
|
if (rc == Success)
|
||||||
{
|
{
|
||||||
int evtype = xi2_get_type(xi2);
|
int evtype = xi2_get_type(xi2);
|
||||||
mask = grab->xi2mask[XIAllDevices][evtype/8] |
|
mask = GetXI2MaskByte(grab->xi2mask, thisDev, evtype);
|
||||||
grab->xi2mask[XIAllMasterDevices][evtype/8] |
|
|
||||||
grab->xi2mask[thisDev->id][evtype/8];
|
|
||||||
/* try XI2 event */
|
/* try XI2 event */
|
||||||
FixUpEventFromWindow(pSprite, xi2, grab->window, None, TRUE);
|
FixUpEventFromWindow(pSprite, xi2, grab->window, None, TRUE);
|
||||||
/* XXX: XACE */
|
/* XXX: XACE */
|
||||||
|
@ -4544,9 +4575,7 @@ DeviceEnterLeaveEvent(
|
||||||
if (grab)
|
if (grab)
|
||||||
{
|
{
|
||||||
Mask mask;
|
Mask mask;
|
||||||
mask = grab->xi2mask[XIAllDevices][type/8] |
|
mask = GetXI2MaskByte(grab->xi2mask, mouse, type);
|
||||||
grab->xi2mask[XIAllMasterDevices][type/8] |
|
|
||||||
grab->xi2mask[mouse->id][type/8];
|
|
||||||
TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask,
|
TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask,
|
||||||
filter, grab);
|
filter, grab);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4765,7 +4794,6 @@ ProcGrabPointer(ClientPtr client)
|
||||||
WindowPtr confineTo;
|
WindowPtr confineTo;
|
||||||
CursorPtr oldCursor;
|
CursorPtr oldCursor;
|
||||||
REQUEST(xGrabPointerReq);
|
REQUEST(xGrabPointerReq);
|
||||||
TimeStamp time;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGrabPointerReq);
|
REQUEST_SIZE_MATCH(xGrabPointerReq);
|
||||||
|
@ -4811,7 +4839,6 @@ ProcGrabPointer(ClientPtr client)
|
||||||
if (oldCursor && rep.status == GrabSuccess)
|
if (oldCursor && rep.status == GrabSuccess)
|
||||||
FreeCursor (oldCursor, (Cursor)0);
|
FreeCursor (oldCursor, (Cursor)0);
|
||||||
|
|
||||||
time = ClientTimeToServerTime(stuff->time);
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
|
@ -5224,6 +5251,8 @@ CloseDownEvents(void)
|
||||||
InputEventList = NULL;
|
InputEventList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SEND_EVENT_BIT 0x80
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server-side protocol handling for SendEvent request.
|
* Server-side protocol handling for SendEvent request.
|
||||||
*
|
*
|
||||||
|
@ -5241,6 +5270,16 @@ ProcSendEvent(ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSendEventReq);
|
REQUEST_SIZE_MATCH(xSendEventReq);
|
||||||
|
|
||||||
|
/* libXext and other extension libraries may set the bit indicating
|
||||||
|
* that this event came from a SendEvent request so remove it
|
||||||
|
* since otherwise the event type may fail the range checks
|
||||||
|
* and cause an invalid BadValue error to be returned.
|
||||||
|
*
|
||||||
|
* This is safe to do since we later add the SendEvent bit (0x80)
|
||||||
|
* back in once we send the event to the client */
|
||||||
|
|
||||||
|
stuff->event.u.u.type &= ~(SEND_EVENT_BIT);
|
||||||
|
|
||||||
/* The client's event type must be a core event type or one defined by an
|
/* The client's event type must be a core event type or one defined by an
|
||||||
extension. */
|
extension. */
|
||||||
|
|
||||||
|
@ -5298,7 +5337,7 @@ ProcSendEvent(ClientPtr client)
|
||||||
client->errorValue = stuff->propagate;
|
client->errorValue = stuff->propagate;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
stuff->event.u.u.type |= 0x80;
|
stuff->event.u.u.type |= SEND_EVENT_BIT;
|
||||||
if (stuff->propagate)
|
if (stuff->propagate)
|
||||||
{
|
{
|
||||||
for (;pWin; pWin = pWin->parent)
|
for (;pWin; pWin = pWin->parent)
|
||||||
|
@ -5360,7 +5399,7 @@ ProcUngrabKey(ClientPtr client)
|
||||||
tempGrab.window = pWin;
|
tempGrab.window = pWin;
|
||||||
tempGrab.modifiersDetail.exact = stuff->modifiers;
|
tempGrab.modifiersDetail.exact = stuff->modifiers;
|
||||||
tempGrab.modifiersDetail.pMask = NULL;
|
tempGrab.modifiersDetail.pMask = NULL;
|
||||||
tempGrab.modifierDevice = GetPairedDevice(keybd);
|
tempGrab.modifierDevice = keybd;
|
||||||
tempGrab.type = KeyPress;
|
tempGrab.type = KeyPress;
|
||||||
tempGrab.grabtype = GRABTYPE_CORE;
|
tempGrab.grabtype = GRABTYPE_CORE;
|
||||||
tempGrab.detail.exact = stuff->key;
|
tempGrab.detail.exact = stuff->key;
|
||||||
|
|
|
@ -153,17 +153,6 @@ key_autorepeats(DeviceIntPtr pDev, int key_code)
|
||||||
(1 << (key_code & 7)));
|
(1 << (key_code & 7)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
init_event(DeviceIntPtr dev, DeviceEvent* event, Time ms)
|
|
||||||
{
|
|
||||||
memset(event, 0, sizeof(DeviceEvent));
|
|
||||||
event->header = ET_Internal;
|
|
||||||
event->length = sizeof(DeviceEvent);
|
|
||||||
event->time = ms;
|
|
||||||
event->deviceid = dev->id;
|
|
||||||
event->sourceid = dev->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_raw(DeviceIntPtr dev, RawDeviceEvent *event, Time ms, int type, int detail)
|
init_raw(DeviceIntPtr dev, RawDeviceEvent *event, Time ms, int type, int detail)
|
||||||
{
|
{
|
||||||
|
@ -414,7 +403,6 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
|
||||||
Time current;
|
Time current;
|
||||||
/* The size of a single motion event. */
|
/* The size of a single motion event. */
|
||||||
int size;
|
int size;
|
||||||
int dflt;
|
|
||||||
AxisInfo from, *to; /* for scaling */
|
AxisInfo from, *to; /* for scaling */
|
||||||
INT32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
|
INT32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
|
||||||
INT16 *corebuf;
|
INT16 *corebuf;
|
||||||
|
@ -502,13 +490,6 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
|
||||||
else if (j == 1 && (from.max_value < from.min_value))
|
else if (j == 1 && (from.max_value < from.min_value))
|
||||||
from.max_value = pScreen->height;
|
from.max_value = pScreen->height;
|
||||||
|
|
||||||
if (j == 0 && (to->max_value < to->min_value))
|
|
||||||
dflt = pScreen->width;
|
|
||||||
else if (j == 1 && (to->max_value < to->min_value))
|
|
||||||
dflt = pScreen->height;
|
|
||||||
else
|
|
||||||
dflt = 0;
|
|
||||||
|
|
||||||
/* scale from stored range into current range */
|
/* scale from stored range into current range */
|
||||||
coord = rescaleValuatorAxis(coord, 0.0, NULL, &from, to, 0);
|
coord = rescaleValuatorAxis(coord, 0.0, NULL, &from, to, 0);
|
||||||
memcpy(ocbuf, &coord, sizeof(INT32));
|
memcpy(ocbuf, &coord, sizeof(INT32));
|
||||||
|
@ -1014,7 +995,7 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
set_raw_valuators(raw, &mask, raw->valuators.data);
|
set_raw_valuators(raw, &mask, raw->valuators.data);
|
||||||
|
|
||||||
event = &events->device_event;
|
event = &events->device_event;
|
||||||
init_event(pDev, event, ms);
|
init_device_event(event, pDev, ms);
|
||||||
event->detail.key = key_code;
|
event->detail.key = key_code;
|
||||||
|
|
||||||
if (type == KeyPress) {
|
if (type == KeyPress) {
|
||||||
|
@ -1236,7 +1217,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
|
||||||
clipValuators(pDev, &mask);
|
clipValuators(pDev, &mask);
|
||||||
|
|
||||||
event = &events->device_event;
|
event = &events->device_event;
|
||||||
init_event(pDev, event, ms);
|
init_device_event(event, pDev, ms);
|
||||||
|
|
||||||
if (type == MotionNotify) {
|
if (type == MotionNotify) {
|
||||||
event->type = ET_Motion;
|
event->type = ET_Motion;
|
||||||
|
@ -1329,7 +1310,7 @@ GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, const Val
|
||||||
events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events);
|
events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events);
|
||||||
|
|
||||||
event = &events->device_event;
|
event = &events->device_event;
|
||||||
init_event(pDev, event, GetTimeInMillis());
|
init_device_event(event, pDev, GetTimeInMillis());
|
||||||
event->type = (type == ProximityIn) ? ET_ProximityIn : ET_ProximityOut;
|
event->type = (type == ProximityIn) ? ET_ProximityIn : ET_ProximityOut;
|
||||||
|
|
||||||
clipValuators(pDev, &mask);
|
clipValuators(pDev, &mask);
|
||||||
|
@ -1365,7 +1346,7 @@ PostSyntheticMotion(DeviceIntPtr pDev,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(&ev, 0, sizeof(DeviceEvent));
|
memset(&ev, 0, sizeof(DeviceEvent));
|
||||||
init_event(pDev, &ev, time);
|
init_device_event(&ev, pDev, time);
|
||||||
ev.root_x = x;
|
ev.root_x = x;
|
||||||
ev.root_y = y;
|
ev.root_y = y;
|
||||||
ev.type = ET_Motion;
|
ev.type = ET_Motion;
|
||||||
|
|
|
@ -479,7 +479,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab)
|
||||||
|
|
||||||
for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next)
|
for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next)
|
||||||
{
|
{
|
||||||
if (GrabMatchesSecond(pGrab, grab, FALSE))
|
if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == GRABTYPE_CORE)))
|
||||||
{
|
{
|
||||||
if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource))
|
if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource))
|
||||||
{
|
{
|
||||||
|
|
155
dix/inpututils.c
155
dix/inpututils.c
|
@ -584,3 +584,158 @@ void verify_internal_event(const InternalEvent *ev)
|
||||||
FatalError("Wrong event type %d. Aborting server\n", ev->any.header);
|
FatalError("Wrong event type %d. Aborting server\n", ev->any.header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the given event to zero (or default values), for the given
|
||||||
|
* device.
|
||||||
|
*/
|
||||||
|
void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms)
|
||||||
|
{
|
||||||
|
memset(event, 0, sizeof(DeviceEvent));
|
||||||
|
event->header = ET_Internal;
|
||||||
|
event->length = sizeof(DeviceEvent);
|
||||||
|
event->time = ms;
|
||||||
|
event->deviceid = dev->id;
|
||||||
|
event->sourceid = dev->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the element with the key from the list, freeing all memory
|
||||||
|
* associated with the element..
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
input_option_free(InputOption *o)
|
||||||
|
{
|
||||||
|
free(o->key);
|
||||||
|
free(o->value);
|
||||||
|
free(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a new InputOption with the key/value pair provided.
|
||||||
|
* If a list is provided, the new options is added to the list and the list
|
||||||
|
* is returned.
|
||||||
|
*
|
||||||
|
* If a new option is added to a list that already contains that option, the
|
||||||
|
* previous option is overwritten.
|
||||||
|
*
|
||||||
|
* @param list The list to add to.
|
||||||
|
* @param key Option key, will be copied.
|
||||||
|
* @param value Option value, will be copied.
|
||||||
|
*
|
||||||
|
* @return If list is not NULL, the list with the new option added. If list
|
||||||
|
* is NULL, a new option list with one element. On failure, NULL is
|
||||||
|
* returned.
|
||||||
|
*/
|
||||||
|
InputOption*
|
||||||
|
input_option_new(InputOption* list, const char *key, const char *value)
|
||||||
|
{
|
||||||
|
InputOption *opt = NULL;
|
||||||
|
|
||||||
|
if (!key)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (list)
|
||||||
|
{
|
||||||
|
nt_list_for_each_entry(opt, list, next)
|
||||||
|
{
|
||||||
|
if (strcmp(input_option_get_key(opt), key) == 0)
|
||||||
|
{
|
||||||
|
input_option_set_value(opt, value);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
opt = calloc(1, sizeof(InputOption));
|
||||||
|
if (!opt)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
nt_list_init(opt, next);
|
||||||
|
input_option_set_key(opt, key);
|
||||||
|
input_option_set_value(opt, value);
|
||||||
|
|
||||||
|
if (list)
|
||||||
|
{
|
||||||
|
nt_list_append(opt, list, InputOption, next);
|
||||||
|
return list;
|
||||||
|
} else
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputOption*
|
||||||
|
input_option_free_element(InputOption *list, const char *key)
|
||||||
|
{
|
||||||
|
InputOption *element;
|
||||||
|
|
||||||
|
nt_list_for_each_entry(element, list, next) {
|
||||||
|
if (strcmp(input_option_get_key(element), key) == 0) {
|
||||||
|
nt_list_del(element, list, InputOption, next);
|
||||||
|
input_option_free(element);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free the list pointed at by opt.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
input_option_free_list(InputOption **opt)
|
||||||
|
{
|
||||||
|
InputOption *element, *tmp;
|
||||||
|
|
||||||
|
nt_list_for_each_entry_safe(element, tmp, *opt, next) {
|
||||||
|
nt_list_del(element, *opt, InputOption, next);
|
||||||
|
input_option_free(element);
|
||||||
|
}
|
||||||
|
*opt = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the InputOption with the given option name.
|
||||||
|
*
|
||||||
|
* @return The InputOption or NULL if not present.
|
||||||
|
*/
|
||||||
|
InputOption*
|
||||||
|
input_option_find(InputOption *list, const char *key)
|
||||||
|
{
|
||||||
|
InputOption *element;
|
||||||
|
|
||||||
|
nt_list_for_each_entry(element, list, next) {
|
||||||
|
if (strcmp(input_option_get_key(element), key) == 0)
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char*
|
||||||
|
input_option_get_key(const InputOption *opt)
|
||||||
|
{
|
||||||
|
return opt->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char*
|
||||||
|
input_option_get_value(const InputOption *opt)
|
||||||
|
{
|
||||||
|
return opt->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
input_option_set_key(InputOption *opt, const char *key)
|
||||||
|
{
|
||||||
|
free(opt->key);
|
||||||
|
if (key)
|
||||||
|
opt->key = strdup(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
input_option_set_value(InputOption *opt, const char *value)
|
||||||
|
{
|
||||||
|
free(opt->value);
|
||||||
|
if (value)
|
||||||
|
opt->value = strdup(value);
|
||||||
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
|
||||||
xf86PciInfo.h xf86Priv.h xf86Privstr.h \
|
xf86PciInfo.h xf86Priv.h xf86Privstr.h \
|
||||||
xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
|
xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
|
||||||
$(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
|
$(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
|
||||||
xf86sbusBus.h xf86VGAarbiter.h
|
xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h
|
||||||
|
|
||||||
DISTCLEANFILES = xf86Build.h
|
DISTCLEANFILES = xf86Build.h
|
||||||
CLEANFILES = $(BUILT_SOURCES)
|
CLEANFILES = $(BUILT_SOURCES)
|
||||||
|
|
|
@ -331,7 +331,7 @@ extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePt
|
||||||
|
|
||||||
/* xf86Option.c */
|
/* xf86Option.c */
|
||||||
|
|
||||||
extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
|
extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
|
||||||
|
|
||||||
|
|
||||||
/* xf86RandR.c */
|
/* xf86RandR.c */
|
||||||
|
|
|
@ -1038,6 +1038,45 @@ Bool xf86DRI2Enabled(void)
|
||||||
return xf86Info.dri2;
|
return xf86Info.dri2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for the pInfo in the null-terminated list given and remove (and
|
||||||
|
* free) it if present. All other devices are moved forward.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
freeDevice(InputInfoPtr *list, InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
InputInfoPtr *devs;
|
||||||
|
|
||||||
|
for (devs = list; devs && *devs; devs++) {
|
||||||
|
if (*devs == pInfo) {
|
||||||
|
free(*devs);
|
||||||
|
for (; devs && *devs; devs++)
|
||||||
|
devs[0] = devs[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append pInfo to the null-terminated list, allocating space as necessary.
|
||||||
|
* pInfo is used as the last element.
|
||||||
|
*/
|
||||||
|
static InputInfoPtr*
|
||||||
|
addDevice(InputInfoPtr *list, InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
InputInfoPtr *devs;
|
||||||
|
int count = 1;
|
||||||
|
|
||||||
|
for (devs = list; devs && *devs; devs++)
|
||||||
|
count++;
|
||||||
|
|
||||||
|
list = xnfrealloc(list, (count + 1) * sizeof(InputInfoPtr));
|
||||||
|
list[count] = NULL;
|
||||||
|
|
||||||
|
list[count - 1] = pInfo;
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Locate the core input devices. These can be specified/located in
|
* Locate the core input devices. These can be specified/located in
|
||||||
* the following ways, in order of priority:
|
* the following ways, in order of priority:
|
||||||
|
@ -1061,12 +1100,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
const char *pointerMsg = NULL, *keyboardMsg = NULL;
|
const char *pointerMsg = NULL, *keyboardMsg = NULL;
|
||||||
InputInfoPtr *devs, /* iterator */
|
InputInfoPtr *devs, /* iterator */
|
||||||
indp;
|
indp;
|
||||||
InputInfoRec Pointer = {}, Keyboard = {};
|
InputInfoPtr Pointer, Keyboard;
|
||||||
XF86ConfInputPtr confInput;
|
XF86ConfInputPtr confInput;
|
||||||
XF86ConfInputRec defPtr, defKbd;
|
XF86ConfInputRec defPtr, defKbd;
|
||||||
int count = 0;
|
|
||||||
MessageType from = X_DEFAULT;
|
MessageType from = X_DEFAULT;
|
||||||
int found = 0;
|
|
||||||
const char *mousedrivers[] = { "mouse", "synaptics", "evdev", "vmmouse",
|
const char *mousedrivers[] = { "mouse", "synaptics", "evdev", "vmmouse",
|
||||||
"void", NULL };
|
"void", NULL };
|
||||||
|
|
||||||
|
@ -1081,25 +1118,14 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
|
xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
|
||||||
if (!corePointer) {
|
if (!corePointer) {
|
||||||
corePointer = indp;
|
corePointer = indp;
|
||||||
} else {
|
|
||||||
xf86ReplaceBoolOption(indp->options, "CorePointer", FALSE);
|
|
||||||
xf86Msg(X_WARNING, "Duplicate core pointer devices. "
|
|
||||||
"Removing core pointer attribute from \"%s\"\n",
|
|
||||||
indp->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (indp->options &&
|
if (indp->options &&
|
||||||
xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
|
xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
|
||||||
if (!coreKeyboard) {
|
if (!coreKeyboard) {
|
||||||
coreKeyboard = indp;
|
coreKeyboard = indp;
|
||||||
} else {
|
|
||||||
xf86ReplaceBoolOption(indp->options, "CoreKeyboard", FALSE);
|
|
||||||
xf86Msg(X_WARNING, "Duplicate core keyboard devices. "
|
|
||||||
"Removing core keyboard attribute from \"%s\"\n",
|
|
||||||
indp->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
confInput = NULL;
|
confInput = NULL;
|
||||||
|
@ -1119,18 +1145,9 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
* removed.
|
* removed.
|
||||||
*/
|
*/
|
||||||
if (corePointer) {
|
if (corePointer) {
|
||||||
for (devs = servlayoutp->inputs; devs && *devs; devs++)
|
freeDevice(servlayoutp->inputs, corePointer);
|
||||||
if (*devs == corePointer)
|
|
||||||
{
|
|
||||||
free(*devs);
|
|
||||||
*devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop*/
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (; devs && *devs; devs++)
|
|
||||||
devs[0] = devs[1];
|
|
||||||
count--;
|
|
||||||
}
|
|
||||||
corePointer = NULL;
|
corePointer = NULL;
|
||||||
|
}
|
||||||
foundPointer = TRUE;
|
foundPointer = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1186,67 +1203,23 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
|
|
||||||
/* Add the core pointer device to the layout, and set it to Core. */
|
/* Add the core pointer device to the layout, and set it to Core. */
|
||||||
if (foundPointer && confInput) {
|
if (foundPointer && confInput) {
|
||||||
foundPointer = configInput(&Pointer, confInput, from);
|
Pointer = xf86AllocateInput();
|
||||||
|
if (Pointer)
|
||||||
|
foundPointer = configInput(Pointer, confInput, from);
|
||||||
if (foundPointer) {
|
if (foundPointer) {
|
||||||
count++;
|
Pointer->options = xf86addNewOption(Pointer->options,
|
||||||
devs = xnfrealloc(servlayoutp->inputs,
|
xnfstrdup("CorePointer"), "on");
|
||||||
(count + 1) * sizeof(InputInfoPtr));
|
servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
|
||||||
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
|
|
||||||
Pointer.fd = -1;
|
|
||||||
*devs[count - 1] = Pointer;
|
|
||||||
devs[count - 1]->options =
|
|
||||||
xf86addNewOption(devs[count -1]->options,
|
|
||||||
xnfstrdup("CorePointer"), NULL);
|
|
||||||
devs[count] = NULL;
|
|
||||||
servlayoutp->inputs = devs;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundPointer && xf86Info.forceInputDevices) {
|
if (!foundPointer && xf86Info.forceInputDevices) {
|
||||||
/* This shouldn't happen. */
|
/* This shouldn't happen. */
|
||||||
xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
|
xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
|
||||||
|
xf86DeleteInput(Pointer, 0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* always synthesize a 'mouse' section configured to send core
|
|
||||||
* events, unless a 'void' section is found, in which case the user
|
|
||||||
* probably wants to run footless.
|
|
||||||
*
|
|
||||||
* If you're using an evdev keyboard and expect a default mouse
|
|
||||||
* section ... deal.
|
|
||||||
*/
|
|
||||||
for (devs = servlayoutp->inputs; devs && *devs; devs++) {
|
|
||||||
const char **driver = mousedrivers;
|
|
||||||
while(*driver) {
|
|
||||||
if (!strcmp((*devs)->driver, *driver)) {
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
driver++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found && xf86Info.forceInputDevices) {
|
|
||||||
xf86Msg(X_INFO, "No default mouse found, adding one\n");
|
|
||||||
memset(&defPtr, 0, sizeof(defPtr));
|
|
||||||
defPtr.inp_identifier = strdup("<default pointer>");
|
|
||||||
defPtr.inp_driver = strdup("mouse");
|
|
||||||
confInput = &defPtr;
|
|
||||||
foundPointer = configInput(&Pointer, confInput, from);
|
|
||||||
if (foundPointer) {
|
|
||||||
count++;
|
|
||||||
devs = xnfrealloc(servlayoutp->inputs,
|
|
||||||
(count + 1) * sizeof(InputInfoPtr));
|
|
||||||
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
|
|
||||||
Pointer.fd = -1;
|
|
||||||
*devs[count - 1] = Pointer;
|
|
||||||
devs[count - 1]->options =
|
|
||||||
xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
|
|
||||||
devs[count] = NULL;
|
|
||||||
servlayoutp->inputs = devs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
confInput = NULL;
|
confInput = NULL;
|
||||||
|
|
||||||
/* 1. Check for the -keyboard command line option. */
|
/* 1. Check for the -keyboard command line option. */
|
||||||
|
@ -1264,18 +1237,9 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
* removed.
|
* removed.
|
||||||
*/
|
*/
|
||||||
if (coreKeyboard) {
|
if (coreKeyboard) {
|
||||||
for (devs = servlayoutp->inputs; devs && *devs; devs++)
|
freeDevice(servlayoutp->inputs, coreKeyboard);
|
||||||
if (*devs == coreKeyboard)
|
|
||||||
{
|
|
||||||
free(*devs);
|
|
||||||
*devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (; devs && *devs; devs++)
|
|
||||||
devs[0] = devs[1];
|
|
||||||
count--;
|
|
||||||
}
|
|
||||||
coreKeyboard = NULL;
|
coreKeyboard = NULL;
|
||||||
|
}
|
||||||
foundKeyboard = TRUE;
|
foundKeyboard = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1329,25 +1293,20 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
|
|
||||||
/* Add the core keyboard device to the layout, and set it to Core. */
|
/* Add the core keyboard device to the layout, and set it to Core. */
|
||||||
if (foundKeyboard && confInput) {
|
if (foundKeyboard && confInput) {
|
||||||
foundKeyboard = configInput(&Keyboard, confInput, from);
|
Keyboard = xf86AllocateInput();
|
||||||
|
if (Keyboard)
|
||||||
|
foundKeyboard = configInput(Keyboard, confInput, from);
|
||||||
if (foundKeyboard) {
|
if (foundKeyboard) {
|
||||||
count++;
|
Keyboard->options = xf86addNewOption(Keyboard->options,
|
||||||
devs = xnfrealloc(servlayoutp->inputs,
|
xnfstrdup("CoreKeyboard"), "on");
|
||||||
(count + 1) * sizeof(InputInfoPtr));
|
servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard);
|
||||||
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
|
|
||||||
Keyboard.fd = -1;
|
|
||||||
*devs[count - 1] = Keyboard;
|
|
||||||
devs[count - 1]->options =
|
|
||||||
xf86addNewOption(devs[count - 1]->options,
|
|
||||||
xnfstrdup("CoreKeyboard"), NULL);
|
|
||||||
devs[count] = NULL;
|
|
||||||
servlayoutp->inputs = devs;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundKeyboard && xf86Info.forceInputDevices) {
|
if (!foundKeyboard && xf86Info.forceInputDevices) {
|
||||||
/* This shouldn't happen. */
|
/* This shouldn't happen. */
|
||||||
xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
|
xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
|
||||||
|
xf86DeleteInput(Keyboard, 0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1027,36 +1027,20 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print driver messages in the standard format */
|
/* Print driver messages in the standard format of
|
||||||
|
(<type>) <screen name>(<screen index>): <message> */
|
||||||
#undef PREFIX_SIZE
|
|
||||||
#define PREFIX_SIZE 14
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
|
xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
|
||||||
va_list args)
|
va_list args)
|
||||||
{
|
{
|
||||||
char *tmpFormat;
|
|
||||||
|
|
||||||
/* Prefix the scrnIndex name to the format string. */
|
/* Prefix the scrnIndex name to the format string. */
|
||||||
if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
|
if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
|
||||||
xf86Screens[scrnIndex]->name) {
|
xf86Screens[scrnIndex]->name)
|
||||||
tmpFormat = malloc(strlen(format) +
|
LogHdrMessageVerb(type, verb, format, args, "%s(%d): ",
|
||||||
strlen(xf86Screens[scrnIndex]->name) +
|
|
||||||
PREFIX_SIZE + 1);
|
|
||||||
if (!tmpFormat)
|
|
||||||
return;
|
|
||||||
|
|
||||||
snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ",
|
|
||||||
xf86Screens[scrnIndex]->name, scrnIndex);
|
xf86Screens[scrnIndex]->name, scrnIndex);
|
||||||
|
else
|
||||||
strcat(tmpFormat, format);
|
|
||||||
LogVMessageVerb(type, verb, tmpFormat, args);
|
|
||||||
free(tmpFormat);
|
|
||||||
} else
|
|
||||||
LogVMessageVerb(type, verb, format, args);
|
LogVMessageVerb(type, verb, format, args);
|
||||||
}
|
}
|
||||||
#undef PREFIX_SIZE
|
|
||||||
|
|
||||||
/* Print driver messages, with verbose level specified directly */
|
/* Print driver messages, with verbose level specified directly */
|
||||||
void
|
void
|
||||||
|
@ -1082,20 +1066,23 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print input driver messages in the standard format of
|
/* Print input driver messages in the standard format of
|
||||||
<driver>: <device name>: <message> */
|
(<type>) <driver>: <device name>: <message> */
|
||||||
void
|
void
|
||||||
xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
|
xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb,
|
||||||
va_list args)
|
const char *format, va_list args)
|
||||||
{
|
{
|
||||||
char *msg;
|
const char *driverName = NULL;
|
||||||
|
const char *deviceName = NULL;
|
||||||
|
|
||||||
if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
|
/* Prefix driver and device names to formatted message. */
|
||||||
== -1) {
|
if (dev) {
|
||||||
LogVMessageVerb(type, verb, "%s", args);
|
deviceName = dev->name;
|
||||||
} else {
|
if (dev->drv)
|
||||||
LogVMessageVerb(type, verb, msg, args);
|
driverName = dev->drv->driverName;
|
||||||
free(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName,
|
||||||
|
deviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print input driver message, with verbose level specified directly */
|
/* Print input driver message, with verbose level specified directly */
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
#include "xf86Bus.h"
|
#include "xf86Bus.h"
|
||||||
#include "xf86VGAarbiter.h"
|
#include "xf86VGAarbiter.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "xserver-properties.h"
|
||||||
|
|
||||||
#ifdef DPMSExtension
|
#ifdef DPMSExtension
|
||||||
#include <X11/extensions/dpmsconst.h>
|
#include <X11/extensions/dpmsconst.h>
|
||||||
|
@ -654,6 +655,24 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SeatId) {
|
||||||
|
Atom SeatAtom;
|
||||||
|
|
||||||
|
SeatAtom = MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE);
|
||||||
|
|
||||||
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
|
||||||
|
SeatAtom, XA_STRING, 8,
|
||||||
|
strlen(SeatId)+1, SeatId );
|
||||||
|
if (ret != Success) {
|
||||||
|
xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
|
||||||
|
"Failed to register seat property\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If a screen uses depth 24, show what the pixmap format is */
|
/* If a screen uses depth 24, show what the pixmap format is */
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
if (xf86Screens[i]->depth == 24) {
|
if (xf86Screens[i]->depth == 24) {
|
||||||
|
@ -806,11 +825,10 @@ duplicateDevice(InputInfoPtr pInfo)
|
||||||
return dup;
|
return dup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* InitInput --
|
* Initialize all supported input devices present and referenced in the
|
||||||
* Initialize all supported input devices.
|
* xorg.conf.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
InitInput(int argc, char **argv)
|
InitInput(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#ifndef _XF86_OPT_H_
|
#ifndef _XF86_OPT_H_
|
||||||
#define _XF86_OPT_H_
|
#define _XF86_OPT_H_
|
||||||
|
#include "xf86Optionstr.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
double freq;
|
double freq;
|
||||||
|
@ -69,34 +70,34 @@ typedef struct {
|
||||||
Bool found;
|
Bool found;
|
||||||
} OptionInfoRec, *OptionInfoPtr;
|
} OptionInfoRec, *OptionInfoPtr;
|
||||||
|
|
||||||
extern _X_EXPORT int xf86SetIntOption(pointer optlist, const char *name, int deflt);
|
extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt);
|
||||||
extern _X_EXPORT double xf86SetRealOption(pointer optlist, const char *name, double deflt);
|
extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt);
|
||||||
extern _X_EXPORT char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
|
extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
|
||||||
extern _X_EXPORT int xf86SetBoolOption(pointer list, const char *name, int deflt );
|
extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name, int deflt );
|
||||||
extern _X_EXPORT double xf86SetPercentOption(pointer list, const char *name, double deflt );
|
extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list, const char *name, double deflt );
|
||||||
extern _X_EXPORT int xf86CheckIntOption(pointer optlist, const char *name, int deflt);
|
extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt);
|
||||||
extern _X_EXPORT double xf86CheckRealOption(pointer optlist, const char *name, double deflt);
|
extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt);
|
||||||
extern _X_EXPORT char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt);
|
extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
|
||||||
extern _X_EXPORT int xf86CheckBoolOption(pointer list, const char *name, int deflt );
|
extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name, int deflt );
|
||||||
extern _X_EXPORT double xf86CheckPercentOption(pointer list, const char *name, double deflt );
|
extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list, const char *name, double deflt );
|
||||||
extern _X_EXPORT pointer xf86AddNewOption(pointer head, const char *name, const char *val );
|
extern _X_EXPORT XF86OptionPtr xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val );
|
||||||
extern _X_EXPORT pointer xf86NewOption(char *name, char *value );
|
extern _X_EXPORT XF86OptionPtr xf86NewOption(char *name, char *value );
|
||||||
extern _X_EXPORT pointer xf86NextOption(pointer list );
|
extern _X_EXPORT XF86OptionPtr xf86NextOption(XF86OptionPtr list );
|
||||||
extern _X_EXPORT pointer xf86OptionListCreate(const char **options, int count, int used);
|
extern _X_EXPORT XF86OptionPtr xf86OptionListCreate(const char **options, int count, int used);
|
||||||
extern _X_EXPORT pointer xf86OptionListMerge(pointer head, pointer tail);
|
extern _X_EXPORT XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
|
||||||
extern _X_EXPORT pointer xf86OptionListDuplicate(pointer list);
|
extern _X_EXPORT XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr list);
|
||||||
extern _X_EXPORT void xf86OptionListFree(pointer opt);
|
extern _X_EXPORT void xf86OptionListFree(XF86OptionPtr opt);
|
||||||
extern _X_EXPORT char *xf86OptionName(pointer opt);
|
extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt);
|
||||||
extern _X_EXPORT char *xf86OptionValue(pointer opt);
|
extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt);
|
||||||
extern _X_EXPORT void xf86OptionListReport(pointer parm);
|
extern _X_EXPORT void xf86OptionListReport(XF86OptionPtr parm);
|
||||||
extern _X_EXPORT pointer xf86FindOption(pointer options, const char *name);
|
extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
|
||||||
extern _X_EXPORT char *xf86FindOptionValue(pointer options, const char *name);
|
extern _X_EXPORT char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
|
||||||
extern _X_EXPORT void xf86MarkOptionUsed(pointer option);
|
extern _X_EXPORT void xf86MarkOptionUsed(XF86OptionPtr option);
|
||||||
extern _X_EXPORT void xf86MarkOptionUsedByName(pointer options, const char *name);
|
extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
|
||||||
extern _X_EXPORT Bool xf86CheckIfOptionUsed(pointer option);
|
extern _X_EXPORT Bool xf86CheckIfOptionUsed(XF86OptionPtr option);
|
||||||
extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
|
extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name);
|
||||||
extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, pointer options);
|
extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr options);
|
||||||
extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
|
extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo);
|
||||||
extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
|
extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
|
||||||
extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
|
extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
|
||||||
extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
|
extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
|
||||||
|
@ -110,9 +111,9 @@ extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec *table, int token, B
|
||||||
extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
|
extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
|
||||||
extern _X_EXPORT int xf86NameCmp(const char *s1, const char *s2);
|
extern _X_EXPORT int xf86NameCmp(const char *s1, const char *s2);
|
||||||
extern _X_EXPORT char *xf86NormalizeName(const char *s);
|
extern _X_EXPORT char *xf86NormalizeName(const char *s);
|
||||||
extern _X_EXPORT pointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val);
|
extern _X_EXPORT XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val);
|
||||||
extern _X_EXPORT pointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val);
|
extern _X_EXPORT XF86OptionPtr xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val);
|
||||||
extern _X_EXPORT pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val);
|
extern _X_EXPORT XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val);
|
||||||
extern _X_EXPORT pointer xf86ReplacePercentOption(pointer optlist, const char *name, const double val);
|
extern _X_EXPORT XF86OptionPtr xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val);
|
||||||
extern _X_EXPORT pointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val);
|
extern _X_EXPORT XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char* val);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,11 +40,12 @@
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
|
#include "xf86Opt.h"
|
||||||
#include "xf86Xinput.h"
|
#include "xf86Xinput.h"
|
||||||
#include "xf86Optrec.h"
|
#include "xf86Optrec.h"
|
||||||
#include "xf86Parser.h"
|
#include "xf86Parser.h"
|
||||||
|
|
||||||
static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
|
||||||
Bool markUsed);
|
Bool markUsed);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -66,7 +67,7 @@ static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
|
xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts)
|
||||||
{
|
{
|
||||||
XF86OptionPtr tmp;
|
XF86OptionPtr tmp;
|
||||||
XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
|
XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
|
||||||
|
@ -140,10 +141,10 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts)
|
||||||
* Duplicate the option list passed in. The returned pointer will be a newly
|
* Duplicate the option list passed in. The returned pointer will be a newly
|
||||||
* allocated option list and must be freed by the caller.
|
* allocated option list and must be freed by the caller.
|
||||||
*/
|
*/
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86OptionListDuplicate(pointer options)
|
xf86OptionListDuplicate(XF86OptionPtr options)
|
||||||
{
|
{
|
||||||
pointer o = NULL;
|
XF86OptionPtr o = NULL;
|
||||||
|
|
||||||
while (options)
|
while (options)
|
||||||
{
|
{
|
||||||
|
@ -158,7 +159,7 @@ xf86OptionListDuplicate(pointer options)
|
||||||
/* Created for new XInput stuff -- essentially extensions to the parser */
|
/* Created for new XInput stuff -- essentially extensions to the parser */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed)
|
LookupIntOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed)
|
||||||
{
|
{
|
||||||
OptionInfoRec o;
|
OptionInfoRec o;
|
||||||
|
|
||||||
|
@ -171,7 +172,7 @@ LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed)
|
||||||
|
|
||||||
|
|
||||||
static double
|
static double
|
||||||
LookupRealOption(pointer optlist, const char *name, double deflt,
|
LookupRealOption(XF86OptionPtr optlist, const char *name, double deflt,
|
||||||
Bool markUsed)
|
Bool markUsed)
|
||||||
{
|
{
|
||||||
OptionInfoRec o;
|
OptionInfoRec o;
|
||||||
|
@ -185,7 +186,7 @@ LookupRealOption(pointer optlist, const char *name, double deflt,
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
|
LookupStrOption(XF86OptionPtr optlist, const char *name, char *deflt, Bool markUsed)
|
||||||
{
|
{
|
||||||
OptionInfoRec o;
|
OptionInfoRec o;
|
||||||
|
|
||||||
|
@ -201,7 +202,7 @@ LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
|
LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed)
|
||||||
{
|
{
|
||||||
OptionInfoRec o;
|
OptionInfoRec o;
|
||||||
|
|
||||||
|
@ -213,7 +214,7 @@ LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUsed)
|
LookupPercentOption(XF86OptionPtr optlist, const char *name, double deflt, Bool markUsed)
|
||||||
{
|
{
|
||||||
OptionInfoRec o;
|
OptionInfoRec o;
|
||||||
|
|
||||||
|
@ -227,34 +228,34 @@ LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUs
|
||||||
/* These xf86Set* functions are intended for use by non-screen specific code */
|
/* These xf86Set* functions are intended for use by non-screen specific code */
|
||||||
|
|
||||||
int
|
int
|
||||||
xf86SetIntOption(pointer optlist, const char *name, int deflt)
|
xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt)
|
||||||
{
|
{
|
||||||
return LookupIntOption(optlist, name, deflt, TRUE);
|
return LookupIntOption(optlist, name, deflt, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
xf86SetRealOption(pointer optlist, const char *name, double deflt)
|
xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt)
|
||||||
{
|
{
|
||||||
return LookupRealOption(optlist, name, deflt, TRUE);
|
return LookupRealOption(optlist, name, deflt, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xf86SetStrOption(pointer optlist, const char *name, char *deflt)
|
xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
|
||||||
{
|
{
|
||||||
return LookupStrOption(optlist, name, deflt, TRUE);
|
return LookupStrOption(optlist, name, deflt, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
xf86SetBoolOption(pointer optlist, const char *name, int deflt)
|
xf86SetBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
|
||||||
{
|
{
|
||||||
return LookupBoolOption(optlist, name, deflt, TRUE);
|
return LookupBoolOption(optlist, name, deflt, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
xf86SetPercentOption(pointer optlist, const char *name, double deflt)
|
xf86SetPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
|
||||||
{
|
{
|
||||||
return LookupPercentOption(optlist, name, deflt, TRUE);
|
return LookupPercentOption(optlist, name, deflt, TRUE);
|
||||||
}
|
}
|
||||||
|
@ -264,35 +265,35 @@ xf86SetPercentOption(pointer optlist, const char *name, double deflt)
|
||||||
* as used.
|
* as used.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xf86CheckIntOption(pointer optlist, const char *name, int deflt)
|
xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt)
|
||||||
{
|
{
|
||||||
return LookupIntOption(optlist, name, deflt, FALSE);
|
return LookupIntOption(optlist, name, deflt, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
xf86CheckRealOption(pointer optlist, const char *name, double deflt)
|
xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt)
|
||||||
{
|
{
|
||||||
return LookupRealOption(optlist, name, deflt, FALSE);
|
return LookupRealOption(optlist, name, deflt, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xf86CheckStrOption(pointer optlist, const char *name, char *deflt)
|
xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
|
||||||
{
|
{
|
||||||
return LookupStrOption(optlist, name, deflt, FALSE);
|
return LookupStrOption(optlist, name, deflt, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
xf86CheckBoolOption(pointer optlist, const char *name, int deflt)
|
xf86CheckBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
|
||||||
{
|
{
|
||||||
return LookupBoolOption(optlist, name, deflt, FALSE);
|
return LookupBoolOption(optlist, name, deflt, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
xf86CheckPercentOption(pointer optlist, const char *name, double deflt)
|
xf86CheckPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
|
||||||
{
|
{
|
||||||
return LookupPercentOption(optlist, name, deflt, FALSE);
|
return LookupPercentOption(optlist, name, deflt, FALSE);
|
||||||
}
|
}
|
||||||
|
@ -300,44 +301,44 @@ xf86CheckPercentOption(pointer optlist, const char *name, double deflt)
|
||||||
* addNewOption() has the required property of replacing the option value
|
* addNewOption() has the required property of replacing the option value
|
||||||
* if the option is already present.
|
* if the option is already present.
|
||||||
*/
|
*/
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
|
xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val)
|
||||||
{
|
{
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
sprintf(tmp,"%i",val);
|
sprintf(tmp,"%i",val);
|
||||||
return xf86AddNewOption(optlist,name,tmp);
|
return xf86AddNewOption(optlist,name,tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86ReplaceRealOption(pointer optlist, const char *name, const double val)
|
xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val)
|
||||||
{
|
{
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
snprintf(tmp,32,"%f",val);
|
snprintf(tmp,32,"%f",val);
|
||||||
return xf86AddNewOption(optlist,name,tmp);
|
return xf86AddNewOption(optlist,name,tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val)
|
xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val)
|
||||||
{
|
{
|
||||||
return xf86AddNewOption(optlist,name,val?"True":"False");
|
return xf86AddNewOption(optlist,name,val?"True":"False");
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86ReplacePercentOption(pointer optlist, const char *name, const double val)
|
xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val)
|
||||||
{
|
{
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
sprintf(tmp, "%lf%%", val);
|
sprintf(tmp, "%lf%%", val);
|
||||||
return xf86AddNewOption(optlist,name,tmp);
|
return xf86AddNewOption(optlist,name,tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86ReplaceStrOption(pointer optlist, const char *name, const char* val)
|
xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char* val)
|
||||||
{
|
{
|
||||||
return xf86AddNewOption(optlist,name,val);
|
return xf86AddNewOption(optlist,name,val);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86AddNewOption(pointer head, const char *name, const char *val)
|
xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val)
|
||||||
{
|
{
|
||||||
/* XXX These should actually be allocated in the parser library. */
|
/* XXX These should actually be allocated in the parser library. */
|
||||||
char *tmp = val ? strdup(val) : NULL;
|
char *tmp = val ? strdup(val) : NULL;
|
||||||
|
@ -347,51 +348,51 @@ xf86AddNewOption(pointer head, const char *name, const char *val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86NewOption(char *name, char *value)
|
xf86NewOption(char *name, char *value)
|
||||||
{
|
{
|
||||||
return xf86newOption(name, value);
|
return xf86newOption(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86NextOption(pointer list)
|
xf86NextOption(XF86OptionPtr list)
|
||||||
{
|
{
|
||||||
return xf86nextOption(list);
|
return xf86nextOption(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86OptionListCreate(const char **options, int count, int used)
|
xf86OptionListCreate(const char **options, int count, int used)
|
||||||
{
|
{
|
||||||
return xf86optionListCreate(options, count, used);
|
return xf86optionListCreate(options, count, used);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86OptionListMerge(pointer head, pointer tail)
|
xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail)
|
||||||
{
|
{
|
||||||
return xf86optionListMerge(head, tail);
|
return xf86optionListMerge(head, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86OptionListFree(pointer opt)
|
xf86OptionListFree(XF86OptionPtr opt)
|
||||||
{
|
{
|
||||||
xf86optionListFree(opt);
|
xf86optionListFree(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xf86OptionName(pointer opt)
|
xf86OptionName(XF86OptionPtr opt)
|
||||||
{
|
{
|
||||||
return xf86optionName(opt);
|
return xf86optionName(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xf86OptionValue(pointer opt)
|
xf86OptionValue(XF86OptionPtr opt)
|
||||||
{
|
{
|
||||||
return xf86optionValue(opt);
|
return xf86optionValue(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86OptionListReport(pointer parm)
|
xf86OptionListReport(XF86OptionPtr parm)
|
||||||
{
|
{
|
||||||
XF86OptionPtr opts = parm;
|
XF86OptionPtr opts = parm;
|
||||||
|
|
||||||
|
@ -407,30 +408,30 @@ xf86OptionListReport(pointer parm)
|
||||||
|
|
||||||
/* End of XInput-caused section */
|
/* End of XInput-caused section */
|
||||||
|
|
||||||
pointer
|
XF86OptionPtr
|
||||||
xf86FindOption(pointer options, const char *name)
|
xf86FindOption(XF86OptionPtr options, const char *name)
|
||||||
{
|
{
|
||||||
return xf86findOption(options, name);
|
return xf86findOption(options, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xf86FindOptionValue(pointer options, const char *name)
|
xf86FindOptionValue(XF86OptionPtr options, const char *name)
|
||||||
{
|
{
|
||||||
return xf86findOptionValue(options, name);
|
return xf86findOptionValue(options, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86MarkOptionUsed(pointer option)
|
xf86MarkOptionUsed(XF86OptionPtr option)
|
||||||
{
|
{
|
||||||
if (option != NULL)
|
if (option != NULL)
|
||||||
((XF86OptionPtr)option)->opt_used = TRUE;
|
option->opt_used = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86MarkOptionUsedByName(pointer options, const char *name)
|
xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name)
|
||||||
{
|
{
|
||||||
XF86OptionPtr opt;
|
XF86OptionPtr opt;
|
||||||
|
|
||||||
|
@ -440,16 +441,16 @@ xf86MarkOptionUsedByName(pointer options, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xf86CheckIfOptionUsed(pointer option)
|
xf86CheckIfOptionUsed(XF86OptionPtr option)
|
||||||
{
|
{
|
||||||
if (option != NULL)
|
if (option != NULL)
|
||||||
return ((XF86OptionPtr)option)->opt_used;
|
return option->opt_used;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xf86CheckIfOptionUsedByName(pointer options, const char *name)
|
xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name)
|
||||||
{
|
{
|
||||||
XF86OptionPtr opt;
|
XF86OptionPtr opt;
|
||||||
|
|
||||||
|
@ -461,10 +462,8 @@ xf86CheckIfOptionUsedByName(pointer options, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86ShowUnusedOptions(int scrnIndex, pointer options)
|
xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr opt)
|
||||||
{
|
{
|
||||||
XF86OptionPtr opt = options;
|
|
||||||
|
|
||||||
while (opt) {
|
while (opt) {
|
||||||
if (opt->opt_name && !opt->opt_used) {
|
if (opt->opt_name && !opt->opt_used) {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
|
xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
|
||||||
|
@ -482,7 +481,7 @@ GetBoolValue(OptionInfoPtr p, const char *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
|
||||||
Bool markUsed)
|
Bool markUsed)
|
||||||
{
|
{
|
||||||
char *s, *end;
|
char *s, *end;
|
||||||
|
@ -695,7 +694,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo)
|
xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo)
|
||||||
{
|
{
|
||||||
OptionInfoPtr p;
|
OptionInfoPtr p;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XF86OPTIONSTR_H
|
||||||
|
#define XF86OPTIONSTR_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* all records that need to be linked lists should contain a GenericList as
|
||||||
|
* their first field.
|
||||||
|
*/
|
||||||
|
typedef struct generic_list_rec
|
||||||
|
{
|
||||||
|
void *next;
|
||||||
|
}
|
||||||
|
GenericListRec, *GenericListPtr, *glp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All options are stored using this data type.
|
||||||
|
*/
|
||||||
|
typedef struct _XF86OptionRec
|
||||||
|
{
|
||||||
|
GenericListRec list;
|
||||||
|
char *opt_name;
|
||||||
|
char *opt_val;
|
||||||
|
int opt_used;
|
||||||
|
char *opt_comment;
|
||||||
|
}
|
||||||
|
XF86OptionRec;
|
||||||
|
|
||||||
|
typedef struct _XF86OptionRec *XF86OptionPtr;
|
||||||
|
|
||||||
|
#endif
|
|
@ -266,6 +266,34 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ApplyTransformationMatrix(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
|
||||||
|
char *str;
|
||||||
|
int rc;
|
||||||
|
float matrix[9] = {0};
|
||||||
|
|
||||||
|
if (!dev->valuator)
|
||||||
|
return;
|
||||||
|
|
||||||
|
str = xf86SetStrOption(pInfo->options, "TransformationMatrix", NULL);
|
||||||
|
if (!str)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rc = sscanf(str, "%f %f %f %f %f %f %f %f %f", &matrix[0], &matrix[1], &matrix[2],
|
||||||
|
&matrix[3], &matrix[4], &matrix[5], &matrix[6], &matrix[7], &matrix[8]);
|
||||||
|
if (rc != 9) {
|
||||||
|
xf86Msg(X_ERROR, "%s: invalid format for transformation matrix. Ignoring configuration.\n",
|
||||||
|
pInfo->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_TRANSFORM),
|
||||||
|
XIGetKnownProperty(XATOM_FLOAT), 32,
|
||||||
|
PropModeReplace, 9, matrix, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* xf86ProcessCommonOptions --
|
* xf86ProcessCommonOptions --
|
||||||
|
@ -276,7 +304,7 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xf86ProcessCommonOptions(InputInfoPtr pInfo,
|
xf86ProcessCommonOptions(InputInfoPtr pInfo,
|
||||||
pointer list)
|
XF86OptionPtr list)
|
||||||
{
|
{
|
||||||
if (xf86SetBoolOption(list, "Floating", 0) ||
|
if (xf86SetBoolOption(list, "Floating", 0) ||
|
||||||
!xf86SetBoolOption(list, "AlwaysCore", 1) ||
|
!xf86SetBoolOption(list, "AlwaysCore", 1) ||
|
||||||
|
@ -746,7 +774,7 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Apply backend-specific initialization. Invoked after ActiveteDevice(),
|
* Apply backend-specific initialization. Invoked after ActivateDevice(),
|
||||||
* i.e. after the driver successfully completed DEVICE_INIT and the device
|
* i.e. after the driver successfully completed DEVICE_INIT and the device
|
||||||
* is advertised.
|
* is advertised.
|
||||||
* @param dev the device
|
* @param dev the device
|
||||||
|
@ -755,6 +783,7 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
|
||||||
static int
|
static int
|
||||||
xf86InputDevicePostInit(DeviceIntPtr dev) {
|
xf86InputDevicePostInit(DeviceIntPtr dev) {
|
||||||
ApplyAccelerationSettings(dev);
|
ApplyAccelerationSettings(dev);
|
||||||
|
ApplyTransformationMatrix(dev);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,35 +908,35 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
for (option = options; option; option = option->next) {
|
nt_list_for_each_entry(option, options, next) {
|
||||||
if (strcasecmp(option->key, "driver") == 0) {
|
if (strcasecmp(input_option_get_key(option), "driver") == 0) {
|
||||||
if (pInfo->driver) {
|
if (pInfo->driver) {
|
||||||
rval = BadRequest;
|
rval = BadRequest;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
pInfo->driver = xstrdup(option->value);
|
pInfo->driver = xstrdup(input_option_get_value(option));
|
||||||
if (!pInfo->driver) {
|
if (!pInfo->driver) {
|
||||||
rval = BadAlloc;
|
rval = BadAlloc;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcasecmp(option->key, "name") == 0 ||
|
if (strcasecmp(input_option_get_key(option), "name") == 0 ||
|
||||||
strcasecmp(option->key, "identifier") == 0) {
|
strcasecmp(input_option_get_key(option), "identifier") == 0) {
|
||||||
if (pInfo->name) {
|
if (pInfo->name) {
|
||||||
rval = BadRequest;
|
rval = BadRequest;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
pInfo->name = xstrdup(option->value);
|
pInfo->name = xstrdup(input_option_get_value(option));
|
||||||
if (!pInfo->name) {
|
if (!pInfo->name) {
|
||||||
rval = BadAlloc;
|
rval = BadAlloc;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(option->key, "_source") == 0 &&
|
if (strcmp(input_option_get_key(option), "_source") == 0 &&
|
||||||
(strcmp(option->value, "server/hal") == 0 ||
|
(strcmp(input_option_get_value(option), "server/hal") == 0 ||
|
||||||
strcmp(option->value, "server/udev") == 0)) {
|
strcmp(input_option_get_value(option), "server/udev") == 0)) {
|
||||||
is_auto = 1;
|
is_auto = 1;
|
||||||
if (!xf86Info.autoAddDevices) {
|
if (!xf86Info.autoAddDevices) {
|
||||||
rval = BadMatch;
|
rval = BadMatch;
|
||||||
|
@ -916,13 +945,11 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (option = options; option; option = option->next) {
|
nt_list_for_each_entry(option, options, next) {
|
||||||
/* Steal option key/value strings from the provided list.
|
/* Copy option key/value strings from the provided list */
|
||||||
* We need those strings, the InputOption list doesn't. */
|
pInfo->options = xf86AddNewOption(pInfo->options,
|
||||||
pInfo->options = xf86addNewOption(pInfo->options,
|
input_option_get_key(option),
|
||||||
option->key, option->value);
|
input_option_get_value(option));
|
||||||
option->key = NULL;
|
|
||||||
option->value = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply InputClass settings */
|
/* Apply InputClass settings */
|
||||||
|
@ -1348,7 +1375,7 @@ xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the valuator values to be in synch with dix/event.c
|
* Set the valuator values to be in sync with dix/event.c
|
||||||
* DefineInitialRootWindow().
|
* DefineInitialRootWindow().
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -103,7 +103,7 @@ typedef struct _InputInfoRec {
|
||||||
char * type_name;
|
char * type_name;
|
||||||
InputDriverPtr drv;
|
InputDriverPtr drv;
|
||||||
pointer module;
|
pointer module;
|
||||||
pointer options;
|
XF86OptionPtr options;
|
||||||
InputAttributes *attrs;
|
InputAttributes *attrs;
|
||||||
} *InputInfoPtr;
|
} *InputInfoPtr;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int ke
|
||||||
extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
|
extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
|
||||||
extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min);
|
extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min);
|
||||||
extern _X_EXPORT void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y);
|
extern _X_EXPORT void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y);
|
||||||
extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
|
extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr options);
|
||||||
extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
|
extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
|
||||||
int maxval, int resolution, int min_res,
|
int maxval, int resolution, int min_res,
|
||||||
int max_res, int mode);
|
int max_res, int mode);
|
||||||
|
|
|
@ -3175,7 +3175,7 @@ would not need to use these directly.
|
||||||
|
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
pointer xf86FindOption(pointer options, const char *name);
|
XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
Takes a list of options and an option name, and returns a handle
|
Takes a list of options and an option name, and returns a handle
|
||||||
|
@ -3187,7 +3187,7 @@ would not need to use these directly.
|
||||||
|
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
char *xf86FindOptionValue(pointer options, const char *name);
|
char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
Takes a list of options and an option name, and returns the value
|
Takes a list of options and an option name, and returns the value
|
||||||
|
@ -3201,7 +3201,7 @@ would not need to use these directly.
|
||||||
|
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
void xf86MarkOptionUsed(pointer option);
|
void xf86MarkOptionUsed(XF86OptionPtr option);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
Takes a handle for an option, and marks that option as used.
|
Takes a handle for an option, and marks that option as used.
|
||||||
|
@ -3211,7 +3211,7 @@ would not need to use these directly.
|
||||||
|
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
void xf86MarkOptionUsedByName(pointer options, const char *name);
|
void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
Takes a list of options and an option name and marks the first
|
Takes a list of options and an option name and marks the first
|
||||||
|
@ -3225,7 +3225,7 @@ Next, the higher level functions that most drivers would use.
|
||||||
</para>
|
</para>
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
|
void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
Collect the options from each of the config file sections used by
|
Collect the options from each of the config file sections used by
|
||||||
|
@ -3245,7 +3245,7 @@ Next, the higher level functions that most drivers would use.
|
||||||
|
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
void xf86ProcessOptions(int scrnIndex, pointer options,
|
void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options,
|
||||||
OptionInfoPtr optinfo);
|
OptionInfoPtr optinfo);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
|
@ -3354,7 +3354,7 @@ Next, the higher level functions that most drivers would use.
|
||||||
|
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
void xf86ShowUnusedOptions(int scrnIndex, pointer options);
|
void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr options);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<blockquote><para>
|
<blockquote><para>
|
||||||
Prints out warning messages for each option in the list of options
|
Prints out warning messages for each option in the list of options
|
||||||
|
|
|
@ -942,7 +942,18 @@ is equivalent to
|
||||||
|
|
||||||
This option controls the startup behavior only, a device
|
This option controls the startup behavior only, a device
|
||||||
may be reattached or set floating at runtime.
|
may be reattached or set floating at runtime.
|
||||||
.PP
|
.TP 7
|
||||||
|
.BI "Option \*qTransformationMatrix\*q \*q" a " " b " " c " " d " " e " " f " " g " " h " " i \*q
|
||||||
|
Specifies the 3x3 transformation matrix for absolute input devices. The
|
||||||
|
input device will be bound to the area given in the matrix. In most
|
||||||
|
configurations, "a" and "e" specify the width and height of the area the
|
||||||
|
device is bound to, and "c" and "f" specify the x and y offset of the area.
|
||||||
|
The value range is 0 to 1, where 1 represents the width or height of all
|
||||||
|
root windows together, 0.5 represents half the area, etc. The values
|
||||||
|
represent a 3x3 matrix, with the first, second and third group of three
|
||||||
|
values representing the first, second and third row of the matrix,
|
||||||
|
respectively. The identity matrix is "1 0 0 0 1 0 0 0 1".
|
||||||
|
.SS POINTER ACCELERATION
|
||||||
For pointing devices, the following options control how the pointer
|
For pointing devices, the following options control how the pointer
|
||||||
is accelerated or decelerated with respect to physical device motion. Most of
|
is accelerated or decelerated with respect to physical device motion. Most of
|
||||||
these can be adjusted at runtime, see the xinput(1) man page for details. Only
|
these can be adjusted at runtime, see the xinput(1) man page for details. Only
|
||||||
|
@ -1432,7 +1443,7 @@ driver plus the identifier of a monitor section, one associates a monitor
|
||||||
section with an output by adding an option to the Device section in the
|
section with an output by adding an option to the Device section in the
|
||||||
following format:
|
following format:
|
||||||
|
|
||||||
.B Option \*qMonitor-outputname\*q \*qmonitorsection\*q
|
.BI "Option \*qMonitor-" outputname "\*q \*q" monitorsection \*q
|
||||||
|
|
||||||
(for example,
|
(for example,
|
||||||
.B Option \*qMonitor-VGA\*q \*qVGA monitor\*q
|
.B Option \*qMonitor-VGA\*q \*qVGA monitor\*q
|
||||||
|
@ -1448,7 +1459,7 @@ modes available.
|
||||||
When modes are specified explicitly in the
|
When modes are specified explicitly in the
|
||||||
.B Monitor
|
.B Monitor
|
||||||
section (with the
|
section (with the
|
||||||
.BR Modes ,
|
.BR Mode ,
|
||||||
.BR ModeLine ,
|
.BR ModeLine ,
|
||||||
or
|
or
|
||||||
.B UseModes
|
.B UseModes
|
||||||
|
@ -1597,7 +1608,7 @@ mentioned above doubles this value.
|
||||||
This entry is a more compact version of the
|
This entry is a more compact version of the
|
||||||
.B Mode
|
.B Mode
|
||||||
entry, and it also can be used to specify video modes for the monitor.
|
entry, and it also can be used to specify video modes for the monitor.
|
||||||
is a single line format for specifying video modes.
|
This is a single line format for specifying video modes.
|
||||||
In most cases this isn't necessary because the built\-in set of VESA
|
In most cases this isn't necessary because the built\-in set of VESA
|
||||||
standard modes will be sufficient.
|
standard modes will be sufficient.
|
||||||
.PP
|
.PP
|
||||||
|
@ -1652,61 +1663,61 @@ The
|
||||||
and
|
and
|
||||||
.B VScan
|
.B VScan
|
||||||
options mentioned above in the
|
options mentioned above in the
|
||||||
.B Modes
|
.B Mode
|
||||||
entry description can also be used here.
|
entry description can also be used here.
|
||||||
.RE
|
.RE
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qDPMS\*q " \*qbool\*q
|
.BI "Option \*qDPMS\*q \*q" bool \*q
|
||||||
This option controls whether the server should enable the DPMS extension
|
This option controls whether the server should enable the DPMS extension
|
||||||
for power management for this screen. The default is to enable the
|
for power management for this screen. The default is to enable the
|
||||||
extension.
|
extension.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qSyncOnGreen\*q " \*qbool\*q
|
.BI "Option \*qSyncOnGreen\*q \*q" bool \*q
|
||||||
This option controls whether the video card should drive the sync signal
|
This option controls whether the video card should drive the sync signal
|
||||||
on the green color pin. Not all cards support this option, and most
|
on the green color pin. Not all cards support this option, and most
|
||||||
monitors do not require it. The default is off.
|
monitors do not require it. The default is off.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qPrimary\*q " \*qbool\*q
|
.BI "Option \*qPrimary\*q \*q" bool \*q
|
||||||
This optional entry specifies that the monitor should be treated as the primary
|
This optional entry specifies that the monitor should be treated as the primary
|
||||||
monitor. (RandR 1.2-supporting drivers only)
|
monitor. (RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qPreferredMode\*q " \*qstring\*q
|
.BI "Option \*qPreferredMode\*q \*q" name \*q
|
||||||
This optional entry specifies a mode to be marked as the preferred initial mode
|
This optional entry specifies a mode to be marked as the preferred initial mode
|
||||||
of the monitor.
|
of the monitor.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qPosition\*q " "\*qx y\*q"
|
.BI "Option \*qPosition\*q \*q" x " " y \*q
|
||||||
This optional entry specifies the position of the monitor within the X
|
This optional entry specifies the position of the monitor within the X
|
||||||
screen.
|
screen.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qLeftOf\*q " \*qoutput\*q
|
.BI "Option \*qLeftOf\*q \*q" output \*q
|
||||||
This optional entry specifies that the monitor should be positioned to the
|
This optional entry specifies that the monitor should be positioned to the
|
||||||
left of the output (not monitor) of the given name.
|
left of the output (not monitor) of the given name.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qRightOf\*q " \*qoutput\*q
|
.BI "Option \*qRightOf\*q \*q" output \*q
|
||||||
This optional entry specifies that the monitor should be positioned to the
|
This optional entry specifies that the monitor should be positioned to the
|
||||||
right of the output (not monitor) of the given name.
|
right of the output (not monitor) of the given name.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qAbove\*q " \*qoutput\*q
|
.BI "Option \*qAbove\*q \*q" output \*q
|
||||||
This optional entry specifies that the monitor should be positioned above the
|
This optional entry specifies that the monitor should be positioned above the
|
||||||
output (not monitor) of the given name.
|
output (not monitor) of the given name.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qBelow\*q " \*qoutput\*q
|
.BI "Option \*qBelow\*q \*q" output \*q
|
||||||
This optional entry specifies that the monitor should be positioned below the
|
This optional entry specifies that the monitor should be positioned below the
|
||||||
output (not monitor) of the given name.
|
output (not monitor) of the given name.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qEnable\*q " \*qbool\*q
|
.BI "Option \*qEnable\*q \*q" bool \*q
|
||||||
This optional entry specifies whether the monitor should be turned on
|
This optional entry specifies whether the monitor should be turned on
|
||||||
at startup. By default, the server will attempt to enable all connected
|
at startup. By default, the server will attempt to enable all connected
|
||||||
monitors.
|
monitors.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qDefaultModes\*q " \*qbool\*q
|
.BI "Option \*qDefaultModes\*q \*q" bool \*q
|
||||||
This optional entry specifies whether the server should add supported default
|
This optional entry specifies whether the server should add supported default
|
||||||
modes to the list of modes offered on this monitor. By default, the server
|
modes to the list of modes offered on this monitor. By default, the server
|
||||||
will add default modes; you should only disable this if you can guarantee
|
will add default modes; you should only disable this if you can guarantee
|
||||||
|
@ -1714,21 +1725,21 @@ that EDID will be available at all times, or if you have added custom modelines
|
||||||
which the server can use.
|
which the server can use.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qMinClock\*q " \*qfrequency\*q
|
.BI "Option \*qMinClock\*q \*q" frequency \*q
|
||||||
This optional entry specifies the minimum dot clock, in kHz, that is supported
|
This optional entry specifies the minimum dot clock, in kHz, that is supported
|
||||||
by the monitor.
|
by the monitor.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qMaxClock\*q " \*qfrequency\*q
|
.BI "Option \*qMaxClock\*q \*q" frequency \*q
|
||||||
This optional entry specifies the maximum dot clock, in kHz, that is supported
|
This optional entry specifies the maximum dot clock, in kHz, that is supported
|
||||||
by the monitor.
|
by the monitor.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qIgnore\*q " \*qbool\*q
|
.BI "Option \*qIgnore\*q \*q" bool \*q
|
||||||
This optional entry specifies that the monitor should be ignored entirely,
|
This optional entry specifies that the monitor should be ignored entirely,
|
||||||
and not reported through RandR. This is useful if the hardware reports the
|
and not reported through RandR. This is useful if the hardware reports the
|
||||||
presence of outputs that don't exist.
|
presence of outputs that don't exist.
|
||||||
(RandR 1.2-supporting drivers only)
|
(RandR 1.2-supporting drivers only)
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option " "\*qRotate\*q " \*qrotation\*q
|
.BI "Option \*qRotate\*q \*q" rotation \*q
|
||||||
This optional entry specifies the initial rotation of the given monitor.
|
This optional entry specifies the initial rotation of the given monitor.
|
||||||
Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and
|
Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and
|
||||||
\*qinverted\*q.
|
\*qinverted\*q.
|
||||||
|
|
|
@ -112,7 +112,7 @@ GetBaud (int baudrate)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xf86OpenSerial (pointer options)
|
xf86OpenSerial (XF86OptionPtr options)
|
||||||
{
|
{
|
||||||
struct termios t;
|
struct termios t;
|
||||||
int fd, i;
|
int fd, i;
|
||||||
|
@ -185,7 +185,7 @@ xf86OpenSerial (pointer options)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xf86SetSerial (int fd, pointer options)
|
xf86SetSerial (int fd, XF86OptionPtr options)
|
||||||
{
|
{
|
||||||
struct termios t;
|
struct termios t;
|
||||||
int val;
|
int val;
|
||||||
|
|
|
@ -126,6 +126,7 @@
|
||||||
|
|
||||||
#include <X11/Xfuncproto.h>
|
#include <X11/Xfuncproto.h>
|
||||||
#include "opaque.h"
|
#include "opaque.h"
|
||||||
|
#include "xf86Optionstr.h"
|
||||||
|
|
||||||
_XFUNCPROTOBEGIN
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
@ -145,8 +146,8 @@ extern _X_EXPORT void xf86SetRGBOut(void);
|
||||||
extern _X_EXPORT void xf86OSRingBell(int, int, int);
|
extern _X_EXPORT void xf86OSRingBell(int, int, int);
|
||||||
extern _X_EXPORT void xf86SetReallySlowBcopy(void);
|
extern _X_EXPORT void xf86SetReallySlowBcopy(void);
|
||||||
extern _X_EXPORT void xf86SlowBcopy(unsigned char *, unsigned char *, int);
|
extern _X_EXPORT void xf86SlowBcopy(unsigned char *, unsigned char *, int);
|
||||||
extern _X_EXPORT int xf86OpenSerial(pointer options);
|
extern _X_EXPORT int xf86OpenSerial(XF86OptionPtr options);
|
||||||
extern _X_EXPORT int xf86SetSerial(int fd, pointer options);
|
extern _X_EXPORT int xf86SetSerial(int fd, XF86OptionPtr options);
|
||||||
extern _X_EXPORT int xf86SetSerialSpeed(int fd, int speed);
|
extern _X_EXPORT int xf86SetSerialSpeed(int fd, int speed);
|
||||||
extern _X_EXPORT int xf86ReadSerial(int fd, void *buf, int count);
|
extern _X_EXPORT int xf86ReadSerial(int fd, void *buf, int count);
|
||||||
extern _X_EXPORT int xf86WriteSerial(int fd, const void *buf, int count);
|
extern _X_EXPORT int xf86WriteSerial(int fd, const void *buf, int count);
|
||||||
|
|
|
@ -50,3 +50,5 @@ EXTRA_DIST = \
|
||||||
sdk_HEADERS = \
|
sdk_HEADERS = \
|
||||||
xf86Parser.h \
|
xf86Parser.h \
|
||||||
xf86Optrec.h
|
xf86Optrec.h
|
||||||
|
|
||||||
|
INCLUDES = -I$(srcdir)/../common
|
||||||
|
|
|
@ -65,33 +65,10 @@
|
||||||
#define _xf86Optrec_h_
|
#define _xf86Optrec_h_
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "xf86Optionstr.h"
|
||||||
|
|
||||||
#include <X11/Xfuncproto.h>
|
#include <X11/Xfuncproto.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* all records that need to be linked lists should contain a GenericList as
|
|
||||||
* their first field.
|
|
||||||
*/
|
|
||||||
typedef struct generic_list_rec
|
|
||||||
{
|
|
||||||
void *next;
|
|
||||||
}
|
|
||||||
GenericListRec, *GenericListPtr, *glp;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* All options are stored using this data type.
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GenericListRec list;
|
|
||||||
char *opt_name;
|
|
||||||
char *opt_val;
|
|
||||||
int opt_used;
|
|
||||||
char *opt_comment;
|
|
||||||
}
|
|
||||||
XF86OptionRec, *XF86OptionPtr;
|
|
||||||
|
|
||||||
|
|
||||||
extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val);
|
extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val);
|
||||||
extern _X_EXPORT XF86OptionPtr xf86optionListDup(XF86OptionPtr opt);
|
extern _X_EXPORT XF86OptionPtr xf86optionListDup(XF86OptionPtr opt);
|
||||||
extern _X_EXPORT void xf86optionListFree(XF86OptionPtr opt);
|
extern _X_EXPORT void xf86optionListFree(XF86OptionPtr opt);
|
||||||
|
|
|
@ -21,7 +21,7 @@ extern _X_EXPORT int defaultColorVisualClass;
|
||||||
|
|
||||||
extern _X_EXPORT int GrabInProgress;
|
extern _X_EXPORT int GrabInProgress;
|
||||||
extern _X_EXPORT Bool noTestExtensions;
|
extern _X_EXPORT Bool noTestExtensions;
|
||||||
|
extern _X_EXPORT char *SeatId;
|
||||||
extern _X_EXPORT char *ConnectionInfo;
|
extern _X_EXPORT char *ConnectionInfo;
|
||||||
|
|
||||||
#ifdef DPMSExtension
|
#ifdef DPMSExtension
|
||||||
|
|
|
@ -56,6 +56,7 @@ SOFTWARE.
|
||||||
#include "window.h" /* for WindowPtr */
|
#include "window.h" /* for WindowPtr */
|
||||||
#include "xkbrules.h"
|
#include "xkbrules.h"
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
#define DEVICE_INIT 0
|
#define DEVICE_INIT 0
|
||||||
#define DEVICE_ON 1
|
#define DEVICE_ON 1
|
||||||
|
@ -202,11 +203,7 @@ typedef struct {
|
||||||
extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
|
extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
|
||||||
extern _X_EXPORT PtrCtrl defaultPointerControl;
|
extern _X_EXPORT PtrCtrl defaultPointerControl;
|
||||||
|
|
||||||
typedef struct _InputOption {
|
typedef struct _InputOption InputOption;
|
||||||
char *key;
|
|
||||||
char *value;
|
|
||||||
struct _InputOption *next;
|
|
||||||
} InputOption;
|
|
||||||
|
|
||||||
typedef struct _InputAttributes {
|
typedef struct _InputAttributes {
|
||||||
char *product;
|
char *product;
|
||||||
|
@ -595,4 +592,14 @@ extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
|
||||||
const ValuatorMask *src);
|
const ValuatorMask *src);
|
||||||
extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
|
extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
|
||||||
|
|
||||||
|
/* InputOption handling interface */
|
||||||
|
extern _X_EXPORT InputOption* input_option_new(InputOption *list, const char *key, const char *value);
|
||||||
|
extern _X_EXPORT void input_option_free_list(InputOption **opt);
|
||||||
|
extern _X_EXPORT InputOption* input_option_free_element(InputOption *opt, const char *key);
|
||||||
|
extern _X_EXPORT InputOption* input_option_find(InputOption *list, const char *key);
|
||||||
|
extern _X_EXPORT const char* input_option_get_key(const InputOption *opt);
|
||||||
|
extern _X_EXPORT const char* input_option_get_value(const InputOption *opt);
|
||||||
|
extern _X_EXPORT void input_option_set_key(InputOption *opt, const char* key);
|
||||||
|
extern _X_EXPORT void input_option_set_value(InputOption *opt, const char* value);
|
||||||
|
|
||||||
#endif /* INPUT_H */
|
#endif /* INPUT_H */
|
||||||
|
|
|
@ -472,7 +472,10 @@ typedef struct _SpriteInfoRec {
|
||||||
#define MASTER_POINTER 1
|
#define MASTER_POINTER 1
|
||||||
#define MASTER_KEYBOARD 2
|
#define MASTER_KEYBOARD 2
|
||||||
#define SLAVE 3
|
#define SLAVE 3
|
||||||
#define MASTER_ATTACHED 4 /* special type for GetMaster */
|
/* special types for GetMaster */
|
||||||
|
#define MASTER_ATTACHED 4 /* Master for this device */
|
||||||
|
#define KEYBOARD_OR_FLOAT 5 /* Keyboard master for this device or this device if floating */
|
||||||
|
#define POINTER_OR_FLOAT 6 /* Pointer master for this device or this device if floating */
|
||||||
|
|
||||||
typedef struct _DeviceIntRec {
|
typedef struct _DeviceIntRec {
|
||||||
DeviceRec public;
|
DeviceRec public;
|
||||||
|
@ -599,4 +602,11 @@ static inline WindowPtr DeepestSpriteWin(SpritePtr sprite)
|
||||||
return sprite->spriteTrace[sprite->spriteTraceGood - 1];
|
return sprite->spriteTrace[sprite->spriteTraceGood - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct _InputOption {
|
||||||
|
char *key;
|
||||||
|
char *value;
|
||||||
|
struct _InputOption *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* INPUTSTRUCT_H */
|
#endif /* INPUTSTRUCT_H */
|
||||||
|
|
|
@ -38,5 +38,6 @@ struct _ValuatorMask {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void verify_internal_event(const InternalEvent *ev);
|
extern void verify_internal_event(const InternalEvent *ev);
|
||||||
|
extern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
160
include/list.h
160
include/list.h
|
@ -278,4 +278,164 @@ list_is_empty(struct list *head)
|
||||||
&pos->member != (head); \
|
&pos->member != (head); \
|
||||||
pos = tmp, tmp = __container_of(pos->member.next, tmp, member))
|
pos = tmp, tmp = __container_of(pos->member.next, tmp, member))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* NULL-Terminated List Interface
|
||||||
|
*
|
||||||
|
* The interface below does _not_ use the struct list as described above.
|
||||||
|
* It is mainly for legacy structures that cannot easily be switched to
|
||||||
|
* struct list.
|
||||||
|
*
|
||||||
|
* This interface is for structs like
|
||||||
|
* struct foo {
|
||||||
|
* [...]
|
||||||
|
* struct foo *next;
|
||||||
|
* [...]
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* The position and field name of "next" are arbitrary.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the element as null-terminated list.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo *list = malloc();
|
||||||
|
* nt_list_init(list, next);
|
||||||
|
*
|
||||||
|
* @param list The list element that will be the start of the list
|
||||||
|
* @param member Member name of the field pointing to next struct
|
||||||
|
*/
|
||||||
|
#define nt_list_init(_list, _member) \
|
||||||
|
(_list)->_member = NULL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the next element in the list or NULL on termination.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo *element = list;
|
||||||
|
* while ((element = nt_list_next(element, next)) { }
|
||||||
|
*
|
||||||
|
* This macro is not safe for node deletion. Use list_for_each_entry_safe
|
||||||
|
* instead.
|
||||||
|
*
|
||||||
|
* @param list The list or current element.
|
||||||
|
* @param member Member name of the field pointing to next struct.
|
||||||
|
*/
|
||||||
|
#define nt_list_next(_list, _member) \
|
||||||
|
(_list)->_member
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate through each element in the list.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo *iterator;
|
||||||
|
* nt_list_for_each_entry(iterator, list, next) {
|
||||||
|
* [modify iterator]
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @param entry Assigned to the current list element
|
||||||
|
* @param list The list to iterate through.
|
||||||
|
* @param member Member name of the field pointing to next struct.
|
||||||
|
*/
|
||||||
|
#define nt_list_for_each_entry(_entry, _list, _member) \
|
||||||
|
for (_entry = _list; _entry; _entry = (_entry)->_member)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate through each element in the list, keeping a backup pointer to the
|
||||||
|
* element. This macro allows for the deletion of a list element while
|
||||||
|
* looping through the list.
|
||||||
|
*
|
||||||
|
* See nt_list_for_each_entry for more details.
|
||||||
|
*
|
||||||
|
* @param entry Assigned to the current list element
|
||||||
|
* @param tmp The pointer to the next element
|
||||||
|
* @param list The list to iterate through.
|
||||||
|
* @param member Member name of the field pointing to next struct.
|
||||||
|
*/
|
||||||
|
#define nt_list_for_each_entry_safe(_entry, _tmp, _list, _member) \
|
||||||
|
for (_entry = _list, _tmp = (_entry) ? (_entry)->_member : NULL;\
|
||||||
|
_entry; \
|
||||||
|
_entry = _tmp, _tmp = (_tmp) ? (_tmp)->_member: NULL)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append the element to the end of the list. This macro may be used to
|
||||||
|
* merge two lists.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo *elem = malloc(...);
|
||||||
|
* nt_list_init(elem, next)
|
||||||
|
* nt_list_append(elem, list, struct foo, next);
|
||||||
|
*
|
||||||
|
* Resulting list order:
|
||||||
|
* list_item_0 -> list_item_1 -> ... -> elem_item_0 -> elem_item_1 ...
|
||||||
|
*
|
||||||
|
* @param entry An entry (or list) to append to the list
|
||||||
|
* @param list The list to append to. This list must be a valid list, not
|
||||||
|
* NULL.
|
||||||
|
* @param type The list type
|
||||||
|
* @param member Member name of the field pointing to next struct
|
||||||
|
*/
|
||||||
|
#define nt_list_append(_entry, _list, _type, _member) \
|
||||||
|
do { \
|
||||||
|
_type *__iterator = _list; \
|
||||||
|
while (__iterator->_member) { __iterator = __iterator->_member;}\
|
||||||
|
__iterator->_member = _entry; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert the element at the next position in the list. This macro may be
|
||||||
|
* used to insert a list into a list.
|
||||||
|
*
|
||||||
|
* struct foo *elem = malloc(...);
|
||||||
|
* nt_list_init(elem, next)
|
||||||
|
* nt_list_insert(elem, list, struct foo, next);
|
||||||
|
*
|
||||||
|
* Resulting list order:
|
||||||
|
* list_item_0 -> elem_item_0 -> elem_item_1 ... -> list_item_1 -> ...
|
||||||
|
*
|
||||||
|
* @param entry An entry (or list) to append to the list
|
||||||
|
* @param list The list to insert to. This list must be a valid list, not
|
||||||
|
* NULL.
|
||||||
|
* @param type The list type
|
||||||
|
* @param member Member name of the field pointing to next struct
|
||||||
|
*/
|
||||||
|
#define nt_list_insert(_entry, _list, _type, _member) \
|
||||||
|
do { \
|
||||||
|
nt_list_append((_list)->_member, _entry, _type, _member); \
|
||||||
|
(_list)->_member = _entry; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the entry from the list by iterating through the list and
|
||||||
|
* removing any reference from the list to the entry.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo *elem = <assign to right element>
|
||||||
|
* nt_list_del(elem, list, struct foo, next);
|
||||||
|
*
|
||||||
|
* @param entry The entry to delete from the list. entry is always
|
||||||
|
* re-initialized as a null-terminated list.
|
||||||
|
* @param list The list containing the entry, set to the new list without
|
||||||
|
* the removed entry.
|
||||||
|
* @param type The list type
|
||||||
|
* @param member Member name of the field pointing to the next entry
|
||||||
|
*/
|
||||||
|
#define nt_list_del(_entry, _list, _type, _member) \
|
||||||
|
do { \
|
||||||
|
_type *__e = _entry; \
|
||||||
|
if (__e == NULL) break; \
|
||||||
|
if ((_list) == __e) { \
|
||||||
|
_list = __e->_member; \
|
||||||
|
} else { \
|
||||||
|
_type *__prev = _list; \
|
||||||
|
while (__prev->_member && __prev->_member != __e) \
|
||||||
|
__prev = nt_list_next(__prev, _member); \
|
||||||
|
if (__prev->_member) \
|
||||||
|
__prev->_member = __e->_member; \
|
||||||
|
} \
|
||||||
|
nt_list_init(__e, _member); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
13
include/os.h
13
include/os.h
|
@ -525,6 +525,19 @@ extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *for
|
||||||
...) _X_ATTRIBUTE_PRINTF(3,4);
|
...) _X_ATTRIBUTE_PRINTF(3,4);
|
||||||
extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
|
extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
|
||||||
_X_ATTRIBUTE_PRINTF(2,3);
|
_X_ATTRIBUTE_PRINTF(2,3);
|
||||||
|
|
||||||
|
extern _X_EXPORT void LogVHdrMessageVerb(MessageType type, int verb,
|
||||||
|
const char *msg_format, va_list msg_args,
|
||||||
|
const char *hdr_format, va_list hdr_args)
|
||||||
|
_X_ATTRIBUTE_PRINTF(3,0) _X_ATTRIBUTE_PRINTF(5,0);
|
||||||
|
extern _X_EXPORT void LogHdrMessageVerb(MessageType type, int verb,
|
||||||
|
const char *msg_format, va_list msg_args,
|
||||||
|
const char *hdr_format, ...)
|
||||||
|
_X_ATTRIBUTE_PRINTF(3,0) _X_ATTRIBUTE_PRINTF(5,6);
|
||||||
|
extern _X_EXPORT void LogHdrMessage(MessageType type, const char *msg_format,
|
||||||
|
va_list msg_args, const char *hdr_format, ...)
|
||||||
|
_X_ATTRIBUTE_PRINTF(2,0) _X_ATTRIBUTE_PRINTF(4,5);
|
||||||
|
|
||||||
extern _X_EXPORT void FreeAuditTimer(void);
|
extern _X_EXPORT void FreeAuditTimer(void);
|
||||||
extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
|
extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
|
||||||
extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
|
extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
* byte-ordering. */
|
* byte-ordering. */
|
||||||
#define XATOM_FLOAT "FLOAT"
|
#define XATOM_FLOAT "FLOAT"
|
||||||
|
|
||||||
|
/* STRING. Seat name of this display */
|
||||||
|
#define SEAT_ATOM_NAME "Xorg_Seat"
|
||||||
|
|
||||||
/* BOOL. 0 - device disabled, 1 - device enabled */
|
/* BOOL. 0 - device disabled, 1 - device enabled */
|
||||||
#define XI_PROP_ENABLED "Device Enabled"
|
#define XI_PROP_ENABLED "Device Enabled"
|
||||||
/* BOOL. If present, device is a virtual XTEST device */
|
/* BOOL. If present, device is a virtual XTEST device */
|
||||||
|
|
|
@ -220,6 +220,12 @@ sets screen-saver timeout time in minutes.
|
||||||
.B \-su
|
.B \-su
|
||||||
disables save under support on all screens.
|
disables save under support on all screens.
|
||||||
.TP 8
|
.TP 8
|
||||||
|
.B \-seat \fIseat\fP
|
||||||
|
seat to run on. Takes a string identifying a seat in a platform
|
||||||
|
specific syntax. On platforms which support this feature this may be
|
||||||
|
used to limit the server to expose only a specific subset of devices
|
||||||
|
connected to the system.
|
||||||
|
.TP 8
|
||||||
.B \-t \fInumber\fP
|
.B \-t \fInumber\fP
|
||||||
sets pointer acceleration threshold in pixels (i.e. after how many pixels
|
sets pointer acceleration threshold in pixels (i.e. after how many pixels
|
||||||
pointer acceleration should take effect).
|
pointer acceleration should take effect).
|
||||||
|
|
2
mi/mi.h
2
mi/mi.h
|
@ -206,7 +206,7 @@ extern _X_EXPORT void mieqEnqueue(
|
||||||
extern _X_EXPORT void mieqSwitchScreen(
|
extern _X_EXPORT void mieqSwitchScreen(
|
||||||
DeviceIntPtr /* pDev */,
|
DeviceIntPtr /* pDev */,
|
||||||
ScreenPtr /*pScreen*/,
|
ScreenPtr /*pScreen*/,
|
||||||
Bool /*fromDIX*/
|
Bool /*set_dequeue_screen*/
|
||||||
);
|
);
|
||||||
|
|
||||||
extern _X_EXPORT void mieqProcessDeviceEvent(
|
extern _X_EXPORT void mieqProcessDeviceEvent(
|
||||||
|
|
19
mi/mieq.c
19
mi/mieq.c
|
@ -209,14 +209,29 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the screen reference events are being enqueued from.
|
||||||
|
* Input events are enqueued with a screen reference and dequeued and
|
||||||
|
* processed with a (potentially different) screen reference.
|
||||||
|
* This function is called whenever a new event has changed screen but is
|
||||||
|
* still logically on the previous screen as seen by the client.
|
||||||
|
* This usually happens whenever the visible cursor moves across screen
|
||||||
|
* boundaries during event generation, before the same event is processed
|
||||||
|
* and sent down the wire.
|
||||||
|
*
|
||||||
|
* @param pDev The device that triggered a screen change.
|
||||||
|
* @param pScreen The new screen events are being enqueued for.
|
||||||
|
* @param set_dequeue_screen If TRUE, pScreen is set as both enqueue screen
|
||||||
|
* and dequeue screen.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
mieqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX)
|
mieqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool set_dequeue_screen)
|
||||||
{
|
{
|
||||||
#ifdef XQUARTZ
|
#ifdef XQUARTZ
|
||||||
pthread_mutex_lock(&miEventQueueMutex);
|
pthread_mutex_lock(&miEventQueueMutex);
|
||||||
#endif
|
#endif
|
||||||
EnqueueScreen(pDev) = pScreen;
|
EnqueueScreen(pDev) = pScreen;
|
||||||
if (fromDIX)
|
if (set_dequeue_screen)
|
||||||
DequeueScreen(pDev) = pScreen;
|
DequeueScreen(pDev) = pScreen;
|
||||||
#ifdef XQUARTZ
|
#ifdef XQUARTZ
|
||||||
pthread_mutex_unlock(&miEventQueueMutex);
|
pthread_mutex_unlock(&miEventQueueMutex);
|
||||||
|
|
|
@ -569,9 +569,9 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
*
|
*
|
||||||
* @param pDev The device to move
|
* @param pDev The device to move
|
||||||
* @param mode Movement mode (Absolute or Relative)
|
* @param mode Movement mode (Absolute or Relative)
|
||||||
* @param[in,out] x The x coordiante in screen coordinates (in regards to total
|
* @param[in,out] x The x coordinate in screen coordinates (in regards to total
|
||||||
* desktop size)
|
* desktop size)
|
||||||
* @param[in,out] y The y coordiante in screen coordinates (in regards to total
|
* @param[in,out] y The y coordinate in screen coordinates (in regards to total
|
||||||
* desktop size)
|
* desktop size)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
|
|
@ -87,7 +87,7 @@ typedef struct _miPointerScreenFuncRec {
|
||||||
void (*NewEventScreen)(
|
void (*NewEventScreen)(
|
||||||
DeviceIntPtr /* pDev */,
|
DeviceIntPtr /* pDev */,
|
||||||
ScreenPtr /* pScr */,
|
ScreenPtr /* pScr */,
|
||||||
Bool /* fromDIX */
|
Bool /* set_dequeue_screen */
|
||||||
);
|
);
|
||||||
} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
|
} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
|
||||||
|
|
||||||
|
|
|
@ -937,8 +937,6 @@ static void
|
||||||
miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
|
miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
miSpriteScreenPtr pScreenPriv;
|
miSpriteScreenPtr pScreenPriv;
|
||||||
int x, y;
|
|
||||||
CursorPtr pCursor;
|
|
||||||
miCursorInfoPtr pCursorInfo;
|
miCursorInfoPtr pCursorInfo;
|
||||||
|
|
||||||
if (IsFloating(pDev))
|
if (IsFloating(pDev))
|
||||||
|
@ -949,10 +947,7 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
pCursorInfo = MISPRITE(pDev);
|
pCursorInfo = MISPRITE(pDev);
|
||||||
|
|
||||||
miSpriteComputeSaved (pDev, pScreen);
|
miSpriteComputeSaved (pDev, pScreen);
|
||||||
pCursor = pCursorInfo->pCursor;
|
|
||||||
|
|
||||||
x = pCursorInfo->x - (int)pCursor->bits->xhot;
|
|
||||||
y = pCursorInfo->y - (int)pCursor->bits->yhot;
|
|
||||||
miSpriteDisableDamage(pScreen, pScreenPriv);
|
miSpriteDisableDamage(pScreen, pScreenPriv);
|
||||||
|
|
||||||
miDCSaveUnderCursor(pDev,
|
miDCSaveUnderCursor(pDev,
|
||||||
|
|
|
@ -223,7 +223,6 @@ miComputeClips (
|
||||||
RegionRec childUnion;
|
RegionRec childUnion;
|
||||||
Bool overlap;
|
Bool overlap;
|
||||||
RegionPtr borderVisible;
|
RegionPtr borderVisible;
|
||||||
Bool resized;
|
|
||||||
/*
|
/*
|
||||||
* Figure out the new visibility of this window.
|
* Figure out the new visibility of this window.
|
||||||
* The extent of the universe should be the same as the extent of
|
* The extent of the universe should be the same as the extent of
|
||||||
|
@ -378,7 +377,6 @@ miComputeClips (
|
||||||
}
|
}
|
||||||
|
|
||||||
borderVisible = pParent->valdata->before.borderVisible;
|
borderVisible = pParent->valdata->before.borderVisible;
|
||||||
resized = pParent->valdata->before.resized;
|
|
||||||
RegionNull(&pParent->valdata->after.borderExposed);
|
RegionNull(&pParent->valdata->after.borderExposed);
|
||||||
RegionNull(&pParent->valdata->after.exposed);
|
RegionNull(&pParent->valdata->after.exposed);
|
||||||
|
|
||||||
|
|
157
os/log.c
157
os/log.c
|
@ -165,6 +165,9 @@ asm (".desc ___crashreporter_info__, 0x10");
|
||||||
#ifndef X_NOT_IMPLEMENTED_STRING
|
#ifndef X_NOT_IMPLEMENTED_STRING
|
||||||
#define X_NOT_IMPLEMENTED_STRING "(NI)"
|
#define X_NOT_IMPLEMENTED_STRING "(NI)"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef X_NONE_STRING
|
||||||
|
#define X_NONE_STRING ""
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LogInit is called to start logging to a file. It is also called (with
|
* LogInit is called to start logging to a file. It is also called (with
|
||||||
|
@ -325,58 +328,65 @@ LogWrite(int verb, const char *f, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns the Message Type string to prepend to a logging message, or NULL
|
||||||
|
* if the message will be dropped due to insufficient verbosity. */
|
||||||
|
static const char *
|
||||||
|
LogMessageTypeVerbString(MessageType type, int verb)
|
||||||
|
{
|
||||||
|
if (type == X_ERROR)
|
||||||
|
verb = 0;
|
||||||
|
|
||||||
|
if (logVerbosity < verb && logFileVerbosity < verb)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case X_PROBED:
|
||||||
|
return X_PROBE_STRING;
|
||||||
|
case X_CONFIG:
|
||||||
|
return X_CONFIG_STRING;
|
||||||
|
case X_DEFAULT:
|
||||||
|
return X_DEFAULT_STRING;
|
||||||
|
case X_CMDLINE:
|
||||||
|
return X_CMDLINE_STRING;
|
||||||
|
case X_NOTICE:
|
||||||
|
return X_NOTICE_STRING;
|
||||||
|
case X_ERROR:
|
||||||
|
return X_ERROR_STRING;
|
||||||
|
case X_WARNING:
|
||||||
|
return X_WARNING_STRING;
|
||||||
|
case X_INFO:
|
||||||
|
return X_INFO_STRING;
|
||||||
|
case X_NOT_IMPLEMENTED:
|
||||||
|
return X_NOT_IMPLEMENTED_STRING;
|
||||||
|
case X_UNKNOWN:
|
||||||
|
return X_UNKNOWN_STRING;
|
||||||
|
case X_NONE:
|
||||||
|
return X_NONE_STRING;
|
||||||
|
default:
|
||||||
|
return X_UNKNOWN_STRING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
|
LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
const char *s = X_UNKNOWN_STRING;
|
const char *type_str;
|
||||||
char tmpBuf[1024];
|
char tmpFormat[1024];
|
||||||
|
char *new_format;
|
||||||
|
|
||||||
/* Ignore verbosity for X_ERROR */
|
type_str = LogMessageTypeVerbString(type, verb);
|
||||||
if (logVerbosity >= verb || logFileVerbosity >= verb || type == X_ERROR) {
|
if (!type_str)
|
||||||
switch (type) {
|
return;
|
||||||
case X_PROBED:
|
|
||||||
s = X_PROBE_STRING;
|
/* if type_str is not "", prepend it and ' ', to format */
|
||||||
break;
|
if (type_str[0] == '\0')
|
||||||
case X_CONFIG:
|
new_format = format;
|
||||||
s = X_CONFIG_STRING;
|
else {
|
||||||
break;
|
new_format = tmpFormat;
|
||||||
case X_DEFAULT:
|
snprintf(tmpFormat, sizeof(tmpFormat), "%s %s", type_str, format);
|
||||||
s = X_DEFAULT_STRING;
|
|
||||||
break;
|
|
||||||
case X_CMDLINE:
|
|
||||||
s = X_CMDLINE_STRING;
|
|
||||||
break;
|
|
||||||
case X_NOTICE:
|
|
||||||
s = X_NOTICE_STRING;
|
|
||||||
break;
|
|
||||||
case X_ERROR:
|
|
||||||
s = X_ERROR_STRING;
|
|
||||||
if (verb > 0)
|
|
||||||
verb = 0;
|
|
||||||
break;
|
|
||||||
case X_WARNING:
|
|
||||||
s = X_WARNING_STRING;
|
|
||||||
break;
|
|
||||||
case X_INFO:
|
|
||||||
s = X_INFO_STRING;
|
|
||||||
break;
|
|
||||||
case X_NOT_IMPLEMENTED:
|
|
||||||
s = X_NOT_IMPLEMENTED_STRING;
|
|
||||||
break;
|
|
||||||
case X_UNKNOWN:
|
|
||||||
s = X_UNKNOWN_STRING;
|
|
||||||
break;
|
|
||||||
case X_NONE:
|
|
||||||
s = NULL;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if s is not NULL we need a space before format */
|
LogVWrite(verb, new_format, args);
|
||||||
snprintf(tmpBuf, sizeof(tmpBuf), "%s%s%s", s ? s : "",
|
|
||||||
s ? " " : "",
|
|
||||||
format);
|
|
||||||
LogVWrite(verb, tmpBuf, args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Log message with verbosity level specified. */
|
/* Log message with verbosity level specified. */
|
||||||
|
@ -401,6 +411,61 @@ LogMessage(MessageType type, const char *format, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
|
||||||
|
va_list msg_args, const char *hdr_format, va_list hdr_args)
|
||||||
|
{
|
||||||
|
const char *type_str;
|
||||||
|
char tmpFormat[1024];
|
||||||
|
char *tmpFormat_end = &tmpFormat[sizeof(tmpFormat)];
|
||||||
|
char *p;
|
||||||
|
int left;
|
||||||
|
|
||||||
|
type_str = LogMessageTypeVerbString(type, verb);
|
||||||
|
if (!type_str)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* if type_str != "", copy it and ' ' to tmpFormat; set p after ' ' */
|
||||||
|
p = tmpFormat;
|
||||||
|
if (type_str[0] != '\0')
|
||||||
|
p += snprintf(tmpFormat, sizeof(tmpFormat), "%s ", type_str);
|
||||||
|
|
||||||
|
/* append as much of hdr as fits after type_str (if there was one) */
|
||||||
|
left = tmpFormat_end - p;
|
||||||
|
if (left > 1)
|
||||||
|
p += vsnprintf(p, left, hdr_format, hdr_args);
|
||||||
|
|
||||||
|
/* append as much of msg_format as will fit after hdr */
|
||||||
|
left = tmpFormat_end - p;
|
||||||
|
if (left > 1)
|
||||||
|
snprintf(p, left, "%s", msg_format);
|
||||||
|
|
||||||
|
LogVWrite(verb, tmpFormat, msg_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LogHdrMessageVerb(MessageType type, int verb, const char *msg_format,
|
||||||
|
va_list msg_args, const char *hdr_format, ...)
|
||||||
|
{
|
||||||
|
va_list hdr_args;
|
||||||
|
|
||||||
|
va_start(hdr_args, hdr_format);
|
||||||
|
LogVHdrMessageVerb(type, verb, msg_format, msg_args, hdr_format, hdr_args);
|
||||||
|
va_end(hdr_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LogHdrMessage(MessageType type, const char *msg_format, va_list msg_args,
|
||||||
|
const char *hdr_format, ...)
|
||||||
|
{
|
||||||
|
va_list hdr_args;
|
||||||
|
|
||||||
|
va_start(hdr_args, hdr_format);
|
||||||
|
LogVHdrMessageVerb(type, 1, msg_format, msg_args, hdr_format, hdr_args);
|
||||||
|
va_end(hdr_args);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AbortServer(void) _X_NORETURN;
|
AbortServer(void) _X_NORETURN;
|
||||||
|
|
||||||
|
|
10
os/utils.c
10
os/utils.c
|
@ -201,6 +201,8 @@ Bool PanoramiXExtensionDisabledHack = FALSE;
|
||||||
|
|
||||||
int auditTrailLevel = 1;
|
int auditTrailLevel = 1;
|
||||||
|
|
||||||
|
char *SeatId = NULL;
|
||||||
|
|
||||||
#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
|
#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
|
||||||
#define HAS_SAVED_IDS_AND_SETEUID
|
#define HAS_SAVED_IDS_AND_SETEUID
|
||||||
#endif
|
#endif
|
||||||
|
@ -511,6 +513,7 @@ void UseMsg(void)
|
||||||
ErrorF("-render [default|mono|gray|color] set render color alloc policy\n");
|
ErrorF("-render [default|mono|gray|color] set render color alloc policy\n");
|
||||||
ErrorF("-retro start with classic stipple and cursor\n");
|
ErrorF("-retro start with classic stipple and cursor\n");
|
||||||
ErrorF("-s # screen-saver timeout (minutes)\n");
|
ErrorF("-s # screen-saver timeout (minutes)\n");
|
||||||
|
ErrorF("-seat string seat to run on\n");
|
||||||
ErrorF("-t # default pointer threshold (pixels/t)\n");
|
ErrorF("-t # default pointer threshold (pixels/t)\n");
|
||||||
ErrorF("-terminate terminate at server reset\n");
|
ErrorF("-terminate terminate at server reset\n");
|
||||||
ErrorF("-to # connection time out\n");
|
ErrorF("-to # connection time out\n");
|
||||||
|
@ -802,6 +805,13 @@ ProcessCommandLine(int argc, char *argv[])
|
||||||
else
|
else
|
||||||
UseMsg();
|
UseMsg();
|
||||||
}
|
}
|
||||||
|
else if ( strcmp( argv[i], "-seat") == 0)
|
||||||
|
{
|
||||||
|
if(++i < argc)
|
||||||
|
SeatId = argv[i];
|
||||||
|
else
|
||||||
|
UseMsg();
|
||||||
|
}
|
||||||
else if ( strcmp( argv[i], "-t") == 0)
|
else if ( strcmp( argv[i], "-t") == 0)
|
||||||
{
|
{
|
||||||
if(++i < argc)
|
if(++i < argc)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
if ENABLE_UNIT_TESTS
|
if ENABLE_UNIT_TESTS
|
||||||
if HAVE_LD_WRAP
|
if HAVE_LD_WRAP
|
||||||
SUBDIRS= . xi2
|
SUBDIRS= . xi2
|
||||||
noinst_PROGRAMS = xkb input xtest list misc fixes
|
noinst_PROGRAMS = xkb input xtest list misc fixes xfree86
|
||||||
check_LTLIBRARIES = libxservertest.la
|
check_LTLIBRARIES = libxservertest.la
|
||||||
|
|
||||||
TESTS=$(noinst_PROGRAMS)
|
TESTS=$(noinst_PROGRAMS)
|
||||||
|
@ -23,6 +23,7 @@ xtest_LDADD=$(TEST_LDADD)
|
||||||
list_LDADD=$(TEST_LDADD)
|
list_LDADD=$(TEST_LDADD)
|
||||||
misc_LDADD=$(TEST_LDADD)
|
misc_LDADD=$(TEST_LDADD)
|
||||||
fixes_LDADD=$(TEST_LDADD)
|
fixes_LDADD=$(TEST_LDADD)
|
||||||
|
xfree86_LDADD=$(TEST_LDADD)
|
||||||
|
|
||||||
nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c
|
nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c
|
||||||
libxservertest_la_LIBADD = \
|
libxservertest_la_LIBADD = \
|
||||||
|
|
167
test/input.c
167
test/input.c
|
@ -1223,7 +1223,7 @@ static void dix_valuator_alloc(void)
|
||||||
|
|
||||||
assert(v);
|
assert(v);
|
||||||
assert(v->numAxes == num_axes);
|
assert(v->numAxes == num_axes);
|
||||||
#ifndef __i386__
|
#if !defined(__i386__) && !defined(__sh__)
|
||||||
/* must be double-aligned on 64 bit */
|
/* must be double-aligned on 64 bit */
|
||||||
assert(((void*)v->axisVal - (void*)v) % sizeof(double) == 0);
|
assert(((void*)v->axisVal - (void*)v) % sizeof(double) == 0);
|
||||||
assert(((void*)v->axes - (void*)v) % sizeof(double) == 0);
|
assert(((void*)v->axes - (void*)v) % sizeof(double) == 0);
|
||||||
|
@ -1234,6 +1234,169 @@ static void dix_valuator_alloc(void)
|
||||||
free(v);
|
free(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dix_get_master(void)
|
||||||
|
{
|
||||||
|
DeviceIntRec vcp, vck;
|
||||||
|
DeviceIntRec ptr, kbd;
|
||||||
|
DeviceIntRec floating;
|
||||||
|
SpriteInfoRec vcp_sprite, vck_sprite;
|
||||||
|
SpriteInfoRec ptr_sprite, kbd_sprite;
|
||||||
|
SpriteInfoRec floating_sprite;
|
||||||
|
|
||||||
|
memset(&vcp, 0, sizeof(DeviceIntRec));
|
||||||
|
memset(&vck, 0, sizeof(DeviceIntRec));
|
||||||
|
memset(&ptr, 0, sizeof(DeviceIntRec));
|
||||||
|
memset(&kbd, 0, sizeof(DeviceIntRec));
|
||||||
|
memset(&floating, 0, sizeof(DeviceIntRec));
|
||||||
|
|
||||||
|
memset(&vcp_sprite, 0, sizeof(DeviceIntRec));
|
||||||
|
memset(&vck_sprite, 0, sizeof(DeviceIntRec));
|
||||||
|
memset(&ptr_sprite, 0, sizeof(DeviceIntRec));
|
||||||
|
memset(&kbd_sprite, 0, sizeof(DeviceIntRec));
|
||||||
|
memset(&floating_sprite, 0, sizeof(DeviceIntRec));
|
||||||
|
|
||||||
|
vcp.type = MASTER_POINTER;
|
||||||
|
vck.type = MASTER_KEYBOARD;
|
||||||
|
ptr.type = SLAVE;
|
||||||
|
kbd.type = SLAVE;
|
||||||
|
floating.type = SLAVE;
|
||||||
|
|
||||||
|
vcp.spriteInfo = &vcp_sprite;
|
||||||
|
vck.spriteInfo = &vck_sprite;
|
||||||
|
ptr.spriteInfo = &ptr_sprite;
|
||||||
|
kbd.spriteInfo = &kbd_sprite;
|
||||||
|
floating.spriteInfo = &floating_sprite;
|
||||||
|
|
||||||
|
vcp_sprite.paired = &vck;
|
||||||
|
vck_sprite.paired = &vcp;
|
||||||
|
ptr_sprite.paired = &vcp;
|
||||||
|
kbd_sprite.paired = &vck;
|
||||||
|
floating_sprite.paired = &floating;
|
||||||
|
|
||||||
|
vcp_sprite.spriteOwner = TRUE;
|
||||||
|
floating_sprite.spriteOwner = TRUE;
|
||||||
|
|
||||||
|
ptr.master = &vcp;
|
||||||
|
kbd.master = &vck;
|
||||||
|
|
||||||
|
assert(GetPairedDevice(&vcp) == &vck);
|
||||||
|
assert(GetPairedDevice(&vck) == &vcp);
|
||||||
|
assert(GetMaster(&ptr, MASTER_POINTER) == &vcp);
|
||||||
|
assert(GetMaster(&ptr, MASTER_KEYBOARD) == &vck);
|
||||||
|
assert(GetMaster(&kbd, MASTER_POINTER) == &vcp);
|
||||||
|
assert(GetMaster(&kbd, MASTER_KEYBOARD) == &vck);
|
||||||
|
assert(GetMaster(&ptr, MASTER_ATTACHED) == &vcp);
|
||||||
|
assert(GetMaster(&kbd, MASTER_ATTACHED) == &vck);
|
||||||
|
|
||||||
|
assert(GetPairedDevice(&floating) == &floating);
|
||||||
|
assert(GetMaster(&floating, MASTER_POINTER) == NULL);
|
||||||
|
assert(GetMaster(&floating, MASTER_KEYBOARD) == NULL);
|
||||||
|
assert(GetMaster(&floating, MASTER_ATTACHED) == NULL);
|
||||||
|
|
||||||
|
assert(GetMaster(&vcp, POINTER_OR_FLOAT) == &vcp);
|
||||||
|
assert(GetMaster(&vck, POINTER_OR_FLOAT) == &vcp);
|
||||||
|
assert(GetMaster(&ptr, POINTER_OR_FLOAT) == &vcp);
|
||||||
|
assert(GetMaster(&kbd, POINTER_OR_FLOAT) == &vcp);
|
||||||
|
|
||||||
|
assert(GetMaster(&vcp, KEYBOARD_OR_FLOAT) == &vck);
|
||||||
|
assert(GetMaster(&vck, KEYBOARD_OR_FLOAT) == &vck);
|
||||||
|
assert(GetMaster(&ptr, KEYBOARD_OR_FLOAT) == &vck);
|
||||||
|
assert(GetMaster(&kbd, KEYBOARD_OR_FLOAT) == &vck);
|
||||||
|
|
||||||
|
assert(GetMaster(&floating, KEYBOARD_OR_FLOAT) == &floating);
|
||||||
|
assert(GetMaster(&floating, POINTER_OR_FLOAT) == &floating);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void input_option_test(void)
|
||||||
|
{
|
||||||
|
InputOption *list = NULL;
|
||||||
|
InputOption *opt;
|
||||||
|
const char *val;
|
||||||
|
|
||||||
|
printf("Testing input_option list interface\n");
|
||||||
|
|
||||||
|
list = input_option_new(list, "key", "value");
|
||||||
|
assert(list);
|
||||||
|
opt = input_option_find(list, "key");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "value") == 0);
|
||||||
|
|
||||||
|
list = input_option_new(list, "2", "v2");
|
||||||
|
opt = input_option_find(list, "key");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "value") == 0);
|
||||||
|
|
||||||
|
opt = input_option_find(list, "2");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "v2") == 0);
|
||||||
|
|
||||||
|
list = input_option_new(list, "3", "v3");
|
||||||
|
|
||||||
|
/* search, delete */
|
||||||
|
opt = input_option_find(list, "key");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "value") == 0);
|
||||||
|
list = input_option_free_element(list, "key");
|
||||||
|
opt = input_option_find(list, "key");
|
||||||
|
assert(opt == NULL);
|
||||||
|
|
||||||
|
opt = input_option_find(list, "2");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "v2") == 0);
|
||||||
|
list = input_option_free_element(list, "2");
|
||||||
|
opt = input_option_find(list, "2");
|
||||||
|
assert(opt == NULL);
|
||||||
|
|
||||||
|
opt = input_option_find(list, "3");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "v3") == 0);
|
||||||
|
list = input_option_free_element(list, "3");
|
||||||
|
opt = input_option_find(list, "3");
|
||||||
|
assert(opt == NULL);
|
||||||
|
|
||||||
|
/* list deletion */
|
||||||
|
list = input_option_new(list, "1", "v3");
|
||||||
|
list = input_option_new(list, "2", "v3");
|
||||||
|
list = input_option_new(list, "3", "v3");
|
||||||
|
input_option_free_list(&list);
|
||||||
|
|
||||||
|
assert(list == NULL);
|
||||||
|
|
||||||
|
list = input_option_new(list, "1", "v1");
|
||||||
|
list = input_option_new(list, "2", "v2");
|
||||||
|
list = input_option_new(list, "3", "v3");
|
||||||
|
|
||||||
|
/* value replacement */
|
||||||
|
opt = input_option_find(list, "2");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "v2") == 0);
|
||||||
|
input_option_set_value(opt, "foo");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "foo") == 0);
|
||||||
|
opt = input_option_find(list, "2");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "foo") == 0);
|
||||||
|
|
||||||
|
/* key replacement */
|
||||||
|
input_option_set_key(opt, "bar");
|
||||||
|
val = input_option_get_key(opt);
|
||||||
|
assert(strcmp(val, "bar") == 0);
|
||||||
|
opt = input_option_find(list, "bar");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "foo") == 0);
|
||||||
|
|
||||||
|
/* value replacement in input_option_new */
|
||||||
|
list = input_option_new(list, "bar", "foobar");
|
||||||
|
opt = input_option_find(list, "bar");
|
||||||
|
val = input_option_get_value(opt);
|
||||||
|
assert(strcmp(val, "foobar") == 0);
|
||||||
|
|
||||||
|
input_option_free_list(&list);
|
||||||
|
assert(list == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
dix_input_valuator_masks();
|
dix_input_valuator_masks();
|
||||||
|
@ -1249,6 +1412,8 @@ int main(int argc, char** argv)
|
||||||
include_bit_test_macros();
|
include_bit_test_macros();
|
||||||
xi_unregister_handlers();
|
xi_unregister_handlers();
|
||||||
dix_valuator_alloc();
|
dix_valuator_alloc();
|
||||||
|
dix_get_master();
|
||||||
|
input_option_test();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
164
test/list.c
164
test/list.c
|
@ -29,6 +29,7 @@
|
||||||
#include <list.h>
|
#include <list.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
struct parent {
|
struct parent {
|
||||||
int a;
|
int a;
|
||||||
|
@ -161,6 +162,164 @@ test_list_for_each(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct foo {
|
||||||
|
char a;
|
||||||
|
struct foo *next;
|
||||||
|
char b;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_nt_list_init(void)
|
||||||
|
{
|
||||||
|
struct foo foo;
|
||||||
|
|
||||||
|
foo.a = 10;
|
||||||
|
foo.b = 20;
|
||||||
|
nt_list_init(&foo, next);
|
||||||
|
|
||||||
|
assert(foo.a == 10);
|
||||||
|
assert(foo.b == 20);
|
||||||
|
assert(foo.next == NULL);
|
||||||
|
assert(nt_list_next(&foo, next) == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_nt_list_append(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct foo *foo = calloc(10, sizeof(struct foo));
|
||||||
|
struct foo *item;
|
||||||
|
|
||||||
|
for (item = foo, i = 1; i <= 10; i++, item++)
|
||||||
|
{
|
||||||
|
item->a = i;
|
||||||
|
item->b = i * 2;
|
||||||
|
nt_list_init(item, next);
|
||||||
|
|
||||||
|
if (item != foo)
|
||||||
|
nt_list_append(item, foo, struct foo, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test using nt_list_next */
|
||||||
|
for (item = foo, i = 1; i <= 10; i++, item = nt_list_next(item, next))
|
||||||
|
{
|
||||||
|
assert(item->a = i);
|
||||||
|
assert(item->b = i * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test using nt_list_for_each_entry */
|
||||||
|
i = 1;
|
||||||
|
nt_list_for_each_entry(item, foo, next) {
|
||||||
|
assert(item->a = i);
|
||||||
|
assert(item->b = i * 2);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
assert(i == 11);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_nt_list_insert(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct foo *foo = calloc(10, sizeof(struct foo));
|
||||||
|
struct foo *item;
|
||||||
|
|
||||||
|
foo->a = 10;
|
||||||
|
foo->b = 20;
|
||||||
|
nt_list_init(foo, next);
|
||||||
|
|
||||||
|
for (item = &foo[1], i = 9; i > 0; i--, item++)
|
||||||
|
{
|
||||||
|
item->a = i;
|
||||||
|
item->b = i * 2;
|
||||||
|
nt_list_init(item, next);
|
||||||
|
nt_list_insert(item, foo, struct foo, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test using nt_list_next */
|
||||||
|
for (item = foo, i = 10; i > 0; i--, item = nt_list_next(item, next))
|
||||||
|
{
|
||||||
|
assert(item->a = i);
|
||||||
|
assert(item->b = i * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test using nt_list_for_each_entry */
|
||||||
|
i = 1;
|
||||||
|
nt_list_for_each_entry(item, foo, next) {
|
||||||
|
assert(item->a = i);
|
||||||
|
assert(item->b = i * 2);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
assert(i == 11);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_nt_list_delete(void)
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
struct foo *list = calloc(10, sizeof(struct foo));
|
||||||
|
struct foo *foo = list;
|
||||||
|
struct foo *item, *tmp;
|
||||||
|
struct foo *empty_list = foo;
|
||||||
|
|
||||||
|
nt_list_init(empty_list, next);
|
||||||
|
nt_list_del(empty_list, empty_list, struct foo, next);
|
||||||
|
assert(!empty_list);
|
||||||
|
|
||||||
|
for (item = foo, i = 1; i <= 10; i++, item++)
|
||||||
|
{
|
||||||
|
item->a = i;
|
||||||
|
item->b = i * 2;
|
||||||
|
nt_list_init(item, next);
|
||||||
|
|
||||||
|
if (item != foo)
|
||||||
|
nt_list_append(item, foo, struct foo, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
nt_list_for_each_entry(item, foo, next) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
assert(i == 10);
|
||||||
|
|
||||||
|
/* delete last item */
|
||||||
|
nt_list_del(&foo[9], foo, struct foo, next);
|
||||||
|
i = 0;
|
||||||
|
nt_list_for_each_entry(item, foo, next) {
|
||||||
|
assert(item->a != 10); /* element 10 is gone now */
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
assert(i == 9); /* 9 elements left */
|
||||||
|
|
||||||
|
/* delete second item */
|
||||||
|
nt_list_del(foo->next, foo, struct foo, next);
|
||||||
|
assert(foo->next->a == 3);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
nt_list_for_each_entry(item, foo, next) {
|
||||||
|
assert(item->a != 10); /* element 10 is gone now */
|
||||||
|
assert(item->a != 2); /* element 2 is gone now */
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
assert(i == 8); /* 9 elements left */
|
||||||
|
|
||||||
|
item = foo;
|
||||||
|
/* delete first item */
|
||||||
|
nt_list_del(foo, foo, struct foo, next);
|
||||||
|
assert(item != foo);
|
||||||
|
assert(item->next == NULL);
|
||||||
|
assert(foo->a == 3);
|
||||||
|
assert(foo->next->a == 4);
|
||||||
|
|
||||||
|
nt_list_for_each_entry_safe(item, tmp, foo, next) {
|
||||||
|
nt_list_del(item, foo, struct foo, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(!foo);
|
||||||
|
assert(!item);
|
||||||
|
|
||||||
|
free(list);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
@ -169,5 +328,10 @@ int main(int argc, char** argv)
|
||||||
test_list_del();
|
test_list_del();
|
||||||
test_list_for_each();
|
test_list_for_each();
|
||||||
|
|
||||||
|
test_nt_list_init();
|
||||||
|
test_nt_list_append();
|
||||||
|
test_nt_list_insert();
|
||||||
|
test_nt_list_delete();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
* Copyright © 2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "xf86.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
xfree86_option_list_duplicate(void)
|
||||||
|
{
|
||||||
|
XF86OptionPtr options;
|
||||||
|
XF86OptionPtr duplicate;
|
||||||
|
const char *o1 = "foo",
|
||||||
|
*o2 = "bar",
|
||||||
|
*v1 = "one",
|
||||||
|
*v2 = "two";
|
||||||
|
const char *o_null= "NULL";
|
||||||
|
char *val1, *val2;
|
||||||
|
XF86OptionPtr a, b;
|
||||||
|
|
||||||
|
duplicate = xf86OptionListDuplicate(NULL);
|
||||||
|
assert(!duplicate);
|
||||||
|
|
||||||
|
options = xf86AddNewOption(NULL, o1, v1);
|
||||||
|
assert(options);
|
||||||
|
options = xf86AddNewOption(options, o2, v2);
|
||||||
|
assert(options);
|
||||||
|
options = xf86AddNewOption(options, o_null, NULL);
|
||||||
|
assert(options);
|
||||||
|
|
||||||
|
duplicate = xf86OptionListDuplicate(options);
|
||||||
|
assert(duplicate);
|
||||||
|
|
||||||
|
val1 = xf86CheckStrOption(options, o1, "1");
|
||||||
|
val2 = xf86CheckStrOption(duplicate, o1, "2");
|
||||||
|
|
||||||
|
assert(strcmp(val1, v1) == 0);
|
||||||
|
assert(strcmp(val1, val2) == 0);
|
||||||
|
|
||||||
|
val1 = xf86CheckStrOption(options, o2, "1");
|
||||||
|
val2 = xf86CheckStrOption(duplicate, o2, "2");
|
||||||
|
|
||||||
|
assert(strcmp(val1, v2) == 0);
|
||||||
|
assert(strcmp(val1, val2) == 0);
|
||||||
|
|
||||||
|
a = xf86FindOption(options, o_null);
|
||||||
|
b = xf86FindOption(duplicate, o_null);
|
||||||
|
assert(a && b);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
xfree86_option_list_duplicate();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -124,15 +124,11 @@ AccessXKeyboardEvent(DeviceIntPtr keybd,
|
||||||
Bool isRepeat)
|
Bool isRepeat)
|
||||||
{
|
{
|
||||||
DeviceEvent event;
|
DeviceEvent event;
|
||||||
memset(&event, 0, sizeof(DeviceEvent));
|
|
||||||
event.header = ET_Internal;
|
init_device_event(&event, keybd, GetTimeInMillis());
|
||||||
event.type = type;
|
event.type = type;
|
||||||
event.detail.key = keyCode;
|
event.detail.key = keyCode;
|
||||||
event.time = GetTimeInMillis();
|
|
||||||
event.length = sizeof(DeviceEvent);
|
|
||||||
event.key_repeat = isRepeat;
|
event.key_repeat = isRepeat;
|
||||||
event.sourceid = keybd->id;
|
|
||||||
event.deviceid = keybd->id;
|
|
||||||
|
|
||||||
if (xkbDebugFlags&0x8) {
|
if (xkbDebugFlags&0x8) {
|
||||||
DebugF("[xkb] AXKE: Key %d %s\n", keyCode,
|
DebugF("[xkb] AXKE: Key %d %s\n", keyCode,
|
||||||
|
|
Loading…
Reference in New Issue