From 52a4d15945a1dd17357633b3344344d61ca88608 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 20 Jan 2004 19:41:43 +0000 Subject: [PATCH] Josh Hill's patch for full-screen mode on a multi-monitor system: clicks in the top left of the window should not be detected by comparing the coordinates with (0,0) since this won't work on secondary monitors. git-svn-id: svn://svn.tartarus.org/sgt/putty@3742 cda61777-01e9-0310-a592-d414129be87e --- window.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/window.c b/window.c index c76b083d..9a9a5ce4 100644 --- a/window.c +++ b/window.c @@ -2078,11 +2078,42 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, * window, we put up the System menu instead of doing * selection. */ - if (is_full_screen() && press && button == MBT_LEFT && - X_POS(lParam) == 0 && Y_POS(lParam) == 0) { - SendMessage(hwnd, WM_SYSCOMMAND, SC_MOUSEMENU, 0); - return 0; + { + char mouse_on_hotspot = 0; + POINT pt; + + GetCursorPos(&pt); +#ifndef NO_MULTIMON + { + HMONITOR mon; + MONITORINFO mi; + + mon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); + + if (mon != NULL) { + mi.cbSize = sizeof(MONITORINFO); + GetMonitorInfo(mon, &mi); + + if (mi.rcMonitor.left == pt.x && + mi.rcMonitor.top == pt.y) { + mouse_on_hotspot = 1; + } + CloseHandle(mon); + } + } +#else + if (pt.x == 0 && pt.y == 0) { + mouse_on_hotspot = 1; + } +#endif + if (is_full_screen() && press && + button == MBT_LEFT && mouse_on_hotspot) { + SendMessage(hwnd, WM_SYSCOMMAND, SC_MOUSEMENU, + MAKELPARAM(pt.x, pt.y)); + return 0; + } } + if (press) { click(button, TO_CHR_X(X_POS(lParam)), TO_CHR_Y(Y_POS(lParam)), -- 2.11.0