From 9f49bcf7e90d7b68fd80e8c80884e690454d29be Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Tue, 8 Jan 2013 02:46:08 +0100 Subject: [PATCH] redo mouse click position calculation --- dunst.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dunst.c b/dunst.c index fe5ed04..def01d7 100644 --- a/dunst.c +++ b/dunst.c @@ -923,17 +923,19 @@ void handle_mouse_click(XEvent ev) } if (ev.xbutton.button == Button1) { - int y = 0; + int y = separator_height; notification *n = NULL; for (n_queue *iter = displayed; iter; iter = iter->next) { n = iter->n; - int line_h = MAX(font_h, line_height); - int lines = line_h * n->line_count; - int height = lines + (2 * h_padding); + int text_h = MAX(font_h, line_height) * n->line_count; + int padding = 2 * h_padding; + + int height = text_h + padding; + if (ev.xbutton.y > y && ev.xbutton.y < y + height) break; else - y += height; + y += height + separator_height; } if (n) close_notification(n, 2);