mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Improve support for non-colour displays by adding a mask of attributes to
ignore when breaking text into runs for display, and implement setting this on Mac (other ports just use 0xffffffff). We don't use DeviceLoop for this any more because Apple Technical Q&A QA1024 says we shouldn't. Unlike their example, we don't depend on the Display Manager's being present either. [originally from svn r2264]
This commit is contained in:
parent
26f8c13f7b
commit
12081087e7
@ -52,8 +52,6 @@ typedef struct {
|
|||||||
char *realhost;
|
char *realhost;
|
||||||
/* Logging */
|
/* Logging */
|
||||||
void *logctx;
|
void *logctx;
|
||||||
/* Conveniences */
|
|
||||||
unsigned long attr_mask; /* Mask of attributes to display */
|
|
||||||
|
|
||||||
/* Mac-specific elements */
|
/* Mac-specific elements */
|
||||||
short fontnum;
|
short fontnum;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macterm.c,v 1.15 2002/11/28 21:10:55 ben Exp $ */
|
/* $Id: macterm.c,v 1.16 2002/11/29 00:32:03 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Simon Tatham
|
* Copyright (c) 1999 Simon Tatham
|
||||||
* Copyright (c) 1999, 2002 Ben Harris
|
* Copyright (c) 1999, 2002 Ben Harris
|
||||||
@ -94,13 +94,9 @@ static RoutineDescriptor mac_scrolltracker_upp =
|
|||||||
static RoutineDescriptor do_text_for_device_upp =
|
static RoutineDescriptor do_text_for_device_upp =
|
||||||
BUILD_ROUTINE_DESCRIPTOR(uppDeviceLoopDrawingProcInfo,
|
BUILD_ROUTINE_DESCRIPTOR(uppDeviceLoopDrawingProcInfo,
|
||||||
(ProcPtr)do_text_for_device);
|
(ProcPtr)do_text_for_device);
|
||||||
static RoutineDescriptor mac_set_attr_mask_upp =
|
|
||||||
BUILD_ROUTINE_DESCRIPTOR(uppDeviceLoopDrawingProcInfo,
|
|
||||||
(ProcPtr)mac_set_attr_mask);
|
|
||||||
#else /* not TARGET_RT_MAC_CFM */
|
#else /* not TARGET_RT_MAC_CFM */
|
||||||
#define mac_scrolltracker_upp mac_scrolltracker
|
#define mac_scrolltracker_upp mac_scrolltracker
|
||||||
#define do_text_for_device_upp do_text_for_device
|
#define do_text_for_device_upp do_text_for_device
|
||||||
#define mac_set_attr_mask_upp mac_set_attr_mask
|
|
||||||
#endif /* not TARGET_RT_MAC_CFM */
|
#endif /* not TARGET_RT_MAC_CFM */
|
||||||
|
|
||||||
static void inbuf_putc(Session *s, int c) {
|
static void inbuf_putc(Session *s, int c) {
|
||||||
@ -170,7 +166,6 @@ void mac_newsession(void) {
|
|||||||
|
|
||||||
mac_initfont(s);
|
mac_initfont(s);
|
||||||
mac_initpalette(s);
|
mac_initpalette(s);
|
||||||
s->attr_mask = ATTR_MASK;
|
|
||||||
if (HAVE_COLOR_QD()) {
|
if (HAVE_COLOR_QD()) {
|
||||||
/* Set to FALSE to not get palette updates in the background. */
|
/* Set to FALSE to not get palette updates in the background. */
|
||||||
SetPalette(s->window, s->palette, TRUE);
|
SetPalette(s->window, s->palette, TRUE);
|
||||||
@ -946,12 +941,34 @@ void do_cursor(Context ctx, int x, int y, char *text, int len,
|
|||||||
* Should probably be called start_redraw or something.
|
* Should probably be called start_redraw or something.
|
||||||
*/
|
*/
|
||||||
void pre_paint(Session *s) {
|
void pre_paint(Session *s) {
|
||||||
|
GDHandle gdh;
|
||||||
|
Rect myrect, tmprect;
|
||||||
|
|
||||||
s->attr_mask = ATTR_INVALID;
|
s->term->attr_mask = 0xffffffff;
|
||||||
if (HAVE_COLOR_QD())
|
if (HAVE_COLOR_QD()) {
|
||||||
DeviceLoop(s->window->visRgn, &mac_set_attr_mask_upp, (long)s, 0);
|
SetPort(s->window);
|
||||||
else
|
myrect = (*s->window->visRgn)->rgnBBox;
|
||||||
mac_set_attr_mask(1, 0, NULL, (long)s);
|
LocalToGlobal((Point *)&myrect.top);
|
||||||
|
LocalToGlobal((Point *)&myrect.bottom);
|
||||||
|
for (gdh = GetDeviceList();
|
||||||
|
gdh != NULL;
|
||||||
|
gdh = GetNextDevice(gdh)) {
|
||||||
|
if (TestDeviceAttribute(gdh, screenDevice) &&
|
||||||
|
TestDeviceAttribute(gdh, screenActive) &&
|
||||||
|
SectRect(&(*gdh)->gdRect, &myrect, &tmprect)) {
|
||||||
|
switch ((*(*gdh)->gdPMap)->pixelSize) {
|
||||||
|
case 1:
|
||||||
|
if (s->cfg.bold_colour)
|
||||||
|
s->term->attr_mask &= ~ATTR_BOLD;
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
case 2:
|
||||||
|
s->term->attr_mask &= ~ATTR_COLOURS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
s->term->attr_mask &= ~(ATTR_COLOURS |
|
||||||
|
(s->cfg.bold_colour ? ATTR_BOLD : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Context get_ctx(void *frontend) {
|
Context get_ctx(void *frontend) {
|
||||||
@ -965,26 +982,6 @@ void free_ctx(Context ctx) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static pascal void mac_set_attr_mask(short depth, short devflags,
|
|
||||||
GDHandle device, long cookie) {
|
|
||||||
|
|
||||||
Session *s = (Session *)cookie;
|
|
||||||
|
|
||||||
switch (depth) {
|
|
||||||
default:
|
|
||||||
s->attr_mask |= ATTR_FGMASK | ATTR_BGMASK;
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
case 2:
|
|
||||||
s->attr_mask |= ATTR_BOLD;
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
case 1:
|
|
||||||
s->attr_mask |= ATTR_UNDER | ATTR_REVERSE | TATTR_ACTCURS |
|
|
||||||
TATTR_PASCURS | ATTR_ASCII | ATTR_GBCHR | ATTR_LINEDRW |
|
|
||||||
(s->cfg.bold_colour ? 0 : ATTR_BOLD);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Presumably this does something in Windows
|
* Presumably this does something in Windows
|
||||||
*/
|
*/
|
||||||
|
@ -336,6 +336,7 @@ Terminal *term_init(Config *mycfg, void *frontend)
|
|||||||
term->nbeeps = 0;
|
term->nbeeps = 0;
|
||||||
term->lastbeep = FALSE;
|
term->lastbeep = FALSE;
|
||||||
term->beep_overloaded = FALSE;
|
term->beep_overloaded = FALSE;
|
||||||
|
term->attr_mask = 0xffffffff;
|
||||||
term->resize_fn = NULL;
|
term->resize_fn = NULL;
|
||||||
term->resize_ctx = NULL;
|
term->resize_ctx = NULL;
|
||||||
|
|
||||||
@ -3039,7 +3040,8 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise)
|
|||||||
if ((term->disptext[idx] ^ tattr) & ATTR_WIDE)
|
if ((term->disptext[idx] ^ tattr) & ATTR_WIDE)
|
||||||
dirty_line = TRUE;
|
dirty_line = TRUE;
|
||||||
|
|
||||||
break_run = (tattr != attr || j - start >= sizeof(ch));
|
break_run = (((tattr ^ attr) & term->attr_mask) ||
|
||||||
|
j - start >= sizeof(ch));
|
||||||
|
|
||||||
/* Special hack for VT100 Linedraw glyphs */
|
/* Special hack for VT100 Linedraw glyphs */
|
||||||
if ((attr & CSET_MASK) == 0x2300 && tchar >= 0xBA
|
if ((attr & CSET_MASK) == 0x2300 && tchar >= 0xBA
|
||||||
|
@ -155,6 +155,9 @@ struct terminal_tag {
|
|||||||
|
|
||||||
short wordness[256];
|
short wordness[256];
|
||||||
|
|
||||||
|
/* Mask of attributes to pay attention to when painting. */
|
||||||
|
unsigned long attr_mask;
|
||||||
|
|
||||||
wchar_t *paste_buffer;
|
wchar_t *paste_buffer;
|
||||||
int paste_len, paste_pos, paste_hold;
|
int paste_len, paste_pos, paste_hold;
|
||||||
long last_paste;
|
long last_paste;
|
||||||
|
Loading…
Reference in New Issue
Block a user