Hi (Peter),
I've no idea how to make the git tools work with gmane news groups and
such like (especially when I'm subscribed under a different address to
the one used in the patch), so please forgive me for just attaching this
patch.
We discussed this on IRC last night Peter. Seems to work here in my testing.
I had to change a bit in parse_cmd to stop it clobbering the command
line args for the second run.
Slightly more than the 10 lines predicted, but not that complex really :)
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
>From 411126050e99eb2bf8096b1a3815deff88d1ab3a Mon Sep 17 00:00:00 2001
From: Colin Guthrie <[email protected]>
Date: Thu, 23 Apr 2009 12:45:48 +0100
Subject: [PATCH] When appling changes via property mode, apply to all synaptics devices found.
This change solves a non-obvious problem. If synaptics is loaded both via HAL and via a hard-coded entry in
xorg.conf, only the properties of the first device found are changed.
With this patch we now apply our changes to all synaptics devices.
We only list the results for the last one found (this is different to before which listed the first one found),
but as this appears to be the one that matters, this is actually better than before.
---
tools/synclient.c | 45 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/tools/synclient.c b/tools/synclient.c
index 39b3bf6..77d34a0 100644
--- a/tools/synclient.c
+++ b/tools/synclient.c
@@ -252,9 +252,9 @@ parse_cmd(char* cmd, struct Parameter** par)
if (eqp) {
int j;
int found = 0;
- *eqp = 0;
+ size_t size = (eqp - cmd);
for (j = 0; params[j].name; j++) {
- if (strcasecmp(cmd, params[j].name) == 0) {
+ if (strncasecmp(cmd, params[j].name, size) == 0) {
found = 1;
break;
}
@@ -456,7 +456,7 @@ unwind:
}
static XDevice *
-dp_get_device(Display *dpy)
+dp_get_device(Display *dpy, int idx)
{
XDevice* dev = NULL;
XDeviceInfo *info = NULL;
@@ -466,6 +466,7 @@ dp_get_device(Display *dpy)
Atom *properties = NULL;
int nprops = 0;
int error = 0;
+ int showfinalerror = (idx < 1);
touchpad_type = XInternAtom(dpy, XI_TOUCHPAD, True);
synaptics_property = XInternAtom(dpy, SYNAPTICS_PROP_EDGES, True);
@@ -473,6 +474,10 @@ dp_get_device(Display *dpy)
while(ndevices--) {
if (info[ndevices].type == touchpad_type) {
+ if (idx > 0) {
+ --idx;
+ continue;
+ }
dev = XOpenDevice(dpy, info[ndevices].id);
if (!dev) {
fprintf(stderr, "Failed to open device '%s'.\n",
@@ -511,7 +516,8 @@ unwind:
XFree(properties);
XFreeDeviceList(info);
if (!dev)
- fprintf(stderr, "Unable to find a synaptics device.\n");
+ if (showfinalerror)
+ fprintf(stderr, "Unable to find a synaptics device.\n");
else if (error && dev)
{
XCloseDevice(dpy, dev);
@@ -697,6 +703,7 @@ main(int argc, char *argv[])
int dump_settings = 0;
int use_shm = 1;
int first_cmd;
+ int idx = 0;
#ifdef HAVE_PROPERTIES
use_shm = 0;
@@ -760,14 +767,34 @@ main(int argc, char *argv[])
XDevice *dev;
dpy = dp_init();
- if (!dpy || !(dev = dp_get_device(dpy)))
+ if (!dpy)
return 1;
- dp_set_variables(dpy, dev, argc, argv, first_cmd);
- if (dump_settings)
- dp_show_settings(dpy, dev);
- XCloseDevice(dpy, dev);
+ /* Apply the settings changes to all synaptics devices */
+ while ((dev = dp_get_device(dpy, idx++))) {
+ dp_set_variables(dpy, dev, argc, argv, first_cmd);
+ XCloseDevice(dpy, dev);
+ }
+
+ /* If we didn't open any devices just return. */
+ if (idx < 2) {
+ XCloseDisplay(dpy);
+ return 1;
+ }
+
+ if (dump_settings) {
+ /* Reopen the last one we found to print it out...
+ This is not really ideal, but it'll do to allow the basic tools to continue */
+ dev = dp_get_device(dpy, (idx - 2));
+ if (!dev) {
+ XCloseDisplay(dpy);
+ return 1;
+ }
+
+ dp_show_settings(dpy, dev);
+ XCloseDevice(dpy, dev);
+ }
XCloseDisplay(dpy);
}
#endif
--
1.6.2.4
_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg