From 5c8dc9cb73be8b3fde25475dbc3e5f931f73f642 Mon Sep 17 00:00:00 2001 From: Calvin Lee Date: Tue, 31 Oct 2017 12:42:08 -0600 Subject: Correct context menu placement if bar is bottom Originally the context menu would draw at the top of the screen, which is incorrect. --- swaybar/tray/tray.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'swaybar/tray') 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: return -1; } -void tray_mouse_event(struct output *output, int x, int y, +void tray_mouse_event(struct output *output, int rel_x, int rel_y, uint32_t button, uint32_t state) { + int x = rel_x; + int y = rel_y + (swaybar.config->position == DESKTOP_SHELL_PANEL_POSITION_TOP + ? 0 : (output->state->height - output->window->height)); + struct window *window = output->window; uint32_t tray_padding = swaybar.config->tray_padding; int tray_width = window->width * window->scale; -- cgit v1.2.3-54-g00ecf