Qt: Ensure window is raised after recreation

Should hopefully help with raw input issues.
This commit is contained in:
Stenzek 2024-08-24 21:28:21 +10:00
parent 41fb5d3d9a
commit a8cac70ee6
No known key found for this signature in database
2 changed files with 7 additions and 7 deletions

View File

@ -44,13 +44,7 @@ DisplayWidget::DisplayWidget(QWidget* parent) : QWidget(parent)
setMouseTracking(true); setMouseTracking(true);
} }
DisplayWidget::~DisplayWidget() DisplayWidget::~DisplayWidget() = default;
{
#ifdef _WIN32
if (m_clip_mouse_enabled)
ClipCursor(nullptr);
#endif
}
int DisplayWidget::scaledWindowWidth() const int DisplayWidget::scaledWindowWidth() const
{ {
@ -157,6 +151,11 @@ void DisplayWidget::destroy()
{ {
m_destroying = true; m_destroying = true;
#ifdef _WIN32
if (m_clip_mouse_enabled)
ClipCursor(nullptr);
#endif
#ifdef __APPLE__ #ifdef __APPLE__
// See Qt documentation, entire application is in full screen state, and the main // See Qt documentation, entire application is in full screen state, and the main
// window will get reopened fullscreen instead of windowed if we don't close the // window will get reopened fullscreen instead of windowed if we don't close the

View File

@ -309,6 +309,7 @@ std::optional<WindowInfo> MainWindow::acquireRenderWindow(bool recreate_window,
updateDisplayWidgetCursor(); updateDisplayWidgetCursor();
updateDisplayRelatedActions(true, render_to_main, fullscreen); updateDisplayRelatedActions(true, render_to_main, fullscreen);
QtUtils::ShowOrRaiseWindow(QtUtils::GetRootWidget(m_display_widget));
m_display_widget->setFocus(); m_display_widget->setFocus();
return wi; return wi;