-
Notifications
You must be signed in to change notification settings - Fork 452
Add support for custom clipboard formats #6223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
minetoblend
wants to merge
29
commits into
ppy:master
Choose a base branch
from
minetoblend:feature/custom-clipboard-formats
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c32b348
Alter clipboard to support multiple formats
minetoblend 95116ea
Add custom format support to `HeadlessClipboard`
minetoblend cdd0c0c
Add in-memory fallback for custom clipboard format to `MacOSClipboard`
minetoblend 16b00d9
Add in-memory fallback for custom clipboard format to `SDL2Clipboard`
minetoblend d149485
Add support for custom clipboard formats & web custom formats to `Win…
minetoblend 99179b3
Add in-memory fallback for custom clipboard format to `AndroidClipboard`
minetoblend ef661c9
Add comment linking to web custom format explainer
minetoblend 1b7ff7c
Add doc comments to clipboard entry classes
minetoblend 38b11cf
Fix comments in `Clipboard`
minetoblend 5f7d94d
Undo change to how pointers are freed in `WindowsClipboard.setClipboard`
minetoblend 744d72d
Simplify the data structures used to represent multiple clipboard values
minetoblend beb1d98
Always free pointer after registering clipboard format
27efe4c
Refactor logic to create web custom format clipboard entries
ae106b3
Add documentation explaining the clipboard entries created to support…
def378e
Use consistent ordering for method parameters
51b5fbc
Use UTF8 instead of ansi for web custom format clipboard entries
825b952
Rename variable
74a35fa
Clean up `ClipboardData` and `Clipboard`
7e660f0
Rename variables to be consistent between methods
3398cad
Add doc comment explaining the web custom format fallback when readin…
48115c3
Add documentation for `SetData` return value
6fa516d
Fix formatting for `ClipboardData` values in `Clipboard`
ac78808
Handle cases where registering clipboard format fails
c758183
Add logging for cases where calls to win32 clipboard api fail
629ddff
Add logging for cases where calls to win32 clipboard api fail when re…
7e4231a
Add `SetLastError` flag to dll imports
minetoblend 8081b3c
Fix gibberish in doc comment
minetoblend e0fd3fb
Rename `customFormats` to `registeredFormatIdentifiers`
minetoblend 87f243b
Use `TryGetValue` to retrieve values from web custom format map
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Simplify the data structures used to represent multiple clipboard values
- Loading branch information
commit 744d72db533a7271fb959e879a867c69ea567883
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
| // See the LICENCE file in the repository root for full licence text. | ||
|
|
||
| using System.Collections.Generic; | ||
| using SixLabors.ImageSharp; | ||
|
|
||
| namespace osu.Framework.Platform | ||
| { | ||
| /// <summary> | ||
| /// Holds multiple values that can be copied to the clipboard | ||
bdach marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public struct ClipboardData | ||
| { | ||
| /// <summary> | ||
| /// Text to be stored in the default plaintext format in the clipboard. | ||
| /// </summary> | ||
| public string? Text; | ||
|
|
||
| /// <summary> | ||
| /// Image to be stored in the default image format in the clipboard. | ||
| /// </summary> | ||
| public Image? Image; | ||
|
|
||
| /// <summary> | ||
| /// Values to be stored as custom formats on the clipboard. | ||
| /// </summary> | ||
| public readonly Dictionary<string, string> CustomFormatValues = new Dictionary<string, string>(); | ||
bdach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public ClipboardData() | ||
| { | ||
| Text = null; | ||
| Image = null; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Adds a clipboard entry with a custom format | ||
| /// </summary> | ||
| /// <param name="format">format of the clipboard entry</param> | ||
| /// <param name="value">value of the clipboard entry</param> | ||
| public void AddCustom(string format, string value) | ||
| { | ||
| CustomFormatValues[format] = value; | ||
| } | ||
bdach marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> | ||
| /// Returns true if no data is present | ||
| /// </summary> | ||
| public bool IsEmpty() | ||
| { | ||
| return Text == null && Image == null && CustomFormatValues.Count == 0; | ||
| } | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.