-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement extend to title for Windows and Linux #96310
base: master
Are you sure you want to change the base?
Conversation
1971a79
to
495e0e1
Compare
495e0e1
to
d4f88c2
Compare
d4f88c2
to
f624e6a
Compare
I'm not sure if we want a separate flag for it, might be better to merge it with |
I've been working on the same feature for the past few days and have a few questions.
|
That's a interesting suggestion, I'll think about it. It should be easier to implement in the Project Manager or other windows in the future if the buttons are drawn directly in the Window class. I thought it could be interesting for games/app created with Godot to be able to create resizable without without the window min/max/close buttons. It could be added later. |
I'll look into it, bruvzg made the same suggestion.
I'm curious how you implemented it.
Indeed. |
FYI: https://learn.microsoft.com/en-us/windows/win32/dwm/customframe The screenshot below shows the project manager window run in windowed mode on Windows 10, notice the shadow around the window. |
bf73210
to
73016ce
Compare
I fixed the issue with the white border on top of the window on Windows 7/10. Thanks bughandler! If you want to work on that together @bughandler, I'm available in the Godot Contributors Chat: https://chat.godotengine.org |
@bruvzg I was working on using the already existing flag Should I create a control for that and add it to the scene? That would be the easiest way, but my concern is that these controls would be present in the scene tree at runtime for any project that uses The other alternative could be to manage the rendering manually, like in What’s the best approach? |
3c5830e
to
7b71dd0
Compare
7b71dd0
to
af45363
Compare
af45363
to
2db9ab6
Compare
Yes, I think we could get rid of their background colors (when not hovered) too. This would better match Windows' UI appearance in particular. |
Thank you for implementing generic CSDs! I'm already concocting a Wayland port. Resizing was pretty easy (Wayland is built with CSDs in mind) but I'm having issues understanding how to move the window when dragging the "title bar". I can't catch events in a rect otherwise I'd be causing issues to all UI under it, so how am I supposed to catch empty the empty title bar space like in the video? |
In "Extend to ttitle" mode, the moving of the window when dragging the "title bar" is not done in the DisplayServer, it's done into the |
Like to comment just before, in the "Extend to title" mode, you will have to implement your own window move because it's impossible to tell exactly what is an empty space or not, also you could want to implement a full size draggable window if you want. It should be pretty say in GDScript to implement the window movement using mouse events.
I'm concerned with the compatibility when Godot is not in "Extend to title" mode. Also, it's not the way it works on macOS. I would like to know what others think about about. |
Ooooh so it's already implemented. Gotcha. Too bad that this class won't work as-is on Wayland since it wants a "please start moving" command. We can't override the window position manually. Not too much of an issue though, I don't think that anybody would be against a generic "start move operation" DS method or something like that. This can be improved or at least discussed later.
I'm not yet digging into that but as you said the decoration canvas work is fundamental for "non-extend-to-title" decorations. I can give a stab at them later, even just implementing only this feature will be very nice for now. I'll polish the thing up and send you a patch soon™. I'm a bit... chaotic. I also found a weird bug: the decorations kinda distort when any form of pillar/letterboxing gets applied to the canvas. Just try setting "keep" to the "display/window/stretch/aspect" project setting. |
@Hilderin Ah, I'm making this suggestion not just for this mode, but in general, even when the normal OS titlebar is there. If it's implemented, it should look like that consistently. I don't use macOS, so I don't know the implications in this case. |
43d65e9
to
87e4b31
Compare
@Calinou What do you think? These changed are not pushed yet, I still need to fix the full screen mode, the margin to put the menu in the corner, the border in splash screen of the Project Manager, and the distorting bug when any form of pillar/letterboxing is applied. |
72a26df
to
2b34729
Compare
Made some fixes/adjustments:
@Calinou This should fix everything you mentioned in your previous post, except for moving the main menu to the top-left corner. There are already some settings in the editor to specify spacing, and the editor uses these to define the global margin. I'm not sure I want to change that behavior in this PR?!? |
2b34729
to
b5a553a
Compare
Hi, I finally have a patch for Wayland. You can find it in my branch: https://github.com/Riteo/godot/commit/wayland-no-title-bar/ I had trouble adding drawing tablet support on sway so I left that out for now. Also keep note that if the backend detects and uses libdecor, our current "stopgap" decoration library, it won't be able to disable borders on natively decorated windows due to an upstream bug. #96825 would be useful in this case. |
Needs a rebase after #97333. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b5a553a
to
883a9b3
Compare
Rebased to fix conflict with master and fix a transparent line at the bottom when starting in extend to title mode and maximized on Windows. |
First, thanks for testing it! Second, that's weird ;) Can you share with me your Can you try restarting the editor after you move all the Another possibility could be a wrong settings in Also, do you have multiple monitors?? |
System info: The problem persist even on a fresh config (removed C:\Users[username]\AppData\Roaming\Godot folder). I have a monitor connected to my laptop right now, which seems to cause the issue: the editor becomes visible when I disconnect the monitor. |
Thanks a lot, that is very helpful, I'll look into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was waiting for the implementation to settle in.
883a9b3
to
77b4852
Compare
77b4852
to
45b0a5a
Compare
Thanks for the review @Mickeon, I made the suggested modifications the best I can. |
45b0a5a
to
fdfc6d1
Compare
The project manager that extends to titles is not a good experience under Linux X11:
Maybe it should call the x11 start moving window and start resizing api, instead of directly setting the window position and size? This pr: 2024-10-21.09-45-46.mp4My experimental project: 2024-10-21.09-46-40.mp4 |
This PR implements the
EXTEND_TO_TITLE
flag for Windows and Linux X11. Implementing this flag allows Windows and Linux to use the editor without the default title bar. Additionally, it makes it possible to use this flag in any Godot project outside the editor.Since Windows and Linux don’t natively support this mode, it is "simulated" by providing a resizable borderless window with minimize, maximize, and close buttons rendered directly in the
Window
class. New properties were added to theWindow Theme
to define the button icons, positions, and styles.Here’s a little demo:
Windows:
godot.windows.editor.dev.x86_64_5zKbXLNLPu.mp4
Linux: