[pitivi] mainwindow: Fix main window shrinking when restarting
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] mainwindow: Fix main window shrinking when restarting
- Date: Sat, 5 Oct 2019 05:14:23 +0000 (UTC)
commit 83287af3a2e5e05e199e53d4cb1df54992df7a2e
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Thu Feb 28 09:42:46 2019 +0100
mainwindow: Fix main window shrinking when restarting
pitivi/mainwindow.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 762a83d9..6ec847a7 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -122,17 +122,22 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
if height == -1 and width == -1:
self.maximize()
else:
- self.set_default_size(width, height)
# Wait until placing the window, to avoid the window manager
# ignoring the call. See the documentation for Gtk.Window.move.
+ # If you change this, pay attention opening `pitivi` works
+ # a bit different than opening `pitivi file.xges`. For example
+ # connecting to the "realize" signal instead of idle_add-ing
+ # fails to restore the position when directly loading a project.
GLib.idle_add(self.__initial_placement_cb,
self.app.settings.mainWindowX,
- self.app.settings.mainWindowY)
+ self.app.settings.mainWindowY,
+ width, height)
self.connect("configure-event", self.__configure_cb)
self.connect("delete-event", self.__delete_cb)
- def __initial_placement_cb(self, x, y):
+ def __initial_placement_cb(self, x, y, width, height):
+ self.resize(width, height)
self.move(x, y)
def __check_screen_constraints(self):
@@ -199,17 +204,15 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
def __configure_cb(self, unused_widget, unused_event):
"""Saves the main window position and size."""
- # Takes window manager decorations into account.
position = self.get_position()
self.app.settings.mainWindowX = position.root_x
self.app.settings.mainWindowY = position.root_y
- # Does not include the size of the window manager decorations.
size = self.get_size()
self.app.settings.mainWindowWidth = size.width
self.app.settings.mainWindowHeight = size.height
- def __delete_cb(self, unused_widget, unused_data=None):
+ def __delete_cb(self, unused_widget, unused_event):
self.app.settings.mainWindowHPanePosition = self.editor.secondhpaned.get_position()
self.app.settings.mainWindowMainHPanePosition = self.editor.mainhpaned.get_position()
self.app.settings.mainWindowVPanePosition = self.editor.toplevel_widget.get_position()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]