Josh Hill's patch for full-screen mode on a multi-monitor system:
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 20 Jan 2004 19:41:43 +0000 (19:41 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 20 Jan 2004 19:41:43 +0000 (19:41 +0000)
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

index c76b083..9a9a5ce 100644 (file)
--- 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)),