mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1035774 - Factor out a function getting the windows power platform role. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D3299
This commit is contained in:
parent
ef03e2a299
commit
d82fa0f0c9
@ -835,17 +835,9 @@ IMEHandler::NeedOnScreenKeyboard()
|
||||
// checked by first checking the role of the device and then the
|
||||
// corresponding system metric (SM_CONVERTIBLESLATEMODE). If it is being
|
||||
// used as a tablet then we want the OSK to show up.
|
||||
typedef POWER_PLATFORM_ROLE (WINAPI* PowerDeterminePlatformRoleEx)(ULONG Version);
|
||||
if (!sDeterminedPowerPlatformRole) {
|
||||
sDeterminedPowerPlatformRole = true;
|
||||
PowerDeterminePlatformRoleEx power_determine_platform_role =
|
||||
reinterpret_cast<PowerDeterminePlatformRoleEx>(::GetProcAddress(
|
||||
::LoadLibraryW(L"PowrProf.dll"), "PowerDeterminePlatformRoleEx"));
|
||||
if (power_determine_platform_role) {
|
||||
sPowerPlatformRole = power_determine_platform_role(POWER_PLATFORM_ROLE_V2);
|
||||
} else {
|
||||
sPowerPlatformRole = PlatformRoleUnspecified;
|
||||
}
|
||||
sPowerPlatformRole = WinUtils::GetPowerPlatformRole();
|
||||
}
|
||||
|
||||
// If this a mobile or slate (tablet) device, check if it is in slate mode.
|
||||
|
@ -1784,6 +1784,24 @@ WinUtils::GetMaxTouchPoints()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* static */
|
||||
POWER_PLATFORM_ROLE
|
||||
WinUtils::GetPowerPlatformRole()
|
||||
{
|
||||
typedef POWER_PLATFORM_ROLE (WINAPI* PowerDeterminePlatformRoleEx)
|
||||
(ULONG Version);
|
||||
static PowerDeterminePlatformRoleEx power_determine_platform_role =
|
||||
reinterpret_cast<PowerDeterminePlatformRoleEx>(::GetProcAddress(
|
||||
::LoadLibraryW(L"PowrProf.dll"), "PowerDeterminePlatformRoleEx"));
|
||||
|
||||
POWER_PLATFORM_ROLE powerPlatformRole = PlatformRoleUnspecified;
|
||||
if (!power_determine_platform_role) {
|
||||
return powerPlatformRole;
|
||||
}
|
||||
|
||||
return power_determine_platform_role(POWER_PLATFORM_ROLE_V2);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
WinUtils::ResolveJunctionPointsAndSymLinks(std::wstring& aPath)
|
||||
|
@ -469,6 +469,11 @@ public:
|
||||
*/
|
||||
static uint32_t GetMaxTouchPoints();
|
||||
|
||||
/**
|
||||
* Returns the windows power platform role, which is useful for detecting tablets.
|
||||
*/
|
||||
static POWER_PLATFORM_ROLE GetPowerPlatformRole();
|
||||
|
||||
/**
|
||||
* Fully resolves a path to its final path name. So if path contains
|
||||
* junction points or symlinks to other folders, we'll resolve the path
|
||||
|
Loading…
Reference in New Issue
Block a user