mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 00:02:56 +08:00
Merge pull request #23720 from peppy/fix-mouse-disappear-screenshot-fail
Fix mouse cursor potentially disappearing for good if screenshot capture fails
This commit is contained in:
commit
f8289927d2
@ -19,6 +19,7 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
@ -69,7 +70,7 @@ namespace osu.Game.Graphics
|
|||||||
{
|
{
|
||||||
case GlobalAction.TakeScreenshot:
|
case GlobalAction.TakeScreenshot:
|
||||||
shutter.Play();
|
shutter.Play();
|
||||||
TakeScreenshotAsync();
|
TakeScreenshotAsync().FireAndForget();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +87,8 @@ namespace osu.Game.Graphics
|
|||||||
{
|
{
|
||||||
Interlocked.Increment(ref screenShotTasks);
|
Interlocked.Increment(ref screenShotTasks);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (!captureMenuCursor.Value)
|
if (!captureMenuCursor.Value)
|
||||||
{
|
{
|
||||||
cursorVisibility.Value = false;
|
cursorVisibility.Value = false;
|
||||||
@ -113,9 +116,6 @@ namespace osu.Game.Graphics
|
|||||||
|
|
||||||
using (var image = await host.TakeScreenshotAsync().ConfigureAwait(false))
|
using (var image = await host.TakeScreenshotAsync().ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
if (Interlocked.Decrement(ref screenShotTasks) == 0 && cursorVisibility.Value == false)
|
|
||||||
cursorVisibility.Value = true;
|
|
||||||
|
|
||||||
host.GetClipboard()?.SetImage(image);
|
host.GetClipboard()?.SetImage(image);
|
||||||
|
|
||||||
(string filename, var stream) = getWritableStream();
|
(string filename, var stream) = getWritableStream();
|
||||||
@ -151,6 +151,12 @@ namespace osu.Game.Graphics
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (Interlocked.Decrement(ref screenShotTasks) == 0)
|
||||||
|
cursorVisibility.Value = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
private static readonly object filename_reservation_lock = new object();
|
private static readonly object filename_reservation_lock = new object();
|
||||||
|
Loading…
Reference in New Issue
Block a user