-
Notifications
You must be signed in to change notification settings - Fork 340
Conversation
Add a check for surface != NULL inside xdg_pointer_grab_enter()
I think this fix will work, but there's an underlying architectural issue that it doesn't address. Here's what's happened, as far as I can tell: Prior to #183, compositors used two functions to tell wlroots about pointer movement between surfaces:
Eventually, #183 came along with commit 17b134e ("wlr-seat: pointer grab interface"). In order for wlroots to support pointer grabs (used for xdg_shell popups and, since #262, drag-and-drop), this commit added an extra layer of indirection. Now, instead of calling However, there was an oversight: #183 added indirected versions of This brings us, finally, to the commit that @Xyene identified as the cause of swaywm/sway#5294. In swaywm/sway#5220, @nickdiego noticed weird behavior of drag-and-drop grabs caused by—surprise!—missing events when the pointer left a surface. In order to fix this, they wrote swaywm/sway#5222, adding a call to So, how should we fix it? One approach is the one taken by this commit, which is to ensure that all grab enter hooks can treat a
The other approach we could take is to explicitly prohibit passing a
I personally like the second approach a bit better, and I'll probably attempt to write a PR implementing it this weekend barring any objections. As a stopgap, I think we should revert swaywm/sway#5222, since a rare drag-and-drop bug is preferable to a segfault every time your cursor leaves a surface while a popup is up. |
I agree with @tchebb. I also slightly prefer the second approach because the x/y parameters don't make sense for leave events. Since we're going to break the API, it would be nice to rename |
Also see #1506 |
@tchebb, I agree absolutely with you, Indeed I just try to fix it as sway is my daily driver and any issue that can crash it makes me feeling bad, but I don't know any clue about the architecture. I already known that was a ugly workaround, but any is better than get a segfault and loss the daily work. Thanks for your advice and hope you can figure out the best way to tackle this. Cheers! |
Wow! thanks for the in-depth analysis and sorry for not being able to look into this regression introduced by my change. Quite busy week here :/ TBH, I hesitated a bit before sending that patch without any kind of automated test / CI to "ensure" it was regressions-free.
IMHO, this sounds better, had even asked about such a function to @emersion as I was a bit surprised it didn't exist yet :P Thanks for looking into it. I still have several DND issues on the pipeline to report / try to fix :( hope to have some time for it in the coming weeks |
I've posted #2217 and swaywm/sway#5368 to implement the second solution I proposed above. |
Superseded by #2217 |
Add a check for surface != NULL inside xdg_pointer_grab_enter()