ClearSystemMessages does now also just remove keyboard/mouse events on Linux. Should probably be parametrized in the long run.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3057 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
74b0345a53
commit
17cee03cd1
|
@ -237,13 +237,13 @@ namespace irr
|
|||
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
|
||||
f32 &brightness, f32 &contrast) =0;
|
||||
|
||||
//! Remove all messages pending in the system message loop
|
||||
//! Remove messages pending in the system message loop
|
||||
/** This function is usually used after messages have been buffered for a longer time, for example
|
||||
when loading a large scene. Clearing the message loop prevents that mouse- or buttonclicks which users
|
||||
have pressed in the meantime will now trigger unexpected actions in the gui. <br>
|
||||
So far the following messages are cleared:<br>
|
||||
Win32: All keyboard and mouse messages<br>
|
||||
Linux: All messages<br>
|
||||
Linux: All keyboard and mouse messages<br>
|
||||
All other devices are not yet supported here.<br>
|
||||
The function is still somewhat experimental, as the kind of messages we clear is based on just a few use-cases.
|
||||
If you think further messages should be cleared, or some messages should not be cleared here, then please tell us. */
|
||||
|
|
|
@ -1814,6 +1814,19 @@ void CIrrDeviceLinux::copyToClipboard(const c8* text) const
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
// return true if the passed event has the type passed in parameter arg
|
||||
Bool PredicateIsEventType(Display *display, XEvent *event, XPointer arg)
|
||||
{
|
||||
if ( event && event->type == (int)arg )
|
||||
{
|
||||
// os::Printer::log("remove event:", core::stringc((int)arg).c_str(), ELL_INFORMATION);
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
#endif //_IRR_COMPILE_WITH_X11_
|
||||
|
||||
//! Remove all messages pending in the system message loop
|
||||
void CIrrDeviceLinux::clearSystemMessages()
|
||||
{
|
||||
|
@ -1821,10 +1834,11 @@ void CIrrDeviceLinux::clearSystemMessages()
|
|||
if (CreationParams.DriverType != video::EDT_NULL)
|
||||
{
|
||||
XEvent event;
|
||||
while (XPending(display) > 0 )
|
||||
{
|
||||
XNextEvent(display, &event);
|
||||
}
|
||||
while ( XCheckIfEvent(display, &event, PredicateIsEventType, (XPointer)ButtonPress) == True ) {}
|
||||
while ( XCheckIfEvent(display, &event, PredicateIsEventType, (XPointer)ButtonRelease) == True ) {}
|
||||
while ( XCheckIfEvent(display, &event, PredicateIsEventType, (XPointer)MotionNotify) == True ) {}
|
||||
while ( XCheckIfEvent(display, &event, PredicateIsEventType, (XPointer)KeyRelease) == True ) {}
|
||||
while ( XCheckIfEvent(display, &event, PredicateIsEventType, (XPointer)KeyPress) == True ) {}
|
||||
}
|
||||
#endif //_IRR_COMPILE_WITH_X11_
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue