From 7a100534d3dbfd4ce06245fee0dcec04cd724a72 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 3 Apr 2025 20:50:36 +0100 Subject: [PATCH] Rename cursor attributes from the TATTR_ to the ATTR_ namespace No functional change. --- putty.h | 28 ++++++++++++++-------------- terminal/terminal.c | 8 ++++---- unix/window.c | 14 +++++++------- windows/window.c | 14 +++++++------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/putty.h b/putty.h index b6b8518f..dbd85298 100644 --- a/putty.h +++ b/putty.h @@ -208,9 +208,6 @@ extern const int colour_indices_oscp_to_osc4[OSCP_NCOLOURS]; * ATTR_INVALID is an illegal colour combination. */ -#define TATTR_ACTCURS 0x40000000UL /* active cursor (block) */ -#define TATTR_PASCURS 0x20000000UL /* passive cursor (box) */ -#define TATTR_RIGHTCURS 0x10000000UL /* cursor-on-RHS */ #define TATTR_COMBINING 0x80000000UL /* combining characters */ #define DATTR_STARTRUN 0x80000000UL /* start of redraw run */ @@ -256,17 +253,20 @@ extern const int colour_indices_oscp_to_osc4[OSCP_NCOLOURS]; */ #define UCSWIDE 0xDFFF -#define ATTR_NARROW 0x0800000U -#define ATTR_WIDE 0x0400000U -#define ATTR_BOLD 0x0040000U -#define ATTR_UNDER 0x0080000U -#define ATTR_REVERSE 0x0100000U -#define ATTR_BLINK 0x0200000U -#define ATTR_FGMASK 0x00001FFU /* stores a colour in OSC 4 indexing */ -#define ATTR_BGMASK 0x003FE00U /* stores a colour in OSC 4 indexing */ -#define ATTR_COLOURS 0x003FFFFU -#define ATTR_DIM 0x1000000U -#define ATTR_STRIKE 0x2000000U +#define ATTR_NARROW 0x00800000U +#define ATTR_WIDE 0x00400000U +#define ATTR_BOLD 0x00040000U +#define ATTR_UNDER 0x00080000U +#define ATTR_REVERSE 0x00100000U +#define ATTR_BLINK 0x00200000U +#define ATTR_FGMASK 0x000001FFU /* stores a colour in OSC 4 indexing */ +#define ATTR_BGMASK 0x0003FE00U /* stores a colour in OSC 4 indexing */ +#define ATTR_COLOURS 0x0003FFFFU +#define ATTR_DIM 0x01000000U +#define ATTR_STRIKE 0x02000000U +#define ATTR_ACTCURS 0x40000000UL /* active cursor (block) */ +#define ATTR_PASCURS 0x20000000UL /* passive cursor (box) */ +#define ATTR_RIGHTCURS 0x10000000UL /* cursor-on-RHS */ #define ATTR_FGSHIFT 0 #define ATTR_BGSHIFT 9 diff --git a/terminal/terminal.c b/terminal/terminal.c index 23b9a970..4d1d4f5b 100644 --- a/terminal/terminal.c +++ b/terminal/terminal.c @@ -6017,7 +6017,7 @@ static void do_paint_draw(Terminal *term, termline *ldata, int x, int y, IS_REGIONAL_INDICATOR_LETTER(ch[1])) attr |= ATTR_WIDE | TATTR_COMBINING; win_draw_text(term->win, x, y, ch, ccount, attr, ldata->lattr, tc); - if (attr & (TATTR_ACTCURS | TATTR_PASCURS)) + if (attr & (ATTR_ACTCURS | ATTR_PASCURS)) win_draw_cursor(term->win, x, y, ch, ccount, attr, ldata->lattr, tc); } @@ -6053,13 +6053,13 @@ static void do_paint(Terminal *term) if (term->cursor_on) { if (term->has_focus) { if (term->cblinker || !term->blink_cur) - cursor = TATTR_ACTCURS; + cursor = ATTR_ACTCURS; else cursor = 0; } else - cursor = TATTR_PASCURS; + cursor = ATTR_PASCURS; if (term->wrapnext) - cursor |= TATTR_RIGHTCURS; + cursor |= ATTR_RIGHTCURS; } else cursor = 0; our_curs_y = term->curs.y - term->disptop; diff --git a/unix/window.c b/unix/window.c index e3b7d61b..a172c1c4 100644 --- a/unix/window.c +++ b/unix/window.c @@ -3886,7 +3886,7 @@ static void do_text_internal( nfg = ((monochrome ? ATTR_DEFFG : (attr & ATTR_FGMASK)) >> ATTR_FGSHIFT); nbg = ((monochrome ? ATTR_DEFBG : (attr & ATTR_BGMASK)) >> ATTR_BGSHIFT); - if (!!(attr & ATTR_REVERSE) ^ (monochrome && (attr & TATTR_ACTCURS))) { + if (!!(attr & ATTR_REVERSE) ^ (monochrome && (attr & ATTR_ACTCURS))) { struct optionalrgb trgb; t = nfg; @@ -3905,7 +3905,7 @@ static void do_text_internal( if (nbg < 16) nbg |= 8; else if (nbg >= 256) nbg |= 1; } - if ((attr & TATTR_ACTCURS) && !monochrome) { + if ((attr & ATTR_ACTCURS) && !monochrome) { truecolour.fg = truecolour.bg = optionalrgb_none; nfg = 260; nbg = 261; @@ -4071,13 +4071,13 @@ static void gtkwin_draw_cursor( bool active, passive; int widefactor; - if (attr & TATTR_PASCURS) { - attr &= ~TATTR_PASCURS; + if (attr & ATTR_PASCURS) { + attr &= ~ATTR_PASCURS; passive = true; } else passive = false; - if ((attr & TATTR_ACTCURS) && inst->cursor_type != CURSOR_BLOCK) { - attr &= ~TATTR_ACTCURS; + if ((attr & ATTR_ACTCURS) && inst->cursor_type != CURSOR_BLOCK) { + attr &= ~ATTR_ACTCURS; active = true; } else active = false; @@ -4138,7 +4138,7 @@ static void gtkwin_draw_cursor( length = len * widefactor * char_width; } else /* inst->cursor_type == CURSOR_VERTICAL_LINE */ { int xadjust = 0; - if (attr & TATTR_RIGHTCURS) + if (attr & ATTR_RIGHTCURS) xadjust = char_width - 1; startx = x * inst->font_width + inst->window_border + xadjust; starty = y * inst->font_height + inst->window_border; diff --git a/windows/window.c b/windows/window.c index efc028e9..e28ec652 100644 --- a/windows/window.c +++ b/windows/window.c @@ -3571,7 +3571,7 @@ static void do_text_internal( x += wgs->offset_width; y += wgs->offset_height; - if ((attr & TATTR_ACTCURS) && + if ((attr & ATTR_ACTCURS) && (wgs->cursor_type == CURSOR_BLOCK || wgs->term->big_cursor)) { truecolour.fg = truecolour.bg = optionalrgb_none; attr &= ~(ATTR_REVERSE|ATTR_BLINK|ATTR_COLOURS|ATTR_DIM); @@ -3967,14 +3967,14 @@ static void wintw_draw_cursor( lattr &= LATTR_MODE; - if ((attr & TATTR_ACTCURS) && + if ((attr & ATTR_ACTCURS) && (ctype == CURSOR_BLOCK || wgs->term->big_cursor)) { if (*text != UCSWIDE) { win_draw_text(tw, x, y, text, len, attr, lattr, truecolour); return; } ctype = CURSOR_VERTICAL_LINE; - attr |= TATTR_RIGHTCURS; + attr |= ATTR_RIGHTCURS; } fnt_width = char_width = wgs->font_width * (1 + (lattr != LATTR_NORM)); @@ -3985,7 +3985,7 @@ static void wintw_draw_cursor( x += wgs->offset_width; y += wgs->offset_height; - if ((attr & TATTR_PASCURS) && + if ((attr & ATTR_PASCURS) && (ctype == CURSOR_BLOCK || wgs->term->big_cursor)) { POINT pts[5]; HPEN oldpen; @@ -3998,7 +3998,7 @@ static void wintw_draw_cursor( Polyline(wgs->wintw_hdc, pts, 5); oldpen = SelectObject(wgs->wintw_hdc, oldpen); DeleteObject(oldpen); - } else if ((attr & (TATTR_ACTCURS | TATTR_PASCURS)) && + } else if ((attr & (ATTR_ACTCURS | ATTR_PASCURS)) && ctype != CURSOR_BLOCK) { int startx, starty, dx, dy, length, i; if (ctype == CURSOR_UNDERLINE) { @@ -4009,7 +4009,7 @@ static void wintw_draw_cursor( length = char_width; } else /* ctype == CURSOR_VERTICAL_LINE */ { int xadjust = 0; - if (attr & TATTR_RIGHTCURS) + if (attr & ATTR_RIGHTCURS) xadjust = char_width - 1; startx = x + xadjust; starty = y; @@ -4017,7 +4017,7 @@ static void wintw_draw_cursor( dy = 1; length = wgs->font_height; } - if (attr & TATTR_ACTCURS) { + if (attr & ATTR_ACTCURS) { HPEN oldpen; oldpen = SelectObject(wgs->wintw_hdc,