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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2012-12-16 18:17:03 +01:00
parent 7d1a963352
commit 6a39fa46c1
1 changed files with 2 additions and 2 deletions

View File

@ -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 */