From cfef04f1a87fd3e32cf0ca5b129f18b39d2055b2 Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Thu, 11 Mar 2021 17:07:42 +0000 Subject: [PATCH] Bug 1689884 - Inform PresShell when tablet-mode changes occur r=emilio Currently, PresShell is not informed when a system setting involving Windows 10 Tablet Mode, System Dock Mode, or "Convertible Slate Mode" occur. As this can change the result of @media (pointer) queries, layout should know about this so it can react accordingly. Differential Revision: https://phabricator.services.mozilla.com/D107917 --- widget/windows/nsWindow.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 79d4effb542c2..4345cb6321954 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -5313,6 +5313,21 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, } } } + + // UserInteractionMode, ConvertibleSlateMode, SystemDockMode may cause + // @media(pointer) queries to change, which layout needs to know about + // + // (WM_SETTINGCHANGE will be sent to all top-level windows, so we + // only respond to the hidden top-level window to avoid hammering + // layout with a bunch of NotifyThemeChanged() calls) + // + if (mWindowType == eWindowType_invisible) { + if (!wcscmp(lParamString, L"UserInteractionMode") || + !wcscmp(lParamString, L"ConvertibleSlateMode") || + !wcscmp(lParamString, L"SystemDockMode")) { + NotifyThemeChanged(widget::ThemeChangeKind::MediaQueriesOnly); + } + } } } break;