Weird behavior when resizing frameless windows using hit tests

Hello,

I have created a borderless window that can be moved and resized using the Hit Tests and have noticed some strange behavior:

  • Moving works on Debian 10.8 with SDL 2.0.9, Gnome 3.30.2 and Wayland 1.16.0 as well as on Windows 10 20H2 with SDL 2.0.14 and MSYS2.

  • Resizing works on Windows in all directions (including diagonals) except bottom, bottom-right (corner) and right. In those cases, when I enlarge the window, it does not visually grow. Only after I release the mouse it jumps to its new size. But: This applies only when you enlarge it. When you shrink the window everything works as it should.

  • Resizing works under Debian. However, the changed mouse cursor (the arrow that shows the direction) is only shown to me when I am already dragging and not before. Also, the window flickers badly.

I hope that someone can help me. Maybe there is another way to resize the window without using native APIs.

Greetings

Here is some demo code: