diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index 699a497f7..72d705a09 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -1675,6 +1675,22 @@ QString GetSystemUsername() return username; } +void BringToForeground(QWidget *window) +{ +#ifdef Q_OS_WIN + SetWindowPos((HWND)window->winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + window->setWindowState(Qt::WindowActive); + window->raise(); + window->showNormal(); + window->show(); + SetWindowPos((HWND)window->winId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); +#else + window->activateWindow(); + window->raise(); + window->showNormal(); +#endif +} + bool IsDarkTheme() { float baseLum = getLuminance(QApplication::palette().color(QPalette::Base)); diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index f3c389a81..245f3fc27 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -539,6 +539,8 @@ void setEnabledMultiple(const QList &widgets, bool enabled); QString GetSystemUsername(); +void BringToForeground(QWidget *window); + bool IsDarkTheme(); float getLuminance(const QColor &col); diff --git a/qrenderdoc/Code/RGPInterop.cpp b/qrenderdoc/Code/RGPInterop.cpp index 2e17e02b7..3f807196f 100644 --- a/qrenderdoc/Code/RGPInterop.cpp +++ b/qrenderdoc/Code/RGPInterop.cpp @@ -221,8 +221,7 @@ void RGPInterop::EventSelected(RGPInteropEvent event) m_Ctx.SetEventID({}, eventId, eventId); - m_Ctx.GetMainWindow()->Widget()->activateWindow(); - m_Ctx.GetMainWindow()->Widget()->raise(); + BringToForeground(m_Ctx.GetMainWindow()->Widget()); } void RGPInterop::ConnectionEstablished() diff --git a/qrenderdoc/qrenderdoc.pro b/qrenderdoc/qrenderdoc.pro index 76f9ce490..f8c2069fc 100644 --- a/qrenderdoc/qrenderdoc.pro +++ b/qrenderdoc/qrenderdoc.pro @@ -88,6 +88,8 @@ win32 { LIBS += $$_PRO_FILE_PWD_/3rdparty/pyside/x64/shiboken2.lib } + LIBS += user32.lib + # Link against the core library LIBS += $$DESTDIR/renderdoc.lib diff --git a/qrenderdoc/qrenderdoc_local.vcxproj b/qrenderdoc/qrenderdoc_local.vcxproj index 763f0f5fb..648496a0a 100644 --- a/qrenderdoc/qrenderdoc_local.vcxproj +++ b/qrenderdoc/qrenderdoc_local.vcxproj @@ -134,7 +134,7 @@ PYSIDE2_ENABLED=1;%(PreprocessorDefinitions) - shiboken2.lib;%(AdditionalDependencies) + user32.lib;shiboken2.lib;%(AdditionalDependencies)