Compare commits

..

No commits in common. "d9ce1c4302ceabfd8748a7658ae9a2d918575303" and "b57da216e9b87d97623f7facff82962c4c05f39b" have entirely different histories.

3 changed files with 7 additions and 10 deletions

2
cmake

@ -1 +1 @@
Subproject commit 84457a00a9fa645bbfd8fc9dfdee0ca3449bfac7 Subproject commit 2626fdcdd4f39e159f3afafc62f0e261152e954c

View File

@ -503,10 +503,6 @@ static inline void cleanupFallbackWindow()
} }
g_win32Helper()->data[parentWindowId].fallbackTitleBarWindowId = fallbackTitleBarWindowId; g_win32Helper()->data[parentWindowId].fallbackTitleBarWindowId = fallbackTitleBarWindowId;
g_win32Helper()->fallbackTitleBarToParentWindowMapping.insert(fallbackTitleBarWindowId, parentWindowId); g_win32Helper()->fallbackTitleBarToParentWindowMapping.insert(fallbackTitleBarWindowId, parentWindowId);
// ### Why do we need an extra resize here?
QTimer::singleShot(0, qApp, [parentWindowId, fallbackTitleBarWindowId, hide](){
std::ignore = resizeFallbackTitleBarWindow(parentWindowId, fallbackTitleBarWindowId, hide);
});
return true; return true;
} }
@ -533,10 +529,13 @@ void FramelessHelperWin::addWindow(FramelessParamsConst params)
qApp->installNativeEventFilter(g_win32Helper()->nativeEventFilter.get()); qApp->installNativeEventFilter(g_win32Helper()->nativeEventFilter.get());
} }
DEBUG.noquote() << "The DPI of window" << hwnd2str(windowId) << "is" << data.dpi; DEBUG.noquote() << "The DPI of window" << hwnd2str(windowId) << "is" << data.dpi;
// Remove the bad window styles added by Qt (it's not that "bad" though).
Utils::maybeFixupQtInternals(windowId);
#if 0 #if 0
params->setWindowFlags(params->getWindowFlags() | Qt::FramelessWindowHint); params->setWindowFlags(params->getWindowFlags() | Qt::FramelessWindowHint);
// We need some delay here, otherwise the window styles will be overwritten by
// QPA itself. But don't use QThread::sleep(), it doesn't help in our case.
QTimer::singleShot(0, qApp, [windowId](){
Utils::maybeFixupQtInternals(windowId);
});
#else #else
// Qt maintains a frame margin internally, we need to update it accordingly // Qt maintains a frame margin internally, we need to update it accordingly
// otherwise we'll get lots of warning messages when we change the window // otherwise we'll get lots of warning messages when we change the window

View File

@ -1284,7 +1284,6 @@ void Utils::maybeFixupQtInternals(const WId windowId)
} }
bool shouldUpdateFrame = false; bool shouldUpdateFrame = false;
const auto hwnd = reinterpret_cast<HWND>(windowId); const auto hwnd = reinterpret_cast<HWND>(windowId);
#if 0
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
const auto classStyle = static_cast<DWORD>(GetClassLongPtrW(hwnd, GCL_STYLE)); const auto classStyle = static_cast<DWORD>(GetClassLongPtrW(hwnd, GCL_STYLE));
if (classStyle != 0) { if (classStyle != 0) {
@ -1305,7 +1304,6 @@ void Utils::maybeFixupQtInternals(const WId windowId)
} else { } else {
WARNING << getSystemErrorMessage(kGetClassLongPtrW); WARNING << getSystemErrorMessage(kGetClassLongPtrW);
} }
#endif
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
const auto windowStyle = static_cast<DWORD>(GetWindowLongPtrW(hwnd, GWL_STYLE)); const auto windowStyle = static_cast<DWORD>(GetWindowLongPtrW(hwnd, GWL_STYLE));
if (windowStyle == 0) { if (windowStyle == 0) {
@ -2508,7 +2506,7 @@ bool Utils::isValidWindow(const WId windowId, const bool checkVisible, const boo
return false; return false;
} }
const LONG_PTR exStyles = ::GetWindowLongPtrW(hwnd, GWL_EXSTYLE); const LONG_PTR exStyles = ::GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
if ((exStyles != 0) && (exStyles & WS_EX_TOOLWINDOW)) { if (exStyles & WS_EX_TOOLWINDOW) {
return false; return false;
} }
RECT rect = { 0, 0, 0, 0 }; RECT rect = { 0, 0, 0, 0 };