mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 21:32:57 +08:00
Disable confine mode dropdown when full-screen
After hard-locking the mouse confine mode to `Always` in full-screen to prevent confine issues from popping up, the confine mode dropdown in settings had confusing UX due to seemingly having no effect when full-screen.
This commit is contained in:
parent
9064ca9064
commit
0a745144e3
@ -28,27 +28,38 @@ namespace osu.Game.Input
|
|||||||
{
|
{
|
||||||
frameworkConfineMode = frameworkConfigManager.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode);
|
frameworkConfineMode = frameworkConfigManager.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode);
|
||||||
frameworkWindowMode = frameworkConfigManager.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
frameworkWindowMode = frameworkConfigManager.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
||||||
frameworkWindowMode.BindValueChanged(_ => updateConfineMode());
|
frameworkWindowMode.BindValueChanged(_ => updateGameConfineMode());
|
||||||
|
|
||||||
osuConfineMode = osuConfigManager.GetBindable<OsuConfineMouseMode>(OsuSetting.ConfineMouseMode);
|
osuConfineMode = osuConfigManager.GetBindable<OsuConfineMouseMode>(OsuSetting.ConfineMouseMode);
|
||||||
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
|
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
|
||||||
|
|
||||||
osuConfineMode.ValueChanged += _ => updateConfineMode();
|
osuConfineMode.ValueChanged += _ => updateFrameworkConfineMode();
|
||||||
localUserPlaying.BindValueChanged(_ => updateConfineMode(), true);
|
localUserPlaying.BindValueChanged(_ => updateFrameworkConfineMode(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConfineMode()
|
private LeasedBindable<OsuConfineMouseMode> leasedOsuConfineMode;
|
||||||
|
|
||||||
|
private void updateGameConfineMode()
|
||||||
|
{
|
||||||
|
if (frameworkWindowMode.Value == WindowMode.Fullscreen && leasedOsuConfineMode == null)
|
||||||
|
{
|
||||||
|
leasedOsuConfineMode = osuConfineMode.BeginLease(true);
|
||||||
|
leasedOsuConfineMode.Value = OsuConfineMouseMode.Always;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frameworkWindowMode.Value != WindowMode.Fullscreen && leasedOsuConfineMode != null)
|
||||||
|
{
|
||||||
|
leasedOsuConfineMode.Return();
|
||||||
|
leasedOsuConfineMode = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFrameworkConfineMode()
|
||||||
{
|
{
|
||||||
// confine mode is unavailable on some platforms
|
// confine mode is unavailable on some platforms
|
||||||
if (frameworkConfineMode.Disabled)
|
if (frameworkConfineMode.Disabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (frameworkWindowMode.Value == WindowMode.Fullscreen)
|
|
||||||
{
|
|
||||||
frameworkConfineMode.Value = ConfineMouseMode.Fullscreen;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (osuConfineMode.Value)
|
switch (osuConfineMode.Value)
|
||||||
{
|
{
|
||||||
case OsuConfineMouseMode.Never:
|
case OsuConfineMouseMode.Never:
|
||||||
|
Loading…
Reference in New Issue
Block a user