From eb8ff833e322c11b15215a3ab6303aea8cf76b1d Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 21 Jun 2005 10:22:29 +0000 Subject: Patch from Ben Harper enables autocompletion lists to display on a secondary monitor above or to the left of the main monitor. --- win32/PlatWin.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'win32') 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(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); -- cgit v1.2.3