diff --git a/modules/river.c b/modules/river.c index 6fdeb85..0cdab38 100644 --- a/modules/river.c +++ b/modules/river.c @@ -190,14 +190,15 @@ focused_tags(void *data, struct zriver_output_status_v1 *zriver_output_status_v1 uint32_t tags) { struct output *output = data; - struct module *mod = output->m->mod; + + if (output->focused == tags) + return; LOG_DBG("output: %s: focused tags: 0x%08x", output->name, tags); + struct module *mod = output->m->mod; mtx_lock(&mod->lock); - { - output->focused = tags; - } + output->focused = tags; mtx_unlock(&mod->lock); mod->bar->refresh(mod->bar); } @@ -316,25 +317,25 @@ focused_output(void *data, struct zriver_seat_status_v1 *zriver_seat_status_v1, struct private *m = seat->m; struct module *mod = m->mod; - mtx_lock(&mod->lock); - { - struct output *output = NULL; - tll_foreach(m->outputs, it) { - if (it->item.wl_output == wl_output) { - output = &it->item; - break; - } + struct output *output = NULL; + tll_foreach(m->outputs, it) { + if (it->item.wl_output == wl_output) { + output = &it->item; + break; } - - LOG_DBG("seat: %s: focused output: %s", seat->name, output != NULL ? output->name : ""); - - if (output == NULL) - LOG_WARN("seat: %s: couldn't find output we are mapped on", seat->name); - - seat->output = output; } - mtx_unlock(&mod->lock); - mod->bar->refresh(mod->bar); + + LOG_DBG("seat: %s: focused output: %s", seat->name, output != NULL ? output->name : ""); + + if (output == NULL) + LOG_WARN("seat: %s: couldn't find output we are mapped on", seat->name); + + if (seat->output != output) { + mtx_lock(&mod->lock); + seat->output = output; + mtx_unlock(&mod->lock); + mod->bar->refresh(mod->bar); + } } static void @@ -373,6 +374,12 @@ focused_view(void *data, struct zriver_seat_status_v1 *zriver_seat_status_v1, struct seat *seat = data; struct module *mod = seat->m->mod; + if (seat->title == NULL && title == NULL) + return; + + if (seat->title != NULL && title != NULL && strcmp(seat->title, title) == 0) + return; + LOG_DBG("seat: %s: focused view: %s", seat->name, title); mtx_lock(&mod->lock);