aboutsummaryrefslogtreecommitdiffstats
path: root/src/__main__.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-07-02 10:54:54 +0200
committerMattias Andrée <maandree@operamail.com>2014-07-02 10:54:54 +0200
commit3cd7a64784a1a96e1540e1022d12147e496fe70d (patch)
tree9a2710bb49625c42dfb0be6fcc47f0d5dd5bc3bd /src/__main__.py
parentwhitespace (diff)
downloadxpybar-3cd7a64784a1a96e1540e1022d12147e496fe70d.tar.gz
xpybar-3cd7a64784a1a96e1540e1022d12147e496fe70d.tar.bz2
xpybar-3cd7a64784a1a96e1540e1022d12147e496fe70d.tar.xz
reduce flicker
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-xsrc/__main__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/__main__.py b/src/__main__.py
index 16c935f..c502d7c 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -175,9 +175,15 @@ class Bar:
self.gc.change(foreground = fc, background = bc)
if clear is not None:
(clear_y, line_height) = clear
+ ascent = line_height - self.font_height
for c in text + '\0':
if c in special:
if not buf == '':
+ text_width = self.font_width * len(buf)
+ if clear is not None:
+ self.change_colour(self.background)
+ self.window.fill_rectangle(self.gc, x, clear_y, text_width, ascent)
+ self.gc.change(foreground = fc, background = bc)
if len(buf.encode('utf-8')) > 255:
while not buf == '':
sbuf, buf = buf[:42], buf[42:]
@@ -185,7 +191,7 @@ class Bar:
x += self.font_width * len(sbuf)
else:
draw_text(self.window, self.gc, x, y, buf)
- x += self.font_width * len(buf)
+ x += text_width
buf = ''
if not c == '\0':
segs = []