Changing displays via `CurrentDisplayBindable` doesn't work
I was looking to add display selection to osu!, but it using this bindable wasn't working at all.
It looks like the intention of this bindable was to have it settable. I do remember this working in the past.
A quick attempt to make it work is this diff:
diff --git a/osu.Framework/Platform/SDL2DesktopWindow.cs b/osu.Framework/Platform/SDL2DesktopWindow.cs
index 73b5e953d..01436bee8 100644
--- a/osu.Framework/Platform/SDL2DesktopWindow.cs
+++ b/osu.Framework/Platform/SDL2DesktopWindow.cs
@@ -1174,7 +1174,11 @@ public void SetupWindow(FrameworkConfigManager config)
};
config.BindWith(FrameworkSetting.LastDisplayDevice, windowDisplayIndexBindable);
- windowDisplayIndexBindable.BindValueChanged(evt => CurrentDisplay = Displays.ElementAtOrDefault((int)evt.NewValue) ?? PrimaryDisplay, true);
+ windowDisplayIndexBindable.BindValueChanged(evt =>
+ {
+ CurrentDisplay = Displays.ElementAtOrDefault((int)evt.NewValue) ?? PrimaryDisplay;
+ pendingWindowState = windowState;
+ }, true);
sizeFullscreen.ValueChanged += evt =>
{
This should be enough to show why it isn't working, but still has issues with various OS/display modes. At very least this should work reliably on windows.
In my testing so far:
- Works with macOS windowed, but not borderless or fullscreen
- Works with seemingly all modes on windows, but may be triggering more mode changes than expected. I've only tested on a VM so it's hard to say without further testing.
Not sure whether I should PR the above to at least have it hooked up, or whether more effort should be spent to ensure it works properly.
@Susko3 if you're looking for more platform fixes to make, you're welcome to take this one on 😅
I'd start with PRing the above to move the dependent game-side PR along. Always better to have something in place that's at least partially working rather than nothing.