[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):
|
def sig_USR1_handler(signum,stack):
|
||||||
if update_lock.acquire(blocking=False) == True:
|
if update_lock.acquire(blocking=False) == True:
|
||||||
core.event.trigger("update", redraw_only=False)
|
core.event.trigger("update", force=True)
|
||||||
core.event.trigger("draw")
|
core.event.trigger("draw")
|
||||||
update_lock.release()
|
update_lock.release()
|
||||||
|
|
||||||
|
|
|
@ -221,15 +221,13 @@ class i3(object):
|
||||||
core.event.trigger("next-widget")
|
core.event.trigger("next-widget")
|
||||||
return blocks
|
return blocks
|
||||||
|
|
||||||
# TODO: only updates full text, not the state!?
|
def update(self, affected_modules=None, redraw_only=False, force=False):
|
||||||
# can this TODO be removed now? Will update the state if not redraw_only
|
|
||||||
def update(self, affected_modules=None, redraw_only=False):
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
for module in self.__modules:
|
for module in self.__modules:
|
||||||
if affected_modules and not module.id in affected_modules:
|
if affected_modules and not module.id in affected_modules:
|
||||||
continue
|
continue
|
||||||
if not affected_modules and module.next_update:
|
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
|
continue
|
||||||
|
|
||||||
if not redraw_only:
|
if not redraw_only:
|
||||||
|
|
Loading…
Reference in a new issue