diff --git a/lib/irrlicht/include/EDeviceTypes.h b/lib/irrlicht/include/EDeviceTypes.h index 7d52ee46a..c51942b04 100644 --- a/lib/irrlicht/include/EDeviceTypes.h +++ b/lib/irrlicht/include/EDeviceTypes.h @@ -20,6 +20,7 @@ namespace irr /** This device works on Windows Mobile, Pocket PC and Microsoft SmartPhone devices */ EIDT_WINCE, + //! A device native to Linux EIDT_WAYLAND, //! A device native to Unix style operating systems. diff --git a/lib/irrlicht/source/Irrlicht/CContextEGL.cpp b/lib/irrlicht/source/Irrlicht/CContextEGL.cpp index ae579a2fa..42783dfd0 100644 --- a/lib/irrlicht/source/Irrlicht/CContextEGL.cpp +++ b/lib/irrlicht/source/Irrlicht/CContextEGL.cpp @@ -454,7 +454,7 @@ bool ContextManagerEGL::makeCurrent() bool success = eglMakeCurrent(m_egl_display, m_egl_surface, m_egl_surface, m_egl_context); - return success; + return success; } diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index f6ce34bbb..a66ddb11e 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -312,22 +312,26 @@ void IrrDriver::updateConfigIfRelevant() Log::warn("irr_driver", "Could not retrieve window location\n"); } #elif defined(__linux__) && !defined(ANDROID) - const video::SExposedVideoData& videoData = - m_device->getVideoDriver()->getExposedVideoData(); - Display* display = (Display*)videoData.OpenGLLinux.X11Display; - XWindowAttributes xwa; - XGetWindowAttributes(display, get_toplevel_parent(display, - videoData.OpenGLLinux.X11Window), &xwa); - int wx = xwa.x; - int wy = xwa.y; - Log::verbose("irr_driver", - "Retrieved window location for config : %i %i\n", wx, wy); - - - if (UserConfigParams::m_window_x != wx || UserConfigParams::m_window_y != wy) + if (m_device->getType() == EIDT_X11) { - UserConfigParams::m_window_x = wx; - UserConfigParams::m_window_y = wy; + const video::SExposedVideoData& videoData = + m_device->getVideoDriver()->getExposedVideoData(); + Display* display = (Display*)videoData.OpenGLLinux.X11Display; + XWindowAttributes xwa; + XGetWindowAttributes(display, get_toplevel_parent(display, + videoData.OpenGLLinux.X11Window), &xwa); + int wx = xwa.x; + int wy = xwa.y; + Log::verbose("irr_driver", + "Retrieved window location for config : %i %i\n", wx, wy); + + + if (UserConfigParams::m_window_x != wx || + UserConfigParams::m_window_y != wy) + { + UserConfigParams::m_window_x = wx; + UserConfigParams::m_window_y = wy; + } } #endif } @@ -418,6 +422,7 @@ void IrrDriver::initDevice() UserConfigParams::m_width, UserConfigParams::m_height); res = modes->getVideoModeResolution(res, res); + UserConfigParams::m_width = res.Width; UserConfigParams::m_height = res.Height; } @@ -711,17 +716,20 @@ void IrrDriver::initDevice() // Only change video driver settings if we are showing graphics if (!ProfileWorld::isNoGraphics()) { -#if 0//defined(__linux__) && !defined(ANDROID) && !defined(SERVER_ONLY) - // Set class hints on Linux, used by Window Managers. - const video::SExposedVideoData& videoData = m_video_driver - ->getExposedVideoData(); - XClassHint* classhint = XAllocClassHint(); - classhint->res_name = (char*)"SuperTuxKart"; - classhint->res_class = (char*)"SuperTuxKart"; - XSetClassHint((Display*)videoData.OpenGLLinux.X11Display, - videoData.OpenGLLinux.X11Window, - classhint); - XFree(classhint); +#if defined(__linux__) && !defined(ANDROID) && !defined(SERVER_ONLY) + if (m_device->getType() == EIDT_X11) + { + // Set class hints on Linux, used by Window Managers. + const video::SExposedVideoData& videoData = m_video_driver + ->getExposedVideoData(); + XClassHint* classhint = XAllocClassHint(); + classhint->res_name = (char*)"SuperTuxKart"; + classhint->res_class = (char*)"SuperTuxKart"; + XSetClassHint((Display*)videoData.OpenGLLinux.X11Display, + videoData.OpenGLLinux.X11Window, + classhint); + XFree(classhint); + } #endif m_device->setWindowCaption(L"SuperTuxKart"); m_device->getVideoDriver() @@ -892,25 +900,29 @@ bool IrrDriver::moveWindow(int x, int y) return false; } #elif defined(__linux__) && !defined(ANDROID) - const video::SExposedVideoData& videoData = m_video_driver->getExposedVideoData(); - - Display* display = (Display*)videoData.OpenGLLinux.X11Display; - int screen = DefaultScreen(display); - int screen_w = DisplayWidth(display, screen); - int screen_h = DisplayHeight(display, screen); - - if (x + UserConfigParams::m_width > screen_w) + if (m_device->getType() == EIDT_X11) { - x = screen_w - UserConfigParams::m_width; + const video::SExposedVideoData& videoData = + m_video_driver->getExposedVideoData(); + + Display* display = (Display*)videoData.OpenGLLinux.X11Display; + int screen = DefaultScreen(display); + int screen_w = DisplayWidth(display, screen); + int screen_h = DisplayHeight(display, screen); + + if (x + UserConfigParams::m_width > screen_w) + { + x = screen_w - UserConfigParams::m_width; + } + + if (y + UserConfigParams::m_height > screen_h) + { + y = screen_h - UserConfigParams::m_height; + } + + // TODO: Actually handle possible failure + XMoveWindow(display, videoData.OpenGLLinux.X11Window, x, y); } - - if (y + UserConfigParams::m_height > screen_h) - { - y = screen_h - UserConfigParams::m_height; - } - - // TODO: Actually handle possible failure - XMoveWindow(display, videoData.OpenGLLinux.X11Window, x, y); #endif #endif return true;