mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 900875. Part 1: Move DWM APIs to WinUtils. r=avih
This commit is contained in:
parent
3807c1b21e
commit
c6aa3d174a
@ -191,7 +191,7 @@ TaskbarPreview::Invalidate() {
|
||||
return NS_OK;
|
||||
|
||||
HWND previewWindow = PreviewWindow();
|
||||
return FAILED(nsUXThemeData::dwmInvalidateIconicBitmapsPtr(previewWindow))
|
||||
return FAILED(WinUtils::dwmInvalidateIconicBitmapsPtr(previewWindow))
|
||||
? NS_ERROR_FAILURE
|
||||
: NS_OK;
|
||||
}
|
||||
@ -331,13 +331,13 @@ TaskbarPreview::GetWindowHook() {
|
||||
void
|
||||
TaskbarPreview::EnableCustomDrawing(HWND aHWND, bool aEnable) {
|
||||
BOOL enabled = aEnable;
|
||||
nsUXThemeData::dwmSetWindowAttributePtr(
|
||||
WinUtils::dwmSetWindowAttributePtr(
|
||||
aHWND,
|
||||
DWMWA_FORCE_ICONIC_REPRESENTATION,
|
||||
&enabled,
|
||||
sizeof(enabled));
|
||||
|
||||
nsUXThemeData::dwmSetWindowAttributePtr(
|
||||
WinUtils::dwmSetWindowAttributePtr(
|
||||
aHWND,
|
||||
DWMWA_HAS_ICONIC_BITMAP,
|
||||
&enabled,
|
||||
@ -383,9 +383,9 @@ TaskbarPreview::DrawBitmap(uint32_t width, uint32_t height, bool isPreview) {
|
||||
DWORD flags = drawFrame ? DWM_SIT_DISPLAYFRAME : 0;
|
||||
POINT pptClient = { 0, 0 };
|
||||
if (isPreview)
|
||||
nsUXThemeData::dwmSetIconicLivePreviewBitmapPtr(PreviewWindow(), hBitmap, &pptClient, flags);
|
||||
WinUtils::dwmSetIconicLivePreviewBitmapPtr(PreviewWindow(), hBitmap, &pptClient, flags);
|
||||
else
|
||||
nsUXThemeData::dwmSetIconicThumbnailPtr(PreviewWindow(), hBitmap, flags);
|
||||
WinUtils::dwmSetIconicThumbnailPtr(PreviewWindow(), hBitmap, flags);
|
||||
|
||||
ResetRenderingContext();
|
||||
}
|
||||
|
@ -36,24 +36,58 @@
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
NS_IMPL_ISUPPORTS1(myDownloadObserver, nsIDownloadObserver)
|
||||
NS_IMPL_ISUPPORTS1(myDownloadObserver, nsIDownloadObserver)
|
||||
#ifdef MOZ_PLACES
|
||||
NS_IMPL_ISUPPORTS1(AsyncFaviconDataReady, nsIFaviconDataCallback)
|
||||
NS_IMPL_ISUPPORTS1(AsyncFaviconDataReady, nsIFaviconDataCallback)
|
||||
#endif
|
||||
NS_IMPL_ISUPPORTS1(AsyncEncodeAndWriteIcon, nsIRunnable)
|
||||
NS_IMPL_ISUPPORTS1(AsyncDeleteIconFromDisk, nsIRunnable)
|
||||
NS_IMPL_ISUPPORTS1(AsyncDeleteAllFaviconsFromDisk, nsIRunnable)
|
||||
NS_IMPL_ISUPPORTS1(AsyncEncodeAndWriteIcon, nsIRunnable)
|
||||
NS_IMPL_ISUPPORTS1(AsyncDeleteIconFromDisk, nsIRunnable)
|
||||
NS_IMPL_ISUPPORTS1(AsyncDeleteAllFaviconsFromDisk, nsIRunnable)
|
||||
|
||||
|
||||
const char FaviconHelper::kJumpListCacheDir[] = "jumpListCache";
|
||||
const char FaviconHelper::kShortcutCacheDir[] = "shortcutCache";
|
||||
const char FaviconHelper::kJumpListCacheDir[] = "jumpListCache";
|
||||
const char FaviconHelper::kShortcutCacheDir[] = "shortcutCache";
|
||||
|
||||
// apis available on vista and up.
|
||||
WinUtils::SHCreateItemFromParsingNamePtr WinUtils::sCreateItemFromParsingName = NULL;
|
||||
WinUtils::SHGetKnownFolderPathPtr WinUtils::sGetKnownFolderPath = NULL;
|
||||
|
||||
static const PRUnichar kSehllLibraryName[] = L"shell32.dll";
|
||||
// We just leak these DLL HMODULEs. There's no point in calling FreeLibrary
|
||||
// on them during shutdown anyway.
|
||||
static const PRUnichar kShellLibraryName[] = L"shell32.dll";
|
||||
static HMODULE sShellDll = NULL;
|
||||
static const PRUnichar kDwmLibraryName[] = L"dwmapi.dll";
|
||||
static HMODULE sDwmDll = NULL;
|
||||
|
||||
WinUtils::DwmExtendFrameIntoClientAreaProc WinUtils::dwmExtendFrameIntoClientAreaPtr = NULL;
|
||||
WinUtils::DwmIsCompositionEnabledProc WinUtils::dwmIsCompositionEnabledPtr = NULL;
|
||||
WinUtils::DwmSetIconicThumbnailProc WinUtils::dwmSetIconicThumbnailPtr = NULL;
|
||||
WinUtils::DwmSetIconicLivePreviewBitmapProc WinUtils::dwmSetIconicLivePreviewBitmapPtr = NULL;
|
||||
WinUtils::DwmGetWindowAttributeProc WinUtils::dwmGetWindowAttributePtr = NULL;
|
||||
WinUtils::DwmSetWindowAttributeProc WinUtils::dwmSetWindowAttributePtr = NULL;
|
||||
WinUtils::DwmInvalidateIconicBitmapsProc WinUtils::dwmInvalidateIconicBitmapsPtr = NULL;
|
||||
WinUtils::DwmDefWindowProcProc WinUtils::dwmDwmDefWindowProcPtr = NULL;
|
||||
|
||||
/* static */
|
||||
void
|
||||
WinUtils::Initialize()
|
||||
{
|
||||
if (!sDwmDll && WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION) {
|
||||
sDwmDll = ::LoadLibraryW(kDwmLibraryName);
|
||||
|
||||
// MSDN: "If the function succeeds, the return value is greater than 31."
|
||||
if (uintptr_t(sDwmDll) > 31) {
|
||||
dwmExtendFrameIntoClientAreaPtr = (DwmExtendFrameIntoClientAreaProc)::GetProcAddress(sDwmDll, "DwmExtendFrameIntoClientArea");
|
||||
dwmIsCompositionEnabledPtr = (DwmIsCompositionEnabledProc)::GetProcAddress(sDwmDll, "DwmIsCompositionEnabled");
|
||||
dwmSetIconicThumbnailPtr = (DwmSetIconicThumbnailProc)::GetProcAddress(sDwmDll, "DwmSetIconicThumbnail");
|
||||
dwmSetIconicLivePreviewBitmapPtr = (DwmSetIconicLivePreviewBitmapProc)::GetProcAddress(sDwmDll, "DwmSetIconicLivePreviewBitmap");
|
||||
dwmGetWindowAttributePtr = (DwmGetWindowAttributeProc)::GetProcAddress(sDwmDll, "DwmGetWindowAttribute");
|
||||
dwmSetWindowAttributePtr = (DwmSetWindowAttributeProc)::GetProcAddress(sDwmDll, "DwmSetWindowAttribute");
|
||||
dwmInvalidateIconicBitmapsPtr = (DwmInvalidateIconicBitmapsProc)::GetProcAddress(sDwmDll, "DwmInvalidateIconicBitmaps");
|
||||
dwmDwmDefWindowProcPtr = (DwmDefWindowProcProc)::GetProcAddress(sDwmDll, "DwmDefWindowProc");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
WinUtils::WinVersion
|
||||
@ -466,7 +500,7 @@ WinUtils::SHCreateItemFromParsingName(PCWSTR pszPath, IBindCtx *pbc,
|
||||
}
|
||||
|
||||
if (!sShellDll) {
|
||||
sShellDll = ::LoadLibraryW(kSehllLibraryName);
|
||||
sShellDll = ::LoadLibraryW(kShellLibraryName);
|
||||
if (!sShellDll) {
|
||||
return false;
|
||||
}
|
||||
@ -492,7 +526,7 @@ WinUtils::SHGetKnownFolderPath(REFKNOWNFOLDERID rfid,
|
||||
}
|
||||
|
||||
if (!sShellDll) {
|
||||
sShellDll = ::LoadLibraryW(kSehllLibraryName);
|
||||
sShellDll = ::LoadLibraryW(kShellLibraryName);
|
||||
if (!sShellDll) {
|
||||
return false;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nscore.h"
|
||||
#include <windows.h>
|
||||
#include <shobjidl.h>
|
||||
#include <uxtheme.h>
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsRegion.h"
|
||||
@ -275,6 +276,27 @@ public:
|
||||
static void SetupKeyModifiersSequence(nsTArray<KeyPair>* aArray,
|
||||
uint32_t aModifiers);
|
||||
|
||||
// dwmapi.dll function typedefs and declarations
|
||||
typedef HRESULT (WINAPI*DwmExtendFrameIntoClientAreaProc)(HWND hWnd, const MARGINS *pMarInset);
|
||||
typedef HRESULT (WINAPI*DwmIsCompositionEnabledProc)(BOOL *pfEnabled);
|
||||
typedef HRESULT (WINAPI*DwmSetIconicThumbnailProc)(HWND hWnd, HBITMAP hBitmap, DWORD dwSITFlags);
|
||||
typedef HRESULT (WINAPI*DwmSetIconicLivePreviewBitmapProc)(HWND hWnd, HBITMAP hBitmap, POINT *pptClient, DWORD dwSITFlags);
|
||||
typedef HRESULT (WINAPI*DwmGetWindowAttributeProc)(HWND hWnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
|
||||
typedef HRESULT (WINAPI*DwmSetWindowAttributeProc)(HWND hWnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
|
||||
typedef HRESULT (WINAPI*DwmInvalidateIconicBitmapsProc)(HWND hWnd);
|
||||
typedef HRESULT (WINAPI*DwmDefWindowProcProc)(HWND hWnd, UINT msg, LPARAM lParam, WPARAM wParam, LRESULT *aRetValue);
|
||||
|
||||
static DwmExtendFrameIntoClientAreaProc dwmExtendFrameIntoClientAreaPtr;
|
||||
static DwmIsCompositionEnabledProc dwmIsCompositionEnabledPtr;
|
||||
static DwmSetIconicThumbnailProc dwmSetIconicThumbnailPtr;
|
||||
static DwmSetIconicLivePreviewBitmapProc dwmSetIconicLivePreviewBitmapPtr;
|
||||
static DwmGetWindowAttributeProc dwmGetWindowAttributePtr;
|
||||
static DwmSetWindowAttributeProc dwmSetWindowAttributePtr;
|
||||
static DwmInvalidateIconicBitmapsProc dwmInvalidateIconicBitmapsPtr;
|
||||
static DwmDefWindowProcProc dwmDwmDefWindowProcPtr;
|
||||
|
||||
static void Initialize();
|
||||
|
||||
private:
|
||||
typedef HRESULT (WINAPI * SHCreateItemFromParsingNamePtr)(PCWSTR pszPath,
|
||||
IBindCtx *pbc,
|
||||
@ -327,6 +349,7 @@ private:
|
||||
nsAutoString mIconPath;
|
||||
nsAutoCString mMimeTypeOfInputData;
|
||||
nsAutoArrayPtr<uint8_t> mBuffer;
|
||||
HMODULE sDwmDLL;
|
||||
uint32_t mBufferLength;
|
||||
uint32_t mStride;
|
||||
uint32_t mWidth;
|
||||
|
@ -14,12 +14,15 @@
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include <objbase.h>
|
||||
#include <initguid.h>
|
||||
#include "WinUtils.h"
|
||||
|
||||
#include "nsUXThemeData.h"
|
||||
|
||||
// unknwn.h is needed to build with WIN32_LEAN_AND_MEAN
|
||||
#include <unknwn.h>
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
nsToolkit* nsToolkit::gToolkit = nullptr;
|
||||
HINSTANCE nsToolkit::mDllInstance = 0;
|
||||
static const unsigned long kD3DUsageDelay = 5000;
|
||||
@ -75,6 +78,7 @@ nsToolkit::Startup(HMODULE hModule)
|
||||
{
|
||||
nsToolkit::mDllInstance = hModule;
|
||||
nsUXThemeData::Initialize();
|
||||
WinUtils::Initialize();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "nsUXThemeData.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "WinUtils.h"
|
||||
#include "nsUXThemeConstants.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -18,16 +17,12 @@ using namespace mozilla::widget;
|
||||
|
||||
const PRUnichar
|
||||
nsUXThemeData::kThemeLibraryName[] = L"uxtheme.dll";
|
||||
const PRUnichar
|
||||
nsUXThemeData::kDwmLibraryName[] = L"dwmapi.dll";
|
||||
|
||||
HANDLE
|
||||
nsUXThemeData::sThemes[eUXNumClasses];
|
||||
|
||||
HMODULE
|
||||
nsUXThemeData::sThemeDLL = NULL;
|
||||
HMODULE
|
||||
nsUXThemeData::sDwmDLL = NULL;
|
||||
|
||||
bool
|
||||
nsUXThemeData::sFlatMenus = false;
|
||||
@ -36,22 +31,11 @@ bool nsUXThemeData::sTitlebarInfoPopulatedAero = false;
|
||||
bool nsUXThemeData::sTitlebarInfoPopulatedThemed = false;
|
||||
SIZE nsUXThemeData::sCommandButtons[4];
|
||||
|
||||
nsUXThemeData::DwmExtendFrameIntoClientAreaProc nsUXThemeData::dwmExtendFrameIntoClientAreaPtr = NULL;
|
||||
nsUXThemeData::DwmIsCompositionEnabledProc nsUXThemeData::dwmIsCompositionEnabledPtr = NULL;
|
||||
nsUXThemeData::DwmSetIconicThumbnailProc nsUXThemeData::dwmSetIconicThumbnailPtr = NULL;
|
||||
nsUXThemeData::DwmSetIconicLivePreviewBitmapProc nsUXThemeData::dwmSetIconicLivePreviewBitmapPtr = NULL;
|
||||
nsUXThemeData::DwmGetWindowAttributeProc nsUXThemeData::dwmGetWindowAttributePtr = NULL;
|
||||
nsUXThemeData::DwmSetWindowAttributeProc nsUXThemeData::dwmSetWindowAttributePtr = NULL;
|
||||
nsUXThemeData::DwmInvalidateIconicBitmapsProc nsUXThemeData::dwmInvalidateIconicBitmapsPtr = NULL;
|
||||
nsUXThemeData::DwmDefWindowProcProc nsUXThemeData::dwmDwmDefWindowProcPtr = NULL;
|
||||
|
||||
void
|
||||
nsUXThemeData::Teardown() {
|
||||
Invalidate();
|
||||
if(sThemeDLL)
|
||||
FreeLibrary(sThemeDLL);
|
||||
if(sDwmDLL)
|
||||
FreeLibrary(sDwmDLL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -60,18 +44,7 @@ nsUXThemeData::Initialize()
|
||||
::ZeroMemory(sThemes, sizeof(sThemes));
|
||||
NS_ASSERTION(!sThemeDLL, "nsUXThemeData being initialized twice!");
|
||||
|
||||
if (GetDwmDLL()) {
|
||||
dwmExtendFrameIntoClientAreaPtr = (DwmExtendFrameIntoClientAreaProc)::GetProcAddress(sDwmDLL, "DwmExtendFrameIntoClientArea");
|
||||
dwmIsCompositionEnabledPtr = (DwmIsCompositionEnabledProc)::GetProcAddress(sDwmDLL, "DwmIsCompositionEnabled");
|
||||
dwmSetIconicThumbnailPtr = (DwmSetIconicThumbnailProc)::GetProcAddress(sDwmDLL, "DwmSetIconicThumbnail");
|
||||
dwmSetIconicLivePreviewBitmapPtr = (DwmSetIconicLivePreviewBitmapProc)::GetProcAddress(sDwmDLL, "DwmSetIconicLivePreviewBitmap");
|
||||
dwmGetWindowAttributePtr = (DwmGetWindowAttributeProc)::GetProcAddress(sDwmDLL, "DwmGetWindowAttribute");
|
||||
dwmSetWindowAttributePtr = (DwmSetWindowAttributeProc)::GetProcAddress(sDwmDLL, "DwmSetWindowAttribute");
|
||||
dwmInvalidateIconicBitmapsPtr = (DwmInvalidateIconicBitmapsProc)::GetProcAddress(sDwmDLL, "DwmInvalidateIconicBitmaps");
|
||||
dwmDwmDefWindowProcPtr = (DwmDefWindowProcProc)::GetProcAddress(sDwmDLL, "DwmDefWindowProc");
|
||||
CheckForCompositor(true);
|
||||
}
|
||||
|
||||
CheckForCompositor(true);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
@ -105,13 +78,6 @@ nsUXThemeData::GetThemeDLL() {
|
||||
return sThemeDLL;
|
||||
}
|
||||
|
||||
HMODULE
|
||||
nsUXThemeData::GetDwmDLL() {
|
||||
if (!sDwmDLL && WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)
|
||||
sDwmDLL = ::LoadLibraryW(kDwmLibraryName);
|
||||
return sDwmDLL;
|
||||
}
|
||||
|
||||
const wchar_t *nsUXThemeData::GetClassName(nsUXThemeClass cls) {
|
||||
switch(cls) {
|
||||
case eUXButton:
|
||||
@ -190,10 +156,10 @@ nsUXThemeData::UpdateTitlebarInfo(HWND aWnd)
|
||||
|
||||
if (!sTitlebarInfoPopulatedAero && nsUXThemeData::CheckForCompositor()) {
|
||||
RECT captionButtons;
|
||||
if (SUCCEEDED(nsUXThemeData::dwmGetWindowAttributePtr(aWnd,
|
||||
DWMWA_CAPTION_BUTTON_BOUNDS,
|
||||
&captionButtons,
|
||||
sizeof(captionButtons)))) {
|
||||
if (SUCCEEDED(WinUtils::dwmGetWindowAttributePtr(aWnd,
|
||||
DWMWA_CAPTION_BUTTON_BOUNDS,
|
||||
&captionButtons,
|
||||
sizeof(captionButtons)))) {
|
||||
sCommandButtons[CMDBUTTONIDX_BUTTONBOX].cx = captionButtons.right - captionButtons.left - 3;
|
||||
sCommandButtons[CMDBUTTONIDX_BUTTONBOX].cy = (captionButtons.bottom - captionButtons.top) - 1;
|
||||
sTitlebarInfoPopulatedAero = true;
|
||||
@ -300,6 +266,16 @@ bool nsUXThemeData::IsDefaultWindowTheme()
|
||||
return sIsDefaultWindowsTheme;
|
||||
}
|
||||
|
||||
// static
|
||||
bool nsUXThemeData::CheckForCompositor(bool aUpdateCache)
|
||||
{
|
||||
static BOOL sCachedValue = FALSE;
|
||||
if (aUpdateCache && WinUtils::dwmIsCompositionEnabledPtr) {
|
||||
WinUtils::dwmIsCompositionEnabledPtr(&sCachedValue);
|
||||
}
|
||||
return sCachedValue;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
nsUXThemeData::UpdateNativeThemeInfo()
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "nscore.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
#include <dwmapi.h>
|
||||
|
||||
@ -79,14 +80,12 @@ enum WindowsThemeColor {
|
||||
|
||||
class nsUXThemeData {
|
||||
static HMODULE sThemeDLL;
|
||||
static HMODULE sDwmDLL;
|
||||
static HANDLE sThemes[eUXNumClasses];
|
||||
|
||||
static const wchar_t *GetClassName(nsUXThemeClass);
|
||||
|
||||
public:
|
||||
static const PRUnichar kThemeLibraryName[];
|
||||
static const PRUnichar kDwmLibraryName[];
|
||||
static bool sFlatMenus;
|
||||
static bool sTitlebarInfoPopulatedAero;
|
||||
static bool sTitlebarInfoPopulatedThemed;
|
||||
@ -99,7 +98,6 @@ public:
|
||||
static void Invalidate();
|
||||
static HANDLE GetTheme(nsUXThemeClass cls);
|
||||
static HMODULE GetThemeDLL();
|
||||
static HMODULE GetDwmDLL();
|
||||
|
||||
// nsWindow calls this to update desktop settings info
|
||||
static void InitTitlebarInfo();
|
||||
@ -109,37 +107,12 @@ public:
|
||||
static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
|
||||
static bool IsDefaultWindowTheme();
|
||||
|
||||
// dwmapi.dll function typedefs and declarations
|
||||
typedef HRESULT (WINAPI*DwmExtendFrameIntoClientAreaProc)(HWND hWnd, const MARGINS *pMarInset);
|
||||
typedef HRESULT (WINAPI*DwmIsCompositionEnabledProc)(BOOL *pfEnabled);
|
||||
typedef HRESULT (WINAPI*DwmSetIconicThumbnailProc)(HWND hWnd, HBITMAP hBitmap, DWORD dwSITFlags);
|
||||
typedef HRESULT (WINAPI*DwmSetIconicLivePreviewBitmapProc)(HWND hWnd, HBITMAP hBitmap, POINT *pptClient, DWORD dwSITFlags);
|
||||
typedef HRESULT (WINAPI*DwmGetWindowAttributeProc)(HWND hWnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
|
||||
typedef HRESULT (WINAPI*DwmSetWindowAttributeProc)(HWND hWnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
|
||||
typedef HRESULT (WINAPI*DwmInvalidateIconicBitmapsProc)(HWND hWnd);
|
||||
typedef HRESULT (WINAPI*DwmDefWindowProcProc)(HWND hWnd, UINT msg, LPARAM lParam, WPARAM wParam, LRESULT *aRetValue);
|
||||
|
||||
static DwmExtendFrameIntoClientAreaProc dwmExtendFrameIntoClientAreaPtr;
|
||||
static DwmIsCompositionEnabledProc dwmIsCompositionEnabledPtr;
|
||||
static DwmSetIconicThumbnailProc dwmSetIconicThumbnailPtr;
|
||||
static DwmSetIconicLivePreviewBitmapProc dwmSetIconicLivePreviewBitmapPtr;
|
||||
static DwmGetWindowAttributeProc dwmGetWindowAttributePtr;
|
||||
static DwmSetWindowAttributeProc dwmSetWindowAttributePtr;
|
||||
static DwmInvalidateIconicBitmapsProc dwmInvalidateIconicBitmapsPtr;
|
||||
static DwmDefWindowProcProc dwmDwmDefWindowProcPtr;
|
||||
|
||||
// This method returns the cached compositor state. Most
|
||||
// callers should call without the argument. The cache
|
||||
// should be modified only when the application receives
|
||||
// WM_DWMCOMPOSITIONCHANGED. This rule prevents inconsistent
|
||||
// results for two or more calls which check the state during
|
||||
// composition transition.
|
||||
static bool CheckForCompositor(bool aUpdateCache = false) {
|
||||
static BOOL sCachedValue = FALSE;
|
||||
if(aUpdateCache && dwmIsCompositionEnabledPtr) {
|
||||
dwmIsCompositionEnabledPtr(&sCachedValue);
|
||||
}
|
||||
return (sCachedValue != FALSE);
|
||||
}
|
||||
static bool CheckForCompositor(bool aUpdateCache = false);
|
||||
};
|
||||
#endif // __UXThemeData_h__
|
||||
|
@ -536,9 +536,9 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (mIsRTL && nsUXThemeData::dwmSetWindowAttributePtr) {
|
||||
if (mIsRTL && WinUtils::dwmSetWindowAttributePtr) {
|
||||
DWORD dwAttribute = TRUE;
|
||||
nsUXThemeData::dwmSetWindowAttributePtr(mWnd, DWMWA_NONCLIENT_RTL_LAYOUT, &dwAttribute, sizeof dwAttribute);
|
||||
WinUtils::dwmSetWindowAttributePtr(mWnd, DWMWA_NONCLIENT_RTL_LAYOUT, &dwAttribute, sizeof dwAttribute);
|
||||
}
|
||||
|
||||
if (mWindowType != eWindowType_plugin &&
|
||||
@ -2645,9 +2645,9 @@ void nsWindow::UpdateGlass()
|
||||
margins.cxRightWidth, margins.cyBottomHeight));
|
||||
|
||||
// Extends the window frame behind the client area
|
||||
if(nsUXThemeData::CheckForCompositor()) {
|
||||
nsUXThemeData::dwmExtendFrameIntoClientAreaPtr(mWnd, &margins);
|
||||
nsUXThemeData::dwmSetWindowAttributePtr(mWnd, DWMWA_NCRENDERING_POLICY, &policy, sizeof policy);
|
||||
if (nsUXThemeData::CheckForCompositor()) {
|
||||
WinUtils::dwmExtendFrameIntoClientAreaPtr(mWnd, &margins);
|
||||
WinUtils::dwmSetWindowAttributePtr(mWnd, DWMWA_NCRENDERING_POLICY, &policy, sizeof policy);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -4487,7 +4487,7 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||
LRESULT dwmHitResult;
|
||||
if (mCustomNonClient &&
|
||||
nsUXThemeData::CheckForCompositor() &&
|
||||
nsUXThemeData::dwmDwmDefWindowProcPtr(mWnd, msg, wParam, lParam, &dwmHitResult)) {
|
||||
WinUtils::dwmDwmDefWindowProcPtr(mWnd, msg, wParam, lParam, &dwmHitResult)) {
|
||||
*aRetValue = dwmHitResult;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user