mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Drop Host_GetRenderSurface and pass display to backend
This commit is contained in:
@ -30,14 +30,10 @@ Host* Host::GetInstance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
void* Host::GetRenderHandle()
|
||||
{
|
||||
return m_render_handle;
|
||||
}
|
||||
|
||||
void Host::SetRenderHandle(void* handle)
|
||||
{
|
||||
m_render_handle = handle;
|
||||
if (g_renderer)
|
||||
g_renderer->ChangeSurface(handle);
|
||||
}
|
||||
|
||||
bool Host::GetRenderFocus()
|
||||
@ -94,11 +90,6 @@ void Host_UpdateTitle(const std::string& title)
|
||||
emit Host::GetInstance()->RequestTitle(QString::fromStdString(title));
|
||||
}
|
||||
|
||||
void* Host_GetRenderHandle()
|
||||
{
|
||||
return Host::GetInstance()->GetRenderHandle();
|
||||
}
|
||||
|
||||
bool Host_RendererHasFocus()
|
||||
{
|
||||
return Host::GetInstance()->GetRenderFocus();
|
||||
|
@ -20,7 +20,6 @@ class Host final : public QObject
|
||||
public:
|
||||
static Host* GetInstance();
|
||||
|
||||
void* GetRenderHandle();
|
||||
bool GetRenderFocus();
|
||||
bool GetRenderFullscreen();
|
||||
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include "QtUtils/SignalDaemon.h"
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#endif
|
||||
|
||||
#include "Common/Version.h"
|
||||
|
||||
#include "Core/Boot/Boot.h"
|
||||
@ -98,7 +102,6 @@
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include "UICommon/X11Utils.h"
|
||||
#endif
|
||||
|
||||
@ -797,14 +800,26 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
|
||||
m_pending_boot = std::move(parameters);
|
||||
return;
|
||||
}
|
||||
|
||||
// We need the render widget before booting.
|
||||
ShowRenderWidget();
|
||||
|
||||
// Populate the video backend fields of the boot parameters.
|
||||
parameters->render_surface = reinterpret_cast<void*>(m_render_widget->winId());
|
||||
#ifndef WIN32
|
||||
parameters->display_connection =
|
||||
QGuiApplication::platformNativeInterface()->nativeResourceForWindow("display",
|
||||
windowHandle());
|
||||
#endif
|
||||
|
||||
// Boot up, show an error if it fails to load the game.
|
||||
if (!BootManager::BootCore(std::move(parameters)))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok);
|
||||
HideRenderWidget();
|
||||
return;
|
||||
}
|
||||
|
||||
ShowRenderWidget();
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
if (!NetPlay::IsNetPlayRunning())
|
||||
Discord::UpdateDiscordPresence();
|
||||
|
@ -55,8 +55,6 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
|
||||
connect(this, &RenderWidget::FocusChanged, Host::GetInstance(), &Host::SetRenderFocus,
|
||||
Qt::DirectConnection);
|
||||
|
||||
emit HandleChanged((void*)winId());
|
||||
|
||||
m_mouse_timer = new QTimer(this);
|
||||
connect(m_mouse_timer, &QTimer::timeout, this, &RenderWidget::HandleCursorTimer);
|
||||
m_mouse_timer->setSingleShot(true);
|
||||
@ -144,7 +142,7 @@ bool RenderWidget::event(QEvent* event)
|
||||
}
|
||||
break;
|
||||
case QEvent::WinIdChange:
|
||||
emit HandleChanged((void*)winId());
|
||||
emit HandleChanged(reinterpret_cast<void*>(winId()));
|
||||
break;
|
||||
case QEvent::WindowActivate:
|
||||
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Paused)
|
||||
|
Reference in New Issue
Block a user