You can resize and move an undecorated window using glfwGetWindowSize
and glfwSetWindowPos
. These can be used alongside your own UI to provide drag and resizing. For an example of this see the Dear ImGui Docking branch with viewports .
One problem with this is that you no longer receive OS resizing events such as the Windows WIN+LEFT for tiling the window on a part of the screen.
I am not sure of the status of the linked issue, but it appears the fork mentioned no longer exists. A newer version appears to be in progress here:
glfw:master
← RobbinMarcus:master
opened 07:45PM - 19 Jan 19 UTC
This is a cleaned up version that merges both changes for the drag operation and… resize operation. I implemented the requested changes by @jadahl and @linkmauve and solved conflicts generated by the old pull requests.
Merged these two pull requests together:
- Add support for drag operation on borderless window #987
- Support for resize operation on borderless windows #991
Affected issues:
- Provide a way to specify the window drag area on an undecorrated window #923
- Support for resizing undecorated window #990
Current state:
I tested these changes on windows 10 (win32). I changed the "window" example locally to have an undecorated window and added a buttons to test the drag and resize operations (glfwDragWindow or glfwResizeWindow).
Specifically for win32 this PR implements the `WM_NCHITTEST` and `WM_NCCALCSIZE` to get rid of the 7px white header above the window. These changes led me to add 2 functions to customize the caption area and the resize border size. Currently this information is available for every platform, but only used for win32.
![UndecoratedResize](https://user-images.githubusercontent.com/4852449/192476799-cca65ae3-ed2d-48ef-a56d-b24d306a6661.gif)
Reviewers: please let me know if this needs to be split up into separate PRs. The drag/resize operations are mostly separate from the win32 specific undecorated window changes.
Testing: This PR is only tested in windows 10 at the moment. The other platforms are in the same state as the previous PRs mentioned above, except for the changes I made to get them up to date to the latest master branch.
There still appear to be some issues so I do not expect this to be merged soon, but you can try the linked branch from the pull request yourself: GitHub - RobbinMarcus/glfw: A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input
1 Like