"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "terminal.c" between
putty-0.75.tar.gz and putty-0.76.tar.gz

About: PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms, along with an xterm terminal emulator.

terminal.c  (putty-0.75):terminal.c  (putty-0.76)
skipping to change at line 1632 skipping to change at line 1632
void term_reconfig(Terminal *term, Conf *conf) void term_reconfig(Terminal *term, Conf *conf)
{ {
/* /*
* Before adopting the new config, check all those terminal * Before adopting the new config, check all those terminal
* settings which control power-on defaults; and if they've * settings which control power-on defaults; and if they've
* changed, we will modify the current state as well as the * changed, we will modify the current state as well as the
* default one. The full list is: Auto wrap mode, DEC Origin * default one. The full list is: Auto wrap mode, DEC Origin
* Mode, BCE, blinking text, character classes. * Mode, BCE, blinking text, character classes.
*/ */
bool reset_wrap, reset_decom, reset_bce, reset_tblink, reset_charclass; bool reset_wrap, reset_decom, reset_bce, reset_tblink, reset_charclass;
bool palette_changed = false;
int i; int i;
reset_wrap = (conf_get_bool(term->conf, CONF_wrap_mode) != reset_wrap = (conf_get_bool(term->conf, CONF_wrap_mode) !=
conf_get_bool(conf, CONF_wrap_mode)); conf_get_bool(conf, CONF_wrap_mode));
reset_decom = (conf_get_bool(term->conf, CONF_dec_om) != reset_decom = (conf_get_bool(term->conf, CONF_dec_om) !=
conf_get_bool(conf, CONF_dec_om)); conf_get_bool(conf, CONF_dec_om));
reset_bce = (conf_get_bool(term->conf, CONF_bce) != reset_bce = (conf_get_bool(term->conf, CONF_bce) !=
conf_get_bool(conf, CONF_bce)); conf_get_bool(conf, CONF_bce));
reset_tblink = (conf_get_bool(term->conf, CONF_blinktext) != reset_tblink = (conf_get_bool(term->conf, CONF_blinktext) !=
conf_get_bool(conf, CONF_blinktext)); conf_get_bool(conf, CONF_blinktext));
skipping to change at line 1677 skipping to change at line 1678
const char *old_title = conf_get_str(term->conf, CONF_wintitle); const char *old_title = conf_get_str(term->conf, CONF_wintitle);
const char *new_title = conf_get_str(conf, CONF_wintitle); const char *new_title = conf_get_str(conf, CONF_wintitle);
if (strcmp(old_title, new_title)) { if (strcmp(old_title, new_title)) {
sfree(term->window_title); sfree(term->window_title);
term->window_title = dupstr(new_title); term->window_title = dupstr(new_title);
term->win_title_pending = true; term->win_title_pending = true;
term_schedule_update(term); term_schedule_update(term);
} }
} }
/*
* Just setting conf is sufficient to cause colour setting changes
* to appear on the next ESC]R palette reset. But we should also
* check whether any colour settings have been changed, so that
* they can be updated immediately if they haven't been overridden
* by some escape sequence.
*/
{
int i, j;
for (i = 0; i < CONF_NCOLOURS; i++) {
for (j = 0; j < 3; j++)
if (conf_get_int_int(term->conf, CONF_colours, i*3+j) !=
conf_get_int_int(conf, CONF_colours, i*3+j))
break;
if (j < 3) {
/* Actually enacting the change has to be deferred
* until the new conf is installed. */
palette_changed = true;
break;
}
}
}
conf_free(term->conf); conf_free(term->conf);
term->conf = conf_copy(conf); term->conf = conf_copy(conf);
if (reset_wrap) if (reset_wrap)
term->alt_wrap = term->wrap = conf_get_bool(term->conf, CONF_wrap_mode); term->alt_wrap = term->wrap = conf_get_bool(term->conf, CONF_wrap_mode);
if (reset_decom) if (reset_decom)
term->alt_om = term->dec_om = conf_get_bool(term->conf, CONF_dec_om); term->alt_om = term->dec_om = conf_get_bool(term->conf, CONF_dec_om);
if (reset_bce) { if (reset_bce) {
term->use_bce = conf_get_bool(term->conf, CONF_bce); term->use_bce = conf_get_bool(term->conf, CONF_bce);
set_erase_char(term); set_erase_char(term);
skipping to change at line 1705 skipping to change at line 1729
if (conf_get_bool(term->conf, CONF_no_alt_screen)) if (conf_get_bool(term->conf, CONF_no_alt_screen))
swap_screen(term, 0, false, false); swap_screen(term, 0, false, false);
if (conf_get_bool(term->conf, CONF_no_remote_charset)) { if (conf_get_bool(term->conf, CONF_no_remote_charset)) {
term->cset_attr[0] = term->cset_attr[1] = CSET_ASCII; term->cset_attr[0] = term->cset_attr[1] = CSET_ASCII;
term->sco_acs = term->alt_sco_acs = 0; term->sco_acs = term->alt_sco_acs = 0;
term->utf = false; term->utf = false;
} }
if (!conf_get_str(term->conf, CONF_printer)) { if (!conf_get_str(term->conf, CONF_printer)) {
term_print_finish(term); term_print_finish(term);
} }
if (palette_changed)
term_notify_palette_changed(term);
term_schedule_tblink(term); term_schedule_tblink(term);
term_schedule_cblink(term); term_schedule_cblink(term);
term_copy_stuff_from_conf(term); term_copy_stuff_from_conf(term);
term_update_raw_mouse_mode(term); term_update_raw_mouse_mode(term);
} }
/* /*
* Clear the scrollback. * Clear the scrollback.
*/ */
void term_clrsb(Terminal *term) void term_clrsb(Terminal *term)
skipping to change at line 1792 skipping to change at line 1818
term->icon_title = dupstr(term->window_title); term->icon_title = dupstr(term->window_title);
} }
term->win_title_pending = true; term->win_title_pending = true;
term->win_icon_title_pending = true; term->win_icon_title_pending = true;
} }
static void palette_rebuild(Terminal *term) static void palette_rebuild(Terminal *term)
{ {
unsigned min_changed = OSC4_NCOLOURS, max_changed = 0; unsigned min_changed = OSC4_NCOLOURS, max_changed = 0;
if (term->win_palette_pending) {
/* Possibly extend existing range. */
min_changed = term->win_palette_pending_min;
max_changed = term->win_palette_pending_limit - 1;
} else {
/* Start with empty range. */
min_changed = OSC4_NCOLOURS;
max_changed = 0;
}
for (unsigned i = 0; i < OSC4_NCOLOURS; i++) { for (unsigned i = 0; i < OSC4_NCOLOURS; i++) {
rgb new_value; rgb new_value;
bool found = false; bool found = false;
for (unsigned j = lenof(term->subpalettes); j-- > 0 ;) { for (unsigned j = lenof(term->subpalettes); j-- > 0 ;) {
if (term->subpalettes[j].present[i]) { if (term->subpalettes[j].present[i]) {
new_value = term->subpalettes[j].values[i]; new_value = term->subpalettes[j].values[i];
found = true; found = true;
break; break;
} }
skipping to change at line 1819 skipping to change at line 1855
term->palette[i] = new_value; term->palette[i] = new_value;
if (min_changed > i) if (min_changed > i)
min_changed = i; min_changed = i;
if (max_changed < i) if (max_changed < i)
max_changed = i; max_changed = i;
} }
} }
if (min_changed <= max_changed) { if (min_changed <= max_changed) {
/* /*
* At least one colour changed, so schedule a redraw event to * At least one colour changed (or we had an update scheduled
* pass the result back to the TermWin. This also requires * already). Schedule a redraw event to pass the result back
* invalidating the rest of the window, because usually all * to the TermWin. This also requires invalidating the rest
* the text will need redrawing in the new colours. * of the window, because usually all the text will need
* redrawing in the new colours.
* (If there was an update pending and this palette rebuild
* didn't actually change anything, we'll harmlessly reinforce
* the existing update request.)
*/ */
term->win_palette_pending = true; term->win_palette_pending = true;
term->win_palette_pending_min = min_changed; term->win_palette_pending_min = min_changed;
term->win_palette_pending_limit = max_changed + 1; term->win_palette_pending_limit = max_changed + 1;
term_invalidate(term); term_invalidate(term);
term_schedule_update(term); term_schedule_update(term);
} }
} }
static void palette_reset(Terminal *term, bool overrides_only) /*
* Rebuild the palette from configuration and platform colours.
* If 'keep_overrides' set, any escape-sequence-specified overrides will
* remain in place.
*/
static void palette_reset(Terminal *term, bool keep_overrides)
{ {
if (!overrides_only) { for (unsigned i = 0; i < OSC4_NCOLOURS; i++)
for (unsigned i = 0; i < OSC4_NCOLOURS; i++) term->subpalettes[SUBPAL_CONF].present[i] = true;
term->subpalettes[SUBPAL_CONF].present[i] = true;
/*
* Copy all the palette information out of the Conf.
*/
for (unsigned i = 0; i < CONF_NCOLOURS; i++) {
rgb *col = &term->subpalettes[SUBPAL_CONF].values[
colour_indices_conf_to_osc4[i]];
col->r = conf_get_int_int(term->conf, CONF_colours, i*3+0);
col->g = conf_get_int_int(term->conf, CONF_colours, i*3+1);
col->b = conf_get_int_int(term->conf, CONF_colours, i*3+2);
}
/* /*
* Directly invent the rest of the xterm-256 colours. * Copy all the palette information out of the Conf.
*/ */
for (unsigned i = 0; i < 216; i++) { for (unsigned i = 0; i < CONF_NCOLOURS; i++) {
rgb *col = &term->subpalettes[SUBPAL_CONF].values[i + 16]; rgb *col = &term->subpalettes[SUBPAL_CONF].values[
int r = i / 36, g = (i / 6) % 6, b = i % 6; colour_indices_conf_to_osc4[i]];
col->r = r ? r * 40 + 55 : 0; col->r = conf_get_int_int(term->conf, CONF_colours, i*3+0);
col->g = g ? g * 40 + 55 : 0; col->g = conf_get_int_int(term->conf, CONF_colours, i*3+1);
col->b = b ? b * 40 + 55 : 0; col->b = conf_get_int_int(term->conf, CONF_colours, i*3+2);
} }
for (unsigned i = 0; i < 24; i++) {
rgb *col = &term->subpalettes[SUBPAL_CONF].values[i + 232];
int shade = i * 10 + 8;
col->r = col->g = col->b = shade;
}
/* /*
* Get rid of all escape-sequence configuration. * Directly invent the rest of the xterm-256 colours.
*/ */
for (unsigned i = 0; i < OSC4_NCOLOURS; i++) for (unsigned i = 0; i < 216; i++) {
term->subpalettes[SUBPAL_SESSION].present[i] = false; rgb *col = &term->subpalettes[SUBPAL_CONF].values[i + 16];
int r = i / 36, g = (i / 6) % 6, b = i % 6;
col->r = r ? r * 40 + 55 : 0;
col->g = g ? g * 40 + 55 : 0;
col->b = b ? b * 40 + 55 : 0;
}
for (unsigned i = 0; i < 24; i++) {
rgb *col = &term->subpalettes[SUBPAL_CONF].values[i + 232];
int shade = i * 10 + 8;
col->r = col->g = col->b = shade;
} }
/* /*
* Re-fetch any OS-local overrides. * Re-fetch any OS-local overrides.
*/ */
for (unsigned i = 0; i < OSC4_NCOLOURS; i++) for (unsigned i = 0; i < OSC4_NCOLOURS; i++)
term->subpalettes[SUBPAL_PLATFORM].present[i] = false; term->subpalettes[SUBPAL_PLATFORM].present[i] = false;
win_palette_get_overrides(term->win); win_palette_get_overrides(term->win, term);
if (!keep_overrides) {
/*
* Get rid of all escape-sequence configuration.
*/
for (unsigned i = 0; i < OSC4_NCOLOURS; i++)
term->subpalettes[SUBPAL_SESSION].present[i] = false;
}
/* /*
* Rebuild the composite palette. * Rebuild the composite palette.
*/ */
palette_rebuild(term); palette_rebuild(term);
} }
void term_palette_override(Terminal *term, unsigned osc4_index, rgb rgb) void term_palette_override(Terminal *term, unsigned osc4_index, rgb rgb)
{ {
/* /*
skipping to change at line 7596 skipping to change at line 7641
p->data = NULL; p->data = NULL;
return +1; /* all done */ return +1; /* all done */
} }
} }
void term_notify_minimised(Terminal *term, bool minimised) void term_notify_minimised(Terminal *term, bool minimised)
{ {
term->minimised = minimised; term->minimised = minimised;
} }
void term_notify_palette_overrides_changed(Terminal *term) void term_notify_palette_changed(Terminal *term)
{ {
palette_reset(term, true); palette_reset(term, true);
} }
void term_notify_window_pos(Terminal *term, int x, int y) void term_notify_window_pos(Terminal *term, int x, int y)
{ {
term->winpos_x = x; term->winpos_x = x;
term->winpos_y = y; term->winpos_y = y;
} }
 End of changes. 11 change blocks. 
41 lines changed or deleted 86 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)