mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2024-12-25 21:59:11 +01:00
Log layer priority only on change
Similar to reuse log print debug information only when the priority of a layer changes not whenever priority gets updated but without change. Otherwise the debug log is spammed (depending on LIFTOFF_PRIORITY_PERIOD).
This commit is contained in:
parent
b713b17d31
commit
a3b7c19204
1 changed files with 12 additions and 2 deletions
14
layer.c
14
layer.c
|
@ -147,6 +147,17 @@ void layer_mark_clean(struct liftoff_layer *layer)
|
|||
}
|
||||
}
|
||||
|
||||
static void log_priority(struct liftoff_layer *layer)
|
||||
{
|
||||
if (layer->current_priority == layer->pending_priority) {
|
||||
return;
|
||||
}
|
||||
|
||||
liftoff_log(LIFTOFF_DEBUG, "Layer %p priority change: %d -> %d",
|
||||
(void *)layer, layer->current_priority,
|
||||
layer->pending_priority);
|
||||
}
|
||||
|
||||
void layer_update_priority(struct liftoff_layer *layer, bool make_current) {
|
||||
struct liftoff_layer_property *prop;
|
||||
|
||||
|
@ -158,10 +169,9 @@ void layer_update_priority(struct liftoff_layer *layer, bool make_current) {
|
|||
}
|
||||
|
||||
if (make_current) {
|
||||
log_priority(layer);
|
||||
layer->current_priority = layer->pending_priority;
|
||||
layer->pending_priority = 0;
|
||||
liftoff_log(LIFTOFF_DEBUG, "Layer %p has priority %d",
|
||||
(void *)layer, layer->current_priority);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue