PDA

View Full Version : X11EventFilter() could find it, but x11Event() can't, WHY??????????



dzh1121
30th June 2010, 03:41
Dear All,

Sorry, this is an old question, still unsolved.

In main.cpp file, I have
int main(int argc, char *argv[])
{
SubQApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}


In the related SubQApplication, I just inherit from QApplication, and reimplement the X11EventFilter() as follows:

bool SubQApplication::x11EventFilter(XEvent *e){
// http://doc.trolltech.com/4.1/qapplication.html#x11EventFilter
if(e->type == GenericEvent){
printf("!!!!!!!!!!!!!!!!!!GenericEvent finded !!!!!!!!!!!!!\n");
}
return false;
}

And the Class class MainWindow : public QMainWindow { and implement the bool x11Event(XEvent *e); as follows:

bool MainWindow::x11Event(XEvent * e){
XEvent ev = *e;
XGenericEventCookie *cookie = &ev.xcookie; //&e->xcookie;
if(cookie->type != GenericEvent || cookie->extension != xi_opcode || !XGetEventData(dpy, cookie) ){
printf("No GenericEvent Type is found in X11Event, return ******************* \n");
return false;
}
printf("EVENT TYPE %d hahahahahaha---!!!!GenericEvent!!!!!!!!! \n", cookie->evtype);
return flase;
}

So, the weired thing is that:
In X11EventFilter, GenericEvent type could be found, but can never be found in X11Event().
i.e, printf("EVENT TYPE %d hahahahahaha---!!!!GenericEvent!!!!!!!!! ) is never excuted!!!!!!!!!

WHY? :confused::confused::confused:
Can anybody tell me?

Thanks a million beforehand.

dzh1121
30th June 2010, 20:03
Nobody knows it?
Sad :crying:

dzh1121
1st July 2010, 15:11
Please help.
Thanks