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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
|
From 1ddfa43692cabae0f552351cfbc09377e479471e Mon Sep 17 00:00:00 2001
From: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Date: Mon, 8 Sep 2014 11:38:01 +0200
Subject: [PATCH 21/21] Implement initial IVI-Shell support
IVI-Shell provides a shell interface for Weston, which maps the GENIVI API (http://www.genivi.org) for In-Vehicle Infotainment.
This patch enables detecting the IVI-Shell interface at runtime, and creating compatible surfaces if found.
Task-number: QTBUG-XXXXX/part/2of2
Change-Id: I1f6c11bf56b727a54fb48faab9c076b61d635440
Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
---
src/client/client.pro | 5 ++
src/client/qwaylanddisplay.cpp | 9 ++++
src/client/qwaylanddisplay_p.h | 5 ++
src/client/qwaylandivishell.cpp | 69 +++++++++++++++++++++++++
src/client/qwaylandivishell_p.h | 70 +++++++++++++++++++++++++
src/client/qwaylandivisurface.cpp | 105 ++++++++++++++++++++++++++++++++++++++
src/client/qwaylandivisurface_p.h | 90 ++++++++++++++++++++++++++++++++
src/client/qwaylandwindow.cpp | 8 ++-
8 files changed, 360 insertions(+), 1 deletion(-)
create mode 100644 src/client/qwaylandivishell.cpp
create mode 100644 src/client/qwaylandivishell_p.h
create mode 100644 src/client/qwaylandivisurface.cpp
create mode 100644 src/client/qwaylandivisurface_p.h
diff --git a/src/client/client.pro b/src/client/client.pro
index 73e3b7f..adb526d 100644
--- a/src/client/client.pro
+++ b/src/client/client.pro
@@ -42,6 +42,7 @@ WAYLANDCLIENTSOURCES += \
../extensions/windowmanager.xml \
../3rdparty/protocol/text.xml \
../3rdparty/protocol/xdg-shell.xml \
+ ../3rdparty/protocol/ivi-application.xml \
SOURCES += qwaylandintegration.cpp \
qwaylandnativeinterface.cpp \
@@ -61,6 +62,8 @@ SOURCES += qwaylandintegration.cpp \
qwaylandwlshellsurface.cpp \
qwaylandxdgshell.cpp \
qwaylandxdgsurface.cpp \
+ qwaylandivishell.cpp \
+ qwaylandivisurface.cpp \
qwaylandextendedoutput.cpp \
qwaylandextendedsurface.cpp \
qwaylandsubsurface.cpp \
@@ -92,6 +95,8 @@ HEADERS += qwaylandintegration_p.h \
qwaylandwlshellsurface_p.h \
qwaylandxdgshell_p.h \
qwaylandxdgsurface_p.h \
+ qwaylandivishell_p.h \
+ qwaylandivisurface_p.h \
qwaylandextendedoutput_p.h \
qwaylandextendedsurface_p.h \
qwaylandsubsurface_p.h \
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 2e25672..2a93db7 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -51,6 +51,7 @@
#include "qwaylanddatadevicemanager_p.h"
#include "qwaylandhardwareintegration_p.h"
#include "qwaylandxdgshell_p.h"
+#include "qwaylandivishell_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
@@ -62,6 +63,7 @@
#include <QtWaylandClient/private/qwayland-text.h>
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
+#include <QtWaylandClient/private/qwayland-ivi-application.h>
#include <QtCore/QAbstractEventDispatcher>
#include <QtGui/private/qguiapplication_p.h>
@@ -207,6 +209,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
mCompositor.init(registry, id);
} else if (interface == QStringLiteral("wl_shm")) {
mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
+ } else if (interface == QStringLiteral("ivi_application")) {
+ mShellIvi.reset(new QWaylandIviShell(registry,id));
} else if (interface == QStringLiteral("xdg_shell")
&& qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) {
mShellXdg.reset(new QWaylandXdgShell(registry,id));
@@ -279,4 +283,9 @@ QtWayland::xdg_shell *QWaylandDisplay::shellXdg()
return mShellXdg.data();
}
+QtWayland::ivi_application *QWaylandDisplay::shellIvi()
+{
+ return mShellIvi.data();
+}
+
QT_END_NAMESPACE
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index f1b35a7..b9c686c 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -52,6 +52,7 @@
#include <QtWaylandClient/private/qwayland-wayland.h>
#include <QtWaylandClient/private/qwaylandclientexport_p.h>
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
+#include <QtWaylandClient/private/qwayland-ivi-application.h>
struct wl_cursor_image;
@@ -72,6 +73,7 @@ class QWaylandWindow;
class QWaylandEventThread;
class QWaylandIntegration;
class QWaylandHardwareIntegration;
+class QWaylandIviShell;
class QWaylandXdgShell;
namespace QtWayland {
@@ -81,6 +83,7 @@ namespace QtWayland {
class qt_surface_extension;
class wl_text_input_manager;
class xdg_shell;
+ class ivi_application;
}
typedef void (*RegistryListener)(void *data,
@@ -117,6 +120,7 @@ public:
QtWayland::wl_shell *shell() { return mShell.data(); }
QtWayland::xdg_shell *shellXdg();
+ QtWayland::ivi_application *shellIvi();
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
QWaylandInputDevice *defaultInputDevice() const;
@@ -173,6 +177,7 @@ private:
QWaylandEventThread *mEventThreadObject;
QScopedPointer<QtWayland::wl_shell> mShell;
QScopedPointer<QWaylandXdgShell> mShellXdg;
+ QScopedPointer<QWaylandIviShell> mShellIvi;
QList<QPlatformScreen *> mScreens;
QList<QWaylandInputDevice *> mInputDevices;
QList<Listener> mRegistryListeners;
diff --git a/src/client/qwaylandivishell.cpp b/src/client/qwaylandivishell.cpp
new file mode 100644
index 0000000..9d63d0d
--- /dev/null
+++ b/src/client/qwaylandivishell.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Eurogiciel, author: <manuel.bachmann@open.eurogiciel.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandivishell_p.h"
+
+#include "qwaylanddisplay_p.h"
+#include "qwaylandwindow_p.h"
+#include "qwaylandinputdevice_p.h"
+#include "qwaylanddecoration_p.h"
+#include "qwaylandscreen_p.h"
+
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QWaylandIviShell::QWaylandIviShell(struct ::ivi_application *shell)
+ : QtWayland::ivi_application(shell)
+{
+}
+
+QWaylandIviShell::QWaylandIviShell(struct ::wl_registry *registry, uint32_t id)
+ : QtWayland::ivi_application(registry, id)
+{
+}
+
+QWaylandIviShell::~QWaylandIviShell()
+{
+ ivi_application_destroy(object());
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandivishell_p.h b/src/client/qwaylandivishell_p.h
new file mode 100644
index 0000000..f9f6983
--- /dev/null
+++ b/src/client/qwaylandivishell_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Eurogiciel, author: <manuel.bachmann@open.eurogiciel.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDIVISHELL_H
+#define QWAYLANDIVISHELL_H
+
+#include <QtCore/QSize>
+
+#include <wayland-client.h>
+
+#include <QtWaylandClient/private/qwayland-ivi-application.h>
+#include <QtWaylandClient/private/qwaylandclientexport_p.h>
+#include "qwaylandshellsurface_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandWindow;
+class QWaylandInputDevice;
+class QWindow;
+
+class Q_WAYLAND_CLIENT_EXPORT QWaylandIviShell : public QtWayland::ivi_application
+{
+public:
+ QWaylandIviShell(struct ::ivi_application *shell);
+ QWaylandIviShell(struct ::wl_registry *registry, uint32_t id);
+
+ virtual ~QWaylandIviShell();
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDIVISHELL_H
diff --git a/src/client/qwaylandivisurface.cpp b/src/client/qwaylandivisurface.cpp
new file mode 100644
index 0000000..a12309e
--- /dev/null
+++ b/src/client/qwaylandivisurface.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandivisurface_p.h"
+
+#include "qwaylanddisplay_p.h"
+#include "qwaylandwindow_p.h"
+#include "qwaylandinputdevice_p.h"
+#include "qwaylanddecoration_p.h"
+#include "qwaylandscreen_p.h"
+
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QWaylandIviSurface::QWaylandIviSurface(struct ::ivi_surface *ivi_surface, QWaylandWindow *window)
+ : QtWayland::ivi_surface(ivi_surface)
+ , m_window(window)
+{
+}
+
+QWaylandIviSurface::~QWaylandIviSurface()
+{
+ ivi_surface_destroy(object());
+}
+
+void QWaylandIviSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges)
+{
+}
+
+void QWaylandIviSurface::move(QWaylandInputDevice *inputDevice)
+{
+}
+
+void QWaylandIviSurface::setMaximized()
+{
+}
+
+void QWaylandIviSurface::setFullscreen()
+{
+}
+
+void QWaylandIviSurface::setNormal()
+{
+}
+
+void QWaylandIviSurface::setMinimized()
+{
+}
+
+void QWaylandIviSurface::setTopLevel()
+{
+}
+
+void QWaylandIviSurface::updateTransientParent(QWindow *parent)
+{
+}
+
+void QWaylandIviSurface::setTitle(const QString & title)
+{
+}
+
+void QWaylandIviSurface::setAppId(const QString & appId)
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandivisurface_p.h b/src/client/qwaylandivisurface_p.h
new file mode 100644
index 0000000..c6a7ce6
--- /dev/null
+++ b/src/client/qwaylandivisurface_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDIVISURFACE_H
+#define QWAYLANDIVISURFACE_H
+
+#include <QtCore/QSize>
+
+#include <wayland-client.h>
+
+#include <QtWaylandClient/private/qwayland-ivi-application.h>
+#include <QtWaylandClient/private/qwaylandclientexport_p.h>
+#include "qwaylandshellsurface_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandWindow;
+class QWaylandInputDevice;
+class QWindow;
+class QWaylandExtendedSurface;
+
+class Q_WAYLAND_CLIENT_EXPORT QWaylandIviSurface : public QtWayland::ivi_surface
+ , public QWaylandShellSurface
+{
+public:
+ QWaylandIviSurface(struct ::ivi_surface *shell_surface, QWaylandWindow *window);
+ virtual ~QWaylandIviSurface();
+
+ void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) Q_DECL_OVERRIDE;
+ void move(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE;
+
+ void setTitle(const QString &title) Q_DECL_OVERRIDE;
+ void setAppId(const QString &appId) Q_DECL_OVERRIDE;
+
+private:
+ void setMaximized() Q_DECL_OVERRIDE;
+ void setFullscreen() Q_DECL_OVERRIDE;
+ void setNormal() Q_DECL_OVERRIDE;
+ void setMinimized() Q_DECL_OVERRIDE;
+
+ void setTopLevel() Q_DECL_OVERRIDE;
+ void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE;
+
+private:
+ QWaylandWindow *m_window;
+
+ friend class QWaylandWindow;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDIVISURFACE_H
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 3fb3a49..45a58f2 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -39,6 +39,8 @@
**
****************************************************************************/
+#include <unistd.h>
+
#include "qwaylandwindow_p.h"
#include "qwaylandbuffer_p.h"
@@ -48,10 +50,12 @@
#include "qwaylandshellsurface_p.h"
#include "qwaylandwlshellsurface_p.h"
#include "qwaylandxdgsurface_p.h"
+#include "qwaylandivisurface_p.h"
#include "qwaylandextendedsurface_p.h"
#include "qwaylandsubsurface_p.h"
#include "qwaylanddecoration_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
+#define IVI_SURFACE_ID 8000
#include <QtCore/QFileInfo>
#include <QtGui/QWindow>
@@ -95,7 +99,9 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
mWindowId = id++;
if (!(window->flags() & Qt::BypassWindowManagerHint)) {
- if (mDisplay->shellXdg()) {
+ if (mDisplay->shellIvi()) {
+ mShellSurface = new QWaylandIviSurface(mDisplay->shellIvi()->surface_create(IVI_SURFACE_ID + getpid(), object()), this);
+ } else if (mDisplay->shellXdg()) {
if (window->type() & Qt::Window) {
mShellSurface = new QWaylandXdgSurface(mDisplay->shellXdg()->get_xdg_surface(object()), this);
}
--
1.9.1
|