aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2005-06-21 10:22:29 +0000
committernyamatongwe <unknown>2005-06-21 10:22:29 +0000
commit4710c96e17f244418c70682f1767286031fed4f3 (patch)
tree1bcebbe724c711c52299deed028596836212e859
parent6bcc10d44289829946c7d28d27a32e2c51b04348 (diff)
downloadscintilla-mirror-4710c96e17f244418c70682f1767286031fed4f3.tar.gz
Patch from Ben Harper enables autocompletion lists to display on a
secondary monitor above or to the left of the main monitor.
-rw-r--r--win32/PlatWin.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 8afa93bd2..9346c3fbe 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -771,11 +771,21 @@ void Window::SetPositionRelative(PRectangle rc, Window w) {
RECT rcOther;
::GetWindowRect(reinterpret_cast<HWND>(w.GetID()), &rcOther);
rc.Move(rcOther.left, rcOther.top);
- if (rc.left < 0) {
- rc.Move(-rc.left,0);
+
+ // Retrieve desktop bounds and make sure window popup's origin isn't left-top of the screen.
+ RECT rcDesktop = {0, 0, 0, 0};
+#ifdef SM_XVIRTUALSCREEN
+ rcDesktop.left = ::GetSystemMetrics(SM_XVIRTUALSCREEN);
+ rcDesktop.top = ::GetSystemMetrics(SM_YVIRTUALSCREEN);
+ rcDesktop.right = rcDesktop.left + ::GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ rcDesktop.bottom = rcDesktop.top + ::GetSystemMetrics(SM_CYVIRTUALSCREEN);
+#endif
+
+ if (rc.left < rcDesktop.left) {
+ rc.Move(rcDesktop.left - rc.left,0);
}
- if (rc.top < 0) {
- rc.Move(0,-rc.top);
+ if (rc.top < rcDesktop.top) {
+ rc.Move(0,rcDesktop.top - rc.top);
}
}
SetPosition(rc);