From b35da777e89166e572344dce1247efccbb53fcf4 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 7 Jan 2018 19:13:08 +0100 Subject: Use convenience functions to obtain monitor geometry --- src/ui/uxmanager.cpp | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'src/ui/uxmanager.cpp') 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 -#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 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(width) / static_cast(height); if (aspect > 1.65) { _widescreen = true; -- cgit v1.2.3