Hi Eli, > > Similarly, in version 6.3 with TERM=xterm, in KDE konsole, when I try > > > > M-x set-variable RET mouse RET normal-tracking RET > > > > it has no effect: Even after this operation, the mouse wheel scrolls. > > In both versions you mentioned, the effect of setting the 'mouse' > variable is as documented: when set to Off, the mouse wheel has no > effect, when set to 'normal-tracking', the wheel scrolls. > > So I'm unsure why that doesn't work for you.
The sequence M-x set-variable RET mouse RET normal-tracking RET does have the effect of setting mouse_protocol = 1. On platforms that use the file pcterm.c I don't doubt that it has the intended effect. But on platforms that use terminal.c it has no effect until the function terminal_begin_using_terminal() has been called again (i.e. mouse scrolling still has the effect of moving the cursor vertically). But when I force it to be called again (through Ctrl-Z and 'fg') it has no effect because this time term_Km has already been set to NULL. With the attached patch to terminal.c, which causes 'term_Km' to keep its original value, the sequence M-x set-variable RET mouse RET normal-tracking RET Ctrl-Z fg RET has the effect that mouse scrolling is now different: now it scrolls the window (leaving the status bar in place) without moving the cursor in the text. With additionally the attached patch to variables.c (quick hack), it finally works - modulo a refresh bug. You surely know how to implement this better. Bruno --- info/terminal.c.bak 2016-01-13 13:33:28.000000000 +0100 +++ info/terminal.c 2016-10-21 17:19:13.000000000 +0200 @@ -129,6 +129,9 @@ /* String introducing a mouse event. */ static char *term_Km; +/* The string to turn off reporting of mouse events. */ +static char *term_mouse_off; + /* Strings entering and leaving standout mode. */ char *term_so, *term_se; @@ -181,9 +184,12 @@ probably harmless if it doesn't. */ if (mouse_protocol == MP_NORMAL_TRACKING && term_Km && !strcmp (term_Km, "\033[M")) - send_to_terminal ("\033[?1000h"); + { + term_mouse_off = "\033[?1000l"; + send_to_terminal ("\033[?1000h"); + } else - term_Km = 0; + term_mouse_off = NULL; if (term_keypad_on) send_to_terminal (term_keypad_on); @@ -217,8 +223,8 @@ RETSIGTYPE (*sigsave) (int signum); /* Turn off mouse reporting ("normal tracking mode"). */ - if (term_Km) - send_to_terminal ("\033[?1000l"); + if (term_mouse_off) + send_to_terminal (term_mouse_off); if (term_keypad_off) send_to_terminal (term_keypad_off); --- info/variables.c.bak 2015-12-19 17:47:40.000000000 +0100 +++ info/variables.c 2016-10-21 17:36:18.000000000 +0200 @@ -370,6 +370,12 @@ { *(int *)var->value = j; var->where_set = where; + if (var->value == &mouse_protocol) + { + terminal_unprep_terminal (); + terminal_prep_terminal (); + /* Here a command to refresh the screen is missing. */ + } return 1; } }