summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/MainWindow.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2018-11-12 17:26:03 +0100
committerGitHub <noreply@github.com>2018-11-12 17:26:03 +0100
commit97e3200f5799cb43f508fd6c385321bc778c5ffb (patch)
tree4fb4833f00991fdea4d75a773f13bc736639f3ea /Source/Core/DolphinQt/MainWindow.cpp
parent4de7161eaa9a59c6b80f179c66abd3015bf3b4c9 (diff)
parent6392be61ebf00188cd048b42c99fff60f0a56139 (diff)
Merge pull request #7519 from stenzek/controller-window
Core: Switch controller interface to render surface on booting
Diffstat (limited to 'Source/Core/DolphinQt/MainWindow.cpp')
-rw-r--r--Source/Core/DolphinQt/MainWindow.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp
index ec15365e55..e2b9e15791 100644
--- a/Source/Core/DolphinQt/MainWindow.cpp
+++ b/Source/Core/DolphinQt/MainWindow.cpp
@@ -169,6 +169,7 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainW
setWindowIcon(Resources::GetAppIcon());
setUnifiedTitleAndToolBarOnMac(true);
setAcceptDrops(true);
+ setAttribute(Qt::WA_NativeWindow);
InitControllers();
@@ -237,7 +238,7 @@ void MainWindow::InitControllers()
if (g_controller_interface.IsInit())
return;
- g_controller_interface.Initialize(reinterpret_cast<void*>(winId()));
+ g_controller_interface.Initialize(GetWindowSystemInfo(windowHandle()));
Pad::Initialize();
Keyboard::Initialize();
Wiimote::Initialize(Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
@@ -874,7 +875,8 @@ void MainWindow::SetFullScreenResolution(bool fullscreen)
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
ChangeDisplaySettings(&screen_settings, CDS_FULLSCREEN);
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
- m_xrr_config->ToggleDisplayMode(fullscreen);
+ if (m_xrr_config)
+ m_xrr_config->ToggleDisplayMode(fullscreen);
#endif
}
@@ -938,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);
}
}
@@ -1003,14 +1010,18 @@ void MainWindow::ShowGraphicsWindow()
if (!m_graphics_window)
{
#if defined(HAVE_XRANDR) && HAVE_XRANDR
- m_xrr_config = std::make_unique<X11Utils::XRRConfiguration>(
- static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(
- "display", windowHandle())),
- winId());
+ if (GetWindowSystemType() == WindowSystemType::X11)
+ {
+ m_xrr_config = std::make_unique<X11Utils::XRRConfiguration>(
+ static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(
+ "display", windowHandle())),
+ winId());
+ }
m_graphics_window = new GraphicsWindow(m_xrr_config.get(), this);
#else
m_graphics_window = new GraphicsWindow(nullptr, this);
#endif
+ InstallHotkeyFilter(m_graphics_window);
}
m_graphics_window->show();
@@ -1273,7 +1284,8 @@ void MainWindow::NetPlayQuit()
void MainWindow::EnableScreenSaver(bool enable)
{
#if defined(HAVE_XRANDR) && HAVE_XRANDR
- UICommon::EnableScreenSaver(winId(), enable);
+ if (GetWindowSystemType() == WindowSystemType::X11)
+ UICommon::EnableScreenSaver(winId(), enable);
#else
UICommon::EnableScreenSaver(enable);
#endif