Bug 1819421 - [1/2] create parallel check for Win11 tablet mode r=win-reviewers,Gijs,gsvelto,gstoll

Win11's tablet mode is different from Win10's tablet mode in ways both
subtle and gross. Avoid unifying them implicitly, and make it clear that
they should not be unified _explicitly_ without testing.

Unfortunately, Windows 11's API for checking whether the device is in
tablet mode is broken -- it requires one to know whether the device is a
tablet to interpret the return value, but there is no documented API
providing that information. We use a heuristic partly borrowed from
Chromium and partly based on independent investigation.

As all of the code using WindowsUIUtils effectively only checked for
Win10's tablet mode, this commit technically has no functional
changes.

Differential Revision: https://phabricator.services.mozilla.com/D224244
This commit is contained in:
Ray Kraesig
2024-11-04 13:56:20 +00:00
parent a29f5b5627
commit 28f8d3d9cf
11 changed files with 324 additions and 27 deletions

View File

@@ -1583,7 +1583,7 @@ nsDefaultCommandLineHandler.prototype = {
if (
AppConstants.platform == "win" &&
cmdLine.state != Ci.nsICommandLine.STATE_INITIAL_LAUNCH &&
lazy.WindowsUIUtils.inTabletMode
lazy.WindowsUIUtils.inWin10TabletMode
) {
// In windows 10 tablet mode, do not create a new window, but reuse the existing one.
let win = lazy.BrowserWindowTracker.getTopWindow();