Index: source/Irrlicht/CIrrDeviceLinux.cpp =================================================================== RCS file: /cvsroot/irrlicht/Irrlicht/Irrlicht/CIrrDeviceLinux.cpp,v retrieving revision 1.2 diff -u -w -b -r1.2 CIrrDeviceLinux.cpp --- source/Irrlicht/CIrrDeviceLinux.cpp 19 Mar 2006 17:41:07 -0000 1.2 +++ source/Irrlicht/CIrrDeviceLinux.cpp 15 Apr 2006 19:11:24 -0000 @@ -49,6 +49,7 @@ u32 bits, bool fullscreen, bool sbuffer, bool vsync, bool antiAlias, IEventReceiver* receiver, + const char* externalWindow, const char* version) : CIrrDeviceStub(version, receiver), Close(false), WindowActive(false), DriverType(driverType), Fullscreen(fullscreen), StencilBuffer(sbuffer), SoftwareImage(0) @@ -76,6 +77,20 @@ // create keymap createKeyMap(); + // construct window pointers from user-supplied window (if any) + isUserSuppliedWindow = false; + if (externalWindow != 0) + { + core::stringc tmp = externalWindow; + s32 index = tmp.findFirst(':'); + if (index != -1) + { + display = (Display*)atol(tmp.subString(0, index).c_str()); + window = (Window)atol(tmp.subString(index + 1, tmp.size() - index - 1).c_str()); + isUserSuppliedWindow = display && window; + } + } + // create window if (driverType != video::EDT_NULL) @@ -104,7 +119,7 @@ //! destructor CIrrDeviceLinux::~CIrrDeviceLinux() { - if (display) + if (display && !isUserSuppliedWindow) { //os::Printer::log("Deleting window...", ELL_INFORMATION); @@ -178,6 +193,7 @@ XSetErrorHandler(IrrPrintXError); #endif + if (!isUserSuppliedWindow) display = XOpenDisplay(0); if (!display) { @@ -384,7 +399,7 @@ &bestMapInfo, &count, XA_RGB_BEST_MAP)) { colormap = XCreateColormap(display, - RootWindow(display, visual->screen), + isUserSuppliedWindow ? window : RootWindow(display, visual->screen), visual->visual, AllocNone); attributes.colormap = colormap; } @@ -401,7 +416,7 @@ #ifdef _IRR_LINUX_X11_VIDMODE_ // switch to fullscreen if extension is installed. - if (Fullscreen && bestMode != -1) + if (!isUserSuppliedWindow && Fullscreen && bestMode != -1) { os::Printer::log("Starting fullscreen mode...", ELL_INFORMATION); XF86VidModeSwitchToMode(display, screennr, modes[bestMode]); @@ -430,6 +445,7 @@ } else #endif + if (!isUserSuppliedWindow) { // we want windowed mode if (Fullscreen) @@ -656,6 +671,8 @@ switch (event.type) { case ConfigureNotify: + if(event.xconfigure.display != display || event.xconfigure.window != window) + break; // check for changed window size if ((event.xconfigure.width != Width) || (event.xconfigure.height != Height)) @@ -727,7 +744,8 @@ break; case MappingNotify: + if ((event.xmapping.display == display) && (event.xmapping.window == window)) - XRefreshKeyboardMapping (&event.xmapping) ; + XRefreshKeyboardMapping (&event.xmapping) ; break; case KeyRelease: @@ -754,7 +772,10 @@ break; case ClientMessage: - if (*XGetAtomName(display, event.xclient.message_type) == + if(event.xclient.display != display || event.xclient.window != window) + break; + if (!isUserSuppliedWindow && + *XGetAtomName(display, event.xclient.message_type) == *wmDeleteWindow) { os::Printer::log("Quit message received.", ELL_INFORMATION); @@ -1172,6 +1193,7 @@ param.Vsync, param.AntiAlias, param.EventReceiver, + (const char*)param.WindowId, param.SDK_version_do_not_use); if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL) Index: source/Irrlicht/CIrrDeviceLinux.h =================================================================== RCS file: /cvsroot/irrlicht/Irrlicht/Irrlicht/CIrrDeviceLinux.h,v retrieving revision 1.2 diff -u -w -b -r1.2 CIrrDeviceLinux.h --- source/Irrlicht/CIrrDeviceLinux.h 19 Mar 2006 17:41:07 -0000 1.2 +++ source/Irrlicht/CIrrDeviceLinux.h 15 Apr 2006 19:11:24 -0000 @@ -39,6 +39,7 @@ CIrrDeviceLinux(video::E_DRIVER_TYPE deviceType, const core::dimension2d& windowSize, u32 bits, bool fullscreen, bool stencilbuffer, bool vsync, bool antiAlias, IEventReceiver* receiver, + const char* externalWindow, const char* version); //! destructor @@ -205,6 +206,7 @@ friend class CCursorControl; + bool isUserSuppliedWindow; Display *display; GLXContext context; int screennr; Index: source/Irrlicht/include/SIrrCreationParameters.h =================================================================== RCS file: /cvsroot/irrlicht/Irrlicht/Irrlicht/include/SIrrCreationParameters.h,v retrieving revision 1.2 diff -u -w -b -r1.2 SIrrCreationParameters.h --- include/SIrrCreationParameters.h 19 Mar 2006 17:44:30 -0000 1.2 +++ include/SIrrCreationParameters.h 15 Apr 2006 19:11:27 -0000 @@ -116,7 +116,7 @@ \endcode However, there is no need to draw the picture this often. Just do it how you like. */ - s32 WindowId; + long WindowId; // long to support 64bit architectures //! Don't use or change this parameter. /** Always set it to IRRLICHT_SDK_VERSION, which is done by default.