diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2017-12-26 01:37:03 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2017-12-26 01:37:03 +0000 |
| commit | f138eb91106c9b6abf6d4b07cb1ff8929fcbf0d0 (patch) | |
| tree | 731dfe055b0aff926601da6c3106a017fed14558 /src/ui/uxmanager.cpp | |
| parent | LPE message Gtkmm deprecation fixes (diff) | |
| download | inkscape-f138eb91106c9b6abf6d4b07cb1ff8929fcbf0d0.tar.gz inkscape-f138eb91106c9b6abf6d4b07cb1ff8929fcbf0d0.zip | |
UXManager: Gtkmm deprecation fix
Diffstat (limited to 'src/ui/uxmanager.cpp')
| -rw-r--r-- | src/ui/uxmanager.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index c263eaded..f48f40879 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -20,6 +20,10 @@ #include "util/ege-tags.h" #include "widgets/toolbox.h" +#if GTKMM_CHECK_VERSION(3,22,0) +# include <gdkmm/monitor.h> +#endif + using std::vector; class TrackItem @@ -120,10 +124,28 @@ UXManagerImpl::UXManagerImpl() : tags.addTag(ege::Tag("General")); 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); + } + + 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 gdouble aspect = static_cast<gdouble>(width) / static_cast<gdouble>(height); if (aspect > 1.65) { _widescreen = true; |
