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
22
#
if
defined
(
Q_OS_MACOS
)
23
#
include
<
QtGui
/
private
/
qcoretextfontdatabase_p
.
h
>
24
#
include
<
QtGui
/
private
/
qfontengine_coretext_p
.
h
>
25
#
else
26
#
include
<
QtGui
/
private
/
qgenericunixfontdatabase_p
.
h
>
27
#
endif
28
#
include
<
QtGui
/
private
/
qgenericunixeventdispatcher_p
.
h
>
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
case
OffscreenSurface
:
137
return
mDisplay
->
clientBufferIntegration
()
138
&&
mDisplay
->
clientBufferIntegration
()->
canCreatePlatformOffscreenSurface
();
139
default
:
return
QPlatformIntegration
::
hasCapability
(
cap
);
140
}
141
}
142
143
QPlatformWindow
*
QWaylandIntegration
::
createPlatformWindow
(
QWindow
*
window
)
const
144
{
145
if
(
window
->
surfaceType
() ==
QWindow
::
OpenGLSurface
146
&&
mDisplay
->
clientBufferIntegration
())
147
return
mDisplay
->
clientBufferIntegration
()->
createEglWindow
(
window
);
148
149
#
if
QT_CONFIG
(
vulkan
)
150
if
(
window
->
surfaceType
() ==
QSurface
::
VulkanSurface
)
151
return
new
QWaylandVulkanWindow
(
window
,
mDisplay
.
data
());
152
#
endif
// QT_CONFIG(vulkan)
153
154
return
new
QWaylandShmWindow
(
window
,
mDisplay
.
data
());
155
}
156
157
#
if
QT_CONFIG
(
opengl
)
158
QPlatformOpenGLContext
*
QWaylandIntegration
::
createPlatformOpenGLContext
(
QOpenGLContext
*
context
)
const
159
{
160
if
(
mDisplay
->
clientBufferIntegration
())
161
return
mDisplay
->
clientBufferIntegration
()->
createPlatformOpenGLContext
(
context
->
format
(),
context
->
shareHandle
());
162
return
nullptr
;
163
}
164
165
QPlatformOffscreenSurface
*
QWaylandIntegration
::
createPlatformOffscreenSurface
(
QOffscreenSurface
*
surface
)
const
166
{
167
if
(
mDisplay
->
clientBufferIntegration
())
168
return
mDisplay
->
clientBufferIntegration
()->
createPlatformOffscreenSurface
(
surface
);
169
return
nullptr
;
170
}
171
172
QOpenGLContext
*
QWaylandIntegration
::
createOpenGLContext
(
EGLContext
context
,
EGLDisplay
contextDisplay
,
QOpenGLContext
*
shareContext
)
const
173
{
174
return
mClientBufferIntegration
->
createOpenGLContext
(
context
,
contextDisplay
,
shareContext
);
175
}
176
#
endif
// opengl
177
178
QPlatformBackingStore
*
QWaylandIntegration
::
createPlatformBackingStore
(
QWindow
*
window
)
const
179
{
180
return
new
QWaylandShmBackingStore
(
window
,
mDisplay
.
data
());
181
}
182
183
QAbstractEventDispatcher
*
QWaylandIntegration
::
createEventDispatcher
()
const
184
{
185
return
createUnixEventDispatcher
();
186
}
187
188
QPlatformNativeInterface
*
QWaylandIntegration
::
createPlatformNativeInterface
()
189
{
190
return
new
QWaylandNativeInterface
(
this
);
191
}
192
193
// Support platform specific initialization
194
void
QWaylandIntegration
::
initializePlatform
()
195
{
196
mDisplay
->
initEventThread
();
197
198
mNativeInterface
.
reset
(
createPlatformNativeInterface
());
199
initializeInputDeviceIntegration
();
200
#
if
QT_CONFIG
(
clipboard
)
201
mClipboard
.
reset
(
new
QWaylandClipboard
(
mDisplay
.
data
()));
202
#
endif
203
#
if
QT_CONFIG
(
draganddrop
)
204
mDrag
.
reset
(
new
QWaylandDrag
(
mDisplay
.
data
()));
205
#
endif
206
207
reconfigureInputContext
();
208
}
209
210
void
QWaylandIntegration
::
initialize
()
211
{
212
initializePlatform
();
213
214
// Call this after initializing event thread for QWaylandDisplay::flushRequests()
215
QAbstractEventDispatcher
*
dispatcher
=
QGuiApplicationPrivate
::
eventDispatcher
;
216
QObject
::
connect
(
dispatcher
,
SIGNAL
(
aboutToBlock
()),
mDisplay
.
data
(),
SLOT
(
flushRequests
()));
217
QObject
::
connect
(
dispatcher
,
SIGNAL
(
awake
()),
mDisplay
.
data
(),
SLOT
(
flushRequests
()));
218
219
// Qt does not support running with no screens
220
mDisplay
->
ensureScreen
();
221
}
222
223
QPlatformFontDatabase
*
QWaylandIntegration
::
fontDatabase
()
const
224
{
225
return
mFontDb
.
data
();
226
}
227
228
#
if
QT_CONFIG
(
clipboard
)
229
QPlatformClipboard
*
QWaylandIntegration
::
clipboard
()
const
230
{
231
return
mClipboard
.
data
();
232
}
233
#
endif
234
235
#
if
QT_CONFIG
(
draganddrop
)
236
QPlatformDrag
*
QWaylandIntegration
::
drag
()
const
237
{
238
return
mDrag
.
data
();
239
}
240
#
endif
// draganddrop
241
242
QPlatformInputContext
*
QWaylandIntegration
::
inputContext
()
const
243
{
244
return
mInputContext
.
data
();
245
}
246
247
QVariant
QWaylandIntegration
::
styleHint
(
StyleHint
hint
)
const
248
{
249
if
(
hint
==
ShowIsFullScreen
&&
mDisplay
->
windowManagerIntegration
())
250
return
mDisplay
->
windowManagerIntegration
()->
showIsFullScreen
();
251
252
return
QPlatformIntegration
::
styleHint
(
hint
);
253
}
254
255
#
if
QT_CONFIG
(
accessibility
)
256
QPlatformAccessibility
*
QWaylandIntegration
::
accessibility
()
const
257
{
258
if
(!
mAccessibility
) {
259
#
if
QT_CONFIG
(
accessibility_atspi_bridge
)
260
Q_ASSERT_X
(
QCoreApplication
::
eventDispatcher
(),
"QWaylandIntegration"
,
261
"Initializing accessibility without event-dispatcher!"
);
262
mAccessibility
.
reset
(
new
QSpiAccessibleBridge
());
263
#
else
264
mAccessibility
.
reset
(
new
QPlatformAccessibility
());
265
#
endif
266
}
267
return
mAccessibility
.
data
();
268
}
269
#
endif
270
271
QPlatformServices
*
QWaylandIntegration
::
services
()
const
272
{
273
return
mPlatformServices
.
data
();
274
}
275
276
QWaylandDisplay
*
QWaylandIntegration
::
display
()
const
277
{
278
return
mDisplay
.
data
();
279
}
280
281
Qt
::
KeyboardModifiers
QWaylandIntegration
::
queryKeyboardModifiers
()
const
282
{
283
if
(
auto
*
seat
=
mDisplay
->
currentInputDevice
();
seat
&&
seat
->
keyboardFocus
()) {
284
return
seat
->
modifiers
();
285
}
286
return
Qt
::
NoModifier
;
287
}
288
289
QList
<
int
>
QWaylandIntegration
::
possibleKeys
(
const
QKeyEvent
*
event
)
const
290
{
291
if
(
auto
*
seat
=
mDisplay
->
currentInputDevice
())
292
return
seat
->
possibleKeys
(
event
);
293
return
{};
294
}
295
296
QStringList
QWaylandIntegration
::
themeNames
()
const
297
{
298
return
QGenericUnixTheme
::
themeNames
();
299
}
300
301
QPlatformTheme
*
QWaylandIntegration
::
createPlatformTheme
(
const
QString
&
name
)
const
302
{
303
return
QGenericUnixTheme
::
createUnixTheme
(
name
);
304
}
305
306
QWaylandScreen
*
QWaylandIntegration
::
createPlatformScreen
(
QWaylandDisplay
*
waylandDisplay
,
int
version
,
uint32_t
id
)
const
307
{
308
return
new
QWaylandScreen
(
waylandDisplay
,
version
,
id
);
309
}
310
311
QWaylandCursor
*
QWaylandIntegration
::
createPlatformCursor
(
QWaylandDisplay
*
display
)
const
312
{
313
return
new
QWaylandCursor
(
display
);
314
}
315
316
#
if
QT_CONFIG
(
vulkan
)
317
QPlatformVulkanInstance
*
QWaylandIntegration
::
createPlatformVulkanInstance
(
QVulkanInstance
*
instance
)
const
318
{
319
return
new
QWaylandVulkanInstance
(
instance
);
320
}
321
#
endif
// QT_CONFIG(vulkan)
322
323
// May be called from non-GUI threads
324
QWaylandClientBufferIntegration
*
QWaylandIntegration
::
clientBufferIntegration
()
const
325
{
326
// Do an inexpensive check first to avoid locking whenever possible
327
if
(
Q_UNLIKELY
(!
mClientBufferIntegrationInitialized
))
328
const_cast
<
QWaylandIntegration
*>(
this
)->
initializeClientBufferIntegration
();
329
330
Q_ASSERT
(
mClientBufferIntegrationInitialized
);
331
return
mClientBufferIntegration
&&
mClientBufferIntegration
->
isValid
() ?
mClientBufferIntegration
.
data
() :
nullptr
;
332
}
333
334
QWaylandServerBufferIntegration
*
QWaylandIntegration
::
serverBufferIntegration
()
const
335
{
336
if
(!
mServerBufferIntegrationInitialized
)
337
const_cast
<
QWaylandIntegration
*>(
this
)->
initializeServerBufferIntegration
();
338
339
return
mServerBufferIntegration
.
data
();
340
}
341
342
QWaylandShellIntegration
*
QWaylandIntegration
::
shellIntegration
()
const
343
{
344
if
(!
mShellIntegrationInitialized
)
345
const_cast
<
QWaylandIntegration
*>(
this
)->
initializeShellIntegration
();
346
347
return
mShellIntegration
.
data
();
348
}
349
350
// May be called from non-GUI threads
351
void
QWaylandIntegration
::
initializeClientBufferIntegration
()
352
{
353
QMutexLocker
lock
(&
mClientBufferInitLock
);
354
if
(
mClientBufferIntegrationInitialized
)
355
return
;
356
357
QString
targetKey
=
QString
::
fromLocal8Bit
(
qgetenv
(
"QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"
));
358
if
(
mPlatformName
==
"wayland-egl"_L1
)
359
targetKey
=
"wayland-egl"_L1
;
360
else
if
(
mPlatformName
==
"wayland-brcm"_L1
)
361
targetKey
=
"brcm"_L1
;
362
363
if
(
targetKey
.
isEmpty
()) {
364
if
(
mDisplay
->
hardwareIntegration
()
365
&&
mDisplay
->
hardwareIntegration
()->
clientBufferIntegration
() !=
QLatin1String
(
"wayland-eglstream-controller"
)
366
&&
mDisplay
->
hardwareIntegration
()->
clientBufferIntegration
() !=
QLatin1String
(
"linux-dmabuf-unstable-v1"
)) {
367
targetKey
=
mDisplay
->
hardwareIntegration
()->
clientBufferIntegration
();
368
}
else
{
369
targetKey
=
QLatin1String
(
"wayland-egl"
);
370
}
371
}
372
373
if
(
targetKey
.
isEmpty
()) {
374
qWarning
(
"Failed to determine what client buffer integration to use"
);
375
}
else
{
376
QStringList
keys
=
QWaylandClientBufferIntegrationFactory
::
keys
();
377
qCDebug
(
lcQpaWayland
) <<
"Available client buffer integrations:"
<<
keys
;
378
379
if
(
keys
.
contains
(
targetKey
))
380
mClientBufferIntegration
.
reset
(
QWaylandClientBufferIntegrationFactory
::
create
(
targetKey
,
QStringList
()));
381
382
if
(
mClientBufferIntegration
) {
383
qCDebug
(
lcQpaWayland
) <<
"Initializing client buffer integration"
<<
targetKey
;
384
mClientBufferIntegration
->
initialize
(
mDisplay
.
data
());
385
}
else
{
386
qCWarning
(
lcQpaWayland
) <<
"Failed to load client buffer integration:"
<<
targetKey
;
387
qCWarning
(
lcQpaWayland
) <<
"Available client buffer integrations:"
<<
keys
;
388
}
389
}
390
391
// This must be set last to make sure other threads don't use the
392
// integration before initialization is complete.
393
mClientBufferIntegrationInitialized
=
true
;
394
}
395
396
void
QWaylandIntegration
::
initializeServerBufferIntegration
()
397
{
398
mServerBufferIntegrationInitialized
=
true
;
399
400
QString
targetKey
=
QString
::
fromLocal8Bit
(
qgetenv
(
"QT_WAYLAND_SERVER_BUFFER_INTEGRATION"
));
401
402
if
(
targetKey
.
isEmpty
() &&
mDisplay
->
hardwareIntegration
())
403
targetKey
=
mDisplay
->
hardwareIntegration
()->
serverBufferIntegration
();
404
405
if
(
targetKey
.
isEmpty
()) {
406
qWarning
(
"Failed to determine what server buffer integration to use"
);
407
return
;
408
}
409
410
QStringList
keys
=
QWaylandServerBufferIntegrationFactory
::
keys
();
411
qCDebug
(
lcQpaWayland
) <<
"Available server buffer integrations:"
<<
keys
;
412
413
if
(
keys
.
contains
(
targetKey
))
414
mServerBufferIntegration
.
reset
(
QWaylandServerBufferIntegrationFactory
::
create
(
targetKey
,
QStringList
()));
415
416
if
(
mServerBufferIntegration
) {
417
qCDebug
(
lcQpaWayland
) <<
"Initializing server buffer integration"
<<
targetKey
;
418
mServerBufferIntegration
->
initialize
(
mDisplay
.
data
());
419
}
else
{
420
qCWarning
(
lcQpaWayland
) <<
"Failed to load server buffer integration: "
<<
targetKey
;
421
qCWarning
(
lcQpaWayland
) <<
"Available server buffer integrations:"
<<
keys
;
422
}
423
}
424
425
void
QWaylandIntegration
::
initializeShellIntegration
()
426
{
427
mShellIntegrationInitialized
=
true
;
428
429
QByteArray
integrationNames
=
qgetenv
(
"QT_WAYLAND_SHELL_INTEGRATION"
);
430
QString
targetKeys
=
QString
::
fromLocal8Bit
(
integrationNames
);
431
432
QStringList
preferredShells
;
433
if
(!
targetKeys
.
isEmpty
()) {
434
preferredShells
=
targetKeys
.
split
(
QLatin1Char
(
';'
));
435
}
else
{
436
preferredShells
<<
QLatin1String
(
"xdg-shell"
);
437
preferredShells
<<
QLatin1String
(
"wl-shell"
) <<
QLatin1String
(
"ivi-shell"
);
438
preferredShells
<<
QLatin1String
(
"qt-shell"
);
439
}
440
441
for
(
const
QString
&
preferredShell
:
std
::
as_const
(
preferredShells
)) {
442
mShellIntegration
.
reset
(
createShellIntegration
(
preferredShell
));
443
if
(
mShellIntegration
) {
444
qCDebug
(
lcQpaWayland
,
"Using the '%s' shell integration"
,
qPrintable
(
preferredShell
));
445
break
;
446
}
447
}
448
449
if
(!
mShellIntegration
) {
450
qCWarning
(
lcQpaWayland
) <<
"Loading shell integration failed."
;
451
qCWarning
(
lcQpaWayland
) <<
"Attempted to load the following shells"
<<
preferredShells
;
452
}
453
454
QWindowSystemInterfacePrivate
::
TabletEvent
::
setPlatformSynthesizesMouse
(
false
);
455
}
456
457
QWaylandInputDevice
*
QWaylandIntegration
::
createInputDevice
(
QWaylandDisplay
*
display
,
int
version
,
uint32_t
id
)
const
458
{
459
if
(
mInputDeviceIntegration
) {
460
return
mInputDeviceIntegration
->
createInputDevice
(
display
,
version
,
id
);
461
}
462
return
new
QWaylandInputDevice
(
display
,
version
,
id
);
463
}
464
465
void
QWaylandIntegration
::
initializeInputDeviceIntegration
()
466
{
467
QByteArray
integrationName
=
qgetenv
(
"QT_WAYLAND_INPUTDEVICE_INTEGRATION"
);
468
QString
targetKey
=
QString
::
fromLocal8Bit
(
integrationName
);
469
470
if
(
targetKey
.
isEmpty
()) {
471
return
;
472
}
473
474
QStringList
keys
=
QWaylandInputDeviceIntegrationFactory
::
keys
();
475
if
(
keys
.
contains
(
targetKey
)) {
476
mInputDeviceIntegration
.
reset
(
QWaylandInputDeviceIntegrationFactory
::
create
(
targetKey
,
QStringList
()));
477
qDebug
(
"Using the '%s' input device integration"
,
qPrintable
(
targetKey
));
478
}
else
{
479
qWarning
(
"Wayland inputdevice integration '%s' not found, using default"
,
qPrintable
(
targetKey
));
480
}
481
}
482
483
void
QWaylandIntegration
::
reconfigureInputContext
()
484
{
485
if
(!
mDisplay
) {
486
// This function can be called from QWaylandDisplay::registry_global() when we
487
// are in process of constructing QWaylandDisplay. Configuring input context
488
// in that case is done by calling reconfigureInputContext() from QWaylandIntegration
489
// constructor, after QWaylandDisplay has been constructed.
490
return
;
491
}
492
493
auto
requested
=
QPlatformInputContextFactory
::
requested
();
494
if
(
requested
.
contains
(
QLatin1String
(
"qtvirtualkeyboard"
)))
495
qCWarning
(
lcQpaWayland
) <<
"qtvirtualkeyboard currently is not supported at client-side,"
496
" use QT_IM_MODULES=qtvirtualkeyboard at compositor-side."
;
497
498
if
(
mDisplay
->
isWaylandInputContextRequested
()
499
&& !
requested
.
contains
(
QLatin1String
(
WAYLAND_IM_KEY
)))
500
requested
.
append
(
QLatin1String
(
WAYLAND_IM_KEY
));
501
502
const
QString
defaultInputContext
(
QStringLiteral
(
"compose"
));
503
if
(!
requested
.
contains
(
defaultInputContext
))
504
requested
.
append
(
defaultInputContext
);
505
506
for
(
const
QString
&
imKey
:
requested
) {
507
if
(
imKey
==
QLatin1String
(
WAYLAND_IM_KEY
)) {
508
Q_ASSERT
(
mDisplay
->
isWaylandInputContextRequested
());
509
if
(
mDisplay
->
textInputMethodManager
() !=
nullptr
)
510
mInputContext
.
reset
(
new
QWaylandInputMethodContext
(
mDisplay
.
data
()));
511
else
if
(
mDisplay
->
textInputManagerv1
() !=
nullptr
512
||
mDisplay
->
textInputManagerv2
() !=
nullptr
513
||
mDisplay
->
textInputManagerv3
() !=
nullptr
)
514
mInputContext
.
reset
(
new
QWaylandInputContext
(
mDisplay
.
data
()));
515
}
else
{
516
mInputContext
.
reset
(
QPlatformInputContextFactory
::
create
(
imKey
));
517
}
518
519
if
(
mInputContext
&&
mInputContext
->
isValid
())
520
break
;
521
}
522
523
#
if
QT_CONFIG
(
xkbcommon
)
524
QXkbCommon
::
setXkbContext
(
mInputContext
.
data
(),
mDisplay
->
xkbContext
());
525
if
(
QWaylandInputContext
*
waylandInput
=
qobject_cast
<
QWaylandInputContext
*>(
mInputContext
.
get
())) {
526
waylandInput
->
setXkbContext
(
mDisplay
->
xkbContext
());
527
}
528
#
endif
529
530
qCDebug
(
lcQpaWayland
) <<
"using input method:"
<< (
inputContext
() ?
inputContext
()->
metaObject
()->
className
() :
"<none>"
);
531
}
532
533
QWaylandShellIntegration
*
QWaylandIntegration
::
createShellIntegration
(
const
QString
&
integrationName
)
534
{
535
if
(
QWaylandShellIntegrationFactory
::
keys
().
contains
(
integrationName
)) {
536
return
QWaylandShellIntegrationFactory
::
create
(
integrationName
,
mDisplay
.
data
());
537
}
else
{
538
qCWarning
(
lcQpaWayland
) <<
"No shell integration named"
<<
integrationName
<<
"found"
;
539
return
nullptr
;
540
}
541
}
542
543
#
ifndef
QT_NO_SESSIONMANAGER
544
QPlatformSessionManager
*
QWaylandIntegration
::
createPlatformSessionManager
(
const
QString
&
id
,
const
QString
&
key
)
const
545
{
546
Q_UNUSED
(
key
);
547
return
new
QWaylandSessionManager
(
mDisplay
.
data
(),
id
);
548
}
549
#
endif
550
551
void
QWaylandIntegration
::
reset
()
552
{
553
mServerBufferIntegration
.
reset
();
554
mServerBufferIntegrationInitialized
=
false
;
555
556
mInputDeviceIntegration
.
reset
();
557
558
mClientBufferIntegration
.
reset
();
559
mClientBufferIntegrationInitialized
=
false
;
560
}
561
562
void
QWaylandIntegration
::
setApplicationBadge
(
qint64
number
)
563
{
564
mPlatformServices
->
setApplicationBadge
(
number
);
565
}
566
567
void
QWaylandIntegration
::
beep
()
const
568
{
569
if
(
auto
bell
=
mDisplay
->
systemBell
()) {
570
bell
->
ring
(
nullptr
);
571
}
572
}
573
574
}
575
576
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
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.16.1