X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/850323f90aba84761ba411f18086a2b5a674506d..c259a13d673caca062a1e2244c1d70ed60b1926c:/window.c diff --git a/window.c b/window.c index a039ed3b..14bedd86 100644 --- a/window.c +++ b/window.c @@ -110,7 +110,6 @@ static struct unicode_data ucsdata; static int session_closed; static const struct telnet_special *specials; -static int specials_menu_position; static struct { HMENU menu; @@ -2078,11 +2077,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)), @@ -3140,7 +3170,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, HKL kbd_layout = GetKeyboardLayout(0); - static WORD keys[3]; + /* keys is for ToAsciiEx; XXX do we know how big this needs to be? */ + static BYTE keys[3]; static int compose_char = 0; static WPARAM compose_key = 0; @@ -3831,7 +3862,12 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, keystate[VK_CAPITAL] = 0; } - r = ToAsciiEx(wParam, scan, keystate, keys, 0, kbd_layout); + /* 'keys' parameter is declared in MSDN documentation as + * 'LPWORD lpChar'. In 0.54 and below we took that to mean that + * 'keys' should be an array of WORD, but an array of BYTE works + * better on keyboard with dead keys, at least for Win2K/US- + * International and WinXP/German. Bletch. */ + r = ToAsciiEx(wParam, scan, keystate, (LPWORD)keys, 0, kbd_layout); #ifdef SHOW_TOASCII_RESULT if (r == 1 && !key_down) { if (alt_sum) { @@ -4570,7 +4606,7 @@ char *get_window_title(void *frontend, int icon) /* * See if we're in full-screen mode. */ -int is_full_screen() +static int is_full_screen() { if (!IsZoomed(hwnd)) return FALSE; @@ -4584,7 +4620,7 @@ int is_full_screen() * one monitor is present. */ static int get_fullscreen_rect(RECT * ss) { -#ifdef MONITOR_DEFAULTTONEAREST +#if defined(MONITOR_DEFAULTTONEAREST) && !defined(NO_MULTIMON) HMONITOR mon; MONITORINFO mi; mon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); @@ -4609,7 +4645,7 @@ static int get_fullscreen_rect(RECT * ss) * Go full-screen. This should only be called when we are already * maximised. */ -void make_full_screen() +static void make_full_screen() { DWORD style; RECT ss; @@ -4643,7 +4679,7 @@ void make_full_screen() /* * Clear the full-screen attributes. */ -void clear_full_screen() +static void clear_full_screen() { DWORD oldstyle, style; @@ -4673,7 +4709,7 @@ void clear_full_screen() /* * Toggle full-screen mode. */ -void flip_full_screen() +static void flip_full_screen() { if (is_full_screen()) { ShowWindow(hwnd, SW_RESTORE);