diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/include/IrrlichtDevice.h Irrlicht_starsonata/include/IrrlichtDevice.h --- irrlicht-svn-ss/trunk/include/IrrlichtDevice.h 2007-07-26 02:11:22.000000000 +0200 +++ Irrlicht_starsonata/include/IrrlichtDevice.h 2008-06-24 21:31:18.000000000 +0200 @@ -175,6 +175,29 @@ while(device->run()) //! Sets if the window should be resizeable in windowed mode. /** The default is false. This method only works in windowed mode. */ virtual void setResizeAble(bool resize=false) = 0; + + // starsonata, micha: + //! remove all events pending in the message loop + //! NOTE: This will not remove the WM_QUIT on windows you have to call run() once more to consume that one + virtual void clearPendingEvents() = 0; + + // starsonata, micha: + //! minimize the application. Only supported on windows so far. + virtual void minimize() = 0; + + //! minimize the application. Only supported on windows so far. + virtual void maximize() = 0; + + //! restore mainwindow to original size. Only supported on windows so far. + virtual void restore() = 0; + + // starsonata, micha: + //! Check if application is minimized. Only supported on windows so far. + virtual bool isMinimized() = 0; + + // starsonata, micha: + //! Check if main window is maximized. Only supported on windows so far. + virtual bool isMaximized() = 0; }; } // end namespace irr diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceLinux.cpp Irrlicht_starsonata/source/Irrlicht/CIrrDeviceLinux.cpp --- irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceLinux.cpp 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CIrrDeviceLinux.cpp 2008-03-23 05:18:48.000000000 +0100 @@ -656,7 +656,21 @@ void CIrrDeviceLinux::createDriver(const } } +//! MICHA: remove all events pending in the message loop +void CIrrDeviceLinux::clearPendingEvents() +{ +#ifdef _IRR_COMPILE_WITH_X11_ + if (DriverType != video::EDT_NULL) + { + irr::SEvent irrevent; + while (XPending(display) > 0 ) + { + XNextEvent(display, &event); + } + } +#endif //_IRR_COMPILE_WITH_X11_ +} //! runs the device. Returns false if device wants to be deleted bool CIrrDeviceLinux::run() diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceLinux.h Irrlicht_starsonata/source/Irrlicht/CIrrDeviceLinux.h --- irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceLinux.h 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CIrrDeviceLinux.h 2007-11-16 01:41:08.000000000 +0100 @@ -80,6 +80,9 @@ namespace irr //! Sets if the window should be resizeable in windowed mode. virtual void setResizeAble(bool resize=false); + //! MICHA: remove all events pending in the message loop + virtual void clearPendingEvents(); + private: //! create the driver diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceStub.h Irrlicht_starsonata/source/Irrlicht/CIrrDeviceStub.h --- irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceStub.h 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CIrrDeviceStub.h 2008-02-27 00:15:30.000000000 +0100 @@ -98,6 +98,27 @@ namespace irr //! Returns the operation system opertator object. virtual IOSOperator* getOSOperator(); + //! MICHA: remove all events pending in the message loop + virtual void clearPendingEvents() {} + + // starsonata, micha: + //! minimize the application. Only supported on windows so far. + virtual void minimize() {} + + //! minimize the application. Only supported on windows so far. + virtual void maximize() {} + + //! restore mainwindow to original size. Only supported on windows so far. + virtual void restore() {} + + // starsonata, micha: + //! Check if application is minimized. Only supported on windows so far. + virtual bool isMinimized() { return false; } + + // starsonata, micha: + //! Check if main window is maximized. Only supported on windows so far. + virtual bool isMaximized() { return false; } + protected: void createGUIAndScene(); diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceWin32.cpp Irrlicht_starsonata/source/Irrlicht/CIrrDeviceWin32.cpp --- irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceWin32.cpp 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CIrrDeviceWin32.cpp 2008-06-24 21:30:22.000000000 +0200 @@ -527,6 +637,40 @@ void CIrrDeviceWin32::createDriver(video } } +//! MICHA: remove all events pending in the message loop +void CIrrDeviceWin32::clearPendingEvents() +{ + MSG msg; + while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE)) + {} + while (PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE)) + {} +} + +void CIrrDeviceWin32::minimize() +{ + ShowWindow( HWnd, SW_MINIMIZE ); +} + +void CIrrDeviceWin32::maximize() +{ + ShowWindow( HWnd, SW_MAXIMIZE ); +} + +void CIrrDeviceWin32::restore() +{ + ShowWindow( HWnd, SW_RESTORE ); +} + +bool CIrrDeviceWin32::isMinimized() +{ + return (bool)IsIconic(HWnd); +} + +bool CIrrDeviceWin32::isMaximized() +{ + return (bool)IsZoomed(HWnd); +} //! runs the device. Returns false if device wants to be deleted @@ -965,3 +1116,4 @@ IRRLICHT_API IrrlichtDevice* IRRCALLCONV #endif // _IRR_USE_WINDOWS_DEVICE_ + diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceWin32.h Irrlicht_starsonata/source/Irrlicht/CIrrDeviceWin32.h --- irrlicht-svn-ss/trunk/source/Irrlicht/CIrrDeviceWin32.h 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CIrrDeviceWin32.h 2008-02-27 00:16:04.000000000 +0100 @@ -65,6 +65,28 @@ namespace irr //! Sets if the window should be resizeable in windowed mode. virtual void setResizeAble(bool resize=false); + // Starsonata, Micha + //! remove all events pending in the message loop + virtual void clearPendingEvents(); + + // starsonata, micha: + //! minimize the application. Only supported on windows so far. + virtual void minimize(); + + //! minimize the application. Only supported on windows so far. + virtual void maximize(); + + //! restore mainwindow to original size. Only supported on windows so far. + virtual void restore(); + + // starsonata, micha: + //! Check if application is minimized. Only supported on windows so far. + virtual bool isMinimized(); + + // starsonata, micha: + //! Check if main window is maximized. Only supported on windows so far. + virtual bool isMaximized(); + //! Implementation of the win32 cursor control class CCursorControl : public gui::ICursorControl {