summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/dialog.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-07-09 12:42:10 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-07-09 12:42:10 +0000
commit241554b7ad311b5868ba284c7a4e6a410432b9bd (patch)
tree8bf6fed572d27e9b97ca60b90ae1684ba4856eeb /src/ui/dialog/dialog.cpp
parentUse .xml when exporting shortcuts by default (diff)
parentShortcuts: Fix for 7d248fbba5b0c24d9a24cda8c3f2e79f96395553 (is_user_set was ... (diff)
downloadinkscape-241554b7ad311b5868ba284c7a4e6a410432b9bd.tar.gz
inkscape-241554b7ad311b5868ba284c7a4e6a410432b9bd.zip
Merge branch 'master' into shortcuts
Diffstat (limited to 'src/ui/dialog/dialog.cpp')
-rw-r--r--src/ui/dialog/dialog.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index f36b13d9b..9037e8377 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -19,6 +19,11 @@
#include "dialog-manager.h"
#include <gtkmm/dialog.h>
+
+#if WITH_GTKMM_3_22
+# include <gdkmm/monitor.h>
+#endif
+
#include <gdk/gdkkeysyms.h>
#include "inkscape.h"
@@ -161,10 +166,26 @@ void Dialog::read_geometry()
resize(w, h);
}
+#if WITH_GTKMM_3_22
+ auto const display = Gdk::Display::get_default();
+ auto const monitor = display->get_primary_monitor();
+
+ // If user hasn't configured a primary monitor, nullptr is returned.
+ 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_width();
+#endif
+
// If there are stored values for where the dialog should be
// located, then restore the dialog to that position.
// also check if (x,y) is actually onscreen with the current screen dimensions
- if ( (x >= 0) && (y >= 0) && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE)) ) {
+ if ( (x >= 0) && (y >= 0) && (x < (screen_width-MIN_ONSCREEN_DISTANCE)) && (y < (screen_height-MIN_ONSCREEN_DISTANCE)) ) {
move(x, y);
} else {
// ...otherwise just put it in the middle of the screen