X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/900f9acaaf49b03e188c429b7ab8183eae207b54..eaf1e20af0294d79a176d2ac3b35fd4143163051:/windows/window.c diff --git a/windows/window.c b/windows/window.c index 722f78e0..e997ff06 100644 --- a/windows/window.c +++ b/windows/window.c @@ -1,3 +1,8 @@ +/* + * window.c - the PuTTY(tel) main program, which runs a PuTTY terminal + * emulator and backend in a window. + */ + #include #include #include @@ -1621,8 +1626,8 @@ static void reset_window(int reinit) { #endif } } else { - if ( font_width != win_width/term->cols || - font_height != win_height/term->rows) { + if ( font_width * term->cols != win_width || + font_height * term->rows != win_height) { /* Our only choice at this point is to change the * size of the terminal; Oh well. */ @@ -3723,31 +3728,31 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, if (cfg.nethack_keypad && !left_alt) { switch (wParam) { case VK_NUMPAD1: - *p++ = shift_state ? 'B' : 'b'; + *p++ = "bB\002\002"[shift_state & 3]; return p - output; case VK_NUMPAD2: - *p++ = shift_state ? 'J' : 'j'; + *p++ = "jJ\012\012"[shift_state & 3]; return p - output; case VK_NUMPAD3: - *p++ = shift_state ? 'N' : 'n'; + *p++ = "nN\016\016"[shift_state & 3]; return p - output; case VK_NUMPAD4: - *p++ = shift_state ? 'H' : 'h'; + *p++ = "hH\010\010"[shift_state & 3]; return p - output; case VK_NUMPAD5: *p++ = shift_state ? '.' : '.'; return p - output; case VK_NUMPAD6: - *p++ = shift_state ? 'L' : 'l'; + *p++ = "lL\014\014"[shift_state & 3]; return p - output; case VK_NUMPAD7: - *p++ = shift_state ? 'Y' : 'y'; + *p++ = "yY\031\031"[shift_state & 3]; return p - output; case VK_NUMPAD8: - *p++ = shift_state ? 'K' : 'k'; + *p++ = "kK\013\013"[shift_state & 3]; return p - output; case VK_NUMPAD9: - *p++ = shift_state ? 'U' : 'u'; + *p++ = "uU\025\025"[shift_state & 3]; return p - output; } } @@ -4400,6 +4405,12 @@ void palette_set(void *frontend, int n, int r, int g, int b) UnrealizeObject(pal); RealizePalette(hdc); free_ctx(hdc); + } else { + if (n == (ATTR_DEFBG>>ATTR_BGSHIFT)) + /* If Default Background changes, we need to ensure any + * space between the text area and the window border is + * redrawn. */ + InvalidateRect(hwnd, NULL, TRUE); } } @@ -4428,6 +4439,10 @@ void palette_reset(void *frontend) hdc = get_ctx(frontend); RealizePalette(hdc); free_ctx(hdc); + } else { + /* Default Background may have changed. Ensure any space between + * text area and window border is redrawn. */ + InvalidateRect(hwnd, NULL, TRUE); } } @@ -5153,6 +5168,10 @@ static void make_full_screen() ss.bottom - ss.top, SWP_FRAMECHANGED); + /* We may have changed size as a result */ + + reset_window(0); + /* Tick the menu item in the System menu. */ CheckMenuItem(GetSystemMenu(hwnd, FALSE), IDM_FULLSCREEN, MF_CHECKED);