Advertisement

setting the mouse position...

Started by September 05, 2002 08:06 PM
2 comments, last by uNiQue0815 22 years, 4 months ago
hi ! can''t find anything in google / rest of the web about how to set the mouse-pointer''s position in linux/x. is there any Xlib function to do this ? need this to have the possibility for infinite mouse movement...
XWarpPointer is what you''re looking for. It''s in the Xlib manual (man XWarpPointer), or do a search on google if you don''t have the man pages.

Hope this helps.
Advertisement
mmh... ok that would be a possibility...
i''ve read, that XWarpPointer sends a MotionNotify message... and that''s bad for my purposes. i wanted to have inifinite mouse movement (i.e. for a quake-like game).
the only way to do this (which i know) would be to read the mouse-position every loop & get the difference to the start position. then reset its position again. but when the function causes a motion-message, the app would think, the mouse had moved.
is there any way to query the relative mouse movement ?
or is there maybe another function that sets the pointer''s position without generating a MotionNotify message ?

if not, i''ll just have to set a flag, each time the mouse was reset & ignore the next movement, if the flag is set... but that would be my second-choice solution.

if there''s some other way... plz tell me !
if not... thx for help... the XWarpPointer function will also do.
(somehow)
mmh... plz forget my question... i''ve just found XQueryPointer.
it''s just perfect for my purposes. (and sooo much better than the sh..ty windows-function ''GetCursorPos()'' !!)

This topic is closed to new replies.

Advertisement