diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2018-01-09 20:37:43 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2018-01-09 21:32:06 +0000 |
| commit | 87661ee65e9faccb22adeca6a37de7b065e8a702 (patch) | |
| tree | 474f2e077578ae8524f1697ad37dd61c7b267863 /src/ui/dialog/dialog.cpp | |
| parent | Fix profiling build (diff) | |
| parent | Limit default window size to monitor dimensions (diff) | |
| download | inkscape-87661ee65e9faccb22adeca6a37de7b065e8a702.tar.gz inkscape-87661ee65e9faccb22adeca6a37de7b065e8a702.zip | |
Fix and improve window size/position handling/restoration
- Fix broken window size/position restoration after gtk3 deprecation
fixes in fa8a2ee7e2539b145a87ac9af0d9748effa91631
- Use monitor geometry of the monitor Inkscape will be shown on
instead of defaulting to the primary monitor which is often wrong
- Let gtk+ / window manager handle window size/position sanitization
(confirmed working on Windows and Ubuntu 16.04) and remove custom
code which was prone to errors and did not always work as desired
- Make default window size "Small" work again (was broken in gtk3)
and add a new preference "Default" which uses the native window
size (i.e. tries to make just enough room for all controls)
Diffstat (limited to 'src/ui/dialog/dialog.cpp')
| -rw-r--r-- | src/ui/dialog/dialog.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 3d949a8c9..f7e9a1bed 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -20,13 +20,10 @@ #include "dialog-manager.h" #include <gtkmm/dialog.h> -#if GTKMM_CHECK_VERSION(3,22,0) -# include <gdkmm/monitor.h> -#endif - #include <gdk/gdkkeysyms.h> #include "inkscape.h" +#include "ui/monitor.h" #include "ui/tools/tool-base.h" #include "desktop.h" @@ -166,26 +163,9 @@ void Dialog::read_geometry() resize(w, h); } -#if GTKMM_CHECK_VERSION(3,22,0) - auto const display = Gdk::Display::get_default(); - auto monitor = display->get_primary_monitor(); - - // If user hasn't configured a primary monitor, nullptr is returned so try first monitor. - if (!monitor) { - std::cerr << "Dialog::read_geometry: no primary monitor configured!" << std::endl; - monitor = display->get_monitor(0); - } - - Gdk::Rectangle screen_geometry; - if (monitor) { - monitor->get_geometry(screen_geometry); - } - auto const screen_width = screen_geometry.get_width(); - auto const screen_height = screen_geometry.get_height(); -#else - auto const screen_width = gdk_screen_width(); - auto const screen_height = gdk_screen_height(); -#endif + Gdk::Rectangle monitor_geometry = Inkscape::UI::get_monitor_geometry_primary(); + auto const screen_width = monitor_geometry.get_width(); + auto const screen_height = monitor_geometry.get_height(); // If there are stored values for where the dialog should be // located, then restore the dialog to that position. |
