2012-07-20 02:10:44 -07:00
|
|
|
/* Copyright 2012 Mozilla Foundation and Mozilla contributors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2012-12-14 15:58:45 -08:00
|
|
|
#include "mozilla/DebugOnly.h"
|
|
|
|
|
2012-04-04 23:03:00 -07:00
|
|
|
#include <fcntl.h>
|
2011-12-23 23:13:33 -08:00
|
|
|
|
|
|
|
#include "android/log.h"
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2012-09-11 13:05:52 -07:00
|
|
|
#include "mozilla/dom/TabParent.h"
|
2012-01-17 02:55:25 -08:00
|
|
|
#include "mozilla/Hal.h"
|
2012-04-05 09:15:19 -07:00
|
|
|
#include "mozilla/Preferences.h"
|
2014-07-05 11:19:12 -07:00
|
|
|
#include "mozilla/Services.h"
|
2012-04-04 23:03:00 -07:00
|
|
|
#include "mozilla/FileUtils.h"
|
2013-07-01 16:03:17 -07:00
|
|
|
#include "mozilla/ClearOnShutdown.h"
|
2011-12-23 23:13:33 -08:00
|
|
|
#include "gfxContext.h"
|
2012-08-19 12:33:25 -07:00
|
|
|
#include "gfxPlatform.h"
|
2011-12-23 23:13:33 -08:00
|
|
|
#include "gfxUtils.h"
|
2011-11-10 16:17:46 -08:00
|
|
|
#include "GLContextProvider.h"
|
2013-09-04 05:14:52 -07:00
|
|
|
#include "GLContext.h"
|
2011-12-23 23:13:33 -08:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsAppShell.h"
|
2012-01-10 18:07:00 -08:00
|
|
|
#include "nsIdleService.h"
|
2014-07-05 11:19:12 -07:00
|
|
|
#include "nsIObserverService.h"
|
2012-02-06 14:47:11 -08:00
|
|
|
#include "nsScreenManagerGonk.h"
|
|
|
|
#include "nsTArray.h"
|
2011-12-23 23:13:33 -08:00
|
|
|
#include "nsWindow.h"
|
2012-08-15 11:52:42 -07:00
|
|
|
#include "nsIWidgetListener.h"
|
2012-05-23 12:35:13 -07:00
|
|
|
#include "cutils/properties.h"
|
2013-04-30 22:03:25 -07:00
|
|
|
#include "ClientLayerManager.h"
|
2012-07-30 17:42:26 -07:00
|
|
|
#include "BasicLayers.h"
|
2013-05-07 20:58:22 -07:00
|
|
|
#include "libdisplay/GonkDisplay.h"
|
|
|
|
#include "pixelflinger/format.h"
|
2013-10-01 09:55:42 -07:00
|
|
|
#include "mozilla/BasicEvents.h"
|
2014-01-23 13:34:31 -08:00
|
|
|
#include "mozilla/layers/APZCTreeManager.h"
|
2013-09-16 14:45:31 -07:00
|
|
|
#include "mozilla/layers/CompositorParent.h"
|
|
|
|
#include "ParentProcessController.h"
|
2013-11-26 14:15:17 -08:00
|
|
|
#include "nsThreadUtils.h"
|
2013-05-07 20:58:22 -07:00
|
|
|
#include "HwcComposer2D.h"
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args)
|
2012-07-07 07:07:00 -07:00
|
|
|
#define LOGW(args...) __android_log_print(ANDROID_LOG_WARN, "Gonk", ## args)
|
|
|
|
#define LOGE(args...) __android_log_print(ANDROID_LOG_ERROR, "Gonk", ## args)
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
#define IS_TOPLEVEL() (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog)
|
|
|
|
|
2011-12-23 23:13:33 -08:00
|
|
|
using namespace mozilla;
|
2012-05-08 14:36:07 -07:00
|
|
|
using namespace mozilla::dom;
|
|
|
|
using namespace mozilla::hal;
|
2011-11-10 16:17:46 -08:00
|
|
|
using namespace mozilla::gl;
|
|
|
|
using namespace mozilla::layers;
|
2011-12-15 15:38:45 -08:00
|
|
|
using namespace mozilla::widget;
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
nsIntRect gScreenBounds;
|
2012-02-06 17:47:11 -08:00
|
|
|
static uint32_t sScreenRotation;
|
2012-05-23 12:35:13 -07:00
|
|
|
static uint32_t sPhysicalScreenRotation;
|
2012-02-06 17:47:11 -08:00
|
|
|
static nsIntRect sVirtualBounds;
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
static nsTArray<nsWindow *> sTopWindows;
|
2012-07-30 07:20:58 -07:00
|
|
|
static nsWindow *gFocusedWindow = nullptr;
|
2012-11-19 09:58:38 -08:00
|
|
|
static bool sUsingHwc;
|
2012-06-26 07:38:50 -07:00
|
|
|
static bool sScreenInitialized;
|
2012-04-04 23:03:00 -07:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static uint32_t
|
2012-07-24 12:01:09 -07:00
|
|
|
EffectiveScreenRotation()
|
|
|
|
{
|
|
|
|
return (sScreenRotation + sPhysicalScreenRotation) % (360 / 90);
|
|
|
|
}
|
|
|
|
|
2012-04-04 23:03:00 -07:00
|
|
|
class ScreenOnOffEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
ScreenOnOffEvent(bool on)
|
|
|
|
: mIsOn(on)
|
|
|
|
{}
|
|
|
|
|
|
|
|
NS_IMETHOD Run() {
|
2012-08-22 08:56:38 -07:00
|
|
|
for (uint32_t i = 0; i < sTopWindows.Length(); i++) {
|
2012-04-04 23:03:00 -07:00
|
|
|
nsWindow *win = sTopWindows[i];
|
2012-08-15 11:52:42 -07:00
|
|
|
|
|
|
|
if (nsIWidgetListener* listener = win->GetWidgetListener()) {
|
|
|
|
listener->SizeModeChanged(mIsOn ? nsSizeMode_Fullscreen : nsSizeMode_Minimized);
|
|
|
|
}
|
2012-04-04 23:03:00 -07:00
|
|
|
}
|
|
|
|
|
2013-06-06 00:28:59 -07:00
|
|
|
// Notify observers that the screen state has just changed.
|
|
|
|
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
if (observerService) {
|
|
|
|
observerService->NotifyObservers(
|
|
|
|
nullptr, "screen-state-changed",
|
2013-12-12 17:50:01 -08:00
|
|
|
mIsOn ? MOZ_UTF16("on") : MOZ_UTF16("off")
|
2013-06-06 00:28:59 -07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-04-04 23:03:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool mIsOn;
|
|
|
|
};
|
|
|
|
|
2013-07-01 16:03:17 -07:00
|
|
|
static StaticRefPtr<ScreenOnOffEvent> sScreenOnEvent;
|
|
|
|
static StaticRefPtr<ScreenOnOffEvent> sScreenOffEvent;
|
2012-04-04 23:03:00 -07:00
|
|
|
|
2013-07-01 16:03:17 -07:00
|
|
|
static void
|
|
|
|
displayEnabledCallback(bool enabled)
|
|
|
|
{
|
2014-08-26 22:17:00 -07:00
|
|
|
HwcComposer2D::GetInstance()->EnableVsync(enabled);
|
2013-07-01 16:03:17 -07:00
|
|
|
NS_DispatchToMainThread(enabled ? sScreenOnEvent : sScreenOffEvent);
|
2012-04-26 01:46:52 -07:00
|
|
|
}
|
2012-04-04 23:03:00 -07:00
|
|
|
|
|
|
|
} // anonymous namespace
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
nsWindow::nsWindow()
|
|
|
|
{
|
2014-07-22 13:46:27 -07:00
|
|
|
if (sScreenInitialized)
|
|
|
|
return;
|
2012-05-23 12:35:13 -07:00
|
|
|
|
2014-07-22 13:46:27 -07:00
|
|
|
sScreenOnEvent = new ScreenOnOffEvent(true);
|
|
|
|
ClearOnShutdown(&sScreenOnEvent);
|
|
|
|
sScreenOffEvent = new ScreenOnOffEvent(false);
|
|
|
|
ClearOnShutdown(&sScreenOffEvent);
|
|
|
|
GetGonkDisplay()->OnEnabled(displayEnabledCallback);
|
2012-05-23 12:35:13 -07:00
|
|
|
|
2014-07-22 13:46:27 -07:00
|
|
|
nsIntSize screenSize;
|
2012-03-25 03:06:02 -07:00
|
|
|
|
2014-07-22 13:46:27 -07:00
|
|
|
ANativeWindow *win = GetGonkDisplay()->GetNativeWindow();
|
2012-06-26 07:38:50 -07:00
|
|
|
|
2014-07-22 13:46:27 -07:00
|
|
|
if (win->query(win, NATIVE_WINDOW_WIDTH, &screenSize.width) ||
|
|
|
|
win->query(win, NATIVE_WINDOW_HEIGHT, &screenSize.height)) {
|
|
|
|
NS_RUNTIMEABORT("Failed to get native window size, aborting...");
|
|
|
|
}
|
|
|
|
gScreenBounds = nsIntRect(nsIntPoint(0, 0), screenSize);
|
2012-07-13 08:25:29 -07:00
|
|
|
|
2014-07-22 13:46:27 -07:00
|
|
|
char propValue[PROPERTY_VALUE_MAX];
|
|
|
|
property_get("ro.sf.hwrotation", propValue, "0");
|
|
|
|
sPhysicalScreenRotation = atoi(propValue) / 90;
|
|
|
|
|
|
|
|
sVirtualBounds = gScreenBounds;
|
|
|
|
|
|
|
|
sScreenInitialized = true;
|
|
|
|
|
|
|
|
nsAppShell::NotifyScreenInitialized();
|
|
|
|
|
|
|
|
// This is a hack to force initialization of the compositor
|
|
|
|
// resources, if we're going to use omtc.
|
|
|
|
//
|
|
|
|
// NB: GetPlatform() will create the gfxPlatform, which wants
|
|
|
|
// to know the color depth, which asks our native window.
|
|
|
|
// This has to happen after other init has finished.
|
|
|
|
gfxPlatform::GetPlatform();
|
|
|
|
if (!ShouldUseOffMainThreadCompositing()) {
|
|
|
|
MOZ_CRASH("How can we render apps, then?");
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
2014-07-22 13:46:27 -07:00
|
|
|
// Update sUsingHwc whenever layers.composer2d.enabled changes
|
|
|
|
Preferences::AddBoolVarCache(&sUsingHwc, "layers.composer2d.enabled");
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
nsWindow::~nsWindow()
|
|
|
|
{
|
2014-09-24 06:50:45 -07:00
|
|
|
HwcComposer2D::GetInstance()->SetCompositorParent(nullptr);
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsWindow::DoDraw(void)
|
|
|
|
{
|
2012-01-17 02:55:25 -08:00
|
|
|
if (!hal::GetScreenEnabled()) {
|
|
|
|
gDrawRequest = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
if (sTopWindows.IsEmpty()) {
|
2011-12-23 23:13:33 -08:00
|
|
|
LOG(" no window to draw, bailing");
|
2011-11-10 16:17:46 -08:00
|
|
|
return;
|
2011-12-23 23:13:33 -08:00
|
|
|
}
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
nsWindow *targetWindow = (nsWindow *)sTopWindows[0];
|
|
|
|
while (targetWindow->GetLastChild())
|
|
|
|
targetWindow = (nsWindow *)targetWindow->GetLastChild();
|
2011-12-23 23:13:33 -08:00
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
nsIWidgetListener* listener = targetWindow->GetWidgetListener();
|
2013-01-28 11:34:03 -08:00
|
|
|
if (listener) {
|
2014-04-10 19:21:36 -07:00
|
|
|
listener->WillPaintWindow(targetWindow);
|
2013-01-28 11:34:03 -08:00
|
|
|
}
|
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
LayerManager* lm = targetWindow->GetLayerManager();
|
2014-01-23 10:26:41 -08:00
|
|
|
if (mozilla::layers::LayersBackend::LAYERS_CLIENT == lm->GetBackendType()) {
|
2013-04-30 22:03:25 -07:00
|
|
|
// No need to do anything, the compositor will handle drawing
|
2011-12-23 23:13:33 -08:00
|
|
|
} else {
|
|
|
|
NS_RUNTIMEABORT("Unexpected layer manager type");
|
|
|
|
}
|
2013-01-28 11:34:03 -08:00
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
listener = targetWindow->GetWidgetListener();
|
2013-01-28 11:34:03 -08:00
|
|
|
if (listener) {
|
|
|
|
listener->DidPaintWindow();
|
|
|
|
}
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
nsEventStatus
|
2013-10-01 20:46:03 -07:00
|
|
|
nsWindow::DispatchInputEvent(WidgetGUIEvent& aEvent, bool* aWasCaptured)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
2012-09-11 13:05:52 -07:00
|
|
|
if (aWasCaptured) {
|
|
|
|
*aWasCaptured = false;
|
|
|
|
}
|
|
|
|
if (!gFocusedWindow) {
|
2011-11-10 16:17:46 -08:00
|
|
|
return nsEventStatus_eIgnore;
|
2012-09-11 13:05:52 -07:00
|
|
|
}
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2012-01-10 18:07:00 -08:00
|
|
|
gFocusedWindow->UserActivity();
|
2012-08-15 11:53:09 -07:00
|
|
|
|
2012-08-15 17:54:18 -07:00
|
|
|
aEvent.widget = gFocusedWindow;
|
2012-09-11 13:05:52 -07:00
|
|
|
|
|
|
|
if (TabParent* capturer = TabParent::GetEventCapturer()) {
|
|
|
|
bool captured = capturer->TryCapture(aEvent);
|
|
|
|
if (aWasCaptured) {
|
|
|
|
*aWasCaptured = captured;
|
|
|
|
}
|
|
|
|
if (captured) {
|
|
|
|
return nsEventStatus_eConsumeNoDefault;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsEventStatus status;
|
2012-08-15 11:53:09 -07:00
|
|
|
gFocusedWindow->DispatchEvent(&aEvent, status);
|
|
|
|
return status;
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::Create(nsIWidget *aParent,
|
|
|
|
void *aNativeParent,
|
|
|
|
const nsIntRect &aRect,
|
|
|
|
nsDeviceContext *aContext,
|
|
|
|
nsWidgetInitData *aInitData)
|
|
|
|
{
|
2012-02-06 17:47:11 -08:00
|
|
|
BaseCreate(aParent, IS_TOPLEVEL() ? sVirtualBounds : aRect,
|
2012-08-15 11:53:09 -07:00
|
|
|
aContext, aInitData);
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
mBounds = aRect;
|
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
mParent = (nsWindow *)aParent;
|
2012-06-12 01:00:21 -07:00
|
|
|
mVisible = false;
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
if (!aParent) {
|
2012-02-06 17:47:11 -08:00
|
|
|
mBounds = sVirtualBounds;
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!IS_TOPLEVEL())
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
sTopWindows.AppendElement(this);
|
|
|
|
|
2012-02-06 17:47:11 -08:00
|
|
|
Resize(0, 0, sVirtualBounds.width, sVirtualBounds.height, false);
|
2011-11-10 16:17:46 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::Destroy(void)
|
|
|
|
{
|
2014-01-09 22:48:18 -08:00
|
|
|
mOnDestroyCalled = true;
|
2011-11-10 16:17:46 -08:00
|
|
|
sTopWindows.RemoveElement(this);
|
|
|
|
if (this == gFocusedWindow)
|
2012-07-30 07:20:58 -07:00
|
|
|
gFocusedWindow = nullptr;
|
2014-01-09 22:48:18 -08:00
|
|
|
nsBaseWidget::OnDestroy();
|
2011-11-10 16:17:46 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::Show(bool aState)
|
|
|
|
{
|
2011-11-22 11:51:52 -08:00
|
|
|
if (mWindowType == eWindowType_invisible)
|
2011-11-10 16:17:46 -08:00
|
|
|
return NS_OK;
|
|
|
|
|
2012-01-05 13:23:34 -08:00
|
|
|
if (mVisible == aState)
|
|
|
|
return NS_OK;
|
|
|
|
|
2011-11-22 11:51:52 -08:00
|
|
|
mVisible = aState;
|
|
|
|
if (!IS_TOPLEVEL())
|
|
|
|
return mParent ? mParent->Show(aState) : NS_OK;
|
|
|
|
|
2012-01-05 13:23:34 -08:00
|
|
|
if (aState) {
|
2011-11-10 16:17:46 -08:00
|
|
|
BringToTop();
|
2012-01-05 13:23:34 -08:00
|
|
|
} else {
|
|
|
|
for (unsigned int i = 0; i < sTopWindows.Length(); i++) {
|
|
|
|
nsWindow *win = sTopWindows[i];
|
|
|
|
if (!win->mVisible)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
win->BringToTop();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-07-19 01:57:50 -07:00
|
|
|
bool
|
|
|
|
nsWindow::IsVisible() const
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
2012-07-19 01:57:50 -07:00
|
|
|
return mVisible;
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::ConstrainPosition(bool aAllowSlop,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aX,
|
|
|
|
int32_t *aY)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-12-12 01:57:38 -08:00
|
|
|
nsWindow::Move(double aX,
|
|
|
|
double aY)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-12-12 01:57:38 -08:00
|
|
|
nsWindow::Resize(double aWidth,
|
|
|
|
double aHeight,
|
|
|
|
bool aRepaint)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
|
|
|
return Resize(0, 0, aWidth, aHeight, aRepaint);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-12-12 01:57:38 -08:00
|
|
|
nsWindow::Resize(double aX,
|
|
|
|
double aY,
|
|
|
|
double aWidth,
|
|
|
|
double aHeight,
|
|
|
|
bool aRepaint)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
2012-12-12 01:57:38 -08:00
|
|
|
mBounds = nsIntRect(NSToIntRound(aX), NSToIntRound(aY),
|
|
|
|
NSToIntRound(aWidth), NSToIntRound(aHeight));
|
2012-08-15 11:52:42 -07:00
|
|
|
if (mWidgetListener)
|
2012-12-12 01:57:38 -08:00
|
|
|
mWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
if (aRepaint)
|
|
|
|
Invalidate(sVirtualBounds);
|
2012-02-22 00:50:44 -08:00
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::Enable(bool aState)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-07-22 22:19:08 -07:00
|
|
|
bool
|
|
|
|
nsWindow::IsEnabled() const
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
2012-07-22 22:19:08 -07:00
|
|
|
return true;
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::SetFocus(bool aRaise)
|
|
|
|
{
|
|
|
|
if (aRaise)
|
|
|
|
BringToTop();
|
|
|
|
|
|
|
|
gFocusedWindow = this;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>&)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-01-18 13:22:12 -08:00
|
|
|
nsWindow::Invalidate(const nsIntRect &aRect)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
2014-04-10 19:21:36 -07:00
|
|
|
nsWindow *top = mParent;
|
|
|
|
while (top && top->mParent)
|
|
|
|
top = top->mParent;
|
|
|
|
if (top != sTopWindows[0] && this != sTopWindows[0])
|
2011-11-22 11:51:52 -08:00
|
|
|
return NS_OK;
|
|
|
|
|
2012-01-18 13:22:12 -08:00
|
|
|
gDrawRequest = true;
|
|
|
|
mozilla::NotifyEvent();
|
2011-11-10 16:17:46 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIntPoint
|
|
|
|
nsWindow::WidgetToScreenOffset()
|
|
|
|
{
|
|
|
|
nsIntPoint p(0, 0);
|
|
|
|
nsWindow *w = this;
|
|
|
|
|
|
|
|
while (w && w->mParent) {
|
|
|
|
p.x += w->mBounds.x;
|
|
|
|
p.y += w->mBounds.y;
|
|
|
|
|
|
|
|
w = w->mParent;
|
|
|
|
}
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
void*
|
2012-08-22 08:56:38 -07:00
|
|
|
nsWindow::GetNativeData(uint32_t aDataType)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
|
|
|
switch (aDataType) {
|
|
|
|
case NS_NATIVE_WINDOW:
|
2013-05-07 20:58:22 -07:00
|
|
|
return GetGonkDisplay()->GetNativeWindow();
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2013-10-01 20:46:03 -07:00
|
|
|
nsWindow::DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus)
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
2012-08-15 11:53:09 -07:00
|
|
|
if (mWidgetListener)
|
|
|
|
aStatus = mWidgetListener->HandleEvent(aEvent, mUseAttachedEvents);
|
2011-11-10 16:17:46 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 15:38:45 -08:00
|
|
|
NS_IMETHODIMP_(void)
|
|
|
|
nsWindow::SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction)
|
|
|
|
{
|
2012-01-05 11:17:14 -08:00
|
|
|
mInputContext = aContext;
|
2011-12-15 15:38:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(InputContext)
|
|
|
|
nsWindow::GetInputContext()
|
|
|
|
{
|
2012-10-26 16:35:21 -07:00
|
|
|
// There is only one IME context on Gonk.
|
|
|
|
mInputContext.mNativeIMEContext = nullptr;
|
2012-01-05 11:17:14 -08:00
|
|
|
return mInputContext;
|
2011-12-15 15:38:45 -08:00
|
|
|
}
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::ReparentNativeWidget(nsIWidget* aNewParent)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-14 23:13:48 -07:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWindow::MakeFullScreen(bool aFullScreen)
|
|
|
|
{
|
|
|
|
if (mWindowType != eWindowType_toplevel) {
|
|
|
|
// Ignore fullscreen request for non-toplevel windows.
|
|
|
|
NS_WARNING("MakeFullScreen() on a dialog or child widget?");
|
|
|
|
return nsBaseWidget::MakeFullScreen(aFullScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aFullScreen) {
|
|
|
|
// Fullscreen is "sticky" for toplevel widgets on gonk: we
|
|
|
|
// must paint the entire screen, and should only have one
|
|
|
|
// toplevel widget, so it doesn't make sense to ever "exit"
|
|
|
|
// fullscreen. If we do, we can leave parts of the screen
|
|
|
|
// unpainted.
|
|
|
|
Resize(sVirtualBounds.x, sVirtualBounds.y,
|
|
|
|
sVirtualBounds.width, sVirtualBounds.height,
|
|
|
|
/*repaint*/true);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
float
|
|
|
|
nsWindow::GetDPI()
|
|
|
|
{
|
2013-05-07 20:58:22 -07:00
|
|
|
return GetGonkDisplay()->xdpi;
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
2013-05-01 13:04:56 -07:00
|
|
|
double
|
|
|
|
nsWindow::GetDefaultScaleInternal()
|
|
|
|
{
|
2013-06-03 05:30:28 -07:00
|
|
|
float dpi = GetDPI();
|
|
|
|
// The mean pixel density for mdpi devices is 160dpi, 240dpi for hdpi,
|
|
|
|
// and 320dpi for xhdpi, respectively.
|
|
|
|
// We'll take the mid-value between these three numbers as the boundary.
|
|
|
|
if (dpi < 200.0) {
|
|
|
|
return 1.0; // mdpi devices.
|
|
|
|
}
|
2013-11-21 13:03:24 -08:00
|
|
|
if (dpi < 300.0) {
|
2013-06-03 05:30:28 -07:00
|
|
|
return 1.5; // hdpi devices.
|
|
|
|
}
|
2013-11-21 13:03:24 -08:00
|
|
|
// xhdpi devices and beyond.
|
2014-01-25 04:21:01 -08:00
|
|
|
return floor(dpi / 150.0 + 0.5);
|
2013-05-01 13:04:56 -07:00
|
|
|
}
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
LayerManager *
|
2013-04-24 11:42:40 -07:00
|
|
|
nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
2011-11-10 16:17:46 -08:00
|
|
|
LayersBackend aBackendHint,
|
|
|
|
LayerManagerPersistence aPersistence,
|
|
|
|
bool* aAllowRetaining)
|
|
|
|
{
|
|
|
|
if (aAllowRetaining)
|
|
|
|
*aAllowRetaining = true;
|
2012-08-14 18:10:40 -07:00
|
|
|
if (mLayerManager) {
|
|
|
|
// This layer manager might be used for painting outside of DoDraw(), so we need
|
|
|
|
// to set the correct rotation on it.
|
2014-07-03 19:36:22 -07:00
|
|
|
if (mLayerManager->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientLayerManager* manager =
|
|
|
|
static_cast<ClientLayerManager*>(mLayerManager.get());
|
2014-01-23 10:26:41 -08:00
|
|
|
manager->SetDefaultTargetConfiguration(mozilla::layers::BufferMode::BUFFER_NONE,
|
2012-08-14 18:10:40 -07:00
|
|
|
ScreenRotation(EffectiveScreenRotation()));
|
|
|
|
}
|
2011-11-10 16:17:46 -08:00
|
|
|
return mLayerManager;
|
2012-08-14 18:10:40 -07:00
|
|
|
}
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2012-11-15 10:55:15 -08:00
|
|
|
// Set mUseLayersAcceleration here to make it consistent with
|
2012-07-04 05:30:59 -07:00
|
|
|
// nsBaseWidget::GetLayerManager
|
2012-11-15 10:55:15 -08:00
|
|
|
mUseLayersAcceleration = ComputeShouldAccelerate(mUseLayersAcceleration);
|
2011-11-10 16:17:46 -08:00
|
|
|
nsWindow *topWindow = sTopWindows[0];
|
|
|
|
|
|
|
|
if (!topWindow) {
|
2012-07-07 07:07:00 -07:00
|
|
|
LOGW(" -- no topwindow\n");
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
2014-07-03 19:36:22 -07:00
|
|
|
CreateCompositor();
|
|
|
|
if (mCompositorParent) {
|
|
|
|
uint64_t rootLayerTreeId = mCompositorParent->RootLayerTreeId();
|
|
|
|
CompositorParent::SetControllerForLayerTree(rootLayerTreeId, new ParentProcessController());
|
|
|
|
CompositorParent::GetAPZCTreeManager(rootLayerTreeId)->SetDPI(GetDPI());
|
2014-09-24 06:50:45 -07:00
|
|
|
HwcComposer2D::GetInstance()->SetCompositorParent(mCompositorParent);
|
2011-12-23 23:13:33 -08:00
|
|
|
}
|
2014-07-03 19:36:22 -07:00
|
|
|
MOZ_ASSERT(mLayerManager);
|
2011-11-10 16:17:46 -08:00
|
|
|
return mLayerManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsWindow::BringToTop()
|
|
|
|
{
|
|
|
|
if (!sTopWindows.IsEmpty()) {
|
2012-08-15 11:52:42 -07:00
|
|
|
if (nsIWidgetListener* listener = sTopWindows[0]->GetWidgetListener())
|
|
|
|
listener->WindowDeactivated();
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
sTopWindows.RemoveElement(this);
|
|
|
|
sTopWindows.InsertElementAt(0, this);
|
|
|
|
|
2012-08-15 11:52:42 -07:00
|
|
|
if (mWidgetListener)
|
|
|
|
mWidgetListener->WindowActivated();
|
2012-02-06 17:47:11 -08:00
|
|
|
Invalidate(sVirtualBounds);
|
2011-11-10 16:17:46 -08:00
|
|
|
}
|
|
|
|
|
2012-01-10 18:07:00 -08:00
|
|
|
void
|
|
|
|
nsWindow::UserActivity()
|
|
|
|
{
|
|
|
|
if (!mIdleService) {
|
|
|
|
mIdleService = do_GetService("@mozilla.org/widget/idleservice;1");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mIdleService) {
|
2012-06-29 01:32:21 -07:00
|
|
|
mIdleService->ResetIdleTimeOut(0);
|
2012-01-10 18:07:00 -08:00
|
|
|
}
|
|
|
|
}
|
2012-01-25 18:05:34 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t
|
2012-01-25 18:05:34 -08:00
|
|
|
nsWindow::GetGLFrameBufferFormat()
|
|
|
|
{
|
|
|
|
if (mLayerManager &&
|
2014-01-23 10:26:41 -08:00
|
|
|
mLayerManager->GetBackendType() == mozilla::layers::LayersBackend::LAYERS_OPENGL) {
|
2012-01-25 18:05:34 -08:00
|
|
|
// We directly map the hardware fb on Gonk. The hardware fb
|
|
|
|
// has RGB format.
|
|
|
|
return LOCAL_GL_RGB;
|
|
|
|
}
|
|
|
|
return LOCAL_GL_NONE;
|
|
|
|
}
|
2012-02-06 14:47:11 -08:00
|
|
|
|
2012-07-24 12:01:09 -07:00
|
|
|
nsIntRect
|
|
|
|
nsWindow::GetNaturalBounds()
|
|
|
|
{
|
|
|
|
return gScreenBounds;
|
|
|
|
}
|
|
|
|
|
2012-08-13 19:41:09 -07:00
|
|
|
bool
|
|
|
|
nsWindow::NeedsPaint()
|
|
|
|
{
|
|
|
|
if (!mLayerManager) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return nsIWidget::NeedsPaint();
|
|
|
|
}
|
|
|
|
|
2012-11-19 09:58:38 -08:00
|
|
|
Composer2D*
|
|
|
|
nsWindow::GetComposer2D()
|
|
|
|
{
|
|
|
|
if (!sUsingHwc) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-05-07 20:58:22 -07:00
|
|
|
|
2012-11-19 09:58:38 -08:00
|
|
|
if (HwcComposer2D* hwc = HwcComposer2D::GetInstance()) {
|
|
|
|
return hwc->Initialized() ? hwc : nullptr;
|
|
|
|
}
|
2013-05-07 20:58:22 -07:00
|
|
|
|
2012-11-19 09:58:38 -08:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2012-02-06 14:47:11 -08:00
|
|
|
// nsScreenGonk.cpp
|
|
|
|
|
|
|
|
nsScreenGonk::nsScreenGonk(void *nativeScreen)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsScreenGonk::~nsScreenGonk()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-14 10:22:26 -07:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsScreenGonk::GetId(uint32_t *outId)
|
|
|
|
{
|
|
|
|
*outId = 1;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-02-06 14:47:11 -08:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenGonk::GetRect(int32_t *outLeft, int32_t *outTop,
|
|
|
|
int32_t *outWidth, int32_t *outHeight)
|
2012-02-06 14:47:11 -08:00
|
|
|
{
|
2012-02-06 17:47:11 -08:00
|
|
|
*outLeft = sVirtualBounds.x;
|
|
|
|
*outTop = sVirtualBounds.y;
|
2012-02-06 14:47:11 -08:00
|
|
|
|
2012-02-06 17:47:11 -08:00
|
|
|
*outWidth = sVirtualBounds.width;
|
|
|
|
*outHeight = sVirtualBounds.height;
|
2012-02-06 14:47:11 -08:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenGonk::GetAvailRect(int32_t *outLeft, int32_t *outTop,
|
|
|
|
int32_t *outWidth, int32_t *outHeight)
|
2012-02-06 14:47:11 -08:00
|
|
|
{
|
|
|
|
return GetRect(outLeft, outTop, outWidth, outHeight);
|
|
|
|
}
|
|
|
|
|
2012-05-08 14:36:07 -07:00
|
|
|
static uint32_t
|
|
|
|
ColorDepth()
|
|
|
|
{
|
2013-05-07 20:58:22 -07:00
|
|
|
switch (GetGonkDisplay()->surfaceformat) {
|
2012-06-22 01:18:54 -07:00
|
|
|
case GGL_PIXEL_FORMAT_RGB_565:
|
|
|
|
return 16;
|
|
|
|
case GGL_PIXEL_FORMAT_RGBA_8888:
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
return 24; // GGL_PIXEL_FORMAT_RGBX_8888
|
2012-05-08 14:36:07 -07:00
|
|
|
}
|
2012-02-06 14:47:11 -08:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenGonk::GetPixelDepth(int32_t *aPixelDepth)
|
2012-02-06 14:47:11 -08:00
|
|
|
{
|
2012-05-08 14:36:07 -07:00
|
|
|
// XXX: this should actually return 32 when we're using 24-bit
|
|
|
|
// color, because we use RGBX.
|
|
|
|
*aPixelDepth = ColorDepth();
|
2012-02-06 14:47:11 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenGonk::GetColorDepth(int32_t *aColorDepth)
|
2012-02-06 14:47:11 -08:00
|
|
|
{
|
|
|
|
return GetPixelDepth(aColorDepth);
|
|
|
|
}
|
|
|
|
|
2012-02-06 17:47:11 -08:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenGonk::GetRotation(uint32_t* aRotation)
|
2012-02-06 17:47:11 -08:00
|
|
|
{
|
|
|
|
*aRotation = sScreenRotation;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenGonk::SetRotation(uint32_t aRotation)
|
2012-02-06 17:47:11 -08:00
|
|
|
{
|
2012-07-30 17:42:26 -07:00
|
|
|
if (!(aRotation <= ROTATION_270_DEG))
|
2012-02-06 17:47:11 -08:00
|
|
|
return NS_ERROR_ILLEGAL_VALUE;
|
|
|
|
|
|
|
|
if (sScreenRotation == aRotation)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
sScreenRotation = aRotation;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t rotation = EffectiveScreenRotation();
|
2012-07-24 12:01:09 -07:00
|
|
|
if (rotation == nsIScreen::ROTATION_90_DEG ||
|
|
|
|
rotation == nsIScreen::ROTATION_270_DEG) {
|
2012-02-06 17:47:11 -08:00
|
|
|
sVirtualBounds = nsIntRect(0, 0, gScreenBounds.height,
|
2012-07-24 12:01:09 -07:00
|
|
|
gScreenBounds.width);
|
|
|
|
} else {
|
2012-02-06 17:47:11 -08:00
|
|
|
sVirtualBounds = gScreenBounds;
|
|
|
|
}
|
|
|
|
|
2014-04-10 19:21:36 -07:00
|
|
|
nsAppShell::NotifyScreenRotation();
|
|
|
|
|
2012-02-06 17:47:11 -08:00
|
|
|
for (unsigned int i = 0; i < sTopWindows.Length(); i++)
|
|
|
|
sTopWindows[i]->Resize(sVirtualBounds.width,
|
|
|
|
sVirtualBounds.height,
|
2014-04-10 19:21:36 -07:00
|
|
|
true);
|
2012-04-24 20:59:01 -07:00
|
|
|
|
2012-02-06 17:47:11 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-05-08 14:36:07 -07:00
|
|
|
// NB: This isn't gonk-specific, but gonk is the only widget backend
|
|
|
|
// that does this calculation itself, currently.
|
|
|
|
static ScreenOrientation
|
|
|
|
ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize)
|
|
|
|
{
|
|
|
|
bool naturallyPortrait = (aScreenSize.height > aScreenSize.width);
|
|
|
|
switch (aRotation) {
|
|
|
|
case nsIScreen::ROTATION_0_DEG:
|
|
|
|
return (naturallyPortrait ? eScreenOrientation_PortraitPrimary :
|
|
|
|
eScreenOrientation_LandscapePrimary);
|
|
|
|
case nsIScreen::ROTATION_90_DEG:
|
|
|
|
// Arbitrarily choosing 90deg to be primary "unnatural"
|
|
|
|
// rotation.
|
|
|
|
return (naturallyPortrait ? eScreenOrientation_LandscapePrimary :
|
|
|
|
eScreenOrientation_PortraitPrimary);
|
|
|
|
case nsIScreen::ROTATION_180_DEG:
|
|
|
|
return (naturallyPortrait ? eScreenOrientation_PortraitSecondary :
|
|
|
|
eScreenOrientation_LandscapeSecondary);
|
|
|
|
case nsIScreen::ROTATION_270_DEG:
|
|
|
|
return (naturallyPortrait ? eScreenOrientation_LandscapeSecondary :
|
|
|
|
eScreenOrientation_PortraitSecondary);
|
|
|
|
default:
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Gonk screen must always have a known rotation");
|
2012-05-08 14:36:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*static*/ uint32_t
|
2012-02-06 17:47:11 -08:00
|
|
|
nsScreenGonk::GetRotation()
|
|
|
|
{
|
|
|
|
return sScreenRotation;
|
|
|
|
}
|
|
|
|
|
2012-05-08 14:36:07 -07:00
|
|
|
/*static*/ ScreenConfiguration
|
|
|
|
nsScreenGonk::GetConfiguration()
|
|
|
|
{
|
|
|
|
ScreenOrientation orientation = ComputeOrientation(sScreenRotation,
|
|
|
|
gScreenBounds.Size());
|
|
|
|
uint32_t colorDepth = ColorDepth();
|
|
|
|
// NB: perpetuating colorDepth == pixelDepth illusion here, for
|
|
|
|
// consistency.
|
|
|
|
return ScreenConfiguration(sVirtualBounds, orientation,
|
|
|
|
colorDepth, colorDepth);
|
|
|
|
}
|
|
|
|
|
2014-04-27 00:06:00 -07:00
|
|
|
NS_IMPL_ISUPPORTS(nsScreenManagerGonk, nsIScreenManager)
|
2012-02-06 14:47:11 -08:00
|
|
|
|
|
|
|
nsScreenManagerGonk::nsScreenManagerGonk()
|
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
mOneScreen = new nsScreenGonk(nullptr);
|
2012-02-06 14:47:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
nsScreenManagerGonk::~nsScreenManagerGonk()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsScreenManagerGonk::GetPrimaryScreen(nsIScreen **outScreen)
|
|
|
|
{
|
|
|
|
NS_IF_ADDREF(*outScreen = mOneScreen.get());
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-07-14 10:22:26 -07:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsScreenManagerGonk::ScreenForId(uint32_t aId,
|
|
|
|
nsIScreen **outScreen)
|
|
|
|
{
|
|
|
|
return GetPrimaryScreen(outScreen);
|
|
|
|
}
|
|
|
|
|
2012-02-06 14:47:11 -08:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenManagerGonk::ScreenForRect(int32_t inLeft,
|
|
|
|
int32_t inTop,
|
|
|
|
int32_t inWidth,
|
|
|
|
int32_t inHeight,
|
2012-02-06 14:47:11 -08:00
|
|
|
nsIScreen **outScreen)
|
|
|
|
{
|
|
|
|
return GetPrimaryScreen(outScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsScreenManagerGonk::ScreenForNativeWidget(void *aWidget, nsIScreen **outScreen)
|
|
|
|
{
|
|
|
|
return GetPrimaryScreen(outScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenManagerGonk::GetNumberOfScreens(uint32_t *aNumberOfScreens)
|
2012-02-06 14:47:11 -08:00
|
|
|
{
|
|
|
|
*aNumberOfScreens = 1;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-04-09 14:07:02 -07:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsScreenManagerGonk::GetSystemDefaultScale(float *aDefaultScale)
|
|
|
|
{
|
|
|
|
*aDefaultScale = 1.0f;
|
|
|
|
return NS_OK;
|
|
|
|
}
|