]> git.lyx.org Git - features.git/commitdiff
fix bug 3319: LyX starts offscreen when changing monitor configuration
authorPeter Kümmel <syntheticpp@gmx.net>
Fri, 13 Apr 2007 13:42:59 +0000 (13:42 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Fri, 13 Apr 2007 13:42:59 +0000 (13:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17796 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.C

index 8c0ff308afee66ad6285ca17b713f769475f89ce..f56e4845e60fb3027e243c8eca0c2632319ded86 100644 (file)
@@ -358,17 +358,17 @@ void GuiView::setGeometry(unsigned int width,
        // only true when the -geometry option was NOT used
        if (width != 0 && height != 0) {
                if (posx != -1 && posy != -1) {
-                       // if there are ever startup positioning problems 
-                       // on a virtual desktop then check the 6 lines below
+                       // if there are startup positioning problems:
                        // http://doc.trolltech.com/4.2/qdesktopwidget.html 
                        QDesktopWidget& dw = *qApp->desktop();
-                       QRect desk = dw.availableGeometry(dw.primaryScreen());
-                       (posx >= desk.width() ? posx = 50 : true);
-                       (posy >= desk.height()? posy = 50 : true);
-                       // don't allow negative coordinates on a non-virtual desktop
-                       if (!dw.isVirtualDesktop()) {
-                               (posx < 0 ? posx = 50 : true);
-                               (posy < 0 ? posy = 50 : true);
+                       if (dw.isVirtualDesktop()) {
+                               if(!dw.geometry().contains(posx, posy)) {
+                                       posx = 50;
+                                       posy = 50;
+                               }
+                       } else {
+                               // Which system doesn't use a virtual desktop?
+                               // TODO save also last screen number and check if it is still availabe.
                        }
 #ifdef Q_WS_WIN
                        // FIXME: use setGeometry only when Trolltech has fixed the qt4/X11 bug