[sugar] [PATCH] Fixing timestamp issue on wnck.Window.activate()

Marco Pesenti Gritti mpgritti
Wed Jun 4 13:08:42 EDT 2008

     def present(self):
-        # wnck.Window.activate() expects a timestamp, but we don't
-        # always have one, and libwnck will complain if we pass "0",
-        # and matchbox doesn't look at the timestamp anyway. So we
-        # just always pass "1".
-        self._window.activate(1)
+        self._window.activate(gtk.get_current_event_time())

Since you can't be sure of where present() will be called from (an
event or not), I'd rather pass in a timestamp to method.

-            previous_activity.get_window().activate(1)
+            previous_activity.get_window().activate(gtk.get_current_event_time())

Same as above, and you are exceeding 80 cols.

     def activate_next_activity(self):
         home_model = self._model.get_home()
         next_activity = home_model.get_next_activity()
         if next_activity:
-            next_activity.get_window().activate(1)
+            next_activity.get_window().activate(gtk.get_current_event_time())

Same as above.

+            # This is being called in response to a user generated click,
+            # so I guess gtk.get_current_event_time() is OK here.
+            # See libwnck/test-wnck.c for an example
+            home_activity.get_window().activate(gtk.get_current_event_time())

I think the comment is not necessary.


More information about the Sugar-devel mailing list