codic12 / worm

A dynamic, tag-based window manager written in Nim
MIT License
711 stars 24 forks source link

GTK XDnD (drag&drop) broken #52

Closed lambdadog closed 2 years ago

lambdadog commented 2 years ago

I first noticed this issue in Firefox when I was unable to drag tabs without them popping out into a window of their own, but I've since reproduced in the Nemo file manager as well (dragging and dropping files fails to produce any results). Drag and drop does work in Dolphin, which is written using Qt rather than GTK, and drag and drop functions as normal in both Firefox and Nemo in kwin so it seems some particularity of GTK's XDnD implementation isn't being accounted for by worm.

All I've been able to find about peculiarities in GTK's drag and drop so far is this comment in i3's source code but I'm not certain it's relevant.

codic12 commented 2 years ago

I have noticed this issue but I wasn't able to figure out the cause.

I did figure out it's related to reparenting. I spun up the most basic reparenting wm, which does nothing but simply reparent each window, and I have this issue - I remove reparenting and now i don't. I have an idea that the issue is that you have to copy certain window attributes from the child to the frame / parent; only problem is I have no idea which ones or how, as I can't find any documentation on this.

lambdadog commented 2 years ago

I wouldn't be surprised if the only way to figure out what needs doing here is by reading through the source code of more established WMs or perhaps chatting with their devs.

lambdadog commented 2 years ago

I've been combing through i3's source some more and I'm starting to believe that the part I linked might actually be the solution? From what I can tell, soon after reparenting i3 enters a state where the child window is unmapped but the container window is, which leads to that code path.

If you work more linearly this means after reparenting, you want to set WM_STATE_NORMAL for GTK DnD to work.

I'll do a quick test and open a PR if it works.