widget/qt/nsScreenQt.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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)
    16 {
    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.
    20 }
    22 nsScreenQt::~nsScreenQt()
    23 {
    24 }
    26 NS_IMETHODIMP
    27 nsScreenQt::GetRect(int32_t *outLeft,int32_t *outTop,
    28                     int32_t *outWidth,int32_t *outHeight)
    29 {
    30     QRect r = QGuiApplication::screens()[mScreen]->geometry();
    32     *outTop = r.x();
    33     *outLeft = r.y();
    34     *outWidth = r.width();
    35     *outHeight = r.height();
    37     return NS_OK;
    38 }
    40 NS_IMETHODIMP
    41 nsScreenQt::GetAvailRect(int32_t *outLeft,int32_t *outTop,
    42                          int32_t *outWidth,int32_t *outHeight)
    43 {
    44     QRect r = QGuiApplication::screens()[mScreen]->geometry();
    46     *outTop = r.x();
    47     *outLeft = r.y();
    48     *outWidth = r.width();
    49     *outHeight = r.height();
    51     return NS_OK;
    52 }
    54 NS_IMETHODIMP
    55 nsScreenQt::GetPixelDepth(int32_t *aPixelDepth)
    56 {
    57     // #############
    58     *aPixelDepth = QGuiApplication::primaryScreen()->depth();
    59     return NS_OK;
    60 }
    62 NS_IMETHODIMP
    63 nsScreenQt::GetColorDepth(int32_t *aColorDepth)
    64 {
    65     // ###############
    66     return GetPixelDepth(aColorDepth);
    67 }

mercurial