hal/fallback/FallbackScreenConfiguration.cpp

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial