MainNoGUI: Supply a window in Host_GetRenderHandle
Our existing code was relying on the GLX backend to create the GLX window properly, and for the rest of the code to patch that up, sort of. If we rely on Host_GetRenderHandle() returning a valid window, we can do a lot better about this. Create a simple window inside MainNoGUI to make this happen.
This commit is contained in:
parent
071e175a1d
commit
0dd7f6f5ea
|
@ -67,8 +67,6 @@ bool cInterfaceGLX::Create(void *&window_handle)
|
|||
GLWin.dpy = XOpenDisplay(nullptr);
|
||||
GLWin.parent = (Window)window_handle;
|
||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||
if (GLWin.parent == 0)
|
||||
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
||||
|
||||
glXQueryVersion(GLWin.dpy, &glxMajorVersion, &glxMinorVersion);
|
||||
NOTICE_LOG(VIDEO, "glX-Version %d.%d", glxMajorVersion, glxMinorVersion);
|
||||
|
|
|
@ -13,7 +13,7 @@ void cX11Window::CreateXWindow(void)
|
|||
// Setup window attributes
|
||||
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
|
||||
GLWin.parent, GLWin.vi->visual, AllocNone);
|
||||
GLWin.attr.event_mask = KeyPressMask | StructureNotifyMask | FocusChangeMask;
|
||||
GLWin.attr.event_mask = StructureNotifyMask;
|
||||
GLWin.attr.background_pixel = BlackPixel(GLWin.dpy, GLWin.screen);
|
||||
GLWin.attr.border_pixel = 0;
|
||||
|
||||
|
@ -24,7 +24,6 @@ void cX11Window::CreateXWindow(void)
|
|||
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
|
||||
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1);
|
||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, nullptr, 0, nullptr);
|
||||
XMapRaised(GLWin.dpy, GLWin.win);
|
||||
XSync(GLWin.dpy, True);
|
||||
|
||||
|
|
|
@ -52,9 +52,10 @@ void Host_Message(int Id)
|
|||
}
|
||||
}
|
||||
|
||||
void* windowHandle;
|
||||
void* Host_GetRenderHandle()
|
||||
{
|
||||
return nullptr;
|
||||
return windowHandle;
|
||||
}
|
||||
|
||||
void Host_UpdateTitle(const std::string& title){};
|
||||
|
@ -129,6 +130,7 @@ void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}
|
|||
class PlatformX11 : public Platform
|
||||
{
|
||||
Display *dpy;
|
||||
Window win;
|
||||
Cursor blankCursor = None;
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
X11Utils::XRRConfiguration *XRRConfig;
|
||||
|
@ -138,12 +140,17 @@ class PlatformX11 : public Platform
|
|||
{
|
||||
XInitThreads();
|
||||
dpy = XOpenDisplay(NULL);
|
||||
}
|
||||
|
||||
void MainLoop() override
|
||||
{
|
||||
Window win = (Window)Core::GetWindowHandle();
|
||||
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos,
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos,
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight,
|
||||
0, 0, BlackPixel(dpy, 0));
|
||||
XSelectInput(dpy, win, KeyPressMask | FocusChangeMask);
|
||||
XMapRaised(dpy, win);
|
||||
XFlush(dpy);
|
||||
windowHandle = (void *) win;
|
||||
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
|
||||
X11Utils::InhibitScreensaver(dpy, win, true);
|
||||
|
@ -163,7 +170,10 @@ class PlatformX11 : public Platform
|
|||
XFreePixmap (dpy, Blank);
|
||||
XDefineCursor(dpy, win, blankCursor);
|
||||
}
|
||||
}
|
||||
|
||||
void MainLoop() override
|
||||
{
|
||||
bool fullscreen = SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen;
|
||||
|
||||
if (fullscreen)
|
||||
|
|
Loading…
Reference in New Issue