Show xmore layout only when needed
For the case, that there is a single notification waiting in queue, the xmore layout is an annoying setting.
This commit is contained in:
parent
ec26403a06
commit
f14b0b2b4a
@ -7,6 +7,8 @@
|
||||
- `fullscreen` rule to hide notifications when a fullscreen window is active
|
||||
- When new notifications arrive, but display is full, important notifications don't
|
||||
have to wait for a timeout in a displayed notification (#541)
|
||||
- `<I> more` notifications don't occupy space anymore, if there is only a single
|
||||
notification waiting to get displayed. The notification gets displayed directly (#467)
|
||||
|
||||
## 1.3.2 - 2018-05-06
|
||||
|
||||
|
25
src/queues.c
25
src/queues.c
@ -30,7 +30,6 @@ static GQueue *waiting = NULL; /**< all new notifications get into here */
|
||||
static GQueue *displayed = NULL; /**< currently displayed notifications */
|
||||
static GQueue *history = NULL; /**< history of displayed notifications */
|
||||
|
||||
unsigned int displayed_limit = 0;
|
||||
int next_notification_id = 1;
|
||||
bool pause_displayed = false;
|
||||
|
||||
@ -44,12 +43,6 @@ void queues_init(void)
|
||||
waiting = g_queue_new();
|
||||
}
|
||||
|
||||
/* see queues.h */
|
||||
void queues_displayed_limit(unsigned int limit)
|
||||
{
|
||||
displayed_limit = limit;
|
||||
}
|
||||
|
||||
/* see queues.h */
|
||||
const GList *queues_get_displayed(void)
|
||||
{
|
||||
@ -353,13 +346,23 @@ void queues_update(bool fullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
int cur_displayed_limit;
|
||||
if (settings.geometry.h == 0)
|
||||
cur_displayed_limit = INT_MAX;
|
||||
else if ( settings.indicate_hidden
|
||||
&& settings.geometry.h > 1
|
||||
&& displayed->length + waiting->length > settings.geometry.h)
|
||||
cur_displayed_limit = settings.geometry.h-1;
|
||||
else
|
||||
cur_displayed_limit = settings.geometry.h;
|
||||
|
||||
/* move notifications from queue to displayed */
|
||||
GList *iter = g_queue_peek_head_link(waiting);
|
||||
while (iter) {
|
||||
notification *n = iter->data;
|
||||
GList *nextiter = iter->next;
|
||||
|
||||
if (displayed_limit > 0 && displayed->length >= displayed_limit) {
|
||||
if (displayed->length >= cur_displayed_limit) {
|
||||
/* the list is full */
|
||||
break;
|
||||
}
|
||||
@ -382,6 +385,12 @@ void queues_update(bool fullscreen)
|
||||
iter = nextiter;
|
||||
}
|
||||
|
||||
/* if necessary, push the overhanging notifications from displayed to waiting again */
|
||||
while (displayed->length > cur_displayed_limit) {
|
||||
notification *n = g_queue_pop_tail(displayed);
|
||||
g_queue_insert_sorted(waiting, n, notification_cmp_data, NULL); //TODO: actually it should be on the head if unsorted
|
||||
}
|
||||
|
||||
/* If displayed is actually full, let the more important notifications
|
||||
* from waiting seep into displayed.
|
||||
*/
|
||||
|
@ -18,14 +18,6 @@
|
||||
*/
|
||||
void queues_init(void);
|
||||
|
||||
/**
|
||||
* Set maximum notification count to display
|
||||
* and store in displayed queue
|
||||
*
|
||||
* @param limit The maximum amount
|
||||
*/
|
||||
void queues_displayed_limit(unsigned int limit);
|
||||
|
||||
/**
|
||||
* Receive the current list of displayed notifications
|
||||
*
|
||||
|
11
src/x11/x.c
11
src/x11/x.c
@ -516,17 +516,6 @@ struct geometry x_parse_geometry(const char *geom_str)
|
||||
geometry.negative_x = mask & XNegative;
|
||||
geometry.negative_y = mask & YNegative;
|
||||
|
||||
/* calculate maximum notification count and push information to queue */
|
||||
if (geometry.h == 0) {
|
||||
queues_displayed_limit(0);
|
||||
} else if (geometry.h == 1) {
|
||||
queues_displayed_limit(1);
|
||||
} else if (settings.indicate_hidden) {
|
||||
queues_displayed_limit(geometry.h - 1);
|
||||
} else {
|
||||
queues_displayed_limit(geometry.h);
|
||||
}
|
||||
|
||||
return geometry;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user