mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Centralise check of CONF_no_mouse_rep into Terminal.
This removes code duplication between the front ends: now the terminal itself knows when the Conf is asking it not to turn on mouse reporting, and the front ends can assume that if the terminal asks them to then they should just do it. This also makes the behaviour on mid-session reconfiguration more sensible, in both code organisation and consistent behaviour. Previously, term_reconfig would detect that CONF_no_mouse_rep had been *set* in mid-session, and turn off mouse reporting mode in response. But it would do it by clearing term->xterm_mouse, which isn't how the front end enabled and disabled that feature, so things could get into different states from different sequences of events that should have ended up in the same place. Also, the terminal wouldn't re-enable mouse reporting if CONF_no_mouse_rep was *cleared* and the currently running terminal app had been asking for mouse reports all along. Also, it was silly to have half the CONF_no_mouse_rep handling in term_reconfig and the other half in the front ends. Now it should all be sensible, and also all centralised. term->xterm_mouse consistently tracks whether the terminal application is _requesting_ mouse reports; term->xterm_mouse_forbidden tracks whether the client user is vetoing them; every change to either one of those settings triggers a call to term_update_raw_mouse_mode which sets up the front end appropriately for the current combination.
This commit is contained in:
parent
696550a5f2
commit
07aff63e22
17
terminal.c
17
terminal.c
@ -99,6 +99,7 @@ static void term_print_finish(Terminal *);
|
||||
static void scroll(Terminal *, int, int, int, bool);
|
||||
static void parse_optionalrgb(optionalrgb *out, unsigned *values);
|
||||
static void term_added_data(Terminal *term);
|
||||
static void term_update_raw_mouse_mode(Terminal *term);
|
||||
|
||||
static termline *newtermline(Terminal *term, int cols, bool bce)
|
||||
{
|
||||
@ -1506,6 +1507,7 @@ void term_copy_stuff_from_conf(Terminal *term)
|
||||
term->rxvt_homeend = conf_get_bool(term->conf, CONF_rxvt_homeend);
|
||||
term->scroll_on_disp = conf_get_bool(term->conf, CONF_scroll_on_disp);
|
||||
term->scroll_on_key = conf_get_bool(term->conf, CONF_scroll_on_key);
|
||||
term->xterm_mouse_forbidden = conf_get_bool(term->conf, CONF_no_mouse_rep);
|
||||
term->xterm_256_colour = conf_get_bool(term->conf, CONF_xterm_256_colour);
|
||||
term->true_colour = conf_get_bool(term->conf, CONF_true_colour);
|
||||
|
||||
@ -1624,10 +1626,6 @@ void term_reconfig(Terminal *term, Conf *conf)
|
||||
|
||||
if (conf_get_bool(term->conf, CONF_no_alt_screen))
|
||||
swap_screen(term, 0, false, false);
|
||||
if (conf_get_bool(term->conf, CONF_no_mouse_rep)) {
|
||||
term->xterm_mouse = 0;
|
||||
win_set_raw_mouse_mode(term->win, 0);
|
||||
}
|
||||
if (conf_get_bool(term->conf, CONF_no_remote_charset)) {
|
||||
term->cset_attr[0] = term->cset_attr[1] = CSET_ASCII;
|
||||
term->sco_acs = term->alt_sco_acs = 0;
|
||||
@ -1639,6 +1637,7 @@ void term_reconfig(Terminal *term, Conf *conf)
|
||||
term_schedule_tblink(term);
|
||||
term_schedule_cblink(term);
|
||||
term_copy_stuff_from_conf(term);
|
||||
term_update_raw_mouse_mode(term);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2826,6 +2825,12 @@ static void insch(Terminal *term, int n)
|
||||
}
|
||||
}
|
||||
|
||||
static void term_update_raw_mouse_mode(Terminal *term)
|
||||
{
|
||||
bool want_raw = (term->xterm_mouse != 0 && !term->xterm_mouse_forbidden);
|
||||
win_set_raw_mouse_mode(term->win, want_raw);
|
||||
}
|
||||
|
||||
/*
|
||||
* Toggle terminal mode `mode' to state `state'. (`query' indicates
|
||||
* whether the mode is a DEC private one or a normal one.)
|
||||
@ -2897,11 +2902,11 @@ static void toggle_mode(Terminal *term, int mode, int query, bool state)
|
||||
break;
|
||||
case 1000: /* xterm mouse 1 (normal) */
|
||||
term->xterm_mouse = state ? 1 : 0;
|
||||
win_set_raw_mouse_mode(term->win, state);
|
||||
term_update_raw_mouse_mode(term);
|
||||
break;
|
||||
case 1002: /* xterm mouse 2 (inc. button drags) */
|
||||
term->xterm_mouse = state ? 2 : 0;
|
||||
win_set_raw_mouse_mode(term->win, state);
|
||||
term_update_raw_mouse_mode(term);
|
||||
break;
|
||||
case 1006: /* xterm extended mouse */
|
||||
term->xterm_extended_mouse = state;
|
||||
|
@ -150,6 +150,7 @@ struct terminal_tag {
|
||||
bool seen_disp_event;
|
||||
bool big_cursor;
|
||||
|
||||
bool xterm_mouse_forbidden;
|
||||
int xterm_mouse; /* send mouse messages to host */
|
||||
bool xterm_extended_mouse;
|
||||
bool urxvt_extended_mouse;
|
||||
|
@ -2403,7 +2403,6 @@ static void gtk_seat_set_busy_status(Seat *seat, BusyStatus status)
|
||||
static void gtkwin_set_raw_mouse_mode(TermWin *tw, bool activate)
|
||||
{
|
||||
GtkFrontend *inst = container_of(tw, GtkFrontend, termwin);
|
||||
activate = activate && !conf_get_bool(inst->conf, CONF_no_mouse_rep);
|
||||
inst->send_raw_mouse = activate;
|
||||
update_mouseptr(inst);
|
||||
}
|
||||
|
@ -1129,7 +1129,6 @@ static void win_seat_set_busy_status(Seat *seat, BusyStatus status)
|
||||
*/
|
||||
static void wintw_set_raw_mouse_mode(TermWin *tw, bool activate)
|
||||
{
|
||||
activate = activate && !conf_get_bool(conf, CONF_no_mouse_rep);
|
||||
send_raw_mouse = activate;
|
||||
update_mouse_pointer();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user