summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-04-24 10:17:29 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-04-27 08:56:10 +1000
commit4f58454f53432f67d221ace60675499d8cee2411 (patch)
treeed8e75d9d134531a4e11d7bb21efcf8224f18f03
parentefbc3e98be4bacbb7ca08409d33584ffd55ee794 (diff)
synclient: fix 64 bit issues for float properties.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--tools/synclient.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/tools/synclient.c b/tools/synclient.c
index 1146535..3ea9c50 100644
--- a/tools/synclient.c
+++ b/tools/synclient.c
@@ -51,6 +51,12 @@
#define XATOM_FLOAT "FLOAT"
#endif
+union flong { /* Xlibs 64-bit property handling madness */
+ long l;
+ float f;
+};
+
+
enum ParaType {
PT_INT,
PT_BOOL,
@@ -426,7 +432,7 @@ dp_set_variables(Display *dpy, XDevice* dev, int argc, char *argv[], int first_c
unsigned char* data;
unsigned long nitems, bytes_after;
- float *f;
+ union flong *f;
long *n;
char *b;
@@ -479,8 +485,8 @@ dp_set_variables(Display *dpy, XDevice* dev, int argc, char *argv[], int first_c
par->name, format);
break;
}
- f = (float*)data;
- f[par->prop_offset] = val;
+ f = (union flong*)data;
+ f[par->prop_offset].f = val;
break;
}
@@ -501,7 +507,7 @@ dp_show_settings(Display *dpy, XDevice *dev)
unsigned char* data;
int len;
- float *f;
+ union flong *f;
long *i;
char *b;
@@ -555,8 +561,8 @@ dp_show_settings(Display *dpy, XDevice *dev)
break;
}
- f = (float*)data;
- printf(" %-23s = %g\n", par->name, f[par->prop_offset]);
+ f = (union flong*)data;
+ printf(" %-23s = %g\n", par->name, f[par->prop_offset].f);
break;
}