forked from external/yambar
exposable: add ‘btn’ argument to on_mouse()
This commit is contained in:
parent
8f7ef7c20b
commit
dd724d1bc2
11 changed files with 69 additions and 38 deletions
13
bar/xcb.c
13
bar/xcb.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue