From ff02074558d23fc2ebc992e83073815a7c9141e8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 6 Oct 2009 23:43:10 +0200 Subject: gtk: fix calculation of event hpos/vpos --- src/canberra-gtk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c index cc6719b..b9de2fe 100644 --- a/src/canberra-gtk.c +++ b/src/canberra-gtk.c @@ -377,10 +377,10 @@ int ca_gtk_proplist_set_for_event(ca_proplist *p, GdkEvent *e) { * 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) + if ((ret = ca_proplist_setf(p, CA_PROP_EVENT_MOUSE_HPOS, "%i.%03i", (int) (x/(width-1)), (int) (1000.0*x/(width-1)) % 1000)) < 0) return ret; - if ((ret = ca_proplist_setf(p, CA_PROP_EVENT_MOUSE_VPOS, "%i.%03i", (int) (y/height), (int) (1000.0*y/height) % 1000)) < 0) + if ((ret = ca_proplist_setf(p, CA_PROP_EVENT_MOUSE_VPOS, "%i.%03i", (int) (y/(height-1)), (int) (1000.0*y/(height-1)) % 1000)) < 0) return ret; } } -- cgit