diff options
author | John Ehresman <jpe@wingware.com> | 2013-05-01 10:49:50 -0400 |
---|---|---|
committer | John Ehresman <jpe@wingware.com> | 2013-05-01 10:49:50 -0400 |
commit | ed155f29afee06db8f8730ecffc9680299023f63 (patch) | |
tree | 43445985fd3b3b34ba058eb27d6ff9f4516d5761 | |
parent | 689638d1e56d14d052fbb48048e03b8c361e5a67 (diff) | |
download | scintilla-mirror-ed155f29afee06db8f8730ecffc9680299023f63.tar.gz |
Monitor rect's top right is not necessarily 0, 0
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index aa3f38b95..d0ffcc127 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -647,25 +647,23 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) int ox = oPos.x(); int oy = oPos.y(); ox += rc.left; - if (ox < 0) - ox = 0; oy += rc.top; - if (oy < 0) - oy = 0; QDesktopWidget *desktop = QApplication::desktop(); - QRect rectDesk = desktop->availableGeometry(window(wid)); + QRect rectDesk = desktop->availableGeometry(QPoint(ox, oy)); /* do some corrections to fit into screen */ int sizex = rc.right - rc.left; int sizey = rc.bottom - rc.top; int screenWidth = rectDesk.width(); int screenHeight = rectDesk.height(); + if (ox < rectDesk.x()) + ox = rectDesk.x(); if (sizex > screenWidth) - ox = 0; /* the best we can do */ - else if (ox + sizex > screenWidth) - ox = screenWidth - sizex; - if (oy + sizey > screenHeight) - oy = screenHeight - sizey; + ox = rectDesk.x(); /* the best we can do */ + else if (ox + sizex > rectDesk.right()) + ox = rectDesk.right() - sizex; + if (oy + sizey > rectDesk.bottom()) + oy = rectDesk.bottom() - sizey; Q_ASSERT(wid); window(wid)->move(ox, oy); |