Core: Don't pass through a reference to the window handle

Now that MainNoGUI is properly architected and GLX doesn't need to
sometimes craft its own windows sometimes which we have to thread back
into MainNoGUI, we don't need to thread the window handle that GLX
creates at all.

This removes the reference to pass back here, and the g_pWindowHandle
always be the same as the window returned by Host_GetRenderHandle().

A future cleanup could remove g_pWindowHandle entirely.
This commit is contained in:
Jasper St. Pierre 2014-08-06 00:44:21 -04:00
parent 6e312dce91
commit 7ca8d8dfc7
18 changed files with 26 additions and 21 deletions

View File

@ -208,9 +208,6 @@ bool Init()
!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR")); !!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
} }
// g_pWindowHandle is first the m_Panel handle,
// then it is updated to the render window handle,
// within g_video_backend->Initialize()
g_pWindowHandle = Host_GetRenderHandle(); g_pWindowHandle = Host_GetRenderHandle();
// Start the emu thread // Start the emu thread

View File

@ -16,7 +16,7 @@ void cInterfaceAGL::Swap()
// Create rendering window. // Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() // Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceAGL::Create(void *&window_handle) bool cInterfaceAGL::Create(void *window_handle)
{ {
// FIXME: Get rid of the explicit use of wxPanel here. This shouldn't be necessary. // FIXME: Get rid of the explicit use of wxPanel here. This shouldn't be necessary.
GLWin.cocoaWin = reinterpret_cast<NSView*>(((wxPanel*)window_handle)->GetHandle()); GLWin.cocoaWin = reinterpret_cast<NSView*>(((wxPanel*)window_handle)->GetHandle());

View File

@ -14,7 +14,7 @@ class cInterfaceAGL : public cInterfaceBase
{ {
public: public:
void Swap(); void Swap();
bool Create(void *&window_handle); bool Create(void *window_handle);
bool MakeCurrent(); bool MakeCurrent();
bool ClearCurrent(); bool ClearCurrent();
void Shutdown(); void Shutdown();

View File

@ -87,7 +87,7 @@ err_exit:
// Create rendering window. // Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() // Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceEGL::Create(void *&window_handle) bool cInterfaceEGL::Create(void *window_handle)
{ {
const char *s; const char *s;
EGLint egl_major, egl_minor; EGLint egl_major, egl_minor;

View File

@ -20,7 +20,7 @@ public:
void SetMode(u32 mode) { s_opengl_mode = mode; } void SetMode(u32 mode) { s_opengl_mode = mode; }
void UpdateFPSDisplay(const std::string& text); void UpdateFPSDisplay(const std::string& text);
void* GetFuncAddress(const std::string& name); void* GetFuncAddress(const std::string& name);
bool Create(void *&window_handle); bool Create(void *window_handle);
bool MakeCurrent(); bool MakeCurrent();
void Shutdown(); void Shutdown();
}; };

View File

@ -37,7 +37,7 @@ void cInterfaceGLX::Swap()
// Create rendering window. // Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() // Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceGLX::Create(void *&window_handle) bool cInterfaceGLX::Create(void *window_handle)
{ {
int glxMajorVersion, glxMinorVersion; int glxMajorVersion, glxMinorVersion;
@ -102,7 +102,6 @@ bool cInterfaceGLX::Create(void *&window_handle)
} }
XWindow.CreateXWindow(); XWindow.CreateXWindow();
window_handle = (void *)GLWin.win;
return true; return true;
} }

View File

@ -19,7 +19,7 @@ public:
void Swap() override; void Swap() override;
void UpdateFPSDisplay(const std::string& text) override; void UpdateFPSDisplay(const std::string& text) override;
void* GetFuncAddress(const std::string& name) override; void* GetFuncAddress(const std::string& name) override;
bool Create(void *&window_handle) override; bool Create(void *window_handle);
bool MakeCurrent() override; bool MakeCurrent() override;
bool ClearCurrent() override; bool ClearCurrent() override;
void Shutdown() override; void Shutdown() override;

View File

@ -63,7 +63,7 @@ void cInterfaceWGL::UpdateFPSDisplay(const std::string& text)
// Create rendering window. // Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() // Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceWGL::Create(void *&window_handle) bool cInterfaceWGL::Create(void *window_handle)
{ {
if (window_handle == nullptr) if (window_handle == nullptr)
return false; return false;

View File

@ -14,7 +14,7 @@ public:
void Swap(); void Swap();
void UpdateFPSDisplay(const std::string& text); void UpdateFPSDisplay(const std::string& text);
void* GetFuncAddress(const std::string& name); void* GetFuncAddress(const std::string& name);
bool Create(void *&window_handle); bool Create(void *window_handle);
bool MakeCurrent(); bool MakeCurrent();
bool ClearCurrent(); bool ClearCurrent();
void Shutdown(); void Shutdown();

View File

@ -31,6 +31,7 @@ class Platform
{ {
public: public:
virtual void Init() = 0; virtual void Init() = 0;
virtual void SetTitle(const std::string &title) = 0;
virtual void MainLoop() = 0; virtual void MainLoop() = 0;
virtual void Shutdown() = 0; virtual void Shutdown() = 0;
virtual ~Platform() {}; virtual ~Platform() {};
@ -58,7 +59,10 @@ void* Host_GetRenderHandle()
return windowHandle; return windowHandle;
} }
void Host_UpdateTitle(const std::string& title){}; void Host_UpdateTitle(const std::string& title)
{
platform->SetTitle(title);
}
void Host_UpdateDisasmDialog(){} void Host_UpdateDisasmDialog(){}
@ -175,6 +179,11 @@ class PlatformX11 : public Platform
} }
} }
void SetTitle(const std::string &string) override
{
XStoreName(dpy, win, string.c_str());
}
void MainLoop() override void MainLoop() override
{ {
bool fullscreen = SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen; bool fullscreen = SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen;

View File

@ -8,7 +8,7 @@ namespace DX11
class VideoBackend : public VideoBackendHardware class VideoBackend : public VideoBackendHardware
{ {
bool Initialize(void *&) override; bool Initialize(void *) override;
void Shutdown() override; void Shutdown() override;
std::string GetName() const override; std::string GetName() const override;

View File

@ -141,7 +141,7 @@ void VideoBackend::ShowConfig(void *hParent)
Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_dx11"); Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_dx11");
} }
bool VideoBackend::Initialize(void *&window_handle) bool VideoBackend::Initialize(void *window_handle)
{ {
if (window_handle == nullptr) if (window_handle == nullptr)
return false; return false;

View File

@ -29,7 +29,7 @@ public:
virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; } virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; }
virtual u32 GetMode() { return s_opengl_mode; } virtual u32 GetMode() { return s_opengl_mode; }
virtual void* GetFuncAddress(const std::string& name) { return nullptr; } virtual void* GetFuncAddress(const std::string& name) { return nullptr; }
virtual bool Create(void *&window_handle) { return true; } virtual bool Create(void *window_handle) { return true; }
virtual bool MakeCurrent() { return true; } virtual bool MakeCurrent() { return true; }
virtual bool ClearCurrent() { return true; } virtual bool ClearCurrent() { return true; }
virtual void Shutdown() {} virtual void Shutdown() {}

View File

@ -8,7 +8,7 @@ namespace OGL
class VideoBackend : public VideoBackendHardware class VideoBackend : public VideoBackendHardware
{ {
bool Initialize(void *&) override; bool Initialize(void *) override;
void Shutdown() override; void Shutdown() override;
std::string GetName() const override; std::string GetName() const override;

View File

@ -155,7 +155,7 @@ void VideoBackend::ShowConfig(void *_hParent)
Host_ShowVideoConfig(_hParent, GetDisplayName(), "gfx_opengl"); Host_ShowVideoConfig(_hParent, GetDisplayName(), "gfx_opengl");
} }
bool VideoBackend::Initialize(void *&window_handle) bool VideoBackend::Initialize(void *window_handle)
{ {
InitializeShared(); InitializeShared();
InitBackendInfo(); InitBackendInfo();

View File

@ -71,7 +71,7 @@ void VideoSoftware::ShowConfig(void *hParent)
Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_software"); Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_software");
} }
bool VideoSoftware::Initialize(void *&window_handle) bool VideoSoftware::Initialize(void *window_handle)
{ {
g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str()); g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str());

View File

@ -10,7 +10,7 @@ namespace SW
class VideoSoftware : public VideoBackend class VideoSoftware : public VideoBackend
{ {
bool Initialize(void *&) override; bool Initialize(void *window_handle) override;
void Shutdown() override; void Shutdown() override;
std::string GetName() const override; std::string GetName() const override;

View File

@ -72,7 +72,7 @@ public:
virtual unsigned int PeekMessages() = 0; virtual unsigned int PeekMessages() = 0;
virtual bool Initialize(void *&) = 0; virtual bool Initialize(void *window_handle) = 0;
virtual void Shutdown() = 0; virtual void Shutdown() = 0;
virtual void RunLoop(bool enable) = 0; virtual void RunLoop(bool enable) = 0;