From 103954dd2b7bc54140f19ceda2508f17b1cf5427 Mon Sep 17 00:00:00 2001 From: David Eklov Date: Sun, 10 Jul 2016 22:23:47 -0500 Subject: [PATCH] Setup to receive mouse click events and log them --- swaybar/bar.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/swaybar/bar.c b/swaybar/bar.c index 6d858f92e..ed18b5e66 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -58,6 +58,10 @@ struct output *new_output(const char *name) { return output; } +static void mouse_button_notify(struct window *window, wl_fixed_t x, wl_fixed_t y, uint32_t button) { + sway_log(L_DEBUG, "Mouse button %d clicked at %d %d\n", button, x, y); +} + void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id) { /* initialize bar with default values */ bar_init(bar); @@ -92,6 +96,9 @@ void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id) { /* set font */ bar_output->window->font = bar->config->font; + /* set font */ + bar_output->window->pointer_input.notify = mouse_button_notify; + /* set window height */ set_window_height(bar_output->window, bar->config->height); }