diff options
| author | Stenzek <stenzek@gmail.com> | 2018-10-03 17:34:27 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2018-10-29 11:46:06 +1000 |
| commit | a7f334dc2a3eec0119d8b77ec3ff35bbc8aae5f9 (patch) | |
| tree | d26810619b5fdefa7526619f3ae1dbd8155b9685 /Source/Core/DolphinQt/MainWindow.cpp | |
| parent | 2b905eb06a806bc654281910d92693e2dcb6f201 (diff) | |
ControllerInterface: Don't crash on non-X11 QPA
Diffstat (limited to 'Source/Core/DolphinQt/MainWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/MainWindow.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index ec15365e55..f02542da95 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 } @@ -1003,14 +1005,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 +1279,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 |
