diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp index f999f8f15..80fe43883 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp @@ -665,6 +665,11 @@ void CIrrDeviceLinux::grabPointer(bool grab) #endif } +Bool CIrrDeviceLinux::isWindowMapped(Display* display, XEvent* event, XPointer arg) +{ + return event->type == MapNotify && event->xmap.window == *((Window*)arg); +} + bool CIrrDeviceLinux::createWindow() { #ifdef _IRR_COMPILE_WITH_X11_ @@ -1149,6 +1154,9 @@ bool CIrrDeviceLinux::createWindow() IrrPrintXGrabError(grabPointer, "XGrabPointer"); XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0); } + + XEvent event; + XPeekIfEvent(display, &event, &isWindowMapped, (XPointer)&window); } else { diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.h b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.h index 425934f5b..6e968233e 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.h +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.h @@ -166,6 +166,7 @@ namespace irr int getNumlockMask(Display* display); EKEY_CODE getKeyCode(XEvent &event); void updateIMELocation(); + static Bool isWindowMapped(Display* display, XEvent* event, XPointer arg); #endif //! Implementation of the linux cursor control