File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ target_link_libraries(dock-plugin PUBLIC
156156PRIVATE
157157 PkgConfig::WaylandClient
158158 Qt${QT_VERSION_MAJOR} ::WaylandCompositorPrivate
159+ Qt${QT_VERSION_MAJOR} ::GuiPrivate
159160)
160161
161162target_include_directories (dock-plugin
Original file line number Diff line number Diff line change 1818#include < QJsonObject>
1919#include < QJsonParseError>
2020
21+ #define protected public
22+ #include < private/qwaylandcompositor_p.h>
23+ #undef protected
24+ #include < qpa/qwindowsysteminterface_p.h>
25+
2126DGUI_USE_NAMESPACE
2227
2328PluginScaleManager::PluginScaleManager (QWaylandCompositor *compositor)
@@ -394,7 +399,23 @@ void PluginManager::initialize()
394399{
395400 QWaylandCompositorExtensionTemplate::initialize ();
396401 QWaylandCompositor *compositor = static_cast <QWaylandCompositor *>(extensionContainer ());
402+
403+ // ###(zccrs): 在dde-shell中不要使用QWaylandCompositor的event handler,它会对key event进行
404+ // 特殊处理,会丢弃掉原生事件的信息,仅根据 native scan key code 通过xkb生成原始key event向
405+ // dde-shell 传递,这会导致需要状态切换后进行输入的字符丢失信息,比如外部环境打开NumLock后,小键盘
406+ // 的数字输入会被event handler转成原始事件,丢失了NumLock的开关信息。
407+ // dde-shell不是一个独立的合成器,所以不需要额外处理key event,需要遵守原始事件中的NumLock状态
408+ // 确保输出数字时在dde-shell的wayland客户端中接收到的也是数字。
409+ auto eventHandler = QWaylandCompositorPrivate::get (compositor)->eventHandler .get ();
410+ if (eventHandler == QWindowSystemInterfacePrivate::eventHandler) {
411+ QWindowSystemInterfacePrivate::removeWindowSystemEventhandler (eventHandler);
412+ }
413+
397414 init (compositor->display (), 1 );
415+
416+ // 只创建就行
417+ new QtWayland::QtKeyExtensionGlobal (compositor);
418+ new QtWayland::TouchExtensionGlobal (compositor);
398419}
399420
400421void PluginManager::updateDockOverflowState (int state)
You can’t perform that action at this time.
0 commit comments