From 26d536eb55d4fc847a8c83660fa0de7c4b077bf3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 4 Mar 2014 12:34:23 +0100 Subject: add Bar.invalidate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/__main__.py b/src/__main__.py index 6077a98..efc31fd 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -398,6 +398,22 @@ class Bar: self.change_colour(self.foreground) self.change_font(self.font) + def invalidate(self): + ''' + Cause the window to be redraw on the main window + ''' + # Dummy event for performing update in the main thread # TODO do this better + e = Xlib.protocol.event.KeyPress(detail = 1, + time = Xlib.X.CurrentTime, + root = display.screen().root, + window = self.window, + child = Xlib.X.NONE, + root_x = 1, root_y = 1, + event_x = 1, event_y = 1, + state = 0, same_screen = 1) + display.send_event(self.window, e) + display.flush() + @staticmethod def coloured_length(text): ''' -- cgit v1.2.3-70-g09d2