summaryrefslogtreecommitdiffstats
path: root/src/svg-view-slideshow.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/svg-view-slideshow.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/svg-view-slideshow.cpp')
-rw-r--r--src/svg-view-slideshow.cpp41
1 files changed, 4 insertions, 37 deletions
diff --git a/src/svg-view-slideshow.cpp b/src/svg-view-slideshow.cpp
index 0e50d582b..430fd9ce5 100644
--- a/src/svg-view-slideshow.cpp
+++ b/src/svg-view-slideshow.cpp
@@ -30,11 +30,6 @@
#endif
#include <glibmm/main.h>
-
-#if GTKMM_CHECK_VERSION(3,22,0)
-# include <gdkmm/monitor.h>
-#endif
-
#include <gtkmm/button.h>
#include <gtkmm/buttonbox.h>
#include <gtkmm/image.h>
@@ -42,16 +37,13 @@
#include "document.h"
#include "ui/icon-names.h"
+#include "ui/monitor.h"
#include "util/units.h"
#include "svg-view.h"
#include "svg-view-slideshow.h"
#include "svg-view-widget.h"
-#if GTKMM_CHECK_VERSION(3,22,0)
-# include <gdkmm/monitor.h>
-#endif
-
SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, bool full_screen, int timer, double scale)
: _slides(slides)
@@ -64,34 +56,9 @@ SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, bool full_scr
, _ctrlwin(NULL)
{
// setup initial document
-#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);
-
- auto const monitor_width = monitor_geometry.get_width();
- auto const monitor_height = monitor_geometry.get_height();
-
-#else
- auto default_screen = Gdk::Screen::get_default();
-
- if (default_screen) {
- auto const monitor_width = default_screen->get_width();
- auto const monitor_height = default_screen->get_height();
-#endif
-
- set_default_size(MIN ((int)_doc->getWidth().value("px")*_scale, monitor_width - 64),
- MIN ((int)_doc->getHeight().value("px")*_scale, monitor_height - 64));
-
- }
+ Gdk::Rectangle monitor_geometry = Inkscape::UI::get_monitor_geometry_primary(); // TODO: is inkview always launched on primary monitor?
+ set_default_size(MIN ((int)_doc->getWidth().value("px")*_scale, monitor_geometry.get_width() - 64),
+ MIN ((int)_doc->getHeight().value("px")*_scale, monitor_geometry.get_height() - 64));
_view = sp_svg_view_widget_new(_doc);
SP_SVG_VIEW_WIDGET(_view)->setResize( false, _doc->getWidth().value("px"), _doc->getHeight().value("px") );