From 6a39fa46c128abe574804197646d47f2086824b5 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 16 Dec 2012 18:17:03 +0100 Subject: [PATCH] wibox button: Fix the x/y position in button events The coordinates as used by X11 place (0, 0) at the top-left corner of the window, including its border. However, this code wants the position relative to the drawin's content, thus we also need to substract the border width. Signed-off-by: Uli Schlachter --- event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/event.c b/event.c index b60b2785..af08cfd9 100644 --- a/event.c +++ b/event.c @@ -216,8 +216,8 @@ event_handle_button(xcb_button_press_event_t *ev) * relative to root window */ if(drawin->window == ev->child) { - ev->event_x -= drawin->geometry.x; - ev->event_y -= drawin->geometry.y; + ev->event_x -= drawin->geometry.x + drawin->border_width; + ev->event_y -= drawin->geometry.y + drawin->border_width; } /* Push the drawable */