Minor improvements.

Don't lose original ex-styles.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-05-18 11:05:58 +08:00
parent f525b720ce
commit 1951fe38ce
1 changed files with 5 additions and 3 deletions

View File

@ -656,7 +656,7 @@ UINT GetDotsPerInchForWindow(const HWND handle) {
// Return hard-coded DPI if DPI scaling is disabled. // Return hard-coded DPI if DPI scaling is disabled.
return m_defaultDotsPerInch; return m_defaultDotsPerInch;
} }
if (!m_lpIsWindow(handle)) { if (!handle || !m_lpIsWindow(handle)) {
if (m_lpGetSystemDpiForProcess) { if (m_lpGetSystemDpiForProcess) {
return m_lpGetSystemDpiForProcess(m_lpGetCurrentProcess()); return m_lpGetSystemDpiForProcess(m_lpGetCurrentProcess());
} else if (m_lpGetDpiForSystem) { } else if (m_lpGetDpiForSystem) {
@ -1028,8 +1028,10 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
// SetWindowCompositionAttribute to enable it for this window, // SetWindowCompositionAttribute to enable it for this window,
// the whole window will become totally black. Don't know why // the whole window will become totally black. Don't know why
// currently. // currently.
m_lpSetWindowLongPtrW(msg->hwnd, GWL_EXSTYLE, m_lpSetWindowLongPtrW(
WS_EX_APPWINDOW | WS_EX_LAYERED); msg->hwnd, GWL_EXSTYLE,
m_lpGetWindowLongPtrW(msg->hwnd, GWL_EXSTYLE) |
WS_EX_LAYERED);
updateWindow(msg->hwnd, true, false); updateWindow(msg->hwnd, true, false);
// A layered window can't be visible unless we call // A layered window can't be visible unless we call
// SetLayeredWindowAttributes or UpdateLayeredWindow once. // SetLayeredWindowAttributes or UpdateLayeredWindow once.