Bumping manifests a=b2g-bump
[gecko.git] / widget / qt / nsScreenQt.cpp
blob095238f24ad2f712d359110e22d3c339f7a777e4
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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include <QColor>
6 #include <QRect>
7 #include <QGuiApplication>
8 #include <QTransform>
9 #include <QScreen>
11 #include "nsScreenQt.h"
12 #include "nsXULAppAPI.h"
14 nsScreenQt::nsScreenQt(int aScreen)
15 : mScreen(aScreen)
17 // nothing else to do. I guess we could cache a bunch of information
18 // here, but we want to ask the device at runtime in case anything
19 // has changed.
22 nsScreenQt::~nsScreenQt()
26 NS_IMETHODIMP
27 nsScreenQt::GetId(uint32_t* aId)
29 *aId = mScreen;
30 return NS_OK;
33 NS_IMETHODIMP
34 nsScreenQt::GetRect(int32_t *outLeft,int32_t *outTop,
35 int32_t *outWidth,int32_t *outHeight)
37 QRect r = QGuiApplication::screens()[mScreen]->geometry();
39 *outTop = r.x();
40 *outLeft = r.y();
41 *outWidth = r.width();
42 *outHeight = r.height();
44 return NS_OK;
47 NS_IMETHODIMP
48 nsScreenQt::GetAvailRect(int32_t *outLeft,int32_t *outTop,
49 int32_t *outWidth,int32_t *outHeight)
51 QRect r = QGuiApplication::screens()[mScreen]->geometry();
53 *outTop = r.x();
54 *outLeft = r.y();
55 *outWidth = r.width();
56 *outHeight = r.height();
58 return NS_OK;
61 NS_IMETHODIMP
62 nsScreenQt::GetPixelDepth(int32_t *aPixelDepth)
64 // #############
65 *aPixelDepth = QGuiApplication::primaryScreen()->depth();
66 return NS_OK;
69 NS_IMETHODIMP
70 nsScreenQt::GetColorDepth(int32_t *aColorDepth)
72 // ###############
73 return GetPixelDepth(aColorDepth);