some cleanup
This commit is contained in:
parent
f237d8df84
commit
9b89836e73
23
dunst.c
23
dunst.c
@ -104,25 +104,21 @@ append(msg_queue_t *queue, char *msg, int to, int urgency, const char *fg, const
|
|||||||
|
|
||||||
|
|
||||||
new->msg = fix_markup(msg);
|
new->msg = fix_markup(msg);
|
||||||
new->urgency = urgency;
|
new->urgency = urgency > CRIT ? CRIT : urgency;
|
||||||
new->urgency = new->urgency > CRIT ? CRIT : new->urgency;
|
|
||||||
|
|
||||||
if(fg == NULL || !XAllocNamedColor(dc->dpy, cmap, fg, &color, &color)) {
|
if(fg == NULL || !XAllocNamedColor(dc->dpy, cmap, fg, &color, &color)) {
|
||||||
new->colors[ColFG] = colors[new->urgency][ColFG];
|
new->colors[ColFG] = colors[new->urgency][ColFG];
|
||||||
} else {
|
} else {
|
||||||
new->colors[ColFG] = color.pixel;
|
new->colors[ColFG] = color.pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bg == NULL || !XAllocNamedColor(dc->dpy, cmap, bg, &color, &color)) {
|
if(bg == NULL || !XAllocNamedColor(dc->dpy, cmap, bg, &color, &color)) {
|
||||||
new->colors[ColBG] = colors[new->urgency][ColBG];
|
new->colors[ColBG] = colors[new->urgency][ColBG];
|
||||||
} else {
|
} else {
|
||||||
new->colors[ColBG] = color.pixel;
|
new->colors[ColBG] = color.pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(to == -1) {
|
new->timeout = to == -1 ? timeouts[urgency] : to;
|
||||||
new->timeout = timeouts[urgency];
|
|
||||||
} else {
|
|
||||||
new->timeout = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
new->start = 0;
|
new->start = 0;
|
||||||
dunst_printf("%s (timeout: %d, urgency: %d)\n", new->msg, new->timeout, urgency);
|
dunst_printf("%s (timeout: %d, urgency: %d)\n", new->msg, new->timeout, urgency);
|
||||||
@ -139,12 +135,9 @@ msg_queue_t*
|
|||||||
delete(msg_queue_t *elem) {
|
delete(msg_queue_t *elem) {
|
||||||
msg_queue_t *prev;
|
msg_queue_t *prev;
|
||||||
msg_queue_t *next;
|
msg_queue_t *next;
|
||||||
if(msgqueue == NULL) {
|
if(msgqueue == NULL || elem == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(elem == NULL) {
|
|
||||||
return msgqueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(elem == msgqueue) {
|
if(elem == msgqueue) {
|
||||||
next = elem->next;
|
next = elem->next;
|
||||||
@ -507,14 +500,10 @@ setup(void) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
show_win(void) {
|
show_win(void) {
|
||||||
if(visible == True) {
|
if(visible || msgqueue == NULL) {
|
||||||
/* window is already visible */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(msgqueue == NULL) {
|
|
||||||
/* there's nothing to show */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
XMapRaised(dc->dpy, win);
|
XMapRaised(dc->dpy, win);
|
||||||
XGrabButton(dc->dpy, AnyButton, AnyModifier, win, False,
|
XGrabButton(dc->dpy, AnyButton, AnyModifier, win, False,
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user