diff --git a/xcb/dxcbwmsupport.cpp b/xcb/dxcbwmsupport.cpp index b2bba072..fdb82992 100644 --- a/xcb/dxcbwmsupport.cpp +++ b/xcb/dxcbwmsupport.cpp @@ -171,12 +171,13 @@ void DXcbWMSupport::updateHasComposite() xcb_connection_t *xcb_connection = DPlatformIntegration::xcbConnection()->xcb_connection(); - auto atom = Utility::internAtom("_NET_KDE_COMPOSITE_TOGGLING"); + // _NET_KDE_COMPOSITE_TOGGLING 为 KWin 私有 atom,非 KWin 环境下原本不存在属正常情况。 + // intern 后 stage1 查不到属性会自然落入 stage2 的 _NET_WM_CM_S0 selection owner 探测。 + // 仅在 X 连接异常时(如会话退出期)intern 才会失败,此时 stage2 同样无意义,静默返回 + auto atom = Utility::internAtom("_NET_KDE_COMPOSITE_TOGGLING", false); - if (atom == 0) { - qWarning() << "The value of atom:_NET_KDE_COMPOSITE_TOGGLING is 0 !"; + if (atom == XCB_NONE) return; - } xcb_window_t root = DPlatformIntegration::xcbConnection()->primaryScreen()->root(); diff --git a/xcb/utility_x11.cpp b/xcb/utility_x11.cpp index b100a0de..3dcc5cfe 100644 --- a/xcb/utility_x11.cpp +++ b/xcb/utility_x11.cpp @@ -183,10 +183,18 @@ void Utility::updateMousePointForWindowMove(quint32 WId, bool finished/* = false // 新增:支持多屏幕的版本,接受自定义全局坐标 void Utility::updateMousePointForWindowMove(quint32 WId, const QPoint &globalPos, bool finished/* = false*/) { + // internAtom() 默认 only_if_exists=true:_DEEPIN_MOVE_UPDATE 是 deepin kwin 的私有 + // atom,窗管未创建它时查询返回 XCB_NONE,此时发送 type 为 0 的 ClientMessage, + // 会被窗管转发回客户端并触发 qtbase 的 "Unhandled client message" 告警。窗管不支持 + // 该协议时直接跳过。 + const xcb_atom_t moveUpdateType = internAtom("_DEEPIN_MOVE_UPDATE"); + if (moveUpdateType == XCB_NONE) + return; + xcb_client_message_event_t xev; xev.response_type = XCB_CLIENT_MESSAGE; - xev.type = internAtom("_DEEPIN_MOVE_UPDATE"); + xev.type = moveUpdateType; xev.window = WId; xev.format = 32; xev.data.data32[0] = globalPos.x();