Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Eric Kotato 2020-07-03 04:39:33 +03:00
commit 11a39d9d94
2 changed files with 23 additions and 1 deletions

View file

@ -294,6 +294,10 @@ QImage LoadFromFile(int id, int size, int index) {
|| false) {
return QImage();
}
// This should remove a non necessary detach on Retina screens later.
result.setDevicePixelRatio(style::DevicePixelRatio());
crl::async([=, signature = std::move(signature)] {
// This should not happen (invalid signature),
// so we delay this check and fix only the next launch.

View file

@ -9,6 +9,7 @@
#include "ui/inactive_press.h"
#include "ui/platform/win/ui_window_title_win.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/win/base_windows_safe_library.h"
#include "styles/palette.h"
#include <QtCore/QAbstractNativeEventFilter>
@ -32,6 +33,23 @@ bool IsCompositionEnabled() {
return success && result;
}
HRESULT WinApiSetWindowTheme(
HWND hWnd,
LPCWSTR pszSubAppName,
LPCWSTR pszSubIdList) {
static const auto method = [&] {
using f_SetWindowTheme = HRESULT(FAR STDAPICALLTYPE*)(
HWND hWnd,
LPCWSTR pszSubAppName,
LPCWSTR pszSubIdList);
auto result = f_SetWindowTheme();
const auto loaded = base::Platform::SafeLoadLibrary(u"uxtheme.dll"_q);
base::Platform::LoadMethod(loaded, "SetWindowTheme", result);
return result;
}();
return method ? method(hWnd, pszSubAppName, pszSubIdList) : HRESULT();
}
} // namespace
class WindowHelper::NativeFilter final : public QAbstractNativeEventFilter {
@ -137,7 +155,7 @@ void WindowHelper::init() {
updateMargins();
if (!::Platform::IsWindows8OrGreater()) {
SetWindowTheme(_handle, L" ", L" ");
WinApiSetWindowTheme(_handle, L" ", L" ");
QApplication::setStyle(QStyleFactory::create("Windows"));
}