[kupfer] Yet another workaround for window positions
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer] Yet another workaround for window positions
- Date: Sat, 15 May 2010 11:08:29 +0000 (UTC)
commit b198e8839d7b3094e5b1db58b5179092c6c838cb
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sat May 15 13:04:12 2010 +0200
Yet another workaround for window positions
Only update window position after two successive configure-events are
received; this way we try to catch only the window movements initiated
by the user.
Relevant to bug
https://bugs.launchpad.net/kupfer/+bug/417278
kupfer/ui/browser.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index b68b95a..d6b39b8 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -1407,6 +1407,7 @@ class WindowController (pretty.OutputMixin):
"""
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window_position = -1, -1
+ self._latest_window_position = None
data_controller = data.DataController()
data_controller.connect("launched-action", self.launch_callback)
@@ -1501,14 +1502,20 @@ class WindowController (pretty.OutputMixin):
def _window_frame_event(self, window, event):
# save most recent window position
+ # but only save it on user moves -- detect this by catching two
+ # successive (different) positions
window_pos = self.window.get_position()
if (self.window.get_property("visible") and
window_pos != self.window_position):
self.window_position = self.window.get_position()
- setctl = settings.GetSettingsController()
- setctl.set_session_position("main", self.window_position)
+ if (self._latest_window_position is not None and
+ self._latest_window_position != window_pos):
+ setctl = settings.GetSettingsController()
+ setctl.set_session_position("main", self.window_position)
+ self._latest_window_position = window_pos
def _move_window_to_position(self):
+ self._latest_window_position = None
pos = self.window.get_position()
if self.window_position[0] > 0 and pos != self.window_position:
self.window.move(*self.window_position)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]