PDA

View Full Version : help!!!I got a trouble !about x11eventfilter!!



ohmysweetbaby
27th November 2010, 08:26
I destroy one window,just only one;but XSERVER will send five destroynotify to my client;why?

help me !thanks!!

here is my codes:

#if defined(Q_WS_X11)
App::App():public QApplication
{
display=QX11Info::display();// XOpenDisplay("0:0");
if (display == NULL)
{
printf("Cannot connect to X server " );
exit (-1);
};
XSelectInput(display,QX11Info::appRootWindow(QX11I nfo::appScreen()),SubstructureNotifyMask);
}

bool App::x11EventFilter(XEvent *xe)
{

switch (xe->type)
{

case Expose:
return true;

case ConfigureNotify:
printf("resize1\n");
return true;
case DestroyNotify:
printf("destroy\n");
return true;
default:
return false;
}
}
#endif

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;

wysota
27th November 2010, 10:17
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.

ohmysweetbaby
27th November 2010, 13:07
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;

wysota
27th November 2010, 13:21
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.

ohmysweetbaby
27th November 2010, 13:33
how to write if i dont return true?return false?
sorry, i just started to learn QT

wysota
27th November 2010, 13:39
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.

ohmysweetbaby
27th November 2010, 13:50
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;

wysota
27th November 2010, 16:27
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.

ohmysweetbaby
28th November 2010, 15:47
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