summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <mzfuryy@0pointer.net>2008-06-11 02:22:32 +0200
committerLennart Poettering <mzfuryy@0pointer.net>2008-06-11 02:22:32 +0200
commit76f7d7bc3c060b261589c45df37cf10c69cde3b9 (patch)
treeba3c4a1deb3172310f9ba19419bec48224ad6cf2
parent3c1a92f965e5614c0ba7175068b46a91ac56dd3c (diff)
properly set the hpos/vpos properties in a locale independant way
-rw-r--r--src/canberra-gtk.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c
index 9c290a3..b889768 100644
--- a/src/canberra-gtk.c
+++ b/src/canberra-gtk.c
@@ -221,10 +221,14 @@ int ca_gtk_proplist_set_for_event(ca_proplist *p, GdkEvent *e) {
width = gdk_screen_get_width(gtk_widget_get_screen(w));
height = gdk_screen_get_height(gtk_widget_get_screen(w));
- if ((ret = ca_proplist_setf(p, CA_PROP_EVENT_MOUSE_HPOS, "%0.0f", x/width)) < 0)
+ /* We use these strange format strings here to avoid that
+ * libc applies locale information on the formatting of
+ * floating numbers. */
+
+ if ((ret = ca_proplist_setf(p, CA_PROP_EVENT_MOUSE_HPOS, "%i.%03i", (int) (x/width), (int) (1000.0*x/width) % 1000)) < 0)
return ret;
- if ((ret = ca_proplist_setf(p, CA_PROP_EVENT_MOUSE_VPOS, "%0.0f", y/height)) < 0)
+ if ((ret = ca_proplist_setf(p, CA_PROP_EVENT_MOUSE_VPOS, "%i.%03i", (int) (y/height), (int) (1000.0*y/height) % 1000)) < 0)
return ret;
}
}