Fix DTK titlebar minimize/close buttons disabled on Wayland (winId truncation)#647
Fix DTK titlebar minimize/close buttons disabled on Wayland (winId truncation)#647svan71 wants to merge 1 commit into
Conversation
The slot receives winId as quint32 (eventFilter and the DWindowManagerHelper windowMotifWMHintsChanged signal both deliver it truncated to 32 bits), but the identity guard compared it against the full-width WId from QWindow::winId(). On X11 WId is a 32-bit XID so it worked; on Wayland/Qt6.11 WId is a 64-bit pointer (>4GiB), so the guard is always true and the slot returns before fetching Motif functions, leaving motifFunctions at 0 and disabling the minimize/close buttons on DTK client titlebars (e.g. dde-control-center).
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: svan71 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @svan71. Thanks for your PR. 😃 |
|
Hi @svan71. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Problem
On Wayland, DTK client-side titlebars (e.g.
dde-control-center) render their minimize and close buttons permanently disabled — grayed out, no hover, no action. Only the menu/hamburger button works. The same binaries work correctly on X11 and worked on older Qt.WindowButtonGroup.qmlenables minimize/maximize/close only whenD.DWindow.motifFunctionsincludes the correspondingFUNC_*bit. A runtime probe (a minimal DTKApplicationWindow) showsmotifFunctionsstuck at0x0for the window's entire lifetime under a Wayland session.Root cause
DQuickWindowAttachedPrivate::_q_onWindowMotifHintsChanged(quint32 winId)guards on window identity:The
winIdargument is aquint32— both callers deliver it truncated to 32 bits: theSurfaceCreatedpath ineventFiltercastsstatic_cast<quint32>(window->winId()), and theDWindowManagerHelper::windowMotifWMHintsChanged(quint32)signal is 32-bit by definition. But the guard compares it againstQWindow::winId(), which returns the full-widthWId(quintptr).WIdis a 32-bit XID, so the comparison holds.WIdis a pointer-derived value greater than 32 bits, sofull64 != truncated32is always true. The slot returns early,DWindowManagerHelper::getMotifFunctions()is never called, andmotifFunctionsis never updated from its0default — leaving all window buttons disabled.This is why the regression appears "version-less": the DTK sources are unchanged; it is the Qt QtWayland
winIdassignment that shifted, exposing the latent width mismatch.Fix
Compare the low 32 bits on both sides, matching the width the codebase already delivers. No public API/ABI change (
windowMotifWMHintsChanged(quint32)is unchanged).Verification
Minimal reproducer — a DTK
ApplicationWindowthat logsD.DWindow.motifFunctionson each poll, run inside a Treeland/Wayland session:motifFunctions = 0 (0x0)for the whole run; minimize/close disabled.motifFunctions = 62 (0x3e)(FUNC_RESIZE|MOVE|MINIMIZE|MAXIMIZE|CLOSE); minimize/close enabled.dde-control-centertitlebar buttons hover and work again.