1// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
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 "qwaylandivisurface_p.h"
5
6#include <QtWaylandClient/private/qwaylanddisplay_p.h>
7#include <QtWaylandClient/private/qwaylandwindow_p.h>
8#include <QtWaylandClient/private/qwaylandscreen_p.h>
9#include <QtWaylandClient/private/qwaylandextendedsurface_p.h>
10
11QT_BEGIN_NAMESPACE
12
13namespace QtWaylandClient {
14
15QWaylandIviSurface::QWaylandIviSurface(struct ::ivi_surface *ivi_surface, QWaylandWindow *window)
16 : QtWayland::ivi_surface(ivi_surface)
17 , QWaylandShellSurface(window)
18 , m_window(window)
19{
20 createExtendedSurface(window);
21}
22
23QWaylandIviSurface::QWaylandIviSurface(struct ::ivi_surface *ivi_surface, QWaylandWindow *window,
24 struct ::ivi_controller_surface *iviControllerSurface)
25 : QtWayland::ivi_surface(ivi_surface)
26 , QWaylandShellSurface(window)
27 , QtWayland::ivi_controller_surface(iviControllerSurface)
28 , m_window(window)
29{
30 createExtendedSurface(window);
31}
32
33QWaylandIviSurface::~QWaylandIviSurface()
34{
35 ivi_surface::destroy();
36 if (QtWayland::ivi_controller_surface::object())
37 QtWayland::ivi_controller_surface::destroy(0);
38
39 delete m_extendedWindow;
40}
41
42void QWaylandIviSurface::applyConfigure()
43{
44 m_window->resizeFromApplyConfigure(sizeWithMargins: m_pendingSize);
45}
46
47void QWaylandIviSurface::createExtendedSurface(QWaylandWindow *window)
48{
49 if (window->display()->windowExtension())
50 m_extendedWindow = new QWaylandExtendedSurface(window);
51}
52
53void QWaylandIviSurface::ivi_surface_configure(int32_t width, int32_t height)
54{
55 m_pendingSize = {width, height};
56 m_window->applyConfigureWhenPossible();
57}
58
59void QWaylandIviSurface::ivi_controller_surface_visibility(int32_t visibility)
60{
61 this->m_window->window()->setVisible(visibility != 0);
62}
63
64}
65
66QT_END_NAMESPACE
67

source code of qtwayland/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp