KDE/Plasma window movement/snapping behavior causing problems

I’m trying to make a frameless window (FramelessWindowHint) in Qt. I also want it to move by dragging the background of the window, so I implemented press/release/move handlers for the mouse to track movement and move the window.

However, I’ve found on my KDE/Plasma Linux install, there’s pre-existing behavior at the window manager level to do this, causing my logic to behave strangely. Primarily it seems my movement logic is causing it to snap to the wrong place on the mouse release. Example: i.imgur. com/5oPnrAN.gif

Do you have a suggestion how to handle this situation? I need the manual logic for systems that don’t already implement the window moving behavior, and I want to leave the window snapping like other Plasma windows, but I don’t see a way to do that. Can I detect if the window manager intends to move/snap my window, so I don’t do it myself?

I made a longer post over on the Qt forum (forum.qt. io/topic/157285/trouble-with-kde-plasma-window-movement-snapping-behavior) but never got a response.

Apparently I’m not allowed to include links, which seems a little absurd for a technical forum. You’ll have to remove the spaces in those to get them to work.

I’ve come up with a sort-of solution, I think. I’ve found that os.environ will tell me if the Window Manager is KDE/Plasma. Unless there’s a better way, I’m just going to adjust my program behavior depending on that, but make it configurable in case my guess gets it wrong.