XtGrabPointer and strange behavior

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

4 posts / 0 new
Last post
XtGrabPointer and strange behavior

Submitted by machnone on Fri, 03/09/2001 - 21:33. Developers
I am using XtGrabPointer to grab a pointer and keep it confined inside a particular area. This works fine, but I am getting unexpected responses from my XmPushButton widgets.
Normally, when I click one of them, keep the button down, and move the mouse away from the button, the button pops up. But now, when I move the pointer away from the button, it does not get a button released signal. So if I put a pointer over a button, keep the mouse button down, move the pointer away from the button, let the mouse button go, and put the pointer over the button again, the button acts as though the mouse pointer is pressed (it goes down).
What could be causing this? The XtGrab I am using is
XtGrabPointer(key_shMain, 1, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, XtWindow(key_shMain), (Cursor)NULL, CurrentTime);

Thanks for any help.

machnone

My problem seems to be that the pushbutton widgets are not getting the correct events.
But why would this happen when I explicitly grab the pointer?
Is there some mask I am missing. I have tried all of them.
It seems like when the pointer moves away from the button, it no longer gets the events, like when I release the button. But why is this?

Any help would be greatly appreciated.

Anonymous

In your grab function call, the owner_event flag was set to true, that means each event will be dispatched to its regular owner. When you move the mouse away from the button and release the mouse, the button was no longer the owner of the pointer release event, that was the reason why the event was not reported to the button.
To fix this problem you could try add the leave window event, when the pointer is moved away from the button, the button will receive a leave window notification and change its state correspondingly. Hope this work for you.

machnone

That is exactly what I thought, but it doesn`t work. I am passing every event allowed, but it still can`t tell when the pointer is no longer over a button. Any other ideas??