| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qwaylandshmwindow_p.h" |
| 5 | |
| 6 | #include "qwaylandbuffer_p.h" |
| 7 | |
| 8 | #include <QtCore/QDebug> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | namespace QtWaylandClient { |
| 13 | |
| 14 | QWaylandShmWindow::QWaylandShmWindow(QWindow *window, QWaylandDisplay *display) |
| 15 | : QWaylandWindow(window, display) |
| 16 | { |
| 17 | mSurfaceFormat.setRedBufferSize(8); |
| 18 | mSurfaceFormat.setGreenBufferSize(8); |
| 19 | mSurfaceFormat.setBlueBufferSize(8); |
| 20 | |
| 21 | const QSurfaceFormat format = window->requestedFormat(); |
| 22 | mSurfaceFormat.setAlphaBufferSize(format.hasAlpha() ? 8 : 0); |
| 23 | } |
| 24 | |
| 25 | QWaylandShmWindow::~QWaylandShmWindow() |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | QWaylandWindow::WindowType QWaylandShmWindow::windowType() const |
| 30 | { |
| 31 | return QWaylandWindow::Shm; |
| 32 | } |
| 33 | |
| 34 | bool QWaylandShmWindow::createDecoration() |
| 35 | { |
| 36 | bool rc = QWaylandWindow::createDecoration(); |
| 37 | |
| 38 | const QSurfaceFormat format = window()->requestedFormat(); |
| 39 | if (!format.hasAlpha()) |
| 40 | mSurfaceFormat.setAlphaBufferSize(mWindowDecorationEnabled ? 8 : 0); |
| 41 | |
| 42 | return rc; |
| 43 | } |
| 44 | |
| 45 | } |
| 46 | |
| 47 | QT_END_NAMESPACE |
| 48 |
