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:
parent
7d1a963352
commit
6a39fa46c1
4
event.c
4
event.c
|
@ -216,8 +216,8 @@ event_handle_button(xcb_button_press_event_t *ev)
|
||||||
* relative to root window */
|
* relative to root window */
|
||||||
if(drawin->window == ev->child)
|
if(drawin->window == ev->child)
|
||||||
{
|
{
|
||||||
ev->event_x -= drawin->geometry.x;
|
ev->event_x -= drawin->geometry.x + drawin->border_width;
|
||||||
ev->event_y -= drawin->geometry.y;
|
ev->event_y -= drawin->geometry.y + drawin->border_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Push the drawable */
|
/* Push the drawable */
|
||||||
|
|
Loading…
Reference in New Issue