rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.84k stars 903 forks source link

No window snapping without decorations on Windows #1548

Open chrisduerr opened 4 years ago

chrisduerr commented 4 years ago

It seems like window snapping does not work on Windows when decorations are disabled. This was tested using the Windows shortcuts, since the decorations aren't available to drag them of course.

This was originally reported to Alacritty in https://github.com/alacritty/alacritty/issues/3602.

vovw commented 3 years ago

Did anyone find a solution for this ?

amrbashir commented 3 years ago

Also maximizing the window fills the whole monitor and doesn't account for the taskbar.

A solution for these issues can be found in this repo it is written in c++.

  1. Snapping needs WS_SIZEBOX or WS_THICKFRAME and WS_MAXIMIZEBOX and return 0 in WM_NCCALCSIZE window message. https://github.com/melak47/BorderlessWindow/blob/3b6978d88c0eef47f79c0ac125ec154bf701375c/BorderlessWindow/src/BorderlessWindow.cpp#L20

  2. Maximize issue can be fixed with adjusting the client rect when WM_NCCALCSIZE window message is fired: https://github.com/melak47/BorderlessWindow/blob/3b6978d88c0eef47f79c0ac125ec154bf701375c/BorderlessWindow/src/BorderlessWindow.cpp#L157-L164

    https://github.com/melak47/BorderlessWindow/blob/3b6978d88c0eef47f79c0ac125ec154bf701375c/BorderlessWindow/src/BorderlessWindow.cpp#L37-L56

vovw commented 3 years ago

Oh thx would surely help :)