1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/hal/fallback/FallbackScreenConfiguration.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "Hal.h" 1.9 +#include "mozilla/dom/ScreenOrientation.h" 1.10 +#include "nsIScreenManager.h" 1.11 +#include "nsServiceManagerUtils.h" 1.12 + 1.13 +namespace mozilla { 1.14 +namespace hal_impl { 1.15 + 1.16 +void 1.17 +EnableScreenConfigurationNotifications() 1.18 +{ 1.19 +} 1.20 + 1.21 +void 1.22 +DisableScreenConfigurationNotifications() 1.23 +{ 1.24 +} 1.25 + 1.26 +void 1.27 +GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration) 1.28 +{ 1.29 + nsresult rv; 1.30 + nsCOMPtr<nsIScreenManager> screenMgr = 1.31 + do_GetService("@mozilla.org/gfx/screenmanager;1", &rv); 1.32 + if (NS_FAILED(rv)) { 1.33 + NS_ERROR("Can't find nsIScreenManager!"); 1.34 + return; 1.35 + } 1.36 + 1.37 + nsIntRect rect; 1.38 + int32_t colorDepth, pixelDepth; 1.39 + dom::ScreenOrientation orientation; 1.40 + nsCOMPtr<nsIScreen> screen; 1.41 + 1.42 + screenMgr->GetPrimaryScreen(getter_AddRefs(screen)); 1.43 + screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height); 1.44 + screen->GetColorDepth(&colorDepth); 1.45 + screen->GetPixelDepth(&pixelDepth); 1.46 + orientation = rect.width >= rect.height 1.47 + ? dom::eScreenOrientation_LandscapePrimary 1.48 + : dom::eScreenOrientation_PortraitPrimary; 1.49 + 1.50 + *aScreenConfiguration = 1.51 + hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth); 1.52 +} 1.53 + 1.54 +bool 1.55 +LockScreenOrientation(const dom::ScreenOrientation& aOrientation) 1.56 +{ 1.57 + return false; 1.58 +} 1.59 + 1.60 +void 1.61 +UnlockScreenOrientation() 1.62 +{ 1.63 +} 1.64 + 1.65 +} // hal_impl 1.66 +} // mozilla