From c1b55581a60251ae30a1e86578d2967711e0342d Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 26 Oct 2002 14:06:52 +0000 Subject: [PATCH] Retire another global in favour of adding a feature to the terminal.c interface. git-svn-id: svn://svn.tartarus.org/sgt/putty@2148 cda61777-01e9-0310-a592-d414129be87e --- putty.h | 4 +--- terminal.c | 4 ++-- window.c | 11 +++++------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/putty.h b/putty.h index 116e2a3c..3d971aee 100644 --- a/putty.h +++ b/putty.h @@ -92,8 +92,6 @@ typedef struct terminal_tag Terminal; #define ATTR_CUR_AND (~(ATTR_BOLD|ATTR_REVERSE|ATTR_BLINK|ATTR_COLOURS)) #define ATTR_CUR_XOR 0x00BA0000UL -GLOBAL int alt_pressed; - GLOBAL int session_closed; GLOBAL int nsessions; @@ -458,7 +456,7 @@ void registry_cleanup(void); Terminal *term_init(void *frontend); void term_size(Terminal *, int, int, int); void term_out(Terminal *); -void term_paint(Terminal *, Context, int, int, int, int); +void term_paint(Terminal *, Context, int, int, int, int, int); void term_scroll(Terminal *, int, int); void term_pwron(Terminal *); void term_clrsb(Terminal *); diff --git a/terminal.c b/terminal.c index 738c7540..d222351d 100644 --- a/terminal.c +++ b/terminal.c @@ -3106,7 +3106,7 @@ void term_invalidate(Terminal *term) * Paint the window in response to a WM_PAINT message. */ void term_paint(Terminal *term, Context ctx, - int left, int top, int right, int bottom) + int left, int top, int right, int bottom, int immediately) { int i, j; if (left < 0) left = 0; @@ -3128,7 +3128,7 @@ void term_paint(Terminal *term, Context ctx, * fails to actually do anything when re-sizing ... painting the wrong * window perhaps ? */ - if (alt_pressed) + if (immediately) do_paint (term, ctx, FALSE); } diff --git a/window.c b/window.c index e5f22800..e97fc942 100644 --- a/window.c +++ b/window.c @@ -2082,7 +2082,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, (p.rcPaint.left-offset_width)/font_width, (p.rcPaint.top-offset_height)/font_height, (p.rcPaint.right-offset_width-1)/font_width, - (p.rcPaint.bottom-offset_height-1)/font_height); + (p.rcPaint.bottom-offset_height-1)/font_height, + is_alt_pressed()); if (p.fErase || p.rcPaint.left < offset_width || @@ -2189,7 +2190,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, * 1) Keep the sizetip uptodate * 2) Make sure the window size is _stepped_ in units of the font size. */ - if (cfg.resize_action != RESIZE_FONT && !alt_pressed) { + if (cfg.resize_action != RESIZE_FONT && !is_alt_pressed()) { int width, height, w, h, ew, eh; LPRECT r = (LPRECT) lParam; @@ -2350,7 +2351,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, * down the connection during an NT opaque drag.) */ if (resizing) { - if (cfg.resize_action != RESIZE_FONT && !alt_pressed) { + if (cfg.resize_action != RESIZE_FONT && !is_alt_pressed()) { need_backend_resize = TRUE; w = (width-cfg.window_border*2) / font_width; if (w < 1) w = 1; @@ -2554,7 +2555,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } default: if (message == wm_mousewheel || message == WM_MOUSEWHEEL) { - int shift_pressed=0, control_pressed=0, alt_pressed=0; + int shift_pressed=0, control_pressed=0; if (message == WM_MOUSEWHEEL) { wheel_accumulator += (short)HIWORD(wParam); @@ -3188,8 +3189,6 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, } } - alt_pressed = (left_alt && key_down); - scan = (HIWORD(lParam) & (KF_UP | KF_EXTENDED | 0xFF)); shift_state = ((keystate[VK_SHIFT] & 0x80) != 0) + ((keystate[VK_CONTROL] & 0x80) != 0) * 2; -- 2.11.0