exposable: add ‘btn’ argument to on_mouse()

This commit is contained in:
Daniel Eklöf 2021-06-21 21:00:07 +02:00
parent 8f7ef7c20b
commit dd724d1bc2
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
11 changed files with 69 additions and 38 deletions

View file

@ -312,7 +312,8 @@ cleanup(struct bar *_bar)
static void
loop(struct bar *_bar,
void (*expose)(const struct bar *bar),
void (*on_mouse)(struct bar *bar, enum mouse_event event, int x, int y))
void (*on_mouse)(struct bar *bar, enum mouse_event event,
enum mouse_button btn, int x, int y))
{
struct private *bar = _bar->private;
struct xcb_backend *backend = bar->backend.data;
@ -357,7 +358,7 @@ loop(struct bar *_bar,
case XCB_MOTION_NOTIFY: {
const xcb_motion_notify_event_t *evt = (void *)e;
on_mouse(_bar, ON_MOUSE_MOTION, evt->event_x, evt->event_y);
on_mouse(_bar, ON_MOUSE_MOTION, MOUSE_BTN_NONE, evt->event_x, evt->event_y);
break;
}
@ -366,7 +367,13 @@ loop(struct bar *_bar,
case XCB_BUTTON_RELEASE: {
const xcb_button_release_event_t *evt = (void *)e;
on_mouse(_bar, ON_MOUSE_CLICK, evt->event_x, evt->event_y);
switch (evt->detail) {
case 1: case 2: case 3:
on_mouse(_bar, ON_MOUSE_CLICK,
evt->detail, evt->event_x, evt->event_y);
break;
}
break;
}