From d0e09e5b5c31c432f5fa80980fd77ce7e4fc74dc Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sat, 22 Nov 2025 17:03:04 -0800 Subject: [PATCH 1/5] Fix one remaining case of "copy link" not using existing localisation --- osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPanel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPanel.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPanel.cs index fe03fca4b8..84b420d791 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/RoomPanel.cs @@ -25,6 +25,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; using osu.Game.Online.API; using osu.Game.Online.Chat; using osu.Game.Online.Rooms; @@ -430,7 +431,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components { items.AddRange([ new OsuMenuItem("View in browser", MenuItemType.Standard, () => game?.OpenUrlExternally(url)), - new OsuMenuItem("Copy link", MenuItemType.Standard, () => game?.CopyToClipboard(url)) + new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => game?.CopyToClipboard(url)) ]); } From b6ccc8cae42d51cd424c5fe0c61dd9e95a051ca5 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sat, 22 Nov 2025 17:06:04 -0800 Subject: [PATCH 2/5] Replace local osd and clipboard method with existing game method --- osu.Game/Overlays/Comments/DrawableComment.cs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Comments/DrawableComment.cs b/osu.Game/Overlays/Comments/DrawableComment.cs index 805d997998..33f09b7622 100644 --- a/osu.Game/Overlays/Comments/DrawableComment.cs +++ b/osu.Game/Overlays/Comments/DrawableComment.cs @@ -20,13 +20,11 @@ using System.Collections.Specialized; using System.Diagnostics; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Logging; -using osu.Framework.Platform; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Comments.Buttons; using osu.Game.Overlays.Dialog; -using osu.Game.Overlays.OSD; using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.Comments @@ -83,10 +81,7 @@ namespace osu.Game.Overlays.Comments private IAPIProvider api { get; set; } = null!; [Resolved] - private Clipboard clipboard { get; set; } = null!; - - [Resolved] - private OnScreenDisplay? onScreenDisplay { get; set; } + private OsuGame? game { get; set; } public DrawableComment(Comment comment, IReadOnlyList meta) { @@ -329,7 +324,7 @@ namespace osu.Game.Overlays.Comments if (WasDeleted) makeDeleted(); - actionsContainer.AddLink(CommonStrings.ButtonsPermalink, copyUrl); + actionsContainer.AddLink(CommonStrings.ButtonsPermalink, () => game?.CopyToClipboard($@"{api.Endpoints.APIUrl}/comments/{Comment.Id}")); actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10)); actionsContainer.AddLink(CommonStrings.ButtonsReply.ToLower(), toggleReply); actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10)); @@ -417,12 +412,6 @@ namespace osu.Game.Overlays.Comments api.Queue(request); } - private void copyUrl() - { - clipboard.SetText($@"{api.Endpoints.APIUrl}/comments/{Comment.Id}"); - onScreenDisplay?.Display(new CopiedToClipboardToast()); - } - private void toggleReply() { if (replyEditorContainer.Count == 0) From 49eb013967e0e7f5802742e504f8f3047aa89b83 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sat, 22 Nov 2025 17:06:34 -0800 Subject: [PATCH 3/5] Fix some copy link actions/buttons not showing copied toast --- osu.Game/Online/Chat/ExternalLinkOpener.cs | 4 ++-- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 5 ++--- osu.Game/Screens/Edit/Compose/ComposeScreen.cs | 7 +++---- osu.Game/Screens/SelectV2/BeatmapLeaderboardScore.cs | 5 ++--- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs index 258cca2ad5..53faafcf36 100644 --- a/osu.Game/Online/Chat/ExternalLinkOpener.cs +++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs @@ -24,7 +24,7 @@ namespace osu.Game.Online.Chat private GameHost host { get; set; } = null!; [Resolved] - private Clipboard clipboard { get; set; } = null!; + private OsuGame? game { get; set; } [Resolved] private IDialogOverlay? dialogOverlay { get; set; } @@ -88,7 +88,7 @@ namespace osu.Game.Online.Chat } if (dialogOverlay != null && shouldWarn) - dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url), () => clipboard.SetText(url))); + dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url), () => game?.CopyToClipboard(url))); else host.OpenUrlExternally(url); } diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index bc617cae80..e5aac279fb 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -17,7 +17,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Localisation; -using osu.Framework.Platform; using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -76,7 +75,7 @@ namespace osu.Game.Online.Leaderboards private SongSelect songSelect { get; set; } [Resolved(canBeNull: true)] - private Clipboard clipboard { get; set; } + private OsuGame game { get; set; } [Resolved] private IAPIProvider api { get; set; } @@ -459,7 +458,7 @@ namespace osu.Game.Online.Leaderboards items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => songSelect.Mods.Value = copyableMods)); if (Score.OnlineID > 0) - items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => clipboard?.SetText($@"{api.Endpoints.WebsiteUrl}/scores/{Score.OnlineID}"))); + items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => game?.CopyToClipboard($@"{api.Endpoints.WebsiteUrl}/scores/{Score.OnlineID}"))); if (Score.Files.Count > 0) { diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs index 195625dcde..7f6ddcd54c 100644 --- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs +++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs @@ -9,7 +9,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Extensions; @@ -22,8 +21,8 @@ namespace osu.Game.Screens.Edit.Compose { public partial class ComposeScreen : EditorScreenWithTimeline, IGameplaySettings { - [Resolved] - private Clipboard hostClipboard { get; set; } = null!; + [Resolved(canBeNull: true)] + private OsuGame game { get; set; } [Resolved] private EditorClock clock { get; set; } @@ -138,7 +137,7 @@ namespace osu.Game.Screens.Edit.Compose // regardless of whether anything was even selected at all. // UX-wise this is generally strange and unexpected, but make it work anyways to preserve muscle memory. // note that this means that `getTimestamp()` must handle no-selection case, too. - hostClipboard.SetText(getTimestamp()); + game?.CopyToClipboard(getTimestamp()); if (CanCopy.Value) clipboard.Value = new ClipboardContent(EditorBeatmap).Serialize(); diff --git a/osu.Game/Screens/SelectV2/BeatmapLeaderboardScore.cs b/osu.Game/Screens/SelectV2/BeatmapLeaderboardScore.cs index 5013150f05..16c9ed64f6 100644 --- a/osu.Game/Screens/SelectV2/BeatmapLeaderboardScore.cs +++ b/osu.Game/Screens/SelectV2/BeatmapLeaderboardScore.cs @@ -16,7 +16,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Localisation; -using osu.Framework.Platform; using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Graphics; @@ -77,7 +76,7 @@ namespace osu.Game.Screens.SelectV2 private OsuConfigManager config { get; set; } = null!; [Resolved] - private Clipboard? clipboard { get; set; } + private OsuGame? game { get; set; } [Resolved] private IAPIProvider api { get; set; } = null!; @@ -625,7 +624,7 @@ namespace osu.Game.Screens.SelectV2 items.Add(new OsuMenuItem(SongSelectStrings.UseTheseMods, MenuItemType.Highlighted, () => SelectedMods.Value = copyableMods)); if (Score.OnlineID > 0) - items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => clipboard?.SetText($@"{api.Endpoints.WebsiteUrl}/scores/{Score.OnlineID}"))); + items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => game?.CopyToClipboard($@"{api.Endpoints.WebsiteUrl}/scores/{Score.OnlineID}"))); if (Score.Files.Count <= 0) return items.ToArray(); From 1d353ef63777f2e3983691d88db11a26cc7a0a90 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Mon, 24 Nov 2025 11:06:01 -0800 Subject: [PATCH 4/5] Revert showing toast on editor timestamp clipboard --- osu.Game/Screens/Edit/Compose/ComposeScreen.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs index 7f6ddcd54c..195625dcde 100644 --- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs +++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs @@ -9,6 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Extensions; @@ -21,8 +22,8 @@ namespace osu.Game.Screens.Edit.Compose { public partial class ComposeScreen : EditorScreenWithTimeline, IGameplaySettings { - [Resolved(canBeNull: true)] - private OsuGame game { get; set; } + [Resolved] + private Clipboard hostClipboard { get; set; } = null!; [Resolved] private EditorClock clock { get; set; } @@ -137,7 +138,7 @@ namespace osu.Game.Screens.Edit.Compose // regardless of whether anything was even selected at all. // UX-wise this is generally strange and unexpected, but make it work anyways to preserve muscle memory. // note that this means that `getTimestamp()` must handle no-selection case, too. - game?.CopyToClipboard(getTimestamp()); + hostClipboard.SetText(getTimestamp()); if (CanCopy.Value) clipboard.Value = new ClipboardContent(EditorBeatmap).Serialize(); From 0786e619f1fccebbf99204ac8d94afb99361bbd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 25 Nov 2025 07:51:43 +0100 Subject: [PATCH 5/5] Leave note about lack of toast for posterity --- osu.Game/Screens/Edit/Compose/ComposeScreen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs index 195625dcde..00690c617e 100644 --- a/osu.Game/Screens/Edit/Compose/ComposeScreen.cs +++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs @@ -138,6 +138,8 @@ namespace osu.Game.Screens.Edit.Compose // regardless of whether anything was even selected at all. // UX-wise this is generally strange and unexpected, but make it work anyways to preserve muscle memory. // note that this means that `getTimestamp()` must handle no-selection case, too. + // additionally, note we're intentionally not using `OsuGame.CopyToClipboard()` + // because we do not want toasts to pop up on every Ctrl-C press - it'd be disruptive to mappers. hostClipboard.SetText(getTimestamp()); if (CanCopy.Value)