summaryrefslogtreecommitdiffstats
path: root/src/inkscape-window.cpp
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-02-19 23:40:10 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-02-20 01:44:47 +0000
commitbbfd5e166a8adaf0e76919d5ee13e68db1f256c9 (patch)
tree99ed10c824e05345977140022e3e6c02cc80d154 /src/inkscape-window.cpp
parentRescue code for restoring last used window geometry (diff)
downloadinkscape-bbfd5e166a8adaf0e76919d5ee13e68db1f256c9.tar.gz
inkscape-bbfd5e166a8adaf0e76919d5ee13e68db1f256c9.zip
Fix query for monitor dimensions
The call to Gdk::Display::get_monitor_at_window() in Inkscape::UI::get_monitor_geometry_at_window() requires the underlying GdkWindow to be fully initialized. This is achieved by calling "realize()" before attempting to read that information. Previously we used to show the window first (which implies realizing it) which worked around the issue. However it required us to hide and show it once again later if we wanted to move it in order for the window manager's routines to sanitize the position to kick in.
Diffstat (limited to 'src/inkscape-window.cpp')
-rw-r--r--src/inkscape-window.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/inkscape-window.cpp b/src/inkscape-window.cpp
index f85d94473..bcf10cedd 100644
--- a/src/inkscape-window.cpp
+++ b/src/inkscape-window.cpp
@@ -85,11 +85,15 @@ InkscapeWindow::InkscapeWindow(SPDocument* document)
// ================ Window Options ==============
+ // Make sure the GdkWindow is fully initialized before resizing/moving
+ // (ensures the monitor it'll be shown on is known)
+ realize();
+
// Resize the window to match the document properties
sp_namedview_window_from_document(_desktop); // This should probably be a member function here.
-
+
// Must show before setting zoom and view! (crashes otherwise)
- // Should show after resizing/moving to allow window manager to correct an invalid windows size/position
+ // Showing after resizing/moving allows the window manager to correct an invalid size/position of the window
show();
sp_namedview_zoom_and_view_from_document(_desktop);