colfax4
21st May 2007, 00:50
Hi all,
I am attempting to write a Qt application that displays a small window for a short period of time in certain intervals. I would also like to detect any motion on the mouse both when my window is shown and when it is not.
I have inherited QApplication and overloaded x11EventFilter which from what I have read should receive ALL XEvents and allow me to detect motion on the mouse cursor:
bool OSDApp::x11EventFilter(XEvent *e)
{
qDebug("Got an event!\n");
if (e->type == MotionNotify) {
if ( sendMouseEvent() )
qDebug("Sent Motion Event...\n");
else
qDebug("Error Sending Motion Event...\n");
}
return QApplication::x11EventFilter(e);
}
Unfortunately, after executing my application I am unable to see any activity from x11EventFilter. This leads me to believe I will only see activity in x11EventFilter if I show a window and mouse activity happens within that window. Is this the case? Or am I missing something entirely. If this is indeed the case, does anybody know a way in which I can receive all motion events in Qt?
Thanks!
I am attempting to write a Qt application that displays a small window for a short period of time in certain intervals. I would also like to detect any motion on the mouse both when my window is shown and when it is not.
I have inherited QApplication and overloaded x11EventFilter which from what I have read should receive ALL XEvents and allow me to detect motion on the mouse cursor:
bool OSDApp::x11EventFilter(XEvent *e)
{
qDebug("Got an event!\n");
if (e->type == MotionNotify) {
if ( sendMouseEvent() )
qDebug("Sent Motion Event...\n");
else
qDebug("Error Sending Motion Event...\n");
}
return QApplication::x11EventFilter(e);
}
Unfortunately, after executing my application I am unable to see any activity from x11EventFilter. This leads me to believe I will only see activity in x11EventFilter if I show a window and mouse activity happens within that window. Is this the case? Or am I missing something entirely. If this is indeed the case, does anybody know a way in which I can receive all motion events in Qt?
Thanks!