Passive Mouse Motion

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,

There is an excellent page for programming with the Xlib:

Basic Graphics Programming With The Xlib Library

And this is the relevant part for your question:

Mouse Movement Events

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

Thank you, iznogoud! That is an excellent page!