mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Detect exclusive fullscreen on Windows
This commit is contained in:
parent
c524b665ad
commit
08935cff86
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Framework.Platform.Windows;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -34,10 +35,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
private Bindable<Size> sizeFullscreen;
|
private Bindable<Size> sizeFullscreen;
|
||||||
|
|
||||||
private readonly BindableList<Size> resolutions = new BindableList<Size>(new[] { new Size(9999, 9999) });
|
private readonly BindableList<Size> resolutions = new BindableList<Size>(new[] { new Size(9999, 9999) });
|
||||||
|
private readonly IBindable<FullscreenCapability> fullscreenCapability = new Bindable<FullscreenCapability>(FullscreenCapability.Capable);
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuGameBase game { get; set; }
|
private OsuGameBase game { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
private SettingsDropdown<Size> resolutionDropdown;
|
private SettingsDropdown<Size> resolutionDropdown;
|
||||||
private SettingsDropdown<Display> displayDropdown;
|
private SettingsDropdown<Display> displayDropdown;
|
||||||
private SettingsDropdown<WindowMode> windowModeDropdown;
|
private SettingsDropdown<WindowMode> windowModeDropdown;
|
||||||
@ -65,6 +70,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
windowModes.BindTo(host.Window.SupportedWindowModes);
|
windowModes.BindTo(host.Window.SupportedWindowModes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (host.Window is WindowsWindow windowsWindow)
|
||||||
|
fullscreenCapability.BindTo(windowsWindow.FullscreenCapability);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
windowModeDropdown = new SettingsDropdown<WindowMode>
|
windowModeDropdown = new SettingsDropdown<WindowMode>
|
||||||
@ -139,6 +147,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fullscreenCapability.BindValueChanged(_ => Schedule(updateScreenModeWarning), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -150,8 +160,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
windowModeDropdown.Current.BindValueChanged(mode =>
|
windowModeDropdown.Current.BindValueChanged(mode =>
|
||||||
{
|
{
|
||||||
updateDisplayModeDropdowns();
|
updateDisplayModeDropdowns();
|
||||||
|
updateScreenModeWarning();
|
||||||
windowModeDropdown.WarningText = mode.NewValue != WindowMode.Fullscreen ? GraphicsSettingsStrings.NotFullscreenNote : default;
|
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
windowModes.BindCollectionChanged((sender, args) =>
|
windowModes.BindCollectionChanged((sender, args) =>
|
||||||
@ -213,6 +222,31 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateScreenModeWarning()
|
||||||
|
{
|
||||||
|
if (windowModeDropdown.Current.Value != WindowMode.Fullscreen)
|
||||||
|
{
|
||||||
|
windowModeDropdown.WarningText = GraphicsSettingsStrings.NotFullscreenNote;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (fullscreenCapability.Value)
|
||||||
|
{
|
||||||
|
case FullscreenCapability.Unknown:
|
||||||
|
if (host.Window is WindowsWindow)
|
||||||
|
windowModeDropdown.WarningText = "Checking for exclusive fullscreen...";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FullscreenCapability.Capable:
|
||||||
|
windowModeDropdown.WarningText = default;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FullscreenCapability.Incapable:
|
||||||
|
windowModeDropdown.WarningText = "Unable to enter exclusive fullscreen. You'll still experience some input latency.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void bindPreviewEvent(Bindable<float> bindable)
|
private void bindPreviewEvent(Bindable<float> bindable)
|
||||||
{
|
{
|
||||||
bindable.ValueChanged += _ =>
|
bindable.ValueChanged += _ =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user