I’m implementing a UI library, but i want to draw my title bar, i find glfw don’t support undecorated resizeable window, if i use undecorated window, i could not resize my window.
i find this question in past 5 years ago,
Support for resizing undecorated window · Issue #990 · glfw/glfw · GitHub
but this pr don’t merge to master branch.
You can resize and move an undecorated window using
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:
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
- Provide a way to specify the window drag area on an undecorrated window #923
- Support for resizing undecorated window #990
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.
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
thanks your reply. i find imgui don’t use platform resize event, it simulates a resize event when cursor hover over in the border.
Yes, this is what I stated in my response - you can use
glfwSetWindowPos along with your own UI code to resize and position the window.