gecko-dev/widget/qt/nsScreenQt.cpp
Oleg Romashin 5b8bccef6f Bug 974335 - Refactor Qt Widget Backend implementation. Qt Only changes NPDB. r=romaxa
--HG--
rename : dom/system/unix/Makefile.in => dom/system/qt/Makefile.in
rename : dom/system/unix/QTMLocationProvider.cpp => dom/system/qt/QTMLocationProvider.cpp
rename : dom/system/unix/QTMLocationProvider.h => dom/system/qt/QTMLocationProvider.h
rename : dom/system/unix/nsHapticFeedback.cpp => dom/system/qt/QtHapticFeedback.cpp
rename : dom/system/unix/nsHapticFeedback.h => dom/system/qt/QtHapticFeedback.h
rename : dom/system/unix/moz.build => dom/system/qt/moz.build
2014-02-20 18:09:02 -08:00

68 lines
1.5 KiB
C++

/* 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/. */
#include <QColor>
#include <QRect>
#include <QGuiApplication>
#include <QTransform>
#include <QScreen>
#include "nsScreenQt.h"
#include "nsXULAppAPI.h"
nsScreenQt::nsScreenQt(int aScreen)
: mScreen(aScreen)
{
// 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()
{
}
NS_IMETHODIMP
nsScreenQt::GetRect(int32_t *outLeft,int32_t *outTop,
int32_t *outWidth,int32_t *outHeight)
{
QRect r = QGuiApplication::screens()[mScreen]->geometry();
*outTop = r.x();
*outLeft = r.y();
*outWidth = r.width();
*outHeight = r.height();
return NS_OK;
}
NS_IMETHODIMP
nsScreenQt::GetAvailRect(int32_t *outLeft,int32_t *outTop,
int32_t *outWidth,int32_t *outHeight)
{
QRect r = QGuiApplication::screens()[mScreen]->geometry();
*outTop = r.x();
*outLeft = r.y();
*outWidth = r.width();
*outHeight = r.height();
return NS_OK;
}
NS_IMETHODIMP
nsScreenQt::GetPixelDepth(int32_t *aPixelDepth)
{
// #############
*aPixelDepth = QGuiApplication::primaryScreen()->depth();
return NS_OK;
}
NS_IMETHODIMP
nsScreenQt::GetColorDepth(int32_t *aColorDepth)
{
// ###############
return GetPixelDepth(aColorDepth);
}