summaryrefslogtreecommitdiffstats
path: root/src/ui/uxmanager.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2018-01-09 20:37:43 +0000
committerEduard Braun <eduard.braun2@gmx.de>2018-01-09 21:32:06 +0000
commit87661ee65e9faccb22adeca6a37de7b065e8a702 (patch)
tree474f2e077578ae8524f1697ad37dd61c7b267863 /src/ui/uxmanager.cpp
parentFix profiling build (diff)
parentLimit default window size to monitor dimensions (diff)
downloadinkscape-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/uxmanager.cpp')
-rw-r--r--src/ui/uxmanager.cpp28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp
index f48f40879..3ec38edf9 100644
--- a/src/ui/uxmanager.cpp
+++ b/src/ui/uxmanager.cpp
@@ -17,12 +17,10 @@
#include "uxmanager.h"
#include "desktop.h"
+#include "ui/monitor.h"
#include "util/ege-tags.h"
#include "widgets/toolbox.h"
-#if GTKMM_CHECK_VERSION(3,22,0)
-# include <gdkmm/monitor.h>
-#endif
using std::vector;
@@ -125,27 +123,11 @@ UXManagerImpl::UXManagerImpl() :
tags.addTag(ege::Tag("Icons"));
// Figure out if we're on a widescreen display
-#if GTKMM_CHECK_VERSION(3,22,0)
- auto display = Gdk::Display::get_default();
- auto monitor = display->get_primary_monitor();
-
- // Fallback to monitor number 0 if the user hasn't configured a primary monitor
- if (!monitor) {
- monitor = display->get_monitor(0);
- }
+ Gdk::Rectangle monitor_geometry = Inkscape::UI::get_monitor_geometry_primary();
+ int const width = monitor_geometry.get_width();
+ int const height = monitor_geometry.get_height();
- if(monitor) {
- Gdk::Rectangle monitor_geometry;
- monitor->get_geometry(monitor_geometry);
-
- int const width = monitor_geometry.get_width();
- int const height = monitor_geometry.get_height();
-#else
- Glib::RefPtr<Gdk::Screen> defaultScreen = Gdk::Screen::get_default();
- if (defaultScreen) {
- int width = defaultScreen->get_width();
- int height = defaultScreen->get_height();
-#endif
+ if (width && height) {
gdouble aspect = static_cast<gdouble>(width) / static_cast<gdouble>(height);
if (aspect > 1.65) {
_widescreen = true;