I try to move the cursor depending on hand position. I find some examples, but they don't standart library. How can I set cursor position using C++ on linux?
Asked
Active
Viewed 1,114 times
-1
-
2There isn't a standard way to do this, keep with the examples you found (probably ASCII control characters). – πάντα ῥεῖ Jan 10 '15 at 11:39
2 Answers
1
It depends if you are coding a terminal application, or a graphical desktop application.
For terminal applications, use ncurses library, see e.g. this answer
For GUI applications, use an appropriate toolkit, e.g. Qt. See also libsdl

Community
- 1
- 1

Basile Starynkevitch
- 223,805
- 18
- 296
- 547
1
The answer from Basile Starynkevitch is the way to go if you are advanced enough in C++ to be able to work with the frameworks - however, there is a X11 automation tool called xdotool that you can to perform the mouse movements. You can either use it or look in the sources how they implement the communication with X11. Still, I'm not sure if all Linux distributions have this package and how broadly it is supported.

Rudolfs Bundulis
- 11,636
- 6
- 33
- 71