Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandintegration.cpp
Go to the documentation of this file.
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
"qwaylandintegration_p.h"
5
6
#
include
"qwaylanddisplay_p.h"
7
#
include
"qwaylandshmwindow_p.h"
8
#
include
"qwaylandinputdevice_p.h"
9
#
include
"qwaylandinputcontext_p.h"
10
#
include
"qwaylandinputmethodcontext_p.h"
11
#
include
"qwaylandshmbackingstore_p.h"
12
#
include
"qwaylandnativeinterface_p.h"
13
#
if
QT_CONFIG
(
clipboard
)
14
#
include
"qwaylandclipboard_p.h"
15
#
endif
16
#
include
"qwaylanddnd_p.h"
17
#
include
"qwaylandwindowmanagerintegration_p.h"
18
#
include
"qwaylandplatformservices_p.h"
19
#
include
"qwaylandscreen_p.h"
20
#
include
"qwaylandcursor_p.h"
21
#
include
"qwaylandeventdispatcher_p.h"
22
23
#
if
defined
(
Q_OS_MACOS
)
24
#
include
<
QtGui
/
private
/
qcoretextfontdatabase_p
.
h
>
25
#
include
<
QtGui
/
private
/
qfontengine_coretext_p
.
h
>
26
#
else
27
#
include
<
QtGui
/
private
/
qgenericunixfontdatabase_p
.
h
>
28
#
endif
29
#
include
<
QtGui
/
private
/
qgenericunixtheme_p
.
h
>
30
31
#
include
<
QtGui
/
private
/
qguiapplication_p
.
h
>
32
33
#
include
<
qpa
/
qwindowsysteminterface
.
h
>
34
#
include
<
qpa
/
qplatformcursor
.
h
>
35
#
include
<
QtGui
/
QSurfaceFormat
>
36
#
if
QT_CONFIG
(
opengl
)
37
#
include
<
QtGui
/
QOpenGLContext
>
38
#
endif
// QT_CONFIG(opengl)
39
#
include
<
QSocketNotifier
>
40
41
#
include
<
qpa
/
qplatforminputcontextfactory_p
.
h
>
42
#
include
<
qpa
/
qplatformaccessibility
.
h
>
43
#
include
<
qpa
/
qplatforminputcontext
.
h
>
44
45
#
include
"qwaylandhardwareintegration_p.h"
46
#
include
"qwaylandclientbufferintegration_p.h"
47
#
include
"qwaylandclientbufferintegrationfactory_p.h"
48
49
#
include
"qwaylandserverbufferintegration_p.h"
50
#
include
"qwaylandserverbufferintegrationfactory_p.h"
51
#
include
"qwaylandshellsurface_p.h"
52
53
#
include
"qwaylandshellintegration_p.h"
54
#
include
"qwaylandshellintegrationfactory_p.h"
55
56
#
include
"qwaylandinputdeviceintegration_p.h"
57
#
include
"qwaylandinputdeviceintegrationfactory_p.h"
58
#
include
"qwaylandwindow_p.h"
59
#
include
"qwaylandsessionmanager_p.h"
60
61
#
include
<
QtWaylandClient
/
private
/
qwayland
-
xdg
-
system
-
bell
-
v1
.
h
>
62
63
#
if
QT_CONFIG
(
accessibility_atspi_bridge
)
64
#
include
<
QtGui
/
private
/
qspiaccessiblebridge_p
.
h
>
65
#
endif
66
67
#
if
QT_CONFIG
(
xkbcommon
)
68
#
include
<
QtGui
/
private
/
qxkbcommon_p
.
h
>
69
#
endif
70
71
#
if
QT_CONFIG
(
vulkan
)
72
#
include
"qwaylandvulkaninstance_p.h"
73
#
include
"qwaylandvulkanwindow_p.h"
74
#
endif
75
76
QT_BEGIN_NAMESPACE
77
78
using
namespace
Qt::StringLiterals;
79
80
namespace
QtWaylandClient
{
81
82
QWaylandIntegration
*
QWaylandIntegration
::
sInstance
=
nullptr
;
83
84
QWaylandIntegration
::
QWaylandIntegration
(
const
QString
&
platformName
)
85
#
if
defined
(
Q_OS_MACOS
)
86
:
mFontDb
(
new
QCoreTextFontDatabaseEngineFactory
<
QCoreTextFontEngine
>)
87
#
else
88
:
mPlatformName
(
platformName
),
mFontDb
(
new
QGenericUnixFontDatabase
())
89
#
endif
90
{
91
QCoreApplication
::
setAttribute
(
Qt
::
AA_CompressHighFrequencyEvents
);
92
93
mDisplay
.
reset
(
new
QWaylandDisplay
(
this
));
94
mPlatformServices
.
reset
(
new
QWaylandPlatformServices
(
mDisplay
.
data
()));
95
96
QWaylandWindow
::
fixedToplevelPositions
=
97
!
qEnvironmentVariableIsSet
(
"QT_WAYLAND_DISABLE_FIXED_POSITIONS"
);
98
99
sInstance
=
this
;
100
if
(
platformName
!=
"wayland"_L1
)
101
initializeClientBufferIntegration
();
102
}
103
104
QWaylandIntegration
::~
QWaylandIntegration
()
105
{
106
sInstance
=
nullptr
;
107
}
108
109
bool
QWaylandIntegration
::
init
()
110
{
111
return
mDisplay
->
initialize
();
112
}
113
114
QPlatformNativeInterface
*
QWaylandIntegration
::
nativeInterface
()
const
115
{
116
return
mNativeInterface
.
data
();
117
}
118
119
bool
QWaylandIntegration
::
hasCapability
(
QPlatformIntegration
::
Capability
cap
)
const
120
{
121
switch
(
cap
) {
122
case
ThreadedPixmaps
:
return
true
;
123
case
OpenGL
:
124
return
mDisplay
->
clientBufferIntegration
();
125
case
ThreadedOpenGL
:
126
return
mDisplay
->
clientBufferIntegration
() &&
mDisplay
->
clientBufferIntegration
()->
supportsThreadedOpenGL
();
127
case
BufferQueueingOpenGL
:
128
return
true
;
129
case
MultipleWindows
:
130
case
NonFullScreenWindows
:
131
return
true
;
132
case
WindowActivation
:
133
return
true
;
134
case
ScreenWindowGrabbing
:
// whether QScreen::grabWindow() is supported
135
return
false
;
136
default
:
return
QPlatformIntegration
::
hasCapability
(
cap
);
137
}
138
}
139
140
QPlatformWindow
*
QWaylandIntegration
::
createPlatformWindow
(
QWindow
*
window
)
const
141
{
142
if
(
window
->
surfaceType
() ==
QWindow
::
OpenGLSurface
143
&&
mDisplay
->
clientBufferIntegration
())
144
return
mDisplay
->
clientBufferIntegration
()->
createEglWindow
(
window
);
145
146
#
if
QT_CONFIG
(
vulkan
)
147
if
(
window
->
surfaceType
() ==
QSurface
::
VulkanSurface
)
148
return
new
QWaylandVulkanWindow
(
window
,
mDisplay
.
data
());
149
#
endif
// QT_CONFIG(vulkan)
150
151
return
new
QWaylandShmWindow
(
window
,
mDisplay
.
data
());
152
}
153
154
#
if
QT_CONFIG
(
opengl
)
155
QPlatformOpenGLContext
*
QWaylandIntegration
::
createPlatformOpenGLContext
(
QOpenGLContext
*
context
)
const
156
{
157
if
(
mDisplay
->
clientBufferIntegration
())
158
return
mDisplay
->
clientBufferIntegration
()->
createPlatformOpenGLContext
(
context
->
format
(),
context
->
shareHandle
());
159
return
nullptr
;
160
}
161
162
QPlatformOffscreenSurface
*
QWaylandIntegration
::
createPlatformOffscreenSurface
(
QOffscreenSurface
*
surface
)
const
163
{
164
if
(
mDisplay
->
clientBufferIntegration
())
165
return
mDisplay
->
clientBufferIntegration
()->
createPlatformOffscreenSurface
(
surface
);
166
return
nullptr
;
167
}
168
169
QOpenGLContext
*
QWaylandIntegration
::
createOpenGLContext
(
EGLContext
context
,
EGLDisplay
contextDisplay
,
QOpenGLContext
*
shareContext
)
const
170
{
171
return
mClientBufferIntegration
->
createOpenGLContext
(
context
,
contextDisplay
,
shareContext
);
172
}
173
#
endif
// opengl
174
175
QPlatformBackingStore
*
QWaylandIntegration
::
createPlatformBackingStore
(
QWindow
*
window
)
const
176
{
177
return
new
QWaylandShmBackingStore
(
window
,
mDisplay
.
data
());
178
}
179
180
QAbstractEventDispatcher
*
QWaylandIntegration
::
createEventDispatcher
()
const
181
{
182
return
QWaylandEventDispatcher
::
createEventDispatcher
();
183
}
184
185
QPlatformNativeInterface
*
QWaylandIntegration
::
createPlatformNativeInterface
()
186
{
187
return
new
QWaylandNativeInterface
(
this
);
188
}
189
190
// Support platform specific initialization
191
void
QWaylandIntegration
::
initializePlatform
()
192
{
193
mDisplay
->
initEventThread
();
194
195
mNativeInterface
.
reset
(
createPlatformNativeInterface
());
196
initializeInputDeviceIntegration
();
197
#
if
QT_CONFIG
(
clipboard
)
198
mClipboard
.
reset
(
new
QWaylandClipboard
(
mDisplay
.
data
()));
199
#
endif
200
#
if
QT_CONFIG
(
draganddrop
)
201
mDrag
.
reset
(
new
QWaylandDrag
(
mDisplay
.
data
()));
202
#
endif
203
204
reconfigureInputContext
();
205
}
206
207
void
QWaylandIntegration
::
initialize
()
208
{
209
initializePlatform
();
210
211
// Call this after initializing event thread for QWaylandDisplay::flushRequests()
212
QAbstractEventDispatcher
*
dispatcher
=
QGuiApplicationPrivate
::
eventDispatcher
;
213
QObject
::
connect
(
dispatcher
,
SIGNAL
(
aboutToBlock
()),
mDisplay
.
data
(),
SLOT
(
flushRequests
()));
214
QObject
::
connect
(
dispatcher
,
SIGNAL
(
awake
()),
mDisplay
.
data
(),
SLOT
(
flushRequests
()));
215
216
// Qt does not support running with no screens
217
mDisplay
->
ensureScreen
();
218
}
219
220
QPlatformFontDatabase
*
QWaylandIntegration
::
fontDatabase
()
const
221
{
222
return
mFontDb
.
data
();
223
}
224
225
#
if
QT_CONFIG
(
clipboard
)
226
QPlatformClipboard
*
QWaylandIntegration
::
clipboard
()
const
227
{
228
return
mClipboard
.
data
();
229
}
230
#
endif
231
232
#
if
QT_CONFIG
(
draganddrop
)
233
QPlatformDrag
*
QWaylandIntegration
::
drag
()
const
234
{
235
return
mDrag
.
data
();
236
}
237
#
endif
// draganddrop
238
239
QPlatformInputContext
*
QWaylandIntegration
::
inputContext
()
const
240
{
241
return
mInputContext
.
data
();
242
}
243
244
QVariant
QWaylandIntegration
::
styleHint
(
StyleHint
hint
)
const
245
{
246
if
(
hint
==
ShowIsFullScreen
&&
mDisplay
->
windowManagerIntegration
())
247
return
mDisplay
->
windowManagerIntegration
()->
showIsFullScreen
();
248
249
return
QPlatformIntegration
::
styleHint
(
hint
);
250
}
251
252
#
if
QT_CONFIG
(
accessibility
)
253
QPlatformAccessibility
*
QWaylandIntegration
::
accessibility
()
const
254
{
255
if
(!
mAccessibility
) {
256
#
if
QT_CONFIG
(
accessibility_atspi_bridge
)
257
Q_ASSERT_X
(
QCoreApplication
::
eventDispatcher
(),
"QWaylandIntegration"
,
258
"Initializing accessibility without event-dispatcher!"
);
259
mAccessibility
.
reset
(
new
QSpiAccessibleBridge
());
260
#
else
261
mAccessibility
.
reset
(
new
QPlatformAccessibility
());
262
#
endif
263
}
264
return
mAccessibility
.
data
();
265
}
266
#
endif
267
268
QPlatformServices
*
QWaylandIntegration
::
services
()
const
269
{
270
return
mPlatformServices
.
data
();
271
}
272
273
QWaylandDisplay
*
QWaylandIntegration
::
display
()
const
274
{
275
return
mDisplay
.
data
();
276
}
277
278
Qt
::
KeyboardModifiers
QWaylandIntegration
::
queryKeyboardModifiers
()
const
279
{
280
if
(
auto
*
seat
=
mDisplay
->
currentInputDevice
();
seat
&&
seat
->
keyboardFocus
()) {
281
return
seat
->
modifiers
();
282
}
283
return
Qt
::
NoModifier
;
284
}
285
286
QList
<
int
>
QWaylandIntegration
::
possibleKeys
(
const
QKeyEvent
*
event
)
const
287
{
288
if
(
auto
*
seat
=
mDisplay
->
currentInputDevice
())
289
return
seat
->
possibleKeys
(
event
);
290
return
{};
291
}
292
293
QStringList
QWaylandIntegration
::
themeNames
()
const
294
{
295
return
QGenericUnixTheme
::
themeNames
();
296
}
297
298
QPlatformTheme
*
QWaylandIntegration
::
createPlatformTheme
(
const
QString
&
name
)
const
299
{
300
return
QGenericUnixTheme
::
createUnixTheme
(
name
);
301
}
302
303
QWaylandScreen
*
QWaylandIntegration
::
createPlatformScreen
(
QWaylandDisplay
*
waylandDisplay
,
int
version
,
uint32_t
id
)
const
304
{
305
return
new
QWaylandScreen
(
waylandDisplay
,
version
,
id
);
306
}
307
308
QWaylandCursor
*
QWaylandIntegration
::
createPlatformCursor
(
QWaylandDisplay
*
display
)
const
309
{
310
return
new
QWaylandCursor
(
display
);
311
}
312
313
#
if
QT_CONFIG
(
vulkan
)
314
QPlatformVulkanInstance
*
QWaylandIntegration
::
createPlatformVulkanInstance
(
QVulkanInstance
*
instance
)
const
315
{
316
return
new
QWaylandVulkanInstance
(
instance
);
317
}
318
#
endif
// QT_CONFIG(vulkan)
319
320
// May be called from non-GUI threads
321
QWaylandClientBufferIntegration
*
QWaylandIntegration
::
clientBufferIntegration
()
const
322
{
323
// Do an inexpensive check first to avoid locking whenever possible
324
if
(
Q_UNLIKELY
(!
mClientBufferIntegrationInitialized
))
325
const_cast
<
QWaylandIntegration
*>(
this
)->
initializeClientBufferIntegration
();
326
327
Q_ASSERT
(
mClientBufferIntegrationInitialized
);
328
return
mClientBufferIntegration
&&
mClientBufferIntegration
->
isValid
() ?
mClientBufferIntegration
.
data
() :
nullptr
;
329
}
330
331
QWaylandServerBufferIntegration
*
QWaylandIntegration
::
serverBufferIntegration
()
const
332
{
333
if
(!
mServerBufferIntegrationInitialized
)
334
const_cast
<
QWaylandIntegration
*>(
this
)->
initializeServerBufferIntegration
();
335
336
return
mServerBufferIntegration
.
data
();
337
}
338
339
QWaylandShellIntegration
*
QWaylandIntegration
::
shellIntegration
()
const
340
{
341
if
(!
mShellIntegrationInitialized
)
342
const_cast
<
QWaylandIntegration
*>(
this
)->
initializeShellIntegration
();
343
344
return
mShellIntegration
.
data
();
345
}
346
347
// May be called from non-GUI threads
348
void
QWaylandIntegration
::
initializeClientBufferIntegration
()
349
{
350
QMutexLocker
lock
(&
mClientBufferInitLock
);
351
if
(
mClientBufferIntegrationInitialized
)
352
return
;
353
354
QString
targetKey
=
QString
::
fromLocal8Bit
(
qgetenv
(
"QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"
));
355
if
(
mPlatformName
==
"wayland-egl"_L1
)
356
targetKey
=
"wayland-egl"_L1
;
357
else
if
(
mPlatformName
==
"wayland-brcm"_L1
)
358
targetKey
=
"brcm"_L1
;
359
360
if
(
targetKey
.
isEmpty
()) {
361
if
(
mDisplay
->
hardwareIntegration
()
362
&&
mDisplay
->
hardwareIntegration
()->
clientBufferIntegration
() !=
QLatin1String
(
"wayland-eglstream-controller"
)
363
&&
mDisplay
->
hardwareIntegration
()->
clientBufferIntegration
() !=
QLatin1String
(
"linux-dmabuf-unstable-v1"
)) {
364
targetKey
=
mDisplay
->
hardwareIntegration
()->
clientBufferIntegration
();
365
}
else
{
366
targetKey
=
QLatin1String
(
"wayland-egl"
);
367
}
368
}
369
370
if
(
targetKey
.
isEmpty
()) {
371
qWarning
(
"Failed to determine what client buffer integration to use"
);
372
}
else
{
373
QStringList
keys
=
QWaylandClientBufferIntegrationFactory
::
keys
();
374
qCDebug
(
lcQpaWayland
) <<
"Available client buffer integrations:"
<<
keys
;
375
376
if
(
keys
.
contains
(
targetKey
))
377
mClientBufferIntegration
.
reset
(
QWaylandClientBufferIntegrationFactory
::
create
(
targetKey
,
QStringList
()));
378
379
if
(
mClientBufferIntegration
) {
380
qCDebug
(
lcQpaWayland
) <<
"Initializing client buffer integration"
<<
targetKey
;
381
mClientBufferIntegration
->
initialize
(
mDisplay
.
data
());
382
}
else
{
383
qCWarning
(
lcQpaWayland
) <<
"Failed to load client buffer integration:"
<<
targetKey
;
384
qCWarning
(
lcQpaWayland
) <<
"Available client buffer integrations:"
<<
keys
;
385
}
386
}
387
388
// This must be set last to make sure other threads don't use the
389
// integration before initialization is complete.
390
mClientBufferIntegrationInitialized
=
true
;
391
}
392
393
void
QWaylandIntegration
::
initializeServerBufferIntegration
()
394
{
395
mServerBufferIntegrationInitialized
=
true
;
396
397
QString
targetKey
=
QString
::
fromLocal8Bit
(
qgetenv
(
"QT_WAYLAND_SERVER_BUFFER_INTEGRATION"
));
398
399
if
(
targetKey
.
isEmpty
() &&
mDisplay
->
hardwareIntegration
())
400
targetKey
=
mDisplay
->
hardwareIntegration
()->
serverBufferIntegration
();
401
402
if
(
targetKey
.
isEmpty
()) {
403
qWarning
(
"Failed to determine what server buffer integration to use"
);
404
return
;
405
}
406
407
QStringList
keys
=
QWaylandServerBufferIntegrationFactory
::
keys
();
408
qCDebug
(
lcQpaWayland
) <<
"Available server buffer integrations:"
<<
keys
;
409
410
if
(
keys
.
contains
(
targetKey
))
411
mServerBufferIntegration
.
reset
(
QWaylandServerBufferIntegrationFactory
::
create
(
targetKey
,
QStringList
()));
412
413
if
(
mServerBufferIntegration
) {
414
qCDebug
(
lcQpaWayland
) <<
"Initializing server buffer integration"
<<
targetKey
;
415
mServerBufferIntegration
->
initialize
(
mDisplay
.
data
());
416
}
else
{
417
qCWarning
(
lcQpaWayland
) <<
"Failed to load server buffer integration: "
<<
targetKey
;
418
qCWarning
(
lcQpaWayland
) <<
"Available server buffer integrations:"
<<
keys
;
419
}
420
}
421
422
void
QWaylandIntegration
::
initializeShellIntegration
()
423
{
424
mShellIntegrationInitialized
=
true
;
425
426
QByteArray
integrationNames
=
qgetenv
(
"QT_WAYLAND_SHELL_INTEGRATION"
);
427
QString
targetKeys
=
QString
::
fromLocal8Bit
(
integrationNames
);
428
429
QStringList
preferredShells
;
430
if
(!
targetKeys
.
isEmpty
()) {
431
preferredShells
=
targetKeys
.
split
(
QLatin1Char
(
';'
));
432
}
else
{
433
preferredShells
<<
QLatin1String
(
"xdg-shell"
);
434
preferredShells
<<
QLatin1String
(
"wl-shell"
) <<
QLatin1String
(
"ivi-shell"
);
435
preferredShells
<<
QLatin1String
(
"qt-shell"
);
436
}
437
438
for
(
const
QString
&
preferredShell
:
std
::
as_const
(
preferredShells
)) {
439
mShellIntegration
.
reset
(
createShellIntegration
(
preferredShell
));
440
if
(
mShellIntegration
) {
441
qCDebug
(
lcQpaWayland
,
"Using the '%s' shell integration"
,
qPrintable
(
preferredShell
));
442
break
;
443
}
444
}
445
446
if
(!
mShellIntegration
) {
447
qCWarning
(
lcQpaWayland
) <<
"Loading shell integration failed."
;
448
qCWarning
(
lcQpaWayland
) <<
"Attempted to load the following shells"
<<
preferredShells
;
449
}
450
451
QWindowSystemInterfacePrivate
::
TabletEvent
::
setPlatformSynthesizesMouse
(
false
);
452
}
453
454
QWaylandInputDevice
*
QWaylandIntegration
::
createInputDevice
(
QWaylandDisplay
*
display
,
int
version
,
uint32_t
id
)
const
455
{
456
if
(
mInputDeviceIntegration
) {
457
return
mInputDeviceIntegration
->
createInputDevice
(
display
,
version
,
id
);
458
}
459
return
new
QWaylandInputDevice
(
display
,
version
,
id
);
460
}
461
462
void
QWaylandIntegration
::
initializeInputDeviceIntegration
()
463
{
464
QByteArray
integrationName
=
qgetenv
(
"QT_WAYLAND_INPUTDEVICE_INTEGRATION"
);
465
QString
targetKey
=
QString
::
fromLocal8Bit
(
integrationName
);
466
467
if
(
targetKey
.
isEmpty
()) {
468
return
;
469
}
470
471
QStringList
keys
=
QWaylandInputDeviceIntegrationFactory
::
keys
();
472
if
(
keys
.
contains
(
targetKey
)) {
473
mInputDeviceIntegration
.
reset
(
QWaylandInputDeviceIntegrationFactory
::
create
(
targetKey
,
QStringList
()));
474
qDebug
(
"Using the '%s' input device integration"
,
qPrintable
(
targetKey
));
475
}
else
{
476
qWarning
(
"Wayland inputdevice integration '%s' not found, using default"
,
qPrintable
(
targetKey
));
477
}
478
}
479
480
void
QWaylandIntegration
::
reconfigureInputContext
()
481
{
482
if
(!
mDisplay
) {
483
// This function can be called from QWaylandDisplay::registry_global() when we
484
// are in process of constructing QWaylandDisplay. Configuring input context
485
// in that case is done by calling reconfigureInputContext() from QWaylandIntegration
486
// constructor, after QWaylandDisplay has been constructed.
487
return
;
488
}
489
490
auto
requested
=
QPlatformInputContextFactory
::
requested
();
491
if
(
requested
.
contains
(
QLatin1String
(
"qtvirtualkeyboard"
)))
492
qCWarning
(
lcQpaWayland
) <<
"qtvirtualkeyboard currently is not supported at client-side,"
493
" use QT_IM_MODULES=qtvirtualkeyboard at compositor-side."
;
494
495
if
(
mDisplay
->
isWaylandInputContextRequested
()
496
&& !
requested
.
contains
(
QLatin1String
(
WAYLAND_IM_KEY
)))
497
requested
.
append
(
QLatin1String
(
WAYLAND_IM_KEY
));
498
499
const
QString
defaultInputContext
(
QStringLiteral
(
"compose"
));
500
if
(!
requested
.
contains
(
defaultInputContext
))
501
requested
.
append
(
defaultInputContext
);
502
503
for
(
const
QString
&
imKey
:
requested
) {
504
if
(
imKey
==
QLatin1String
(
WAYLAND_IM_KEY
)) {
505
Q_ASSERT
(
mDisplay
->
isWaylandInputContextRequested
());
506
if
(
mDisplay
->
textInputMethodManager
() !=
nullptr
)
507
mInputContext
.
reset
(
new
QWaylandInputMethodContext
(
mDisplay
.
data
()));
508
else
if
(
mDisplay
->
textInputManagerv1
() !=
nullptr
509
||
mDisplay
->
textInputManagerv2
() !=
nullptr
510
||
mDisplay
->
textInputManagerv3
() !=
nullptr
)
511
mInputContext
.
reset
(
new
QWaylandInputContext
(
mDisplay
.
data
()));
512
}
else
{
513
mInputContext
.
reset
(
QPlatformInputContextFactory
::
create
(
imKey
));
514
}
515
516
if
(
mInputContext
&&
mInputContext
->
isValid
())
517
break
;
518
}
519
520
#
if
QT_CONFIG
(
xkbcommon
)
521
QXkbCommon
::
setXkbContext
(
mInputContext
.
data
(),
mDisplay
->
xkbContext
());
522
if
(
QWaylandInputContext
*
waylandInput
=
qobject_cast
<
QWaylandInputContext
*>(
mInputContext
.
get
())) {
523
waylandInput
->
setXkbContext
(
mDisplay
->
xkbContext
());
524
}
525
#
endif
526
527
qCDebug
(
lcQpaWayland
) <<
"using input method:"
<< (
inputContext
() ?
inputContext
()->
metaObject
()->
className
() :
"<none>"
);
528
}
529
530
QWaylandShellIntegration
*
QWaylandIntegration
::
createShellIntegration
(
const
QString
&
integrationName
)
531
{
532
if
(
QWaylandShellIntegrationFactory
::
keys
().
contains
(
integrationName
)) {
533
return
QWaylandShellIntegrationFactory
::
create
(
integrationName
,
mDisplay
.
data
());
534
}
else
{
535
qCWarning
(
lcQpaWayland
) <<
"No shell integration named"
<<
integrationName
<<
"found"
;
536
return
nullptr
;
537
}
538
}
539
540
#
ifndef
QT_NO_SESSIONMANAGER
541
QPlatformSessionManager
*
QWaylandIntegration
::
createPlatformSessionManager
(
const
QString
&
id
,
const
QString
&
key
)
const
542
{
543
Q_UNUSED
(
key
);
544
return
new
QWaylandSessionManager
(
mDisplay
.
data
(),
id
);
545
}
546
#
endif
547
548
void
QWaylandIntegration
::
reset
()
549
{
550
mServerBufferIntegration
.
reset
();
551
mServerBufferIntegrationInitialized
=
false
;
552
553
mInputDeviceIntegration
.
reset
();
554
555
mClientBufferIntegration
.
reset
();
556
mClientBufferIntegrationInitialized
=
false
;
557
}
558
559
void
QWaylandIntegration
::
setApplicationBadge
(
qint64
number
)
560
{
561
mPlatformServices
->
setApplicationBadge
(
number
);
562
}
563
564
void
QWaylandIntegration
::
beep
()
const
565
{
566
if
(
auto
bell
=
mDisplay
->
systemBell
()) {
567
bell
->
ring
(
nullptr
);
568
}
569
}
570
571
}
572
573
QT_END_NAMESPACE
QPlatformGraphicsBufferHelper
\inmodule QtGui
QtWaylandClient
Definition
qwaylandclientextension.h:15
WAYLAND_IM_KEY
#define WAYLAND_IM_KEY
Definition
qwaylanddisplay_p.h:44
qtbase
src
plugins
platforms
wayland
qwaylandintegration.cpp
Generated on
for Qt by
1.14.0