mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 06:25:37 +00:00
FullscreenUI: Re-enable most previously-missing settings
This commit is contained in:
parent
cac2714555
commit
cab51c6764
|
@ -118,4 +118,10 @@ void SetMouseMode(bool relative, bool hide_cursor);
|
||||||
|
|
||||||
/// Safely executes a function on the VM thread.
|
/// Safely executes a function on the VM thread.
|
||||||
void RunOnCPUThread(std::function<void()> function, bool block = false);
|
void RunOnCPUThread(std::function<void()> function, bool block = false);
|
||||||
|
|
||||||
|
/// Opens a URL, using the default application.
|
||||||
|
void OpenURL(const std::string_view& url);
|
||||||
|
|
||||||
|
/// Copies the provided text to the host's clipboard, if present.
|
||||||
|
bool CopyTextToClipboard(const std::string_view& text);
|
||||||
} // namespace Host
|
} // namespace Host
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="win32_nogui_platform.cpp" />
|
<ClCompile Include="win32_nogui_platform.cpp" />
|
||||||
|
<ClCompile Include="x11_nogui_platform.cpp">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="nogui_host.h" />
|
<ClInclude Include="nogui_host.h" />
|
||||||
|
@ -25,6 +28,9 @@
|
||||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="win32_nogui_platform.h" />
|
<ClInclude Include="win32_nogui_platform.h" />
|
||||||
|
<ClInclude Include="x11_nogui_platform.h">
|
||||||
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Manifest Include="duckstation-nogui.manifest" />
|
<Manifest Include="duckstation-nogui.manifest" />
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<ClCompile Include="win32_nogui_platform.cpp" />
|
<ClCompile Include="win32_nogui_platform.cpp" />
|
||||||
<ClCompile Include="vty_nogui_platform.cpp" />
|
<ClCompile Include="vty_nogui_platform.cpp" />
|
||||||
<ClCompile Include="wayland_nogui_platform.cpp" />
|
<ClCompile Include="wayland_nogui_platform.cpp" />
|
||||||
|
<ClCompile Include="x11_nogui_platform.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
<ClInclude Include="vty_key_names.h" />
|
<ClInclude Include="vty_key_names.h" />
|
||||||
<ClInclude Include="nogui_platform.h" />
|
<ClInclude Include="nogui_platform.h" />
|
||||||
<ClInclude Include="wayland_nogui_platform.h" />
|
<ClInclude Include="wayland_nogui_platform.h" />
|
||||||
|
<ClInclude Include="x11_nogui_platform.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Manifest Include="duckstation-nogui.manifest" />
|
<Manifest Include="duckstation-nogui.manifest" />
|
||||||
|
|
|
@ -509,6 +509,14 @@ void NoGUIHost::ProcessPlatformKeyEvent(s32 key, bool pressed)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NoGUIHost::ProcessPlatformTextEvent(const char* text)
|
||||||
|
{
|
||||||
|
if (!ImGuiManager::WantsTextInput())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Host::RunOnCPUThread([text = std::string(text)]() { ImGuiManager::AddTextInput(std::move(text)); });
|
||||||
|
}
|
||||||
|
|
||||||
void NoGUIHost::PlatformWindowFocusGained()
|
void NoGUIHost::PlatformWindowFocusGained()
|
||||||
{
|
{
|
||||||
Host::RunOnCPUThread([]() {
|
Host::RunOnCPUThread([]() {
|
||||||
|
@ -847,6 +855,16 @@ void Host::RequestResizeHostDisplay(s32 width, s32 height)
|
||||||
g_nogui_window->RequestRenderWindowSize(width, height);
|
g_nogui_window->RequestRenderWindowSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Host::OpenURL(const std::string_view& url)
|
||||||
|
{
|
||||||
|
g_nogui_window->OpenURL(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Host::CopyTextToClipboard(const std::string_view& text)
|
||||||
|
{
|
||||||
|
return g_nogui_window->CopyTextToClipboard(text);
|
||||||
|
}
|
||||||
|
|
||||||
void Host::OnPerformanceCountersUpdated()
|
void Host::OnPerformanceCountersUpdated()
|
||||||
{
|
{
|
||||||
// noop
|
// noop
|
||||||
|
|
|
@ -27,6 +27,7 @@ void ProcessPlatformMouseMoveEvent(float x, float y);
|
||||||
void ProcessPlatformMouseButtonEvent(s32 button, bool pressed);
|
void ProcessPlatformMouseButtonEvent(s32 button, bool pressed);
|
||||||
void ProcessPlatformMouseWheelEvent(float x, float y);
|
void ProcessPlatformMouseWheelEvent(float x, float y);
|
||||||
void ProcessPlatformKeyEvent(s32 key, bool pressed);
|
void ProcessPlatformKeyEvent(s32 key, bool pressed);
|
||||||
|
void ProcessPlatformTextEvent(const char* text);
|
||||||
void PlatformWindowFocusGained();
|
void PlatformWindowFocusGained();
|
||||||
void PlatformWindowFocusLost();
|
void PlatformWindowFocusLost();
|
||||||
bool GetSavedPlatformWindowGeometry(s32* x, s32* y, s32* width, s32* height);
|
bool GetSavedPlatformWindowGeometry(s32* x, s32* y, s32* width, s32* height);
|
||||||
|
|
|
@ -37,6 +37,9 @@ public:
|
||||||
|
|
||||||
virtual bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) = 0;
|
virtual bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) = 0;
|
||||||
|
|
||||||
|
virtual bool OpenURL(const std::string_view& url) = 0;
|
||||||
|
virtual bool CopyTextToClipboard(const std::string_view& text) = 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static std::unique_ptr<NoGUIPlatform> CreateWin32Platform();
|
static std::unique_ptr<NoGUIPlatform> CreateWin32Platform();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -108,6 +108,19 @@ bool VTYNoGUIPlatform::RequestRenderWindowSize(s32 new_window_width, s32 new_win
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VTYNoGUIPlatform::OpenURL(const std::string_view& url)
|
||||||
|
{
|
||||||
|
Log_ErrorPrintf("VTYNoGUIPlatform::OpenURL() not implemented: %.*s", static_cast<int>(url.size()), url.data());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VTYNoGUIPlatform::CopyTextToClipboard(const std::string_view& text)
|
||||||
|
{
|
||||||
|
Log_ErrorPrintf("VTYNoGUIPlatform::CopyTextToClipboard() not implemented: %.*s", static_cast<int>(text.size()),
|
||||||
|
text.data());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void VTYNoGUIPlatform::SetPlatformWindowTitle(std::string title)
|
void VTYNoGUIPlatform::SetPlatformWindowTitle(std::string title)
|
||||||
{
|
{
|
||||||
Log_InfoPrintf("Window Title: %s", title.c_str());
|
Log_InfoPrintf("Window Title: %s", title.c_str());
|
||||||
|
|
|
@ -36,6 +36,9 @@ public:
|
||||||
|
|
||||||
bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override;
|
bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override;
|
||||||
|
|
||||||
|
bool OpenURL(const std::string_view& url) override;
|
||||||
|
bool CopyTextToClipboard(const std::string_view& text) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OpenEVDevFDs();
|
void OpenEVDevFDs();
|
||||||
void CloseEVDevFDs();
|
void CloseEVDevFDs();
|
||||||
|
|
|
@ -455,6 +455,18 @@ bool WaylandNoGUIPlatform::RequestRenderWindowSize(s32 new_window_width, s32 new
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WaylandNoGUIPlatform::OpenURL(const std::string_view& url)
|
||||||
|
{
|
||||||
|
Log_ErrorPrintf("WaylandNoGUIPlatform::OpenURL() not implemented: %.*s", static_cast<int>(url.size()), url.data());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WaylandNoGUIPlatform::CopyTextToClipboard(const std::string_view& text)
|
||||||
|
{
|
||||||
|
Log_ErrorPrintf("WaylandNoGUIPlatform::CopyTextToClipboard() not implemented: %.*s", static_cast<int>(text.size()), text.data());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<NoGUIPlatform> NoGUIPlatform::CreateWaylandPlatform()
|
std::unique_ptr<NoGUIPlatform> NoGUIPlatform::CreateWaylandPlatform()
|
||||||
{
|
{
|
||||||
std::unique_ptr<WaylandNoGUIPlatform> ret = std::unique_ptr<WaylandNoGUIPlatform>(new WaylandNoGUIPlatform());
|
std::unique_ptr<WaylandNoGUIPlatform> ret = std::unique_ptr<WaylandNoGUIPlatform>(new WaylandNoGUIPlatform());
|
||||||
|
|
|
@ -41,6 +41,9 @@ public:
|
||||||
|
|
||||||
bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override;
|
bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override;
|
||||||
|
|
||||||
|
bool OpenURL(const std::string_view& url) override;
|
||||||
|
bool CopyTextToClipboard(const std::string_view& text) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeKeyMap();
|
void InitializeKeyMap();
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
#include "win32_nogui_platform.h"
|
#include "win32_nogui_platform.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
#include "common/scoped_guard.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "common/threading.h"
|
#include "common/threading.h"
|
||||||
#include "core/host.h"
|
#include "core/host.h"
|
||||||
#include "core/host_settings.h"
|
#include "core/host_settings.h"
|
||||||
|
#include "frontend-common/imgui_manager.h"
|
||||||
#include "nogui_host.h"
|
#include "nogui_host.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "win32_key_names.h"
|
#include "win32_key_names.h"
|
||||||
|
#include <shellapi.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
Log_SetChannel(Win32HostInterface);
|
Log_SetChannel(Win32HostInterface);
|
||||||
|
|
||||||
|
@ -255,6 +258,37 @@ bool Win32NoGUIPlatform::RequestRenderWindowSize(s32 new_window_width, s32 new_w
|
||||||
return SetWindowPos(m_hwnd, NULL, rc.left, rc.top, new_window_width, new_window_height, SWP_SHOWWINDOW);
|
return SetWindowPos(m_hwnd, NULL, rc.left, rc.top, new_window_width, new_window_height, SWP_SHOWWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Win32NoGUIPlatform::OpenURL(const std::string_view& url)
|
||||||
|
{
|
||||||
|
return (ShellExecuteW(nullptr, L"open", StringUtil::UTF8StringToWideString(url).c_str(), nullptr, nullptr,
|
||||||
|
SW_SHOWNORMAL) != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Win32NoGUIPlatform::CopyTextToClipboard(const std::string_view& text)
|
||||||
|
{
|
||||||
|
const int wlen = MultiByteToWideChar(CP_UTF8, 0, text.data(), static_cast<int>(text.length()), nullptr, 0);
|
||||||
|
if (wlen < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!OpenClipboard(m_hwnd))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ScopedGuard clipboard_cleanup([]() { CloseClipboard(); });
|
||||||
|
EmptyClipboard();
|
||||||
|
|
||||||
|
const HANDLE hText = GlobalAlloc(GMEM_MOVEABLE, (wlen + 1) * sizeof(wchar_t));
|
||||||
|
if (hText == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
LPWSTR mem = static_cast<LPWSTR>(GlobalLock(hText));
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, text.data(), static_cast<int>(text.length()), mem, wlen);
|
||||||
|
mem[wlen] = 0;
|
||||||
|
GlobalUnlock(hText);
|
||||||
|
|
||||||
|
SetClipboardData(CF_UNICODETEXT, hText);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK Win32NoGUIPlatform::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK Win32NoGUIPlatform::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
Win32NoGUIPlatform* platform = static_cast<Win32NoGUIPlatform*>(g_nogui_window.get());
|
Win32NoGUIPlatform* platform = static_cast<Win32NoGUIPlatform*>(g_nogui_window.get());
|
||||||
|
@ -279,6 +313,23 @@ LRESULT CALLBACK Win32NoGUIPlatform::WndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_CHAR:
|
||||||
|
{
|
||||||
|
if (ImGuiManager::WantsTextInput())
|
||||||
|
{
|
||||||
|
const WCHAR utf16[2] = {static_cast<wchar_t>(wParam), 0};
|
||||||
|
char utf8[8] = {};
|
||||||
|
const int utf8_len =
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0, utf16, sizeof(utf16), utf8, sizeof(utf8) - 1, nullptr, nullptr);
|
||||||
|
if (utf8_len > 0)
|
||||||
|
{
|
||||||
|
utf8[utf8_len] = 0;
|
||||||
|
NoGUIHost::ProcessPlatformTextEvent(utf8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
{
|
{
|
||||||
const float x = static_cast<float>(static_cast<s16>(LOWORD(lParam)));
|
const float x = static_cast<float>(static_cast<s16>(LOWORD(lParam)));
|
||||||
|
|
|
@ -35,6 +35,9 @@ public:
|
||||||
|
|
||||||
bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override;
|
bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override;
|
||||||
|
|
||||||
|
bool OpenURL(const std::string_view& url) override;
|
||||||
|
bool CopyTextToClipboard(const std::string_view& text) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
|
|
|
@ -317,6 +317,19 @@ bool X11NoGUIPlatform::RequestRenderWindowSize(s32 new_window_width, s32 new_win
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool X11NoGUIPlatform::OpenURL(const std::string_view& url)
|
||||||
|
{
|
||||||
|
Log_ErrorPrintf("X11NoGUIPlatform::OpenURL() not implemented: %.*s", static_cast<int>(url.size()), url.data());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool X11NoGUIPlatform::CopyTextToClipboard(const std::string_view& text)
|
||||||
|
{
|
||||||
|
Log_ErrorPrintf("X11NoGUIPlatform::CopyTextToClipboard() not implemented: %.*s", static_cast<int>(text.size()),
|
||||||
|
text.data());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<NoGUIPlatform> NoGUIPlatform::CreateX11Platform()
|
std::unique_ptr<NoGUIPlatform> NoGUIPlatform::CreateX11Platform()
|
||||||
{
|
{
|
||||||
std::unique_ptr<X11NoGUIPlatform> ret = std::unique_ptr<X11NoGUIPlatform>(new X11NoGUIPlatform());
|
std::unique_ptr<X11NoGUIPlatform> ret = std::unique_ptr<X11NoGUIPlatform>(new X11NoGUIPlatform());
|
||||||
|
|
|
@ -60,6 +60,9 @@ public:
|
||||||
|
|
||||||
bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override;
|
bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height) override;
|
||||||
|
|
||||||
|
bool OpenURL(const std::string_view& url) override;
|
||||||
|
bool CopyTextToClipboard(const std::string_view& text) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeKeyMap();
|
void InitializeKeyMap();
|
||||||
void SaveWindowGeometry();
|
void SaveWindowGeometry();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/bitutils.h"
|
#include "common/bitutils.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
#include "frontend-common/imgui_manager.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "qthost.h"
|
#include "qthost.h"
|
||||||
#include "qtutils.h"
|
#include "qtutils.h"
|
||||||
|
@ -205,6 +206,14 @@ bool DisplayWidget::event(QEvent* event)
|
||||||
case QEvent::KeyRelease:
|
case QEvent::KeyRelease:
|
||||||
{
|
{
|
||||||
const QKeyEvent* key_event = static_cast<QKeyEvent*>(event);
|
const QKeyEvent* key_event = static_cast<QKeyEvent*>(event);
|
||||||
|
|
||||||
|
if (ImGuiManager::WantsTextInput() && key_event->type() == QEvent::KeyPress)
|
||||||
|
{
|
||||||
|
const QString text(key_event->text());
|
||||||
|
if (!text.isEmpty())
|
||||||
|
emit windowTextEntered(text);
|
||||||
|
}
|
||||||
|
|
||||||
if (key_event->isAutoRepeat())
|
if (key_event->isAutoRepeat())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ Q_SIGNALS:
|
||||||
void windowResizedEvent(int width, int height, float scale);
|
void windowResizedEvent(int width, int height, float scale);
|
||||||
void windowRestoredEvent();
|
void windowRestoredEvent();
|
||||||
void windowKeyEvent(int key_code, bool pressed);
|
void windowKeyEvent(int key_code, bool pressed);
|
||||||
|
void windowTextEntered(const QString& text);
|
||||||
void windowMouseMoveEvent(bool relative, float x, float y);
|
void windowMouseMoveEvent(bool relative, float x, float y);
|
||||||
void windowMouseButtonEvent(int button, bool pressed);
|
void windowMouseButtonEvent(int button, bool pressed);
|
||||||
void windowMouseWheelEvent(const QPoint& angle_delta);
|
void windowMouseWheelEvent(const QPoint& angle_delta);
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <QtCore/QEventLoop>
|
#include <QtCore/QEventLoop>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
#include <QtGui/QClipboard>
|
||||||
#include <QtGui/QKeyEvent>
|
#include <QtGui/QKeyEvent>
|
||||||
#include <QtWidgets/QFileDialog>
|
#include <QtWidgets/QFileDialog>
|
||||||
#include <QtWidgets/QMenu>
|
#include <QtWidgets/QMenu>
|
||||||
|
@ -541,6 +542,13 @@ void EmuThread::onDisplayWindowKeyEvent(int key, bool pressed)
|
||||||
GenericInputBinding::Unknown);
|
GenericInputBinding::Unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmuThread::onDisplayWindowTextEntered(const QString& text)
|
||||||
|
{
|
||||||
|
DebugAssert(isOnThread());
|
||||||
|
|
||||||
|
ImGuiManager::AddTextInput(text.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
void EmuThread::onDisplayWindowMouseMoveEvent(bool relative, float x, float y)
|
void EmuThread::onDisplayWindowMouseMoveEvent(bool relative, float x, float y)
|
||||||
{
|
{
|
||||||
// display might be null here if the event happened after shutdown
|
// display might be null here if the event happened after shutdown
|
||||||
|
@ -763,6 +771,7 @@ void EmuThread::connectDisplaySignals(DisplayWidget* widget)
|
||||||
connect(widget, &DisplayWidget::windowResizedEvent, this, &EmuThread::onDisplayWindowResized);
|
connect(widget, &DisplayWidget::windowResizedEvent, this, &EmuThread::onDisplayWindowResized);
|
||||||
connect(widget, &DisplayWidget::windowRestoredEvent, this, &EmuThread::redrawDisplayWindow);
|
connect(widget, &DisplayWidget::windowRestoredEvent, this, &EmuThread::redrawDisplayWindow);
|
||||||
connect(widget, &DisplayWidget::windowKeyEvent, this, &EmuThread::onDisplayWindowKeyEvent);
|
connect(widget, &DisplayWidget::windowKeyEvent, this, &EmuThread::onDisplayWindowKeyEvent);
|
||||||
|
connect(widget, &DisplayWidget::windowTextEntered, this, &EmuThread::onDisplayWindowTextEntered);
|
||||||
connect(widget, &DisplayWidget::windowMouseMoveEvent, this, &EmuThread::onDisplayWindowMouseMoveEvent);
|
connect(widget, &DisplayWidget::windowMouseMoveEvent, this, &EmuThread::onDisplayWindowMouseMoveEvent);
|
||||||
connect(widget, &DisplayWidget::windowMouseButtonEvent, this, &EmuThread::onDisplayWindowMouseButtonEvent);
|
connect(widget, &DisplayWidget::windowMouseButtonEvent, this, &EmuThread::onDisplayWindowMouseButtonEvent);
|
||||||
connect(widget, &DisplayWidget::windowMouseWheelEvent, this, &EmuThread::onDisplayWindowMouseWheelEvent);
|
connect(widget, &DisplayWidget::windowMouseWheelEvent, this, &EmuThread::onDisplayWindowMouseWheelEvent);
|
||||||
|
@ -1489,6 +1498,21 @@ bool Host::ConfirmMessage(const std::string_view& title, const std::string_view&
|
||||||
QString::fromUtf8(message.data(), message.size()));
|
QString::fromUtf8(message.data(), message.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Host::OpenURL(const std::string_view& url)
|
||||||
|
{
|
||||||
|
QtHost::RunOnUIThread([url = QtUtils::StringViewToQString(url)]() { QtUtils::OpenURL(g_main_window, QUrl(url)); });
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Host::CopyTextToClipboard(const std::string_view& text)
|
||||||
|
{
|
||||||
|
QtHost::RunOnUIThread([text = QtUtils::StringViewToQString(text)]() {
|
||||||
|
QClipboard* clipboard = QGuiApplication::clipboard();
|
||||||
|
if (clipboard)
|
||||||
|
clipboard->setText(text);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Host::ReportDebuggerMessage(const std::string_view& message)
|
void Host::ReportDebuggerMessage(const std::string_view& message)
|
||||||
{
|
{
|
||||||
emit g_emu_thread->debuggerMessageReported(QString::fromUtf8(message));
|
emit g_emu_thread->debuggerMessageReported(QString::fromUtf8(message));
|
||||||
|
|
|
@ -190,6 +190,7 @@ private Q_SLOTS:
|
||||||
void onDisplayWindowMouseWheelEvent(const QPoint& delta_angle);
|
void onDisplayWindowMouseWheelEvent(const QPoint& delta_angle);
|
||||||
void onDisplayWindowResized(int width, int height);
|
void onDisplayWindowResized(int width, int height);
|
||||||
void onDisplayWindowKeyEvent(int key, bool pressed);
|
void onDisplayWindowKeyEvent(int key, bool pressed);
|
||||||
|
void onDisplayWindowTextEntered(const QString& text);
|
||||||
void doBackgroundControllerPoll();
|
void doBackgroundControllerPoll();
|
||||||
void runOnEmuThread(std::function<void()> callback);
|
void runOnEmuThread(std::function<void()> callback);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -733,6 +733,22 @@ ImFont* ImGuiManager::GetLargeFont()
|
||||||
return s_large_font;
|
return s_large_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImGuiManager::WantsTextInput()
|
||||||
|
{
|
||||||
|
return s_imgui_wants_keyboard.load(std::memory_order_acquire);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiManager::AddTextInput(std::string str)
|
||||||
|
{
|
||||||
|
if (!ImGui::GetCurrentContext())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!s_imgui_wants_keyboard.load(std::memory_order_acquire))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ImGui::GetIO().AddInputCharactersUTF8(str.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void ImGuiManager::UpdateMousePosition(float x, float y)
|
void ImGuiManager::UpdateMousePosition(float x, float y)
|
||||||
{
|
{
|
||||||
if (!ImGui::GetCurrentContext())
|
if (!ImGui::GetCurrentContext())
|
||||||
|
|
|
@ -56,6 +56,12 @@ ImFont* GetMediumFont();
|
||||||
/// This font is allocated on demand.
|
/// This font is allocated on demand.
|
||||||
ImFont* GetLargeFont();
|
ImFont* GetLargeFont();
|
||||||
|
|
||||||
|
/// Returns true if imgui wants to intercept text input.
|
||||||
|
bool WantsTextInput();
|
||||||
|
|
||||||
|
/// Called on the UI or CPU thread in response to a key press. String is UTF-8.
|
||||||
|
void AddTextInput(std::string str);
|
||||||
|
|
||||||
/// Called on the UI or CPU thread in response to mouse movement.
|
/// Called on the UI or CPU thread in response to mouse movement.
|
||||||
void UpdateMousePosition(float x, float y);
|
void UpdateMousePosition(float x, float y);
|
||||||
|
|
||||||
|
|
|
@ -901,6 +901,7 @@ void InputManager::SetDefaultConfig(SettingsInterface& si)
|
||||||
si.ClearSection("InputSources");
|
si.ClearSection("InputSources");
|
||||||
si.SetBoolValue("InputSources", "SDL", true);
|
si.SetBoolValue("InputSources", "SDL", true);
|
||||||
si.SetBoolValue("InputSources", "SDLControllerEnhancedMode", false);
|
si.SetBoolValue("InputSources", "SDLControllerEnhancedMode", false);
|
||||||
|
si.SetBoolValue("InputSources", "Evdev", false);
|
||||||
si.SetBoolValue("InputSources", "XInput", false);
|
si.SetBoolValue("InputSources", "XInput", false);
|
||||||
si.SetBoolValue("InputSources", "RawInput", false);
|
si.SetBoolValue("InputSources", "RawInput", false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,20 @@ u32 AudioStream::GetMSForBufferSize(u32 sample_rate, u32 buffer_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr const auto s_stretch_mode_names = make_array("None", "Resample", "TimeStretch");
|
static constexpr const auto s_stretch_mode_names = make_array("None", "Resample", "TimeStretch");
|
||||||
|
static constexpr const auto s_stretch_mode_display_names = make_array("None", "Resampling", "Time Stretching");
|
||||||
|
|
||||||
const char* AudioStream::GetStretchModeName(AudioStretchMode mode)
|
const char* AudioStream::GetStretchModeName(AudioStretchMode mode)
|
||||||
{
|
{
|
||||||
return (static_cast<u32>(mode) < s_stretch_mode_names.size()) ? s_stretch_mode_names[static_cast<u32>(mode)] : "";
|
return (static_cast<u32>(mode) < s_stretch_mode_names.size()) ? s_stretch_mode_names[static_cast<u32>(mode)] : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* AudioStream::GetStretchModeDisplayName(AudioStretchMode mode)
|
||||||
|
{
|
||||||
|
return (static_cast<u32>(mode) < s_stretch_mode_display_names.size()) ?
|
||||||
|
s_stretch_mode_display_names[static_cast<u32>(mode)] :
|
||||||
|
"";
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<AudioStretchMode> AudioStream::ParseStretchMode(const char* name)
|
std::optional<AudioStretchMode> AudioStream::ParseStretchMode(const char* name)
|
||||||
{
|
{
|
||||||
for (u8 i = 0; i < static_cast<u8>(AudioStretchMode::Count); i++)
|
for (u8 i = 0; i < static_cast<u8>(AudioStretchMode::Count); i++)
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
static u32 GetMSForBufferSize(u32 sample_rate, u32 buffer_size);
|
static u32 GetMSForBufferSize(u32 sample_rate, u32 buffer_size);
|
||||||
|
|
||||||
static const char* GetStretchModeName(AudioStretchMode mode);
|
static const char* GetStretchModeName(AudioStretchMode mode);
|
||||||
|
static const char* GetStretchModeDisplayName(AudioStretchMode mode);
|
||||||
static std::optional<AudioStretchMode> ParseStretchMode(const char* name);
|
static std::optional<AudioStretchMode> ParseStretchMode(const char* name);
|
||||||
|
|
||||||
ALWAYS_INLINE u32 GetSampleRate() const { return m_sample_rate; }
|
ALWAYS_INLINE u32 GetSampleRate() const { return m_sample_rate; }
|
||||||
|
|
Loading…
Reference in a new issue