PDA

View Full Version : Passive Mouse Motion



syan
02-03-2005, 08:23 AM
Hi guys,

Can any one show me a simple example on how to detect the Mouse Passive Motion in X?

I tried to do it in the following event callback
function, but it failed to work properly:

-------------------------------------------
void input(Widget w, XtPointer data, XtPointer cd){
if(cd->event->type==keyPress){
....
}
else if(cd->event->type==ButtonPress){
buttondown=True;
HandleMouse(w,cd);
}

else if(cd->event->type==ButtonRelease)
buttondown=False;

else if(cd->event->type==MotionNotify){
if(buttondown) HandleMouseMotion(w,cd);
else HandlePassiveMotion(w,cd);
}

-------------
It seems to me that the event type "MotionNotify" only includes "pointer motion event with a button down". My problem is I don't know how to modify this default behavior for the glxarea widget.

Any help is very much appreciated!

Thanks,

iznogoud
02-03-2005, 01:16 PM
There is an excellent page for programming with the Xlib:

Basic Graphics Programming With The Xlib Library (http://users.actcom.co.il/~choo/lupg/tutorials/xlib-programming/xlib-programming.html)

And this is the relevant part for your question:

Mouse Movement Events (http://users.actcom.co.il/~choo/lupg/tutorials/xlib-programming/xlib-programming.html#user_input_mouse_move)

There is a difference between motion and "dragging" of
the pointer.

syan
02-03-2005, 02:03 PM
Thank you, iznogoud! That is an excellent page!