2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-04-19 08:31:50 -07:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
#include <QColor>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QGuiApplication>
|
2011-03-15 21:41:53 -07:00
|
|
|
#include <QTransform>
|
2014-02-20 18:09:02 -08:00
|
|
|
#include <QScreen>
|
2008-04-19 08:31:50 -07:00
|
|
|
|
2010-03-04 13:51:42 -08:00
|
|
|
#include "nsScreenQt.h"
|
2010-08-04 10:32:09 -07:00
|
|
|
#include "nsXULAppAPI.h"
|
2010-03-04 13:51:42 -08:00
|
|
|
|
2008-04-19 08:31:50 -07:00
|
|
|
nsScreenQt::nsScreenQt(int aScreen)
|
2008-04-20 01:16:40 -07:00
|
|
|
: mScreen(aScreen)
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
|
|
|
// nothing else to do. I guess we could cache a bunch of information
|
|
|
|
// here, but we want to ask the device at runtime in case anything
|
|
|
|
// has changed.
|
|
|
|
}
|
|
|
|
|
|
|
|
nsScreenQt::~nsScreenQt()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-04-20 01:16:40 -07:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenQt::GetRect(int32_t *outLeft,int32_t *outTop,
|
|
|
|
int32_t *outWidth,int32_t *outHeight)
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
2014-02-20 18:09:02 -08:00
|
|
|
QRect r = QGuiApplication::screens()[mScreen]->geometry();
|
2010-08-04 10:32:09 -07:00
|
|
|
|
2008-04-19 08:31:50 -07:00
|
|
|
*outTop = r.x();
|
|
|
|
*outLeft = r.y();
|
|
|
|
*outWidth = r.width();
|
|
|
|
*outHeight = r.height();
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenQt::GetAvailRect(int32_t *outLeft,int32_t *outTop,
|
|
|
|
int32_t *outWidth,int32_t *outHeight)
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
2014-02-20 18:09:02 -08:00
|
|
|
QRect r = QGuiApplication::screens()[mScreen]->geometry();
|
2011-03-15 21:41:53 -07:00
|
|
|
|
2008-04-19 08:31:50 -07:00
|
|
|
*outTop = r.x();
|
|
|
|
*outLeft = r.y();
|
|
|
|
*outWidth = r.width();
|
|
|
|
*outHeight = r.height();
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenQt::GetPixelDepth(int32_t *aPixelDepth)
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
|
|
|
// #############
|
2014-02-20 18:09:02 -08:00
|
|
|
*aPixelDepth = QGuiApplication::primaryScreen()->depth();
|
2008-04-19 08:31:50 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 08:56:38 -07:00
|
|
|
nsScreenQt::GetColorDepth(int32_t *aColorDepth)
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
|
|
|
// ###############
|
|
|
|
return GetPixelDepth(aColorDepth);
|
|
|
|
}
|