0

In windows, I'd use the struct POINT to get the cursor position (GetCursorPos()) and SetCursorPos() to set his position. I'm really new to linux but I've google the web and I want to know how to manipulate the mouse in linux, basic stuff as getting location and setting location. GCC in Linux isn't recognizing the struct POINT :P Any idea?

P.S. NOT in an X window or OpenGL or whatever. Generally - in the operation system.

Dale Hagglund
  • 16,074
  • 4
  • 30
  • 37
Zach P
  • 1,731
  • 11
  • 16
  • 1
    Linux doesn't recognize the concept of a pointer, which is an X Window concept. All that Linux understands is that there is a hardware called a mouse/touchpad which gives a stream of relative values when you move around your mouse/finger, all the interpretations of those values to draw something on the screen is done by X Window (or [GPM](https://en.wikipedia.org/wiki/GPM_%28software%29)) – Lie Ryan May 10 '14 at 19:14
  • The concept of a mouse pointer position depends on the window manager, which means that it's going to be difficult to write reusable code. However, I might suggest looking into [uinput](http://thiemonge.org/getting-started-with-uinput), which seems to have bindings in other languages too. I have no idea if that'll still work for you, since things might have changed since that page was written. – millinon May 10 '14 at 19:18
  • 1
    This has little to do with Linux and a lot to do with X windows. Make sure to keep your code portable to other non-Linux unices – Good Person May 10 '14 at 19:20
  • @GoodPerson - that's exactly what I'm trying to do, well, any idea how to keep it portable with windows? – Zach P May 10 '14 at 19:34
  • @user3195614 you will likely want to use a wrapping library instead of directly talking to X or Windows. – Good Person May 10 '14 at 19:35
  • possible duplicate of [How to set the mouse position under X11 (linux desktop)?](http://stackoverflow.com/questions/578804/how-to-set-the-mouse-position-under-x11-linux-desktop) – Matteo Italia May 10 '14 at 20:13
  • 1
    *Too broad* does not apply here, IMHO, the broadness of the question is obviously coming from the fact that the OP has not much experience with the linux ecosystem yet. @user3195614: See the question proposed as duplicate and read on the difference between X11 and Linux, and you’ll learn a lot! :) – Jonas Schäfer May 10 '14 at 20:15

0 Answers0