mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Core: Switch controller interface to render widget on booting
Previously, the Qt frontend would initialize the controller interface on starting, resulting in the cursor position being relative to the main window, instead of the render window.
This commit is contained in:
parent
a7f334dc2a
commit
52828901ef
@ -456,6 +456,10 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
return;
|
||||
}
|
||||
|
||||
// The frontend will likely have initialized the controller interface, as it needs
|
||||
// it to provide the configuration dialogs. In this case, instead of re-initializing
|
||||
// entirely, we switch the window used for inputs to the render window. This way, the
|
||||
// cursor position is relative to the render window, instead of the main window.
|
||||
bool init_controllers = false;
|
||||
if (!g_controller_interface.IsInit())
|
||||
{
|
||||
@ -467,6 +471,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
else
|
||||
{
|
||||
// Update references in case controllers were refreshed
|
||||
g_controller_interface.ChangeWindow(wsi.render_surface);
|
||||
Pad::LoadConfig();
|
||||
Keyboard::LoadConfig();
|
||||
}
|
||||
|
@ -940,6 +940,11 @@ void MainWindow::HideRenderWidget(bool reinit)
|
||||
if (m_render_widget->isFullScreen())
|
||||
SetFullScreenResolution(focus);
|
||||
});
|
||||
|
||||
// The controller interface will still be registered to the old render widget, if the core
|
||||
// has booted. Therefore, we should re-bind it to the main window for now. When the core
|
||||
// is next started, it will be swapped back to the new render widget.
|
||||
g_controller_interface.ChangeWindow(GetWindowSystemInfo(windowHandle()).render_surface);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,15 @@ void ControllerInterface::Initialize(const WindowSystemInfo& wsi)
|
||||
RefreshDevices();
|
||||
}
|
||||
|
||||
void ControllerInterface::ChangeWindow(void* hwnd)
|
||||
{
|
||||
if (!m_is_init)
|
||||
return;
|
||||
|
||||
m_wsi.render_surface = hwnd;
|
||||
RefreshDevices();
|
||||
}
|
||||
|
||||
void ControllerInterface::RefreshDevices()
|
||||
{
|
||||
if (!m_is_init)
|
||||
|
@ -42,6 +42,7 @@ class ControllerInterface : public ciface::Core::DeviceContainer
|
||||
public:
|
||||
ControllerInterface() : m_is_init(false) {}
|
||||
void Initialize(const WindowSystemInfo& wsi);
|
||||
void ChangeWindow(void* hwnd);
|
||||
void RefreshDevices();
|
||||
void Shutdown();
|
||||
void AddDevice(std::shared_ptr<ciface::Core::Device> device);
|
||||
|
Loading…
Reference in New Issue
Block a user