Ejemplo n.º 1
0
void
GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  nsresult rv;
  nsCOMPtr<nsIScreenManager> screenMgr =
    do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
  if (NS_FAILED(rv)) {
    NS_ERROR("Can't find nsIScreenManager!");
    return;
  }

  int32_t colorDepth, pixelDepth;
  int16_t angle;
  ScreenOrientationInternal orientation;
  nsCOMPtr<nsIScreen> screen;

  int32_t rectX, rectY, rectWidth, rectHeight;

  screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
  
  screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
  screen->GetColorDepth(&colorDepth);
  screen->GetPixelDepth(&pixelDepth);
  orientation = static_cast<ScreenOrientationInternal>(bridge->GetScreenOrientation());
  angle = bridge->GetScreenAngle();

  *aScreenConfiguration =
    hal::ScreenConfiguration(nsIntRect(rectX, rectY, rectWidth, rectHeight),
                             orientation, angle, colorDepth, pixelDepth);
}
Ejemplo n.º 2
0
void
GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  nsresult rv;
  nsCOMPtr<nsIScreenManager> screenMgr =
    do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
  if (NS_FAILED(rv)) {
    NS_ERROR("Can't find nsIScreenManager!");
    return;
  }

  nsIntRect rect;
  PRInt32 colorDepth, pixelDepth;
  ScreenOrientation orientation;
  nsCOMPtr<nsIScreen> screen;

  screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
  screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
  screen->GetColorDepth(&colorDepth);
  screen->GetPixelDepth(&pixelDepth);
  orientation = static_cast<ScreenOrientation>(bridge->GetScreenOrientation());

  *aScreenConfiguration =
    hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth);
}
Ejemplo n.º 3
0
void
GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation)
{
  AndroidBridge* bridge = AndroidBridge::Bridge();
  if (!bridge) {
    return;
  }

  dom::ScreenOrientationWrapper orientationWrapper;
  bridge->GetScreenOrientation(orientationWrapper);
  *aScreenOrientation = orientationWrapper.orientation;
}