diff --git a/terminal.c b/terminal.c index caebe13d..9fc2ea53 100644 --- a/terminal.c +++ b/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; diff --git a/terminal.h b/terminal.h index e64738e5..2237bb7d 100644 --- a/terminal.h +++ b/terminal.h @@ -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; diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 06617645..8178aba2 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -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); } diff --git a/windows/window.c b/windows/window.c index 415b0485..bbd5a8d1 100644 --- a/windows/window.c +++ b/windows/window.c @@ -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(); }