summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2006-11-26 00:32:36 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2006-11-26 00:32:36 +0000
commit84732d56a708069d6ad55469228e863776be5313 (patch)
treeacb031cf5944b9275892b3b77b69961659c20396 /src
parentrename INX name for radiobuttons: <item> => <option> (diff)
downloadinkscape-84732d56a708069d6ad55469228e863776be5313.tar.gz
inkscape-84732d56a708069d6ad55469228e863776be5313.zip
Check if dialog is going to be displayed offscreen, if so: move it to center off screen. [ 1596374 ]
To do: copy this to non-gtkmm dialogs (bzr r2039)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/dialog.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 074ee0d36..8fb04a91f 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -31,6 +31,11 @@
#include "interface.h"
#include "verbs.h"
+
+#define MIN_ONSCREEN_DISTANCE 50
+
+
+
namespace Inkscape {
namespace UI {
namespace Dialog {
@@ -96,18 +101,16 @@ Dialog::read_geometry()
// g_print ("read %d %d %d %d\n", x, y, w, h);
- if (x<0) x=0;
- if (y<0) y=0;
-
// If there are stored height and width values for the dialog,
// resize the window to match; otherwise we leave it at its default
if (w != 0 && h != 0) {
resize (w, h);
}
-
+
// If there are stored values for where the dialog should be
// located, then restore the dialog to that position.
- if (x != -1000 && y != -1000) {
+ // 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)) ) {
move(x, y);
} else {
// ...otherwise just put it in the middle of the screen