michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "Hal.h" michael@0: #include "mozilla/dom/ScreenOrientation.h" michael@0: #include "nsIScreenManager.h" michael@0: #include "nsServiceManagerUtils.h" michael@0: michael@0: namespace mozilla { michael@0: namespace hal_impl { michael@0: michael@0: void michael@0: EnableScreenConfigurationNotifications() michael@0: { michael@0: } michael@0: michael@0: void michael@0: DisableScreenConfigurationNotifications() michael@0: { michael@0: } michael@0: michael@0: void michael@0: GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration) michael@0: { michael@0: nsresult rv; michael@0: nsCOMPtr screenMgr = michael@0: do_GetService("@mozilla.org/gfx/screenmanager;1", &rv); michael@0: if (NS_FAILED(rv)) { michael@0: NS_ERROR("Can't find nsIScreenManager!"); michael@0: return; michael@0: } michael@0: michael@0: nsIntRect rect; michael@0: int32_t colorDepth, pixelDepth; michael@0: dom::ScreenOrientation orientation; michael@0: nsCOMPtr screen; michael@0: michael@0: screenMgr->GetPrimaryScreen(getter_AddRefs(screen)); michael@0: screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height); michael@0: screen->GetColorDepth(&colorDepth); michael@0: screen->GetPixelDepth(&pixelDepth); michael@0: orientation = rect.width >= rect.height michael@0: ? dom::eScreenOrientation_LandscapePrimary michael@0: : dom::eScreenOrientation_PortraitPrimary; michael@0: michael@0: *aScreenConfiguration = michael@0: hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth); michael@0: } michael@0: michael@0: bool michael@0: LockScreenOrientation(const dom::ScreenOrientation& aOrientation) michael@0: { michael@0: return false; michael@0: } michael@0: michael@0: void michael@0: UnlockScreenOrientation() michael@0: { michael@0: } michael@0: michael@0: } // hal_impl michael@0: } // mozilla