diff options
-rw-r--r-- | include/swaybar/bar.h | 1 | ||||
-rw-r--r-- | swaybar/bar.c | 2 | ||||
-rw-r--r-- | swaybar/tray/tray.c | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 50d36e76..6f2a7083 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h | |||
@@ -21,6 +21,7 @@ struct bar { | |||
21 | struct output { | 21 | struct output { |
22 | struct window *window; | 22 | struct window *window; |
23 | struct registry *registry; | 23 | struct registry *registry; |
24 | struct output_state *state; | ||
24 | list_t *workspaces; | 25 | list_t *workspaces; |
25 | #ifdef ENABLE_TRAY | 26 | #ifdef ENABLE_TRAY |
26 | list_t *items; | 27 | list_t *items; |
diff --git a/swaybar/bar.c b/swaybar/bar.c index f12923a8..9cd17303 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -247,6 +247,8 @@ void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id) { | |||
247 | 247 | ||
248 | /* set window height */ | 248 | /* set window height */ |
249 | set_window_height(bar_output->window, bar->config->height); | 249 | set_window_height(bar_output->window, bar->config->height); |
250 | |||
251 | bar_output->state = output; | ||
250 | } | 252 | } |
251 | /* spawn status command */ | 253 | /* spawn status command */ |
252 | spawn_status_cmd_proc(bar); | 254 | spawn_status_cmd_proc(bar); |
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c index e926faae..924ff1a0 100644 --- a/swaybar/tray/tray.c +++ b/swaybar/tray/tray.c | |||
@@ -432,9 +432,13 @@ err: | |||
432 | return -1; | 432 | return -1; |
433 | } | 433 | } |
434 | 434 | ||
435 | void tray_mouse_event(struct output *output, int x, int y, | 435 | void tray_mouse_event(struct output *output, int rel_x, int rel_y, |
436 | uint32_t button, uint32_t state) { | 436 | uint32_t button, uint32_t state) { |
437 | 437 | ||
438 | int x = rel_x; | ||
439 | int y = rel_y + (swaybar.config->position == DESKTOP_SHELL_PANEL_POSITION_TOP | ||
440 | ? 0 : (output->state->height - output->window->height)); | ||
441 | |||
438 | struct window *window = output->window; | 442 | struct window *window = output->window; |
439 | uint32_t tray_padding = swaybar.config->tray_padding; | 443 | uint32_t tray_padding = swaybar.config->tray_padding; |
440 | int tray_width = window->width * window->scale; | 444 | int tray_width = window->width * window->scale; |