Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse wheel not working on ubuntu 18.04 #29

Closed
mingodad opened this issue Nov 6, 2020 · 7 comments
Closed

Mouse wheel not working on ubuntu 18.04 #29

mingodad opened this issue Nov 6, 2020 · 7 comments

Comments

@mingodad
Copy link

mingodad commented Nov 6, 2020

Hello !
Compiling on my machine with lubuntu 18.04 the mouse click works but not the mouse wheel, see the cmake output bellow:

cmake .
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Library output: xxx/tvision/lib
-- Binary output : xxx/tvision/bin
-- Install path  : /usr/local
-- Build Examples: ON
-- Build w/GPM   : ON
-- gpm library requested
-- gpm library found
-- Configuring done
-- Generating done
-- Build files have been written to: xxx/tvision

And here is tvedit link parameters:

/usr/bin/c++     CMakeFiles/tvedit.dir/examples/tvedit/tvedit1.cpp.o CMakeFiles/tvedit.dir/examples/tvedit/tvedit2.cpp.o CMakeFiles/tvedit.dir/examples/tvedit/tvedit3.cpp.o  -o bin/tvedit  lib/libtvision.a -lncursesw /usr/lib/x86_64-linux-gnu/libgpm.so

Cheers !

@magiblot
Copy link
Owner

magiblot commented Nov 6, 2020

¡Hola Domingo! Gracias por comentar.

Could it be that the version of Ncurses provided by Lubuntu 18.04 is too old?

In source/platform/ncursinp.cpp you can find the following code surrounded by #if:

#if NCURSES_MOUSE_VERSION > 1
        // Mouse wheel support was added in Ncurses v6. Before that, only
        // scroll up would work. It's better not to support wheel scrolling
        // in that case.
        if (mevent.bstate & BUTTON4_PRESSED)
            mouseWheel = mwUp;
        else if (mevent.bstate & BUTTON5_PRESSED)
            mouseWheel = mwDown;
#endif

Try to remove the #if and #endif and then compile again. If you get a compilation error, that means Ncurses is indeed too old.

Unfortunately, upgrading packages in LTS distributions can become a painful process. I don't use Ubuntu regularly, so I can't provide you with specific instructions on how to upgrade Ncurses.

¡Saludos!

@magiblot
Copy link
Owner

magiblot commented Nov 6, 2020

@asanoic, for the mouse to work from a tty console, you have to start the GPM service. I do it like this:

systemctl start gpm.service

And to have it started automatically on every session:

systemctl enable gpm.service

@mingodad
Copy link
Author

mingodad commented Nov 6, 2020

Hello magiblot !
Thank you for reply !
Indeed when switching to full tty (Ctr-Alt-F1) and enabling gpm.service the mouse wheel works, but inside an xterminal it doesn't.

@magiblot
Copy link
Owner

magiblot commented Nov 6, 2020

Yes, mouse support on the tty is independent from Ncurses. What I said about Ncurses only applies to terminal emulators, which is your use case.

@mingodad
Copy link
Author

mingodad commented Nov 6, 2020

I'm looking at https://github.com/orbitalquark/textadept and it uses http://www.leonerd.org.uk/code/libtermkey/ and it has mouse wheel working in xterm.

@magiblot
Copy link
Owner

magiblot commented Nov 6, 2020

Yes. Lack of (complete) mouse wheel is a limitation of Ncurses v5 because of ABI compatibility. Applications which do not rely on Ncurses (such as the one you mention) do not suffer from this limitation.

@magiblot
Copy link
Owner

magiblot commented Nov 8, 2020

Hi Domingo. The only way to work around this issue without a system upgrade is to implement an interface for a library other than Ncurses, and I'm not very interested in doing this.

I don't like to tell users to change their working environment, but this is all I can do for now. According to https://bugs.launchpad.net/ubuntu/+source/htop/+bug/1730143/comments/4, the Ncurses ABI was upgraded to v6 in Ubuntu 18.10 (Cosmic Cuttlefish). Maybe you can afford to upgrade your system to that version (or preferably a newer one).

Saludos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants