Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "Hal.h" |
michael@0 | 6 | #include "mozilla/dom/ScreenOrientation.h" |
michael@0 | 7 | #include "nsIScreenManager.h" |
michael@0 | 8 | #include "nsServiceManagerUtils.h" |
michael@0 | 9 | |
michael@0 | 10 | namespace mozilla { |
michael@0 | 11 | namespace hal_impl { |
michael@0 | 12 | |
michael@0 | 13 | void |
michael@0 | 14 | EnableScreenConfigurationNotifications() |
michael@0 | 15 | { |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | void |
michael@0 | 19 | DisableScreenConfigurationNotifications() |
michael@0 | 20 | { |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | void |
michael@0 | 24 | GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration) |
michael@0 | 25 | { |
michael@0 | 26 | nsresult rv; |
michael@0 | 27 | nsCOMPtr<nsIScreenManager> screenMgr = |
michael@0 | 28 | do_GetService("@mozilla.org/gfx/screenmanager;1", &rv); |
michael@0 | 29 | if (NS_FAILED(rv)) { |
michael@0 | 30 | NS_ERROR("Can't find nsIScreenManager!"); |
michael@0 | 31 | return; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | nsIntRect rect; |
michael@0 | 35 | int32_t colorDepth, pixelDepth; |
michael@0 | 36 | dom::ScreenOrientation orientation; |
michael@0 | 37 | nsCOMPtr<nsIScreen> screen; |
michael@0 | 38 | |
michael@0 | 39 | screenMgr->GetPrimaryScreen(getter_AddRefs(screen)); |
michael@0 | 40 | screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height); |
michael@0 | 41 | screen->GetColorDepth(&colorDepth); |
michael@0 | 42 | screen->GetPixelDepth(&pixelDepth); |
michael@0 | 43 | orientation = rect.width >= rect.height |
michael@0 | 44 | ? dom::eScreenOrientation_LandscapePrimary |
michael@0 | 45 | : dom::eScreenOrientation_PortraitPrimary; |
michael@0 | 46 | |
michael@0 | 47 | *aScreenConfiguration = |
michael@0 | 48 | hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | bool |
michael@0 | 52 | LockScreenOrientation(const dom::ScreenOrientation& aOrientation) |
michael@0 | 53 | { |
michael@0 | 54 | return false; |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | void |
michael@0 | 58 | UnlockScreenOrientation() |
michael@0 | 59 | { |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | } // hal_impl |
michael@0 | 63 | } // mozilla |