Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2006-06-15 21:22:36 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2006-06-15 21:22:36 (GMT)
commit122c0dad1652ce9c0ae7610bc95693b9effe750d (patch)
tree75ddf10feaebc4351293d25e65491848b12c4bf2 /sugar
parent9034dc8f3b926ff8e3e9773966c38ad3b8506340 (diff)
Simplify focus a lot by using transient windows
Diffstat (limited to 'sugar')
-rw-r--r--sugar/shell/WindowManager.py48
-rwxr-xr-xsugar/shell/shell.py16
2 files changed, 19 insertions, 45 deletions
diff --git a/sugar/shell/WindowManager.py b/sugar/shell/WindowManager.py
index c4a5804..22b1a98 100644
--- a/sugar/shell/WindowManager.py
+++ b/sugar/shell/WindowManager.py
@@ -15,48 +15,11 @@ class WindowManager:
ABSOLUTE = 0
SCREEN_RELATIVE = 1
- VISIBLE = 0
- SLIDED_IN = 1
- HIDDEN = 2
-
def __init__(self, window):
self._window = window
- 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)
+ WindowManager.__managers_list.append(self)
def __key_press_event_cb(self, window, event):
manager = None
@@ -117,16 +80,13 @@ class WindowManager:
self._window.resize(width, height)
def slide_window_in(self):
- self._visibility = WindowManager.SLIDED_IN
- self._update_visibility()
+ self._window.show()
def slide_window_out(self):
- self._visibility = WindowManager.HIDDEN
- self._update_visibility()
+ self._window.hide()
def show(self):
- self._visibility = WindowManager.VISIBLE
+ self._window.show()
def manage(self):
self._update_size_and_position()
- self._update_visibility()
diff --git a/sugar/shell/shell.py b/sugar/shell/shell.py
index f7eaa18..cb81154 100755
--- a/sugar/shell/shell.py
+++ b/sugar/shell/shell.py
@@ -215,7 +215,6 @@ class ActivityHost(dbus.service.Object):
class ActivityContainer(dbus.service.Object):
def __init__(self, service, bus):
-
self.activities = []
self.bus = bus
@@ -225,7 +224,11 @@ class ActivityContainer(dbus.service.Object):
bus.add_signal_receiver(self.name_owner_changed, dbus_interface = "org.freedesktop.DBus", signal_name = "NameOwnerChanged")
self.window = gtk.Window()
+ self.window.connect("key-press-event", self.__key_press_event_cb)
self.window.set_title("OLPC Sugar")
+
+ self._fullscreen = False
+
self.notebook = gtk.Notebook()
tab_label = gtk.Label("Everyone")
@@ -308,6 +311,15 @@ class ActivityContainer(dbus.service.Object):
for owner, activity in self.activities:
print " %d: owner=%s activity_object_name=%s" % (i, owner, activity.dbus_object_name)
i += 1
+
+ def __key_press_event_cb(self, window, event):
+ if event.keyval == gtk.keysyms.F11:
+ if self._fullscreen:
+ window.unfullscreen()
+ self._fullscreen = False
+ else:
+ window.fullscreen()
+ self._fullscreen = True
class ConsoleLogger(dbus.service.Object):
def __init__(self):
@@ -383,6 +395,7 @@ def main():
wm.manage()
presence_window = PresenceWindow(activity_container)
+ presence_window.set_transient_for(activity_container.window)
wm = WindowManager(presence_window)
@@ -392,6 +405,7 @@ def main():
wm.manage()
group_chat = GroupChat()
+ group_chat.set_transient_for(activity_container.window)
group_chat.set_decorated(False)
group_chat.set_skip_taskbar_hint(True)