forked from external/yambar
module/river: don’t refresh the bar unless there are any actual changes
This commit is contained in:
parent
7c6874d826
commit
8f7ef7c20b
1 changed files with 28 additions and 21 deletions
|
@ -190,14 +190,15 @@ focused_tags(void *data, struct zriver_output_status_v1 *zriver_output_status_v1
|
||||||
uint32_t tags)
|
uint32_t tags)
|
||||||
{
|
{
|
||||||
struct output *output = data;
|
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);
|
LOG_DBG("output: %s: focused tags: 0x%08x", output->name, tags);
|
||||||
|
|
||||||
|
struct module *mod = output->m->mod;
|
||||||
mtx_lock(&mod->lock);
|
mtx_lock(&mod->lock);
|
||||||
{
|
output->focused = tags;
|
||||||
output->focused = tags;
|
|
||||||
}
|
|
||||||
mtx_unlock(&mod->lock);
|
mtx_unlock(&mod->lock);
|
||||||
mod->bar->refresh(mod->bar);
|
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 private *m = seat->m;
|
||||||
struct module *mod = m->mod;
|
struct module *mod = m->mod;
|
||||||
|
|
||||||
mtx_lock(&mod->lock);
|
struct output *output = NULL;
|
||||||
{
|
tll_foreach(m->outputs, it) {
|
||||||
struct output *output = NULL;
|
if (it->item.wl_output == wl_output) {
|
||||||
tll_foreach(m->outputs, it) {
|
output = &it->item;
|
||||||
if (it->item.wl_output == wl_output) {
|
break;
|
||||||
output = &it->item;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DBG("seat: %s: focused output: %s", seat->name, output != NULL ? output->name : "<unknown>");
|
|
||||||
|
|
||||||
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 : "<unknown>");
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
|
@ -373,6 +374,12 @@ focused_view(void *data, struct zriver_seat_status_v1 *zriver_seat_status_v1,
|
||||||
struct seat *seat = data;
|
struct seat *seat = data;
|
||||||
struct module *mod = seat->m->mod;
|
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);
|
LOG_DBG("seat: %s: focused view: %s", seat->name, title);
|
||||||
|
|
||||||
mtx_lock(&mod->lock);
|
mtx_lock(&mod->lock);
|
||||||
|
|
Loading…
Add table
Reference in a new issue