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