Using the mouse in X

Started by
0 comments, last by TUna 23 years, 4 months ago
How do you go about "grabbing" the mouse point like X11Quake and Quake3 do? Otherwise the mouse just scrolls out the end of the window. Also in quake like games you can keep scrolling left forever. Do they reset the mouse to the middle of the screen each frame? If so how do you do this. I can''t find any function to do this in XLib. Thanks
Advertisement
You can grab the pointer using XGrabPointer():

int XGrabPointer(
Display *display,
Window grab_window,
Bool owner_events,
unsigned int event_mask,
int pointer_mode, keyboard_mode,
Window confine_to,
Cursor cursor,
Time time
);

Now you''ll want to be careful with that as you can easilly
lock up X if yer not careful (when you keep grabbing and never
ungrab).

To ungrab you need to call XUngrabPointer() which gets you
out of grabbing mode.
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.

This topic is closed to new replies.

Advertisement