Commit 2e9e0c46 authored by Makoto Kato's avatar Makoto Kato
Browse files

Bug 1744687 - Part 3. Fix build error for newer Windows SDK. r=gsvelto

Now hal uses AR_STATE for screen orientation, so we should move it from
WinUtils.cpp to WinUtils.h for newer Windows 11 SDK.

Also, newer Windows SDK has to set WINVER to WIN8 to use auto rotation API.

Differential Revision: https://phabricator.services.mozilla.com/D163099
parent d377cc7b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -64,14 +64,15 @@ elif CONFIG["OS_TARGET"] == "WINNT":
    REQUIRES_UNIFIED_BUILD = True
    UNIFIED_SOURCES += [
        "fallback/FallbackVibration.cpp",
        "windows/WindowsScreenConfiguration.cpp",
        "windows/WindowsSensor.cpp",
    ]
    # WindowsBattery.cpp cannot be built in unified mode because it relies on HalImpl.h.
    # WindowsProcessPriority.cpp needs to set _WIN32_WINNT to Windows 8
    # WindowsScreenConfiguration.cpp needs to set WINVER to 0x0602.
    SOURCES += [
        "windows/WindowsBattery.cpp",
        "windows/WindowsProcessPriority.cpp",
        "windows/WindowsScreenConfiguration.cpp",
    ]
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
    UNIFIED_SOURCES += [
+5 −0
Original line number Diff line number Diff line
@@ -2,6 +2,11 @@
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

#if defined(WINVER)
#  undef WINVER
#  define WINVER 0x0602
#endif

#include "Hal.h"
#include "mozilla/WindowsVersion.h"
#include "mozilla/widget/ScreenManager.h"
+0 −20
Original line number Diff line number Diff line
@@ -1488,26 +1488,6 @@ uint32_t WinUtils::GetMaxTouchPoints() {
  return 0;
}

// Starting with version 10.0.22621.0 of the Windows SDK the AR_STATE enum and
// types are only defined when building for Windows 8 instead of Windows 7.
#if (WDK_NTDDI_VERSION >= 0x0A00000C) && (WINVER < 0x0602)

enum AR_STATE {
  AR_ENABLED = 0x0,
  AR_DISABLED = 0x1,
  AR_SUPPRESSED = 0x2,
  AR_REMOTESESSION = 0x4,
  AR_MULTIMON = 0x8,
  AR_NOSENSOR = 0x10,
  AR_NOT_SUPPORTED = 0x20,
  AR_DOCKED = 0x40,
  AR_LAPTOP = 0x80
};

using PAR_STATE = enum AR_STATE*;

#endif  // (WDK_NTDDI_VERSION >= 0x0A00000C) && (WINVER < 0x0602)

/* static */
POWER_PLATFORM_ROLE
WinUtils::GetPowerPlatformRole() {
+22 −0
Original line number Diff line number Diff line
@@ -45,6 +45,28 @@
#include "mozilla/WindowsProcessMitigations.h"
#include "mozilla/gfx/2D.h"

// Starting with version 10.0.22621.0 of the Windows SDK the AR_STATE enum and
// types are only defined when building for Windows 8 instead of Windows 7.
#if (WDK_NTDDI_VERSION >= 0x0A00000C) && (WINVER < 0x0602)

enum tagAR_STATE {
  AR_ENABLED = 0x0,
  AR_DISABLED = 0x1,
  AR_SUPPRESSED = 0x2,
  AR_REMOTESESSION = 0x4,
  AR_MULTIMON = 0x8,
  AR_NOSENSOR = 0x10,
  AR_NOT_SUPPORTED = 0x20,
  AR_DOCKED = 0x40,
  AR_LAPTOP = 0x80
};

typedef enum tagAR_STATE AR_STATE;

using PAR_STATE = enum tagAR_STATE*;

#endif  // (WDK_NTDDI_VERSION >= 0x0A00000C) && (WINVER < 0x0602)

/**
 * NS_INLINE_DECL_IUNKNOWN_REFCOUNTING should be used for defining and
 * implementing AddRef() and Release() of IUnknown interface.