Host: Add GetTopLevelWindowInfo()
And use it for screensaver inhibiting on Linux.
This commit is contained in:
@@ -964,9 +964,9 @@ void Host::SetFullscreen(bool enabled)
|
||||
g_nogui_window->SetFullscreen(enabled);
|
||||
}
|
||||
|
||||
void* Host::GetTopLevelWindowHandle()
|
||||
std::optional<WindowInfo> Host::GetTopLevelWindowInfo()
|
||||
{
|
||||
return g_nogui_window->GetPlatformWindowHandle();
|
||||
return g_nogui_window->GetPlatformWindowInfo();
|
||||
}
|
||||
|
||||
void Host::RequestExit(bool save_state_if_running)
|
||||
|
||||
@@ -25,7 +25,6 @@ public:
|
||||
|
||||
virtual std::optional<WindowInfo> GetPlatformWindowInfo() = 0;
|
||||
virtual void SetPlatformWindowTitle(std::string title) = 0;
|
||||
virtual void* GetPlatformWindowHandle() = 0;
|
||||
|
||||
virtual std::optional<u32> ConvertHostKeyboardStringToCode(const std::string_view& str) = 0;
|
||||
virtual std::optional<std::string> ConvertHostKeyboardCodeToString(u32 code) = 0;
|
||||
|
||||
@@ -130,11 +130,6 @@ void VTYNoGUIPlatform::SetPlatformWindowTitle(std::string title)
|
||||
Log_InfoPrintf("Window Title: %s", title.c_str());
|
||||
}
|
||||
|
||||
void* VTYNoGUIPlatform::GetPlatformWindowHandle()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VTYNoGUIPlatform::RunMessageLoop()
|
||||
{
|
||||
while (m_message_loop_running.load(std::memory_order_acquire))
|
||||
|
||||
@@ -24,7 +24,6 @@ public:
|
||||
void DestroyPlatformWindow() override;
|
||||
std::optional<WindowInfo> GetPlatformWindowInfo() override;
|
||||
void SetPlatformWindowTitle(std::string title) override;
|
||||
void* GetPlatformWindowHandle() override;
|
||||
|
||||
std::optional<u32> ConvertHostKeyboardStringToCode(const std::string_view& str) override;
|
||||
std::optional<std::string> ConvertHostKeyboardCodeToString(u32 code) override;
|
||||
|
||||
@@ -193,11 +193,6 @@ void WaylandNoGUIPlatform::SetPlatformWindowTitle(std::string title)
|
||||
xdg_toplevel_set_title(m_xdg_toplevel, title.c_str());
|
||||
}
|
||||
|
||||
void* WaylandNoGUIPlatform::GetPlatformWindowHandle()
|
||||
{
|
||||
return m_surface;
|
||||
}
|
||||
|
||||
std::optional<u32> WaylandNoGUIPlatform::ConvertHostKeyboardStringToCode(const std::string_view& str)
|
||||
{
|
||||
std::unique_lock lock(m_key_map_mutex);
|
||||
|
||||
@@ -29,7 +29,6 @@ public:
|
||||
void DestroyPlatformWindow() override;
|
||||
std::optional<WindowInfo> GetPlatformWindowInfo() override;
|
||||
void SetPlatformWindowTitle(std::string title) override;
|
||||
void* GetPlatformWindowHandle() override;
|
||||
|
||||
std::optional<u32> ConvertHostKeyboardStringToCode(const std::string_view& str) override;
|
||||
std::optional<std::string> ConvertHostKeyboardCodeToString(u32 code) override;
|
||||
|
||||
@@ -177,11 +177,6 @@ void Win32NoGUIPlatform::SetPlatformWindowTitle(std::string title)
|
||||
SetWindowTextW(m_hwnd, StringUtil::UTF8StringToWideString(title).c_str());
|
||||
}
|
||||
|
||||
void* Win32NoGUIPlatform::GetPlatformWindowHandle()
|
||||
{
|
||||
return m_hwnd;
|
||||
}
|
||||
|
||||
std::optional<u32> Win32NoGUIPlatform::ConvertHostKeyboardStringToCode(const std::string_view& str)
|
||||
{
|
||||
std::optional<DWORD> converted(Win32KeyNames::GetKeyCodeForName(str));
|
||||
|
||||
@@ -23,7 +23,6 @@ public:
|
||||
void DestroyPlatformWindow() override;
|
||||
std::optional<WindowInfo> GetPlatformWindowInfo() override;
|
||||
void SetPlatformWindowTitle(std::string title) override;
|
||||
void* GetPlatformWindowHandle() override;
|
||||
|
||||
std::optional<u32> ConvertHostKeyboardStringToCode(const std::string_view& str) override;
|
||||
std::optional<std::string> ConvertHostKeyboardCodeToString(u32 code) override;
|
||||
|
||||
@@ -129,11 +129,6 @@ void X11NoGUIPlatform::SetPlatformWindowTitle(std::string title)
|
||||
});
|
||||
}
|
||||
|
||||
void* X11NoGUIPlatform::GetPlatformWindowHandle()
|
||||
{
|
||||
return reinterpret_cast<void*>(m_window);
|
||||
}
|
||||
|
||||
void X11NoGUIPlatform::InitializeKeyMap()
|
||||
{
|
||||
int min_keycode = 0, max_keycode = -1;
|
||||
|
||||
@@ -48,7 +48,6 @@ public:
|
||||
void DestroyPlatformWindow() override;
|
||||
std::optional<WindowInfo> GetPlatformWindowInfo() override;
|
||||
void SetPlatformWindowTitle(std::string title) override;
|
||||
void* GetPlatformWindowHandle() override;
|
||||
|
||||
std::optional<u32> ConvertHostKeyboardStringToCode(const std::string_view& str) override;
|
||||
std::optional<std::string> ConvertHostKeyboardCodeToString(u32 code) override;
|
||||
|
||||
Reference in New Issue
Block a user