Repository navigation
Report titlebar drags on socket2 - #14
Closed
n0rthstar88 wants to merge 2 commits into
Closed
n0rthstar88 wants to merge 2 commits into
n0rthstar88 wants to merge 2 commits into
Conversation
A titlebar drag holds the pointer button, so the press and release never reach Hyprland's binds, and nothing outside the plugin can tell that a window is being moved by its titlebar. Post custom>>hyprbars:dragstart when a move begins and custom>>hyprbars:dragend when it ends, so tools listening on socket2 can act on where a window was dropped, such as snapping it into a layout at a screen edge. Clicks, button presses and top-edge resizes send nothing. The verifier now listens on the nested compositor's socket2 and checks all of these.
[Medium impact] The PR appears safe to merge; all previous findings are addressed. SummaryThe PR reports titlebar moves through custom socket2 events.
All three previous findings are addressed. No new actionable issues were found.
|
A titlebar drag could send dragstart without a dragend. Closing the window mid-drag destroyed its bar without ending the move, and a release after another window took focus returned before the move was ended, which also left the next drag on that bar without a dragstart. End the reported move in both cases, and skip posting while Hyprland shuts down and has no socket. The verifier now waits for the expected events instead of sleeping, reports socket reader failures, and checks both cases. Drop the compiled verifier that was committed by mistake and ignore __pycache__.
Contributor
|
Thanks! Closing in favor of #15, which reports every kind of window move drag (titlebar, Super-drag, app headerbars) through 0.57's drag controller. That will land together with window snapping (omacom/omarchy#18141). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A titlebar drag holds the pointer button, so the press and release never reach Hyprland's binds, and nothing outside the plugin can tell a window is being moved by its titlebar. That leaves tools that act on a dropped window, like snapping it into a layout when it's dragged to the top edge, working for Super-drags and app-drawn titlebars but not for these titlebars.
This posts two custom socket2 events:
dragstartcomes when a move actually begins (pointer or touch), anddragendwhen it ends. They're paired: a flag makes sure everydragstartgets exactly onedragend, and nothing else sends one. That holds when the window is closed mid-drag or another window takes focus before the release. Clicks, double-clicks, button presses and a resize from the edge above the titlebar send nothing. The names match what the event dispatcher produces (hl.dsp.event), so a listener handles both the same way. The README has a short section on them.Testing
tools/verify.pynow listens on the nested compositor's socket2 and checks that:dragstartand onedragenddragenddragend, and the next drag sends a freshdragstartIt waits for the expected events with a timeout rather than a fixed sleep, and fails if the socket reader stops.
I'm on Hyprland 0.56.2, so I ran the verifier on the same change applied to
v0.2.2, with 0.56'sg_pEventManager->postEventin place ofIPC::Socket2::sock()->postEvent. Every check passes, on three runs. Against the stock 0.2.2 package the drag check fails with no events, and against this PR's first commit the closed-window and focus-change checks each fail with a lonedragstart, as expected. OnmainI compile-checked the 0.57 call against Hyprland v0.57.0'ssrc/ipc/s2/S2.hpp(it's written the same way asGroup.cpp'stogglegroupevent), but I haven't built or run the whole plugin against 0.57.