diff --git a/packages/rtl-console/src/unix/mouse.pp b/packages/rtl-console/src/unix/mouse.pp index c9f3e125a5..9d98a6507d 100644 --- a/packages/rtl-console/src/unix/mouse.pp +++ b/packages/rtl-console/src/unix/mouse.pp @@ -47,6 +47,7 @@ const WaitMouseMove : boolean = false; PrintMouseCur : boolean = false; mousecurofs : longint = -1; + DisableSGRExtModeMouse : boolean = false; var mousecurcell : TVideoCell; @@ -197,6 +198,9 @@ var connect:TGPMConnect; {$endif ndef NOGPM} begin + if fpGetEnv('FPC_DISABLE_SGR_EXT_MODE_MOUSE')='1' then + DisableSGRExtModeMouse:=true; + { if gpm_fs<>-1 then runerror(240);} {Test wether to use X-terminals.} @@ -207,14 +211,16 @@ begin gpm_fs:=-1000; {write(#27'[?1001s');} { save old hilit tracking } write(#27'[?1000h'); { enable mouse tracking } - write(#27'[?1006h'); { try to enable Extended/SGH 1006 mouse tracking } + if not DisableSGRExtModeMouse then + write(#27'[?1006h'); { try to enable Extended/SGH 1006 mouse tracking } end; 1003: begin {Use the xterm mouse, report all mouse events.} gpm_fs:=-1003; write(#27'[?1003h'); { enable mouse tracking } - write(#27'[?1006h'); { try to enable Extended/SGH 1006 mouse tracking } + if not DisableSGRExtModeMouse then + write(#27'[?1006h'); { try to enable Extended/SGH 1006 mouse tracking } end; end; {$ifndef NOGPM} @@ -249,12 +255,14 @@ begin {xterm mouse} write(#27'[?1000l'); { disable mouse tracking } {write(#27'[?1001r');} { Restore old hilit tracking } - write(#27'[?1006l'); { disable Extended/SGH 1006 mouse tracking } + if not DisableSGRExtModeMouse then + write(#27'[?1006l'); { disable Extended/SGH 1006 mouse tracking } end; -1003: begin write(#27'[?1003l'); { disable mouse tracking } - write(#27'[?1006l'); { disable Extended/SGH 1006 mouse tracking } + if not DisableSGRExtModeMouse then + write(#27'[?1006l'); { disable Extended/SGH 1006 mouse tracking } end; {$ifndef NOGPM} else