From 9c4da3c17204192d9527ac4e0f9f629a71df4862 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 15 Jun 2006 17:31:41 -0400 Subject: [PATCH] F11 now put the activities window in fullscreen, --- sugar/chat/Chat.py | 2 +- sugar/shell/PresenceWindow.py | 5 +--- sugar/shell/WindowManager.py | 50 +++++++++++++++++++++++++++++++---- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/sugar/chat/Chat.py b/sugar/chat/Chat.py index c0494354..c06bbc17 100644 --- a/sugar/chat/Chat.py +++ b/sugar/chat/Chat.py @@ -22,7 +22,7 @@ class Chat(gtk.Window): SERVICE_PORT = 6100 def __init__(self): - gtk.Window.__init__(self) + gtk.Window.__init__(self, gtk.WINDOW_POPUP) self._stream_writer = None diff --git a/sugar/shell/PresenceWindow.py b/sugar/shell/PresenceWindow.py index 75236657..35f06a3e 100644 --- a/sugar/shell/PresenceWindow.py +++ b/sugar/shell/PresenceWindow.py @@ -11,10 +11,7 @@ class PresenceWindow(gtk.Window): _MODEL_COL_BUDDY = 2 def __init__(self, activity_container): - gtk.Window.__init__(self) - - self.set_decorated(False) - self.set_skip_taskbar_hint(True) + gtk.Window.__init__(self, gtk.WINDOW_POPUP) self._activity_container = activity_container diff --git a/sugar/shell/WindowManager.py b/sugar/shell/WindowManager.py index 22b1a98e..c4a5804d 100644 --- a/sugar/shell/WindowManager.py +++ b/sugar/shell/WindowManager.py @@ -15,12 +15,49 @@ class WindowManager: ABSOLUTE = 0 SCREEN_RELATIVE = 1 + VISIBLE = 0 + SLIDED_IN = 1 + HIDDEN = 2 + def __init__(self, window): self._window = window - window.connect("key-press-event", self.__key_press_event_cb) - + self._visibility = WindowManager.HIDDEN + WindowManager.__managers_list.append(self) + window.connect("key-press-event", self.__key_press_event_cb) + window.connect("focus-in-event", self.__focus_in_event_cb) + window.connect_after("focus-out-event", self.__focus_out_event_cb) + + def has_focus(self): + return self._window.has_toplevel_focus() + + def _update_visibility(self): + visible = False + + if self._visibility is WindowManager.VISIBLE: + visible = True + elif self._visibility is WindowManager.HIDDEN: + visible = False + elif self._visibility is WindowManager.SLIDED_IN: + for manager in WindowManager.__managers_list: + if manager.has_focus(): + visible = True + + if self._window.get_property('visible') != visible: + self._window.set_property('visible', visible) + + def __focus_change_idle(self): + for manager in WindowManager.__managers_list: + manager._update_visibility() + return False + + def __focus_in_event_cb(self, window, event): + gobject.idle_add(self.__focus_change_idle) + + def __focus_out_event_cb(self, window, event): + gobject.idle_add(self.__focus_change_idle) + def __key_press_event_cb(self, window, event): manager = None @@ -80,13 +117,16 @@ class WindowManager: self._window.resize(width, height) def slide_window_in(self): - self._window.show() + self._visibility = WindowManager.SLIDED_IN + self._update_visibility() def slide_window_out(self): - self._window.hide() + self._visibility = WindowManager.HIDDEN + self._update_visibility() def show(self): - self._window.show() + self._visibility = WindowManager.VISIBLE def manage(self): self._update_size_and_position() + self._update_visibility()