Bug 1390097 - Revert a part of
bug 1354020 changes. r?masayuki
Bug 1354020 causes that IMM-IME on Windows 7 doesn't work with --no-remote. Although I think that this issue is OS or IME bug, when default window proceduce by RegisterClass is DefaultWindowProcW, Google Japanese IME doesn't work.
I am not sure why this issue occurs when lpfnWndProc is DefWidnowProcW and DDE isn't started. But for workaround, we should revert a part of
bug 1354020 changes.
MozReview-Commit-ID: BkxlZnm8mIh
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -470,17 +470,17 @@ WinUtils::Initialize()
#endif
}
// static
LRESULT WINAPI
WinUtils::NonClientDpiScalingDefWindowProcW(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
- if (msg == WM_NCCREATE) {
+ if (msg == WM_NCCREATE && sEnableNonClientDpiScaling) {
sEnableNonClientDpiScaling(hWnd);
}
return ::DefWindowProcW(hWnd, msg, wParam, lParam);
}
// static
void
WinUtils::LogW(const wchar_t *fmt, ...)
--- a/widget/windows/WinUtils.h
+++ b/widget/windows/WinUtils.h
@@ -158,22 +158,16 @@ public:
class WinUtils
{
// Function pointers for APIs that may not be available depending on
// the Win10 update version -- will be set up in Initialize().
static SetThreadDpiAwarenessContextProc sSetThreadDpiAwarenessContext;
static EnableNonClientDpiScalingProc sEnableNonClientDpiScaling;
- // Wrapper for DefWindowProc that will enable non-client dpi scaling on the
- // window during creation.
- static LRESULT WINAPI
- NonClientDpiScalingDefWindowProcW(HWND hWnd, UINT msg,
- WPARAM wParam, LPARAM lParam);
-
public:
class AutoSystemDpiAware
{
public:
AutoSystemDpiAware()
{
if (sSetThreadDpiAwarenessContext) {
mPrevContext = sSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
@@ -186,21 +180,21 @@ public:
sSetThreadDpiAwarenessContext(mPrevContext);
}
}
private:
DPI_AWARENESS_CONTEXT mPrevContext;
};
- static decltype(::DefWindowProcW)* GetDefWindowProc()
- {
- return sEnableNonClientDpiScaling ? NonClientDpiScalingDefWindowProcW :
- ::DefWindowProcW;
- }
+ // Wrapper for DefWindowProc that will enable non-client dpi scaling on the
+ // window during creation.
+ static LRESULT WINAPI
+ NonClientDpiScalingDefWindowProcW(HWND hWnd, UINT msg,
+ WPARAM wParam, LPARAM lParam);
/**
* Get the system's default logical-to-physical DPI scaling factor,
* which is based on the primary display. Note however that unlike
* LogToPhysFactor(GetPrimaryMonitor()), this will not change during
* a session even if the displays are reconfigured. This scale factor
* is used by Windows theme metrics etc, which do not fully support
* dynamic resolution changes but are only updated on logout.
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1010,17 +1010,17 @@ nsWindow::RegisterWindowClass(const wcha
{
WNDCLASSW wc;
if (::GetClassInfoW(nsToolkit::mDllInstance, aClassName, &wc)) {
// already registered
return aClassName;
}
wc.style = CS_DBLCLKS | aExtraStyle;
- wc.lpfnWndProc = WinUtils::GetDefWindowProc();
+ wc.lpfnWndProc = WinUtils::NonClientDpiScalingDefWindowProcW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = nsToolkit::mDllInstance;
wc.hIcon = aIconID ? ::LoadIconW(::GetModuleHandleW(nullptr), aIconID) : nullptr;
wc.hCursor = nullptr;
wc.hbrBackground = mBrush;
wc.lpszMenuName = nullptr;
wc.lpszClassName = aClassName;