mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
Add support binding on-click handlers to other buttons than LEFT
One can now bind the left/middle/right mouse buttons to on-click. In fact, you can have all three buttons bound to different handlers for the same particle. The new syntax is on-click: left: <command> middle: <command> right: <command> Leaving one out is the same thing as not mapping it at all. Furthermore, on-click: <command> is still valid, and is a shorthand for on-click: left: <commsnd>
This commit is contained in:
parent
af163d3f77
commit
c79ffbe057
15 changed files with 163 additions and 90 deletions
|
@ -272,26 +272,25 @@ static void
|
|||
wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
|
||||
{
|
||||
if (state != WL_POINTER_BUTTON_STATE_PRESSED)
|
||||
return;
|
||||
|
||||
struct seat *seat = data;
|
||||
struct wayland_backend *backend = seat->backend;
|
||||
|
||||
backend->active_seat = seat;
|
||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||
backend->active_seat = seat;
|
||||
else {
|
||||
enum mouse_button btn;
|
||||
|
||||
enum mouse_button btn;
|
||||
switch (button) {
|
||||
case BTN_LEFT: btn = MOUSE_BTN_LEFT; break;
|
||||
case BTN_MIDDLE: btn = MOUSE_BTN_MIDDLE; break;
|
||||
case BTN_RIGHT: btn = MOUSE_BTN_RIGHT; break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
switch (button) {
|
||||
case BTN_LEFT: btn = MOUSE_BTN_LEFT; break;
|
||||
case BTN_MIDDLE: btn = MOUSE_BTN_MIDDLE; break;
|
||||
case BTN_RIGHT: btn = MOUSE_BTN_RIGHT; break;
|
||||
default:
|
||||
return;
|
||||
backend->bar_on_mouse(
|
||||
backend->bar, ON_MOUSE_CLICK, btn, seat->pointer.x, seat->pointer.y);
|
||||
}
|
||||
|
||||
backend->bar_on_mouse(
|
||||
backend->bar, ON_MOUSE_CLICK, btn, seat->pointer.x, seat->pointer.y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue