changed behaviour of mouseclicks

Now a rightclick on the message windows deletes ALL messages.
This commit is contained in:
Sascha Kruse 2011-11-05 10:45:59 +01:00
parent 349493c196
commit f237d8df84
2 changed files with 18 additions and 1 deletions

View File

@ -118,6 +118,11 @@ Possible placeholders are:
%i iconname (including its path) %i iconname (including its path)
.TP .TP
%I iconname (without its path) %I iconname (without its path)
.SH MOUSE
.BI leftclick
to Delete oldest messages and
.BI rightclick
Delete all messages.
.SH EXAMPLES .SH EXAMPLES
.BI "dunst " \-geometry " x2" .BI "dunst " \-geometry " x2"
Displays a maximum of two lines across the top of the screen. Displays a maximum of two lines across the top of the screen.

14
dunst.c
View File

@ -80,6 +80,7 @@ int list_len(msg_queue_t *list);
/* misc funtions */ /* misc funtions */
void check_timeouts(void); void check_timeouts(void);
void delete_all_msg(void);
void delete_msg(msg_queue_t *elem); void delete_msg(msg_queue_t *elem);
void drawmsg(void); void drawmsg(void);
void dunst_printf(const char *fmt, ...); void dunst_printf(const char *fmt, ...);
@ -201,6 +202,13 @@ check_timeouts(void) {
} }
} }
void
delete_all_msg(void) {
while (msgqueue != NULL) {
delete_msg(NULL);
}
}
void void
delete_msg(msg_queue_t *elem) { delete_msg(msg_queue_t *elem) {
msg_queue_t *cur; msg_queue_t *cur;
@ -380,7 +388,11 @@ handleXEvents(void) {
break; break;
case ButtonPress: case ButtonPress:
if(ev.xbutton.window == win) { if(ev.xbutton.window == win) {
delete_msg(NULL); if(ev.xbutton.button == Button1) {
delete_msg(NULL);
} else {
delete_all_msg();
}
} }
break; break;
case KeyPress: case KeyPress: