summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorAlexander Valavanis <valavanisalex@gmail.com>2017-06-27 13:03:58 +0000
committerAlexander Valavanis <valavanisalex@gmail.com>2017-06-27 13:03:58 +0000
commitfa8a2ee7e2539b145a87ac9af0d9748effa91631 (patch)
tree457bd081679e98e296be9846117508b4524ec7b3 /src/ui
parentselect-tool: Only stop the rubberband when it was started (diff)
downloadinkscape-fa8a2ee7e2539b145a87ac9af0d9748effa91631.tar.gz
inkscape-fa8a2ee7e2539b145a87ac9af0d9748effa91631.zip
GdkScreen deprecation fixes
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/dialog.cpp20
-rw-r--r--src/ui/interface.cpp29
2 files changed, 42 insertions, 7 deletions
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 27a6e55d9..39c913175 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,23 @@ 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();
+
+ Gdk::Rectangle screen_geometry;
+ 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
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 7e80c1a2f..9abc1f07b 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -30,6 +30,10 @@
#include <gtkmm/imagemenuitem.h>
#include <gtkmm/separatormenuitem.h>
+#if WITH_GTKMM_3_22
+# include <gdkmm/monitor.h>
+#endif
+
#include "inkscape.h"
#include "extension/db.h"
#include "extension/effect.h"
@@ -176,13 +180,26 @@ sp_create_window(SPViewWidget *vw, bool editable)
gint full = prefs->getBool("/desktop/geometry/fullscreen");
gint maxed = prefs->getBool("/desktop/geometry/maximized");
if (pw>0 && ph>0) {
- gint w = MIN(gdk_screen_width(), pw);
- gint h = MIN(gdk_screen_height(), ph);
- gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, px);
- gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, py);
+#if WITH_GTKMM_3_22
+ auto const display = Gdk::Display::get_default();
+ auto const monitor = display->get_primary_monitor();
+
+ // A Gdk::Rectangle in "application pixel" units
+ Gdk::Rectangle screen_geometry;
+ 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_height();
+#endif
+ gint w = MIN(screen_width, pw);
+ gint h = MIN(screen_height, ph);
+ gint x = MIN(screen_width - MIN_ONSCREEN_DISTANCE, px);
+ gint y = MIN(screen_height - MIN_ONSCREEN_DISTANCE, py);
if (w>0 && h>0) {
- x = MIN(gdk_screen_width() - w, x);
- y = MIN(gdk_screen_height() - h, y);
+ x = MIN(screen_width - w, x);
+ y = MIN(screen_height - h, y);
desktop->setWindowSize(w, h);
}