diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-01 02:03:38 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-01 02:03:38 +0000 |
| commit | 0d5bb885dee83f041830dc950d3be6f21a37f08b (patch) | |
| tree | 88a0ae7a15ed496ddad1f83f43547783b88843ac /src/ui/dialog/dialog.cpp | |
| parent | Bug fixes (diff) | |
| parent | Add Mac CI build config (diff) | |
| download | inkscape-0d5bb885dee83f041830dc950d3be6f21a37f08b.tar.gz inkscape-0d5bb885dee83f041830dc950d3be6f21a37f08b.zip | |
update to trunk
Diffstat (limited to 'src/ui/dialog/dialog.cpp')
| -rw-r--r-- | src/ui/dialog/dialog.cpp | 20 |
1 files changed, 19 insertions, 1 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 |
