-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add window sizes in dropdown menu options #35691
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
Conversation
|
Currently: Selecting a resolution with the max height can hide the titlebar. Selecting the native resolution effectively makes the app Borderless and the resize handles inaccessible. MS Windows won't handle the overflowing titlebar unless the user starts manual-resizing the app. Classic osu!'s resize behaviour is to always center the window and do a safe resize that keeps the titlebar in display. Issue: I'd like to always keep the titlebar in display, but the IWindow interface isn't helpful here (?), since Position is read-only and the desktop's safe area isn't known. Maybe we could expose this into the IWindow, or have the framework handle safe resizing/positioning? |
Selecting this option shows the following toast:
This should not be the case. That looks broken.
Not sure what you're expecting to happen here. Yes some framework-side changes are likely going to be required. Probably will need to use https://wiki.libsdl.org/SDL2/SDL_GetWindowBordersSize framework-side. I don't have any particular strong feelings as to whether the framework should be doing the safety logic or not. Maybe fine to put it in framework. Maybe @Susko3 @smoogipoo have differing opinions. |
|
I'm opposed to a resolution dropdown in windowed mode. If you want to have a certain resolution, you can resize the window while looking at the screen resolution toast. If your mouse sensitivity isn't awful, you can always perfectly resize the window, but it may take a little fiddling. (You'll need to use multithreaded mode due to current technical limitations.) If you would like to instantly switch between different resolutions, I would recommend using simple third-party applications, like Sizer. But if there was to be a preset resolution dropdown, I would not have the native resolution or a "maximised"/"default"/9999x9999. If you want to have a maximised window, press the maximise button, and if you want your window to take up the entire display, use borderless. |
| ShowsDefaultIndicator = false, | ||
| ItemSource = resolutions, | ||
| Current = sizeFullscreen | ||
| Current = currentResolution |
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.
This is forcing two unrelated settings (fullscreen size and windowed size) onto the same dropdown. I would make two dropdowns and hide and show them depending on the current screen mode.
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.
This is forcing two unrelated settings (fullscreen size and windowed size) onto the same dropdown. I would make two dropdowns and hide and show them depending on the current screen mode.
Ok, I separated the dropdowns and source lists (435cd27).
|
How do you re-centre your window after resizing it @Susko3? That's fine for other desktop applications but osu! (and maybe games in general) wants to be centred. |
|
Right, if the resolution dropdown also centers the window, it makes more sense. This PR would need to be updated to handle that, probably by setting both |
It's there in stable and therefore it should be there in lazer. I'm not interested in discussion on whether we want this or not, there wouldn't be an issue open for it if we didn't want it, and it's a feature many users would like. Only interested in figuring out how to make this happen not if. |
After separating the dropdowns, I omitted the 9999x9999 option from the windowed sizes list. We probably want to have a different generator for the presets (like Standard/Widescreen are in classic), rather than the DisplayModes. |
|
In osu/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs Lines 253 to 254 in 435cd27
This currently works for centering the window after selecting a size, while the window can still use resize handles normally. It's rather hacky though, because these lines fire on every resizing change. I tried to find a place to hook in for manual item selections (and w/out side effects like ignoring keyboard-based selections, or resetting position on settings open). I could use some help 🙏 |
I think having the titlebar always in-display seems to be acceptable, so long as a window is maneuverable after any resize. Some code I trialed would adjust for top decorations, to cover most systems, and assumes bottom/left/right decorations don't matter. With this, selecting an option w/ max height will be clamped down. On Windows, when I adjusted for bottom/left/right decorations (~8 units), the window doesn't become flush with the sides of the display. Obv this solution isn't resilient if the system doesn't use top-titlebars. |
You would probably need to:
|
|
Hi, I'm having some trouble with adjusting window position within the windowedPositionX/Y interface. I planned on keeping the max resolution options and use the usableBounds and decorations information to position the window. However, if the ClientArea and Display have equal dimensions anywhere, the normalised Position cannot translate it. int windowX = (int)Math.Round((displayBounds.Width - windowSize.Width) * newPosition.X);
int windowY = (int)Math.Round((displayBounds.Height - windowSize.Height) * newPosition.Y);Currently, normalised Position only cares about the client area position, sliding around the screen. Could it makes sense to treat the client area + decorations as one window during movement? This is what I attempted in this code, but it requires a framework change. The difference here is that Positions like Any other suggestions on how should I approach window movement during Layout Settings changes, I'm happy to hear. |
|
Please stop trying to change framework behaviour. Your changes could have undesired consequences. Specifically for your suggestion: the size of the window border is not known during startup by definition, so calculations of the initial window position when first starting the game would be wrong. If you have code that can calculate the desired correct |
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.
This looks to behave pretty well on windows 11 and on macOS. I can't get myself to even pretend to care about linux because I know this will be broken on linux on ${SPECIAL_SNOWFLAKE_WAYLAND_COMPOSITOR_DU_JOUR} and I'm at the acceptance stage of that.
Not sure it's merge-ready just yet pending discussion of a few sticking points below, but pretty good.
|
|
||
| var dBounds = currentDisplay.Value.Bounds; | ||
| var dUsable = currentDisplay.Value.UsableBounds; | ||
| float topBar = host.Window?.BorderSize.Value.Top ?? 0; |
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.
This warrants an inline comment as to why we're discarding the rest of the border size. Just restate what you said previously and it should suffice.
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.
Done, thanks for your patience
bdach
left a comment
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.
let's see how this goes I guess

Fix #17999
This PR enables the preset dropdown options for window sizes in Layout Settings.