Use x11 functions in irr_driver only if x11 device was created
This commit is contained in:
parent
da802d836d
commit
1966d3f072
@ -20,6 +20,7 @@ namespace irr
|
|||||||
/** This device works on Windows Mobile, Pocket PC and Microsoft SmartPhone devices */
|
/** This device works on Windows Mobile, Pocket PC and Microsoft SmartPhone devices */
|
||||||
EIDT_WINCE,
|
EIDT_WINCE,
|
||||||
|
|
||||||
|
//! A device native to Linux
|
||||||
EIDT_WAYLAND,
|
EIDT_WAYLAND,
|
||||||
|
|
||||||
//! A device native to Unix style operating systems.
|
//! A device native to Unix style operating systems.
|
||||||
|
@ -454,7 +454,7 @@ bool ContextManagerEGL::makeCurrent()
|
|||||||
bool success = eglMakeCurrent(m_egl_display, m_egl_surface, m_egl_surface,
|
bool success = eglMakeCurrent(m_egl_display, m_egl_surface, m_egl_surface,
|
||||||
m_egl_context);
|
m_egl_context);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -312,22 +312,26 @@ void IrrDriver::updateConfigIfRelevant()
|
|||||||
Log::warn("irr_driver", "Could not retrieve window location\n");
|
Log::warn("irr_driver", "Could not retrieve window location\n");
|
||||||
}
|
}
|
||||||
#elif defined(__linux__) && !defined(ANDROID)
|
#elif defined(__linux__) && !defined(ANDROID)
|
||||||
const video::SExposedVideoData& videoData =
|
if (m_device->getType() == EIDT_X11)
|
||||||
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;
|
const video::SExposedVideoData& videoData =
|
||||||
UserConfigParams::m_window_y = wy;
|
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
|
#endif
|
||||||
}
|
}
|
||||||
@ -418,6 +422,7 @@ void IrrDriver::initDevice()
|
|||||||
UserConfigParams::m_width,
|
UserConfigParams::m_width,
|
||||||
UserConfigParams::m_height);
|
UserConfigParams::m_height);
|
||||||
res = modes->getVideoModeResolution(res, res);
|
res = modes->getVideoModeResolution(res, res);
|
||||||
|
|
||||||
UserConfigParams::m_width = res.Width;
|
UserConfigParams::m_width = res.Width;
|
||||||
UserConfigParams::m_height = res.Height;
|
UserConfigParams::m_height = res.Height;
|
||||||
}
|
}
|
||||||
@ -711,17 +716,20 @@ void IrrDriver::initDevice()
|
|||||||
// Only change video driver settings if we are showing graphics
|
// Only change video driver settings if we are showing graphics
|
||||||
if (!ProfileWorld::isNoGraphics())
|
if (!ProfileWorld::isNoGraphics())
|
||||||
{
|
{
|
||||||
#if 0//defined(__linux__) && !defined(ANDROID) && !defined(SERVER_ONLY)
|
#if defined(__linux__) && !defined(ANDROID) && !defined(SERVER_ONLY)
|
||||||
// Set class hints on Linux, used by Window Managers.
|
if (m_device->getType() == EIDT_X11)
|
||||||
const video::SExposedVideoData& videoData = m_video_driver
|
{
|
||||||
->getExposedVideoData();
|
// Set class hints on Linux, used by Window Managers.
|
||||||
XClassHint* classhint = XAllocClassHint();
|
const video::SExposedVideoData& videoData = m_video_driver
|
||||||
classhint->res_name = (char*)"SuperTuxKart";
|
->getExposedVideoData();
|
||||||
classhint->res_class = (char*)"SuperTuxKart";
|
XClassHint* classhint = XAllocClassHint();
|
||||||
XSetClassHint((Display*)videoData.OpenGLLinux.X11Display,
|
classhint->res_name = (char*)"SuperTuxKart";
|
||||||
videoData.OpenGLLinux.X11Window,
|
classhint->res_class = (char*)"SuperTuxKart";
|
||||||
classhint);
|
XSetClassHint((Display*)videoData.OpenGLLinux.X11Display,
|
||||||
XFree(classhint);
|
videoData.OpenGLLinux.X11Window,
|
||||||
|
classhint);
|
||||||
|
XFree(classhint);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
m_device->setWindowCaption(L"SuperTuxKart");
|
m_device->setWindowCaption(L"SuperTuxKart");
|
||||||
m_device->getVideoDriver()
|
m_device->getVideoDriver()
|
||||||
@ -892,25 +900,29 @@ bool IrrDriver::moveWindow(int x, int y)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif defined(__linux__) && !defined(ANDROID)
|
#elif defined(__linux__) && !defined(ANDROID)
|
||||||
const video::SExposedVideoData& videoData = m_video_driver->getExposedVideoData();
|
if (m_device->getType() == EIDT_X11)
|
||||||
|
|
||||||
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;
|
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
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user