summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp
blob: ee8c666c8eeb2d2d11cb2624e399faf3a24aa657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include <qpa/qwindowsysteminterface.h>

#include "qminimaleglwindow.h"

QT_BEGIN_NAMESPACE

QMinimalEglWindow::QMinimalEglWindow(QWindow *w)
    : QPlatformWindow(w)
{
    static int serialNo = 0;
    m_winid  = ++serialNo;
#ifdef QEGL_EXTRA_DEBUG
    qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_winid));
#endif

    QRect screenGeometry(screen()->availableGeometry());
    if (w->geometry() != screenGeometry) {
        QWindowSystemInterface::handleGeometryChange(w, screenGeometry);
    }
    w->setSurfaceType(QSurface::OpenGLSurface);
}

void QMinimalEglWindow::setGeometry(const QRect &)
{
    // We only support full-screen windows
    QRect rect(screen()->availableGeometry());
    QWindowSystemInterface::handleGeometryChange(window(), rect);

    QPlatformWindow::setGeometry(rect);
}

WId QMinimalEglWindow::winId() const
{
    return m_winid;
}

QT_END_NAMESPACE