From 3ed489f35c211fecd6b1f3bceec3af0c91794180 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 2 Jan 2023 12:42:24 +1000 Subject: [PATCH] Qt: Only apply non-visible window info rule for X11 Again, DInput needs the main window, even if it's not visible. --- pcsx2-qt/QtUtils.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pcsx2-qt/QtUtils.cpp b/pcsx2-qt/QtUtils.cpp index 2451b0d9a5..14b1e58ac0 100644 --- a/pcsx2-qt/QtUtils.cpp +++ b/pcsx2-qt/QtUtils.cpp @@ -224,12 +224,6 @@ namespace QtUtils std::optional GetWindowInfoForWidget(QWidget* widget) { - if (!widget->isVisible()) - { - Console.WriteLn("Returning null window info for widget because it is not visible."); - return std::nullopt; - } - WindowInfo wi; // Windows and Apple are easy here since there's no display connection. @@ -244,6 +238,13 @@ namespace QtUtils const QString platform_name = QGuiApplication::platformName(); if (platform_name == QStringLiteral("xcb")) { + // Can't get a handle for an unmapped window in X, it doesn't like it. + if (!widget->isVisible()) + { + Console.WriteLn("Returning null window info for widget because it is not visible."); + return std::nullopt; + } + wi.type = WindowInfo::Type::X11; wi.display_connection = pni->nativeResourceForWindow("display", widget->windowHandle()); wi.window_handle = reinterpret_cast(widget->winId());