1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Retire another global in favour of adding a feature to the

terminal.c interface.

[originally from svn r2148]
This commit is contained in:
Simon Tatham 2002-10-26 14:06:52 +00:00
parent 4756c15fc9
commit ea429ee71a
3 changed files with 8 additions and 11 deletions

View File

@ -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 *);

View File

@ -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);
}

View File

@ -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;