Recent

Author Topic: Terminal mouse support in MacOS/NOGPM unix  (Read 258 times)

Dmitry24

  • New Member
  • *
  • Posts: 21
Terminal mouse support in MacOS/NOGPM unix
« on: May 27, 2020, 01:39:49 pm »
I was porting my app to MacOS terminal and found no mouse support (unlike Linux terminal). After some modification of the sources files I was able to turn the mouse support on. I'm not sure if it should be reported to the bugtracker or somewhere else.

In mouse.pp I found out the support was turned off by the instructions
Code: Pascal  [Select][+][-]
  1. {$if defined(aix) or defined(bsd) or defined(solaris)}
  2. {$define NOMOUSE}
  3. {$endif}
  4.  

For me it looked that GPM was not supported in MacOS terminal but mouse terminal sequences was supported through the Keyboard unit. So I just changed the above define NOMOUSE to NOGPM (actually I used a bit different way not to recompile FPC units but the sense it the same):
Code: Pascal  [Select][+][-]
  1. {$define NOGPM}
  2.  

And additionally I called InitMouse procedure disregarding the DetectMouse result (which is default behaviour in the Drivers unit where InitMouse is called only for non-zero ButtonCount = DetectMouse, but DetectMouse returns zero w/o GPM support).

These simple changes turned mouse macOS terminal support on through the use of Keyboard unit which processes mouse special sequences.

Can someone answer if there is any reason for no mouse support on macOS terminal by default? Should this be reported as a bug or improvement request? Should also this way be used to remove the GPM usage on Linux (as I read in gpm.pp file itself the gpm should be abolished ASAP)?

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8491
  • FPC developer.
Re: Terminal mouse support in MacOS/NOGPM unix
« Reply #1 on: May 27, 2020, 01:59:44 pm »
Originally this was mainly for mouse in console. Physical textmode console, not terminals.

However it is possible that it is wrong, and should be more detailed for support in visual consoles. (using what I assume are XTERM escape sequences).

But since then you have two possible situations (real console using GPM/sysmouse) and terminal windows using XTerm escape sequences, that should probably be runtime and not compiletime.

So the situation is not very clear, but filing a bug that something is not right seems prudent.

At the very least the (bsd) should be invidiualized per bsd defining target (free/open/net/darwin).

 

TinyPortal © 2005-2018