|
18 | 18 | #include <QJsonObject> |
19 | 19 | #include <QJsonParseError> |
20 | 20 |
|
| 21 | +#define protected public |
| 22 | +#include <private/qwaylandcompositor_p.h> |
| 23 | +#undef protected |
| 24 | +#include <qpa/qwindowsysteminterface_p.h> |
| 25 | +#include <private/qwlqtkey_p.h> |
| 26 | +#include <private/qwlqttouch_p.h> |
| 27 | + |
21 | 28 | DGUI_USE_NAMESPACE |
22 | 29 |
|
23 | 30 | PluginScaleManager::PluginScaleManager(QWaylandCompositor *compositor) |
@@ -394,6 +401,24 @@ void PluginManager::initialize() |
394 | 401 | { |
395 | 402 | QWaylandCompositorExtensionTemplate::initialize(); |
396 | 403 | QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer()); |
| 404 | + |
| 405 | + // ###(zccrs): 在dde-shell中不要使用QWaylandCompositor的event handler,它会对key event进行 |
| 406 | + // 特殊处理,会丢弃掉原生事件的信息,仅根据 native scan key code 通过xkb生成原始key event向 |
| 407 | + // dde-shell 传递,这会导致需要状态切换后进行输入的字符丢失信息,比如外部环境打开NumLock后,小键盘 |
| 408 | + // 的数字输入会被event handler转成原始事件,丢失了NumLock的开关信息。 |
| 409 | + // dde-shell不是一个独立的合成器,所以不需要额外处理key event,需要遵守原始事件中的NumLock状态 |
| 410 | + // 确保输出数字时在dde-shell的wayland客户端中接收到的也是数字。 |
| 411 | + auto eventHandler = QWaylandCompositorPrivate::get(compositor)->eventHandler.get(); |
| 412 | + if (eventHandler == QWindowSystemInterfacePrivate::eventHandler) { |
| 413 | + QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(eventHandler); |
| 414 | + } |
| 415 | + |
| 416 | + // 只创建就行 |
| 417 | + auto qtKey = new QtWayland::QtKeyExtensionGlobal(compositor); |
| 418 | + qtKey->setParent(compositor); |
| 419 | + auto qtTouch = new QtWayland::TouchExtensionGlobal(compositor); |
| 420 | + qtTouch->setParent(compositor); |
| 421 | + |
397 | 422 | init(compositor->display(), 1); |
398 | 423 | } |
399 | 424 |
|
|
0 commit comments