Thread: Control Mouse

  1. #1
    Registered User
    Join Date
    Oct 2005
    Location
    Brasil
    Posts
    220

    Control Mouse

    How can i can control mouse position? (Not only in my app, but in the whole system)

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Scarvenger View Post
    How can i can control mouse position? (Not only in my app, but in the whole system)
    The most basic X call to move the mouse is XWarpPointer(), but to use it you need a display handle. In general, there should be a function to move the mouse that is specific to the window toolkit you are using.

    What exactly is your purpose?

  3. #3
    Registered User
    Join Date
    Oct 2005
    Location
    Brasil
    Posts
    220
    I have a app for computer vision that "translates" the coordinates of my hand to my app, then i wanted to make it control the mouse accordinly to my hand's position and later i would like to add mouse click support. PS: Control not only mouse position for my app but for the whole OS.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That sounds like you actually want to hook into the mouse-driver interface, rather than fake it in from above. This is probably a bit harder in some ways, but it will help in other ways, because you won't have to combat with things preventing you from moving the mouse...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Oct 2005
    Location
    Brasil
    Posts
    220
    And how can i do this?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You'll have to look at the existing mouse drivers and see how they work, then work out a way to connect your device as a mouse-device - I've never done any work with mice as such, but I'm 95% sure that this is the right way to go.

    There's probably a Linux Kernel mailing list group for mouse drivers or HID (Human Interface Devices).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Curses + Mouse control
    By guesst in forum Linux Programming
    Replies: 0
    Last Post: 05-26-2008, 03:06 PM
  2. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  3. mouse control
    By explosive in forum C++ Programming
    Replies: 1
    Last Post: 03-22-2004, 07:54 AM
  4. Mouse 'control' prob in OpenGL
    By gazsux in forum Game Programming
    Replies: 5
    Last Post: 04-17-2003, 10:00 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM