[core] fix broken "sparse" updates
c77f3aa
accidentially broke "sparse" updates (i.e. updates that do not
trigger during each update interval).
Introduce a new update parameter, "force", to model the use case "update
everything on SIGUSR1".
fixes #692
This commit is contained in:
parent
362d1a5f6f
commit
905f71fa52
2 changed files with 3 additions and 5 deletions
|
@ -106,7 +106,7 @@ def main():
|
|||
|
||||
def sig_USR1_handler(signum,stack):
|
||||
if update_lock.acquire(blocking=False) == True:
|
||||
core.event.trigger("update", redraw_only=False)
|
||||
core.event.trigger("update", force=True)
|
||||
core.event.trigger("draw")
|
||||
update_lock.release()
|
||||
|
||||
|
|
|
@ -221,15 +221,13 @@ class i3(object):
|
|||
core.event.trigger("next-widget")
|
||||
return blocks
|
||||
|
||||
# TODO: only updates full text, not the state!?
|
||||
# can this TODO be removed now? Will update the state if not redraw_only
|
||||
def update(self, affected_modules=None, redraw_only=False):
|
||||
def update(self, affected_modules=None, redraw_only=False, force=False):
|
||||
now = time.time()
|
||||
for module in self.__modules:
|
||||
if affected_modules and not module.id in affected_modules:
|
||||
continue
|
||||
if not affected_modules and module.next_update:
|
||||
if now < module.next_update and redraw_only:
|
||||
if now < module.next_update and not force:
|
||||
continue
|
||||
|
||||
if not redraw_only:
|
||||
|
|
Loading…
Reference in a new issue