Results 1 to 3 of 3

Thread: X11EventFilter() could find it, but x11Event() can't, WHY??????????

  1. #1
    Join Date
    Jun 2010
    Posts
    21
    Thanks
    7
    Qt products
    Qt4

    Question X11EventFilter() could find it, but x11Event() can't, WHY??????????

    Dear All,

    Sorry, this is an old question, still unsolved.

    In main.cpp file, I have
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. SubQApplication a(argc, argv);
    4. MainWindow w;
    5. w.show();
    6. return a.exec();
    7. }
    To copy to clipboard, switch view to plain text mode 

    In the related SubQApplication, I just inherit from QApplication, and reimplement the X11EventFilter() as follows:
    Qt Code:
    1. bool SubQApplication::x11EventFilter(XEvent *e){
    2. // http://doc.trolltech.com/4.1/qapplication.html#x11EventFilter
    3. if(e->type == GenericEvent){
    4. printf("!!!!!!!!!!!!!!!!!!GenericEvent finded !!!!!!!!!!!!!\n");
    5. }
    6. return false;
    7. }
    To copy to clipboard, switch view to plain text mode 

    And the Class class MainWindow : public QMainWindow { and implement the bool x11Event(XEvent *e); as follows:
    Qt Code:
    1. bool MainWindow::x11Event(XEvent * e){
    2. XEvent ev = *e;
    3. XGenericEventCookie *cookie = &ev.xcookie; //&e->xcookie;
    4. if(cookie->type != GenericEvent || cookie->extension != xi_opcode || !XGetEventData(dpy, cookie) ){
    5. printf("No GenericEvent Type is found in X11Event, return ******************* \n");
    6. return false;
    7. }
    8. printf("EVENT TYPE %d hahahahahaha---!!!!GenericEvent!!!!!!!!! \n", cookie->evtype);
    9. return flase;
    10. }
    To copy to clipboard, switch view to plain text mode 

    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?
    Can anybody tell me?

    Thanks a million beforehand.
    Last edited by dzh1121; 30th June 2010 at 04:03. Reason: a smll typo

  2. #2
    Join Date
    Jun 2010
    Posts
    21
    Thanks
    7
    Qt products
    Qt4

    Default Re: X11EventFilter() could find it, but x11Event() can't, WHY??????????

    Nobody knows it?
    Sad

  3. #3
    Join Date
    Jun 2010
    Posts
    21
    Thanks
    7
    Qt products
    Qt4

    Default Re: X11EventFilter() could find it, but x11Event() can't, WHY??????????

    Please help.
    Thanks

Similar Threads

  1. Replies: 2
    Last Post: 26th June 2010, 20:27
  2. Replies: 2
    Last Post: 28th September 2009, 11:45
  3. x11Event() can't listen Button1MotionMask?
    By zeki709 in forum Qt Programming
    Replies: 2
    Last Post: 1st July 2007, 12:19
  4. Catching XEvents with x11EventFilter
    By colfax4 in forum Qt Programming
    Replies: 1
    Last Post: 21st May 2007, 05:27
  5. What happens with X11 events after x11EventFilter?
    By krivenok in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2006, 18:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.