handle_mouse_click: handle split notifications

This commit is contained in:
Sascha Kruse 2012-08-18 22:26:48 +02:00
parent a8d0ef1854
commit 0cff22c46a

29
dunst.c
View File

@ -669,22 +669,25 @@ char
void handle_mouse_click(XEvent ev) void handle_mouse_click(XEvent ev)
{ {
l_node *iter = displayed_notifications->head;
notification *n;
if (ev.xbutton.button == Button3) { if (ev.xbutton.button == Button3) {
move_all_to_history(); move_all_to_history();
} else if (ev.xbutton.button == Button1) {
int i = ev.xbutton.y / font_h; return;
for (; i > 0; i--) { }
/* if the user clicks on the "(x more)" message,
* keep iter at the last displayed message and if (ev.xbutton.button == Button1) {
* remove that instead int y = 0;
*/ notification *n;
if (iter->next) { l_node *iter = displayed_notifications->head;
iter = iter->next; assert(iter);
} for(; iter; iter = iter->next ) {
n = (notification *) iter->data;
int height = font_h * n->draw_txt_buf.line_count;
if (ev.xbutton.y > y && ev.xbutton.y < y + height)
break;
else
y += height;
} }
n = (notification *) iter->data;
close_notification(n, 2); close_notification(n, 2);
} }
} }