Results 1 to 9 of 9

Thread: help!!!I got a trouble !about x11eventfilter!!

  1. #1
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    1

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    I destroy one window,just only one;but XSERVER will send five destroynotify to my client;why?

    help me !thanks!!

    here is my codes:
    Qt Code:
    1. #if defined(Q_WS_X11)
    2. App::App():public QApplication
    3. {
    4. display=QX11Info::display();// XOpenDisplay("0:0");
    5. if (display == NULL)
    6. {
    7. printf("Cannot connect to X server " );
    8. exit (-1);
    9. };
    10. XSelectInput(display,QX11Info::appRootWindow(QX11Info::appScreen()),SubstructureNotifyMask);
    11. }
    12.  
    13. bool App::x11EventFilter(XEvent *xe)
    14. {
    15.  
    16. switch (xe->type)
    17. {
    18.  
    19. case Expose:
    20. return true;
    21.  
    22. case ConfigureNotify:
    23. printf("resize1\n");
    24. return true;
    25. case DestroyNotify:
    26. printf("destroy\n");
    27. return true;
    28. default:
    29. return false;
    30. }
    31. }
    32. #endif
    To copy to clipboard, switch view to plain text mode 


    Added after 4 minutes:


    and another question,
    when i use QApplication::x11eventfilter(),i find my appwindow cannot redraw itself if some other sub-window cover it,


    Added after 13 minutes:


    and
    When I move my mouse to the GNOME's taskbar ,XSERVER will also create a destroy event ,even if no clicked


    Added after 36 minutes:


    can u understand what I wanna say?
    my english is not very well for i am chinese;
    Last edited by wysota; 27th November 2010 at 09:15. Reason: reformatted to look better

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    You might want to call the base class implementation instead of returning false. It doesn't astonish me that your widget is not redrawn if you are discarding all Expose events.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    ohmysweetbaby (27th November 2010)

  4. #3
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    1

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    thanks for your answer ,and,which function should I use to redrawn my widget?
    e.x.
    case expose:
    widget.repaint();???

    it seems doesn't work..

    You might want to call the base class implementation instead of returning false??

    can u give me some more details?
    I dont know how to write if I call the base class implementation instead of returning false;

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    Why do you want to do anything on Expose? Let Qt handle it. Just don't return true from the filter when you encounter the event.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    1

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    how to write if i dont return true?return false?
    sorry, i just started to learn QT

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    Why did you put "case Expose" in your filter? If you just started with Qt then messing with x11EventFilter is probably a very bad idea.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #7
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    1

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    but if I remove "case Expose",my wiget still can not redrawn itself


    and if I dont use the x11eventfilter function,i cant grab subwindow event;

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    First of all call the base class implementation instead of returning false. And never return true unless you are sure this is what you want to do.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #9
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    1

    Default Re: help!!!I got a trouble !about x11eventfilter!!

    thanks,I have solved this problem about redrawn,there is still some stuff make me crazy,but thanks for your help,i can move on

Similar Threads

  1. Replies: 2
    Last Post: 1st July 2010, 15:11
  2. Replies: 2
    Last Post: 26th June 2010, 20:27
  3. SQL trouble
    By xmeister in forum Newbie
    Replies: 2
    Last Post: 25th March 2009, 11:53
  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.