diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2018-01-07 18:34:57 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2018-01-07 18:34:57 +0000 |
| commit | 0d1885407b9d1dfcf3ddd5c16aeb23bf4f34df3a (patch) | |
| tree | b7346cdb7abf545e0c19c0760067af4915f39fe2 /src/sp-namedview.cpp | |
| parent | Use convenience functions to obtain monitor geometry (diff) | |
| download | inkscape-0d1885407b9d1dfcf3ddd5c16aeb23bf4f34df3a.tar.gz inkscape-0d1885407b9d1dfcf3ddd5c16aeb23bf4f34df3a.zip | |
Limit default window size to monitor dimensions
Diffstat (limited to 'src/sp-namedview.cpp')
| -rw-r--r-- | src/sp-namedview.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index e47587734..59c7129f6 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -771,6 +771,16 @@ void sp_namedview_window_from_document(SPDesktop *desktop) w = h = MIN_WINDOW_SIZE; } else if (default_size == PREFS_WINDOW_SIZE_NATURAL) { // don't set size (i.e. keep the gtk+ default, which will be the natural size) + // unless gtk+ decided it would be a good idea to show a window that is larger than the screen + Gdk::Rectangle monitor_geometry = Inkscape::UI::get_monitor_geometry_at_window(win->get_window()); + int monitor_width = monitor_geometry.get_width(); + int monitor_height = monitor_geometry.get_height(); + int window_width, window_height; + win->get_size(window_width, window_height); + if (window_width > monitor_width || window_height > monitor_height) { + w = std::min(monitor_width, window_width); + h = std::min(monitor_height, window_height); + } } if ((w > 0) && (h > 0)) { #ifndef WIN32 |
