aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-27 08:26:50 +0200
committermarha <marha@users.sourceforge.net>2011-09-27 08:26:50 +0200
commit183b7373f9919eeb5eb408f38578e01717b2cc10 (patch)
tree216dcb7e4efb0d67d019a4abe0e58cc6e1fa58b8 /xorg-server/hw/xfree86/common
parent873965b49f283ad028dd4e0e5b7e93a758c84993 (diff)
downloadvcxsrv-183b7373f9919eeb5eb408f38578e01717b2cc10.tar.gz
vcxsrv-183b7373f9919eeb5eb408f38578e01717b2cc10.tar.bz2
vcxsrv-183b7373f9919eeb5eb408f38578e01717b2cc10.zip
libX11 pixman mesa xserver git update 27 sep 2011
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.am2
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c161
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c51
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c26
-rw-r--r--xorg-server/hw/xfree86/common/xf86Opt.h237
-rw-r--r--xorg-server/hw/xfree86/common/xf86Option.c111
-rw-r--r--xorg-server/hw/xfree86/common/xf86Optionstr.h53
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c65
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.h364
10 files changed, 558 insertions, 514 deletions
diff --git a/xorg-server/hw/xfree86/common/Makefile.am b/xorg-server/hw/xfree86/common/Makefile.am
index c031d4be3..23ddb5c34 100644
--- a/xorg-server/hw/xfree86/common/Makefile.am
+++ b/xorg-server/hw/xfree86/common/Makefile.am
@@ -51,7 +51,7 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
xf86PciInfo.h xf86Priv.h xf86Privstr.h \
xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
$(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
- xf86sbusBus.h xf86VGAarbiter.h
+ xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h
DISTCLEANFILES = xf86Build.h
CLEANFILES = $(BUILT_SOURCES)
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index e1e0cd7e0..1b6c9984c 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -331,7 +331,7 @@ extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePt
/* xf86Option.c */
-extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
+extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
/* xf86RandR.c */
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 3aa923a28..e6c4d8f9f 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -1038,6 +1038,45 @@ Bool xf86DRI2Enabled(void)
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
* the following ways, in order of priority:
@@ -1061,12 +1100,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
const char *pointerMsg = NULL, *keyboardMsg = NULL;
InputInfoPtr *devs, /* iterator */
indp;
- InputInfoRec Pointer = {}, Keyboard = {};
+ InputInfoPtr Pointer, Keyboard;
XF86ConfInputPtr confInput;
XF86ConfInputRec defPtr, defKbd;
- int count = 0;
MessageType from = X_DEFAULT;
- int found = 0;
const char *mousedrivers[] = { "mouse", "synaptics", "evdev", "vmmouse",
"void", NULL };
@@ -1081,25 +1118,14 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
if (!corePointer) {
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 &&
xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
if (!coreKeyboard) {
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;
@@ -1119,18 +1145,9 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* removed.
*/
if (corePointer) {
- for (devs = servlayoutp->inputs; devs && *devs; devs++)
- if (*devs == corePointer)
- {
- free(*devs);
- *devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop*/
- break;
- }
- for (; devs && *devs; devs++)
- devs[0] = devs[1];
- count--;
+ freeDevice(servlayoutp->inputs, corePointer);
+ corePointer = NULL;
}
- corePointer = NULL;
foundPointer = TRUE;
}
@@ -1186,67 +1203,23 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
/* Add the core pointer device to the layout, and set it to Core. */
if (foundPointer && confInput) {
- 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(devs[count -1]->options,
- xnfstrdup("CorePointer"), NULL);
- devs[count] = NULL;
- servlayoutp->inputs = devs;
+ Pointer = xf86AllocateInput();
+ if (Pointer)
+ foundPointer = configInput(Pointer, confInput, from);
+ if (foundPointer) {
+ Pointer->options = xf86addNewOption(Pointer->options,
+ xnfstrdup("CorePointer"), "on");
+ servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
}
}
if (!foundPointer && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
+ xf86DeleteInput(Pointer, 0);
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;
/* 1. Check for the -keyboard command line option. */
@@ -1264,18 +1237,9 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* removed.
*/
if (coreKeyboard) {
- for (devs = servlayoutp->inputs; devs && *devs; devs++)
- if (*devs == coreKeyboard)
- {
- free(*devs);
- *devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop */
- break;
- }
- for (; devs && *devs; devs++)
- devs[0] = devs[1];
- count--;
+ freeDevice(servlayoutp->inputs, coreKeyboard);
+ coreKeyboard = NULL;
}
- coreKeyboard = NULL;
foundKeyboard = TRUE;
}
@@ -1329,25 +1293,20 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
/* Add the core keyboard device to the layout, and set it to Core. */
if (foundKeyboard && confInput) {
- foundKeyboard = configInput(&Keyboard, confInput, from);
- if (foundKeyboard) {
- count++;
- devs = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(InputInfoPtr));
- 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;
+ Keyboard = xf86AllocateInput();
+ if (Keyboard)
+ foundKeyboard = configInput(Keyboard, confInput, from);
+ if (foundKeyboard) {
+ Keyboard->options = xf86addNewOption(Keyboard->options,
+ xnfstrdup("CoreKeyboard"), "on");
+ servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard);
}
}
if (!foundKeyboard && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
+ xf86DeleteInput(Keyboard, 0);
return FALSE;
}
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 7c76fa8ec..a8aa316ae 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -1027,36 +1027,20 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
}
}
-/* Print driver messages in the standard format */
-
-#undef PREFIX_SIZE
-#define PREFIX_SIZE 14
-
+/* Print driver messages in the standard format of
+ (<type>) <screen name>(<screen index>): <message> */
void
xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
va_list args)
{
- char *tmpFormat;
-
/* Prefix the scrnIndex name to the format string. */
if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
- xf86Screens[scrnIndex]->name) {
- tmpFormat = malloc(strlen(format) +
- strlen(xf86Screens[scrnIndex]->name) +
- PREFIX_SIZE + 1);
- if (!tmpFormat)
- return;
-
- snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ",
- xf86Screens[scrnIndex]->name, scrnIndex);
-
- strcat(tmpFormat, format);
- LogVMessageVerb(type, verb, tmpFormat, args);
- free(tmpFormat);
- } else
+ xf86Screens[scrnIndex]->name)
+ LogHdrMessageVerb(type, verb, format, args, "%s(%d): ",
+ xf86Screens[scrnIndex]->name, scrnIndex);
+ else
LogVMessageVerb(type, verb, format, args);
}
-#undef PREFIX_SIZE
/* Print driver messages, with verbose level specified directly */
void
@@ -1082,20 +1066,23 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
}
/* Print input driver messages in the standard format of
- <driver>: <device name>: <message> */
+ (<type>) <driver>: <device name>: <message> */
void
-xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
- va_list args)
+xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb,
+ 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)
- == -1) {
- LogVMessageVerb(type, verb, "%s", args);
- } else {
- LogVMessageVerb(type, verb, msg, args);
- free(msg);
+ /* Prefix driver and device names to formatted message. */
+ if (dev) {
+ deviceName = dev->name;
+ if (dev->drv)
+ driverName = dev->drv->driverName;
}
+
+ LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName,
+ deviceName);
}
/* Print input driver message, with verbose level specified directly */
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index 93ea333bf..350918dfe 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -80,6 +80,7 @@
#include "xf86Bus.h"
#include "xf86VGAarbiter.h"
#include "globals.h"
+#include "xserver-properties.h"
#ifdef DPMSExtension
#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 */
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->depth == 24) {
@@ -806,11 +825,10 @@ duplicateDevice(InputInfoPtr pInfo)
return dup;
}
-/*
- * InitInput --
- * Initialize all supported input devices.
+/**
+ * Initialize all supported input devices present and referenced in the
+ * xorg.conf.
*/
-
void
InitInput(int argc, char **argv)
{
diff --git a/xorg-server/hw/xfree86/common/xf86Opt.h b/xorg-server/hw/xfree86/common/xf86Opt.h
index 5ce320891..88392dc6d 100644
--- a/xorg-server/hw/xfree86/common/xf86Opt.h
+++ b/xorg-server/hw/xfree86/common/xf86Opt.h
@@ -1,118 +1,119 @@
-
-/*
- * Copyright (c) 1998-2003 by The XFree86 Project, 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-/* Option handling things that ModuleSetup procs can use */
-
-#ifndef _XF86_OPT_H_
-#define _XF86_OPT_H_
-
-typedef struct {
- double freq;
- int units;
-} OptFrequency;
-
-typedef union {
- unsigned long num;
- char * str;
- double realnum;
- Bool bool;
- OptFrequency freq;
-} ValueUnion;
-
-typedef enum {
- OPTV_NONE = 0,
- OPTV_INTEGER,
- OPTV_STRING, /* a non-empty string */
- OPTV_ANYSTR, /* Any string, including an empty one */
- OPTV_REAL,
- OPTV_BOOLEAN,
- OPTV_PERCENT,
- OPTV_FREQ
-} OptionValueType;
-
-typedef enum {
- OPTUNITS_HZ = 1,
- OPTUNITS_KHZ,
- OPTUNITS_MHZ
-} OptFreqUnits;
-
-typedef struct {
- int token;
- const char* name;
- OptionValueType type;
- ValueUnion value;
- Bool found;
-} OptionInfoRec, *OptionInfoPtr;
-
-extern _X_EXPORT int xf86SetIntOption(pointer optlist, const char *name, int deflt);
-extern _X_EXPORT double xf86SetRealOption(pointer optlist, const char *name, double deflt);
-extern _X_EXPORT char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
-extern _X_EXPORT int xf86SetBoolOption(pointer list, const char *name, int deflt );
-extern _X_EXPORT double xf86SetPercentOption(pointer list, const char *name, double deflt );
-extern _X_EXPORT int xf86CheckIntOption(pointer optlist, const char *name, int deflt);
-extern _X_EXPORT double xf86CheckRealOption(pointer optlist, const char *name, double deflt);
-extern _X_EXPORT char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt);
-extern _X_EXPORT int xf86CheckBoolOption(pointer list, const char *name, int deflt );
-extern _X_EXPORT double xf86CheckPercentOption(pointer list, const char *name, double deflt );
-extern _X_EXPORT pointer xf86AddNewOption(pointer head, const char *name, const char *val );
-extern _X_EXPORT pointer xf86NewOption(char *name, char *value );
-extern _X_EXPORT pointer xf86NextOption(pointer list );
-extern _X_EXPORT pointer xf86OptionListCreate(const char **options, int count, int used);
-extern _X_EXPORT pointer xf86OptionListMerge(pointer head, pointer tail);
-extern _X_EXPORT pointer xf86OptionListDuplicate(pointer list);
-extern _X_EXPORT void xf86OptionListFree(pointer opt);
-extern _X_EXPORT char *xf86OptionName(pointer opt);
-extern _X_EXPORT char *xf86OptionValue(pointer opt);
-extern _X_EXPORT void xf86OptionListReport(pointer parm);
-extern _X_EXPORT pointer xf86FindOption(pointer options, const char *name);
-extern _X_EXPORT char *xf86FindOptionValue(pointer options, const char *name);
-extern _X_EXPORT void xf86MarkOptionUsed(pointer option);
-extern _X_EXPORT void xf86MarkOptionUsedByName(pointer options, const char *name);
-extern _X_EXPORT Bool xf86CheckIfOptionUsed(pointer option);
-extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
-extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, pointer options);
-extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
-extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(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 char *xf86GetOptValString(const OptionInfoRec *table, int token);
-extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
-extern _X_EXPORT Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
-extern _X_EXPORT Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
-extern _X_EXPORT Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
- OptFreqUnits expectedUnits, double *value);
-extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
-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 char *xf86NormalizeName(const char *s);
-extern _X_EXPORT pointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val);
-extern _X_EXPORT pointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val);
-extern _X_EXPORT pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val);
-extern _X_EXPORT pointer xf86ReplacePercentOption(pointer optlist, const char *name, const double val);
-extern _X_EXPORT pointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val);
-#endif
+
+/*
+ * Copyright (c) 1998-2003 by The XFree86 Project, 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Option handling things that ModuleSetup procs can use */
+
+#ifndef _XF86_OPT_H_
+#define _XF86_OPT_H_
+#include "xf86Optionstr.h"
+
+typedef struct {
+ double freq;
+ int units;
+} OptFrequency;
+
+typedef union {
+ unsigned long num;
+ char * str;
+ double realnum;
+ Bool bool;
+ OptFrequency freq;
+} ValueUnion;
+
+typedef enum {
+ OPTV_NONE = 0,
+ OPTV_INTEGER,
+ OPTV_STRING, /* a non-empty string */
+ OPTV_ANYSTR, /* Any string, including an empty one */
+ OPTV_REAL,
+ OPTV_BOOLEAN,
+ OPTV_PERCENT,
+ OPTV_FREQ
+} OptionValueType;
+
+typedef enum {
+ OPTUNITS_HZ = 1,
+ OPTUNITS_KHZ,
+ OPTUNITS_MHZ
+} OptFreqUnits;
+
+typedef struct {
+ int token;
+ const char* name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
+} OptionInfoRec, *OptionInfoPtr;
+
+extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt);
+extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt);
+extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
+extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name, int deflt );
+extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list, const char *name, double deflt );
+extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt);
+extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt);
+extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
+extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name, int deflt );
+extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list, const char *name, double deflt );
+extern _X_EXPORT XF86OptionPtr xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val );
+extern _X_EXPORT XF86OptionPtr xf86NewOption(char *name, char *value );
+extern _X_EXPORT XF86OptionPtr xf86NextOption(XF86OptionPtr list );
+extern _X_EXPORT XF86OptionPtr xf86OptionListCreate(const char **options, int count, int used);
+extern _X_EXPORT XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
+extern _X_EXPORT XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr list);
+extern _X_EXPORT void xf86OptionListFree(XF86OptionPtr opt);
+extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt);
+extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt);
+extern _X_EXPORT void xf86OptionListReport(XF86OptionPtr parm);
+extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
+extern _X_EXPORT char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
+extern _X_EXPORT void xf86MarkOptionUsed(XF86OptionPtr option);
+extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
+extern _X_EXPORT Bool xf86CheckIfOptionUsed(XF86OptionPtr option);
+extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name);
+extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr options);
+extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo);
+extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(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 char *xf86GetOptValString(const OptionInfoRec *table, int token);
+extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
+extern _X_EXPORT Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
+extern _X_EXPORT Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
+extern _X_EXPORT Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
+ OptFreqUnits expectedUnits, double *value);
+extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
+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 char *xf86NormalizeName(const char *s);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val);
+extern _X_EXPORT XF86OptionPtr xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char* val);
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c
index a3a836fc1..73b6573f1 100644
--- a/xorg-server/hw/xfree86/common/xf86Option.c
+++ b/xorg-server/hw/xfree86/common/xf86Option.c
@@ -40,11 +40,12 @@
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
+#include "xf86Opt.h"
#include "xf86Xinput.h"
#include "xf86Optrec.h"
#include "xf86Parser.h"
-static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
+static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
Bool markUsed);
/*
@@ -66,7 +67,7 @@ static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
*/
void
-xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
+xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts)
{
XF86OptionPtr tmp;
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
* allocated option list and must be freed by the caller.
*/
-pointer
-xf86OptionListDuplicate(pointer options)
+XF86OptionPtr
+xf86OptionListDuplicate(XF86OptionPtr options)
{
- pointer o = NULL;
+ XF86OptionPtr o = NULL;
while (options)
{
@@ -158,7 +159,7 @@ xf86OptionListDuplicate(pointer options)
/* Created for new XInput stuff -- essentially extensions to the parser */
static int
-LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed)
+LookupIntOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed)
{
OptionInfoRec o;
@@ -171,7 +172,7 @@ LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed)
static double
-LookupRealOption(pointer optlist, const char *name, double deflt,
+LookupRealOption(XF86OptionPtr optlist, const char *name, double deflt,
Bool markUsed)
{
OptionInfoRec o;
@@ -185,7 +186,7 @@ LookupRealOption(pointer optlist, const char *name, double deflt,
static char *
-LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
+LookupStrOption(XF86OptionPtr optlist, const char *name, char *deflt, Bool markUsed)
{
OptionInfoRec o;
@@ -201,7 +202,7 @@ LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
static int
-LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
+LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed)
{
OptionInfoRec o;
@@ -213,7 +214,7 @@ LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
}
static double
-LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUsed)
+LookupPercentOption(XF86OptionPtr optlist, const char *name, double deflt, Bool markUsed)
{
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 */
int
-xf86SetIntOption(pointer optlist, const char *name, int deflt)
+xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupIntOption(optlist, name, deflt, TRUE);
}
double
-xf86SetRealOption(pointer optlist, const char *name, double deflt)
+xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, TRUE);
}
char *
-xf86SetStrOption(pointer optlist, const char *name, char *deflt)
+xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
{
return LookupStrOption(optlist, name, deflt, TRUE);
}
int
-xf86SetBoolOption(pointer optlist, const char *name, int deflt)
+xf86SetBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, TRUE);
}
double
-xf86SetPercentOption(pointer optlist, const char *name, double deflt)
+xf86SetPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupPercentOption(optlist, name, deflt, TRUE);
}
@@ -264,35 +265,35 @@ xf86SetPercentOption(pointer optlist, const char *name, double deflt)
* as used.
*/
int
-xf86CheckIntOption(pointer optlist, const char *name, int deflt)
+xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupIntOption(optlist, name, deflt, FALSE);
}
double
-xf86CheckRealOption(pointer optlist, const char *name, double deflt)
+xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, FALSE);
}
char *
-xf86CheckStrOption(pointer optlist, const char *name, char *deflt)
+xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
{
return LookupStrOption(optlist, name, deflt, FALSE);
}
int
-xf86CheckBoolOption(pointer optlist, const char *name, int deflt)
+xf86CheckBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, FALSE);
}
double
-xf86CheckPercentOption(pointer optlist, const char *name, double deflt)
+xf86CheckPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
{
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
* if the option is already present.
*/
-pointer
-xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
+XF86OptionPtr
+xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val)
{
char tmp[16];
sprintf(tmp,"%i",val);
return xf86AddNewOption(optlist,name,tmp);
}
-pointer
-xf86ReplaceRealOption(pointer optlist, const char *name, const double val)
+XF86OptionPtr
+xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val)
{
char tmp[32];
snprintf(tmp,32,"%f",val);
return xf86AddNewOption(optlist,name,tmp);
}
-pointer
-xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val)
+XF86OptionPtr
+xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val)
{
return xf86AddNewOption(optlist,name,val?"True":"False");
}
-pointer
-xf86ReplacePercentOption(pointer optlist, const char *name, const double val)
+XF86OptionPtr
+xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val)
{
char tmp[16];
sprintf(tmp, "%lf%%", val);
return xf86AddNewOption(optlist,name,tmp);
}
-pointer
-xf86ReplaceStrOption(pointer optlist, const char *name, const char* val)
+XF86OptionPtr
+xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char* val)
{
return xf86AddNewOption(optlist,name,val);
}
-pointer
-xf86AddNewOption(pointer head, const char *name, const char *val)
+XF86OptionPtr
+xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val)
{
/* XXX These should actually be allocated in the parser library. */
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)
{
return xf86newOption(name, value);
}
-pointer
-xf86NextOption(pointer list)
+XF86OptionPtr
+xf86NextOption(XF86OptionPtr list)
{
return xf86nextOption(list);
}
-pointer
+XF86OptionPtr
xf86OptionListCreate(const char **options, int count, int used)
{
return xf86optionListCreate(options, count, used);
}
-pointer
-xf86OptionListMerge(pointer head, pointer tail)
+XF86OptionPtr
+xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail)
{
return xf86optionListMerge(head, tail);
}
void
-xf86OptionListFree(pointer opt)
+xf86OptionListFree(XF86OptionPtr opt)
{
xf86optionListFree(opt);
}
char *
-xf86OptionName(pointer opt)
+xf86OptionName(XF86OptionPtr opt)
{
return xf86optionName(opt);
}
char *
-xf86OptionValue(pointer opt)
+xf86OptionValue(XF86OptionPtr opt)
{
return xf86optionValue(opt);
}
void
-xf86OptionListReport(pointer parm)
+xf86OptionListReport(XF86OptionPtr parm)
{
XF86OptionPtr opts = parm;
@@ -407,30 +408,30 @@ xf86OptionListReport(pointer parm)
/* End of XInput-caused section */
-pointer
-xf86FindOption(pointer options, const char *name)
+XF86OptionPtr
+xf86FindOption(XF86OptionPtr options, const char *name)
{
return xf86findOption(options, name);
}
char *
-xf86FindOptionValue(pointer options, const char *name)
+xf86FindOptionValue(XF86OptionPtr options, const char *name)
{
return xf86findOptionValue(options, name);
}
void
-xf86MarkOptionUsed(pointer option)
+xf86MarkOptionUsed(XF86OptionPtr option)
{
if (option != NULL)
- ((XF86OptionPtr)option)->opt_used = TRUE;
+ option->opt_used = TRUE;
}
void
-xf86MarkOptionUsedByName(pointer options, const char *name)
+xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name)
{
XF86OptionPtr opt;
@@ -440,16 +441,16 @@ xf86MarkOptionUsedByName(pointer options, const char *name)
}
Bool
-xf86CheckIfOptionUsed(pointer option)
+xf86CheckIfOptionUsed(XF86OptionPtr option)
{
if (option != NULL)
- return ((XF86OptionPtr)option)->opt_used;
+ return option->opt_used;
else
return FALSE;
}
Bool
-xf86CheckIfOptionUsedByName(pointer options, const char *name)
+xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name)
{
XF86OptionPtr opt;
@@ -461,10 +462,8 @@ xf86CheckIfOptionUsedByName(pointer options, const char *name)
}
void
-xf86ShowUnusedOptions(int scrnIndex, pointer options)
+xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr opt)
{
- XF86OptionPtr opt = options;
-
while (opt) {
if (opt->opt_name && !opt->opt_used) {
xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
@@ -482,7 +481,7 @@ GetBoolValue(OptionInfoPtr p, const char *s)
}
static Bool
-ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
+ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
Bool markUsed)
{
char *s, *end;
@@ -695,7 +694,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
void
-xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo)
+xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo)
{
OptionInfoPtr p;
diff --git a/xorg-server/hw/xfree86/common/xf86Optionstr.h b/xorg-server/hw/xfree86/common/xf86Optionstr.h
new file mode 100644
index 000000000..8cc82d34c
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Optionstr.h
@@ -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
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index d22fdc8b9..9fbcba9d5 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -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 --
@@ -276,7 +304,7 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
*/
void
xf86ProcessCommonOptions(InputInfoPtr pInfo,
- pointer list)
+ XF86OptionPtr list)
{
if (xf86SetBoolOption(list, "Floating", 0) ||
!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
* is advertised.
* @param dev the device
@@ -755,6 +783,7 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
static int
xf86InputDevicePostInit(DeviceIntPtr dev) {
ApplyAccelerationSettings(dev);
+ ApplyTransformationMatrix(dev);
return Success;
}
@@ -879,35 +908,35 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
if (!pInfo)
return BadAlloc;
- for (option = options; option; option = option->next) {
- if (strcasecmp(option->key, "driver") == 0) {
+ nt_list_for_each_entry(option, options, next) {
+ if (strcasecmp(input_option_get_key(option), "driver") == 0) {
if (pInfo->driver) {
rval = BadRequest;
goto unwind;
}
- pInfo->driver = xstrdup(option->value);
+ pInfo->driver = xstrdup(input_option_get_value(option));
if (!pInfo->driver) {
rval = BadAlloc;
goto unwind;
}
}
- if (strcasecmp(option->key, "name") == 0 ||
- strcasecmp(option->key, "identifier") == 0) {
+ if (strcasecmp(input_option_get_key(option), "name") == 0 ||
+ strcasecmp(input_option_get_key(option), "identifier") == 0) {
if (pInfo->name) {
rval = BadRequest;
goto unwind;
}
- pInfo->name = xstrdup(option->value);
+ pInfo->name = xstrdup(input_option_get_value(option));
if (!pInfo->name) {
rval = BadAlloc;
goto unwind;
}
}
- if (strcmp(option->key, "_source") == 0 &&
- (strcmp(option->value, "server/hal") == 0 ||
- strcmp(option->value, "server/udev") == 0)) {
+ if (strcmp(input_option_get_key(option), "_source") == 0 &&
+ (strcmp(input_option_get_value(option), "server/hal") == 0 ||
+ strcmp(input_option_get_value(option), "server/udev") == 0)) {
is_auto = 1;
if (!xf86Info.autoAddDevices) {
rval = BadMatch;
@@ -916,13 +945,11 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
}
}
- for (option = options; option; option = option->next) {
- /* Steal option key/value strings from the provided list.
- * We need those strings, the InputOption list doesn't. */
- pInfo->options = xf86addNewOption(pInfo->options,
- option->key, option->value);
- option->key = NULL;
- option->value = NULL;
+ nt_list_for_each_entry(option, options, next) {
+ /* Copy option key/value strings from the provided list */
+ pInfo->options = xf86AddNewOption(pInfo->options,
+ input_option_get_key(option),
+ input_option_get_value(option));
}
/* 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().
*/
void
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h
index 84683168c..a4d9e58a5 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.h
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.h
@@ -1,182 +1,182 @@
-/*
- * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Frederic Lepied not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Frederic Lepied makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-/*
- * Copyright (c) 2000-2002 by The XFree86 Project, 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-#ifndef _xf86Xinput_h
-#define _xf86Xinput_h
-
-#include "xf86str.h"
-#include "inputstr.h"
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "XIstubs.h"
-
-/* Input device flags */
-#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
-/* the device sends Xinput and core pointer events */
-#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
-
-/* This holds the input driver entry and module information. */
-typedef struct _InputDriverRec {
- int driverVersion;
- char * driverName;
- void (*Identify)(int flags);
- int (*PreInit)(struct _InputDriverRec *drv,
- struct _InputInfoRec* pInfo, int flags);
- void (*UnInit)(struct _InputDriverRec *drv,
- struct _InputInfoRec *pInfo,
- int flags);
- pointer module;
- char ** default_options;
-} InputDriverRec, *InputDriverPtr;
-
-/* This is to input devices what the ScrnInfoRec is to screens. */
-
-typedef struct _InputInfoRec {
- struct _InputInfoRec *next;
- char * name;
- char * driver;
-
- int flags;
-
- Bool (*device_control)(DeviceIntPtr device, int what);
- void (*read_input)(struct _InputInfoRec *local);
- int (*control_proc)(struct _InputInfoRec *local,
- xDeviceCtl *control);
- int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
- int mode);
- int (*set_device_valuators)
- (struct _InputInfoRec *local,
- int *valuators, int first_valuator,
- int num_valuators);
-
- int fd;
- DeviceIntPtr dev;
- pointer private;
- char * type_name;
- InputDriverPtr drv;
- pointer module;
- pointer options;
- InputAttributes *attrs;
-} *InputInfoPtr;
-
-/* xf86Globals.c */
-extern InputInfoPtr xf86InputDevs;
-
-/* xf86Xinput.c */
-extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
- int first_valuator, int num_valuators, ...);
-extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
- int first_valuator, int num_valuators, const int *valuators);
-extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute,
- const ValuatorMask *mask);
-extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
- int first_valuator, int num_valuators, ...);
-extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator,
- int num_valuators, const int *valuators);
-extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in,
- const ValuatorMask *mask);
-extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
- int is_down, int first_valuator, int num_valuators,
- ...);
-extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button,
- int is_down, int first_valuator, int num_valuators,
- const int *valuators);
-extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button,
- int is_down, const ValuatorMask *mask);
-extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
- int is_absolute, int first_valuator, int num_valuators,
- ...);
-extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down,
- int is_absolute, const ValuatorMask *mask);
-extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down,
- int is_absolute, int first_valuator, int num_valuators,
- const int *valuators);
-extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
- int is_down);
-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 void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y);
-extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
-extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
- int maxval, int resolution, int min_res,
- int max_res, int mode);
-extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
-extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
-extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
-extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
-extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
-/* not exported */
-int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto);
-InputInfoPtr xf86AllocateInput(void);
-
-/* xf86Helper.c */
-extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
-extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
-extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
-extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
-extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
-extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo);
-extern _X_EXPORT void xf86IDrvMsgVerb(InputInfoPtr dev,
- MessageType type, int verb,
- const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
-extern _X_EXPORT void xf86IDrvMsg(InputInfoPtr dev,
- MessageType type,
- const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4);
-extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
- MessageType type,
- int verb,
- const char *format,
- va_list args);
-
-/* xf86Option.c */
-extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
-
-#endif /* _xf86Xinput_h */
+/*
+ * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Frederic Lepied not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Frederic Lepied makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright (c) 2000-2002 by The XFree86 Project, 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+#ifndef _xf86Xinput_h
+#define _xf86Xinput_h
+
+#include "xf86str.h"
+#include "inputstr.h"
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+
+/* Input device flags */
+#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
+/* the device sends Xinput and core pointer events */
+#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
+
+/* This holds the input driver entry and module information. */
+typedef struct _InputDriverRec {
+ int driverVersion;
+ char * driverName;
+ void (*Identify)(int flags);
+ int (*PreInit)(struct _InputDriverRec *drv,
+ struct _InputInfoRec* pInfo, int flags);
+ void (*UnInit)(struct _InputDriverRec *drv,
+ struct _InputInfoRec *pInfo,
+ int flags);
+ pointer module;
+ char ** default_options;
+} InputDriverRec, *InputDriverPtr;
+
+/* This is to input devices what the ScrnInfoRec is to screens. */
+
+typedef struct _InputInfoRec {
+ struct _InputInfoRec *next;
+ char * name;
+ char * driver;
+
+ int flags;
+
+ Bool (*device_control)(DeviceIntPtr device, int what);
+ void (*read_input)(struct _InputInfoRec *local);
+ int (*control_proc)(struct _InputInfoRec *local,
+ xDeviceCtl *control);
+ int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
+ int mode);
+ int (*set_device_valuators)
+ (struct _InputInfoRec *local,
+ int *valuators, int first_valuator,
+ int num_valuators);
+
+ int fd;
+ DeviceIntPtr dev;
+ pointer private;
+ char * type_name;
+ InputDriverPtr drv;
+ pointer module;
+ XF86OptionPtr options;
+ InputAttributes *attrs;
+} *InputInfoPtr;
+
+/* xf86Globals.c */
+extern InputInfoPtr xf86InputDevs;
+
+/* xf86Xinput.c */
+extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
+ int first_valuator, int num_valuators, ...);
+extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
+ int first_valuator, int num_valuators, const int *valuators);
+extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute,
+ const ValuatorMask *mask);
+extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
+ int first_valuator, int num_valuators, ...);
+extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator,
+ int num_valuators, const int *valuators);
+extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in,
+ const ValuatorMask *mask);
+extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
+ int is_down, int first_valuator, int num_valuators,
+ ...);
+extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button,
+ int is_down, int first_valuator, int num_valuators,
+ const int *valuators);
+extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button,
+ int is_down, const ValuatorMask *mask);
+extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
+ int is_absolute, int first_valuator, int num_valuators,
+ ...);
+extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down,
+ int is_absolute, const ValuatorMask *mask);
+extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down,
+ int is_absolute, int first_valuator, int num_valuators,
+ const int *valuators);
+extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
+ int is_down);
+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 void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y);
+extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr options);
+extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
+ int maxval, int resolution, int min_res,
+ int max_res, int mode);
+extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
+extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
+extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
+/* not exported */
+int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto);
+InputInfoPtr xf86AllocateInput(void);
+
+/* xf86Helper.c */
+extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
+extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
+extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
+extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
+extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
+extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86IDrvMsgVerb(InputInfoPtr dev,
+ MessageType type, int verb,
+ const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
+extern _X_EXPORT void xf86IDrvMsg(InputInfoPtr dev,
+ MessageType type,
+ const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4);
+extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
+ MessageType type,
+ int verb,
+ const char *format,
+ va_list args);
+
+/* xf86Option.c */
+extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
+
+#endif /* _xf86Xinput_h */