summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 14d72ef)
raw | patch | inline | side by side (parent: 14d72ef)
author | ulferikson <ulferikson@users.sourceforge.net> | |
Thu, 30 Nov 2006 21:08:58 +0000 (21:08 +0000) | ||
committer | ulferikson <ulferikson@users.sourceforge.net> | |
Thu, 30 Nov 2006 21:08:58 +0000 (21:08 +0000) |
src/sp-namedview.cpp | patch | blob | history |
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 1b973a6ba0ea26cd4f8d7901b152328fe3658cdb..cf83596db631cfdeac4bde10e017be8eb8410776 100644 (file)
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
sp_namedview_setup_grid(this);
}
+#define MIN_ONSCREEN_DISTANCE 50
+
/*
* Restores window geometry from the document settings
*/
// restore window size and position
if (save_geometry) {
- if (nv->window_width != -1 && nv->window_height != -1)
- desktop->setWindowSize(nv->window_width, nv->window_height);
- if (nv->window_x != -1 && nv->window_y != -1)
- desktop->setWindowPosition(NR::Point(nv->window_x, nv->window_y));
+ gint w = MIN(gdk_screen_width(), nv->window_width);
+ gint h = MIN(gdk_screen_height(), nv->window_height);
+ gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, nv->window_x);
+ gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, nv->window_y);
+ if (w>0 && h>0 && x>0 && y>0) {
+ x = MIN(gdk_screen_width() - w, x);
+ y = MIN(gdk_screen_height() - h, y);
+ }
+ if (w>0 && h>0)
+ desktop->setWindowSize(w, h);
+ if (x>0 && y>0)
+ desktop->setWindowPosition(NR::Point(x, y));
}
// restore zoom and view