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.
Alternatively, you can query mouse pointer outside the event loop like this:
Window root;
Window child;
int root_x, root_y;
int win_x, win_y;
unsigned int button_mask;
static int old_win_x;
static int old_win_y;
if( True == XQueryPointer(Interface::Window->GetDisplay(),
Interface::Window->GetWindow(),
&root, &child,
&root_x, &root_y,
&win_x, &win_y,
&button_mask) )
{
if( button_mask & Button1Mask ) // left button
{
}
if( button_mask & Button3Mask ) // right button
{
}
old_win_x = win_x;
old_win_y = win_y;
}
else // outside window borders
{
}
In the above code, ‘Interface’ is my namespace for various singleton accessors.
I hope everything else is self-explanatory. You would do something like this on
per-frame basis.