LibGUI: Allow extra metadata when copying bitmaps to the clipboard

This commit is contained in:
Tim Ledbetter 2023-01-16 17:35:24 +00:00 committed by Jelle Raaijmakers
parent d6ddca0c0f
commit 112035d5c3
Notes: sideshowbarker 2024-07-17 07:35:03 +09:00
2 changed files with 3 additions and 3 deletions

View File

@ -137,9 +137,9 @@ void Clipboard::set_data(ReadonlyBytes data, DeprecatedString const& type, HashM
connection().async_set_clipboard_data(move(buffer), type, metadata);
}
void Clipboard::set_bitmap(Gfx::Bitmap const& bitmap)
void Clipboard::set_bitmap(Gfx::Bitmap const& bitmap, HashMap<DeprecatedString, DeprecatedString> const& additional_metadata)
{
HashMap<DeprecatedString, DeprecatedString> metadata;
HashMap<DeprecatedString, DeprecatedString> metadata(additional_metadata);
metadata.set("width", DeprecatedString::number(bitmap.width()));
metadata.set("height", DeprecatedString::number(bitmap.height()));
metadata.set("scale", DeprecatedString::number(bitmap.scale()));

View File

@ -44,7 +44,7 @@ public:
void set_data(ReadonlyBytes data, DeprecatedString const& mime_type = "text/plain", HashMap<DeprecatedString, DeprecatedString> const& metadata = {});
void set_plain_text(DeprecatedString const& text) { set_data(text.bytes()); }
void set_bitmap(Gfx::Bitmap const&);
void set_bitmap(Gfx::Bitmap const&, HashMap<DeprecatedString, DeprecatedString> const& additional_metadata = {});
void clear();
void clipboard_data_changed(Badge<ConnectionToClipboardServer>, DeprecatedString const& mime_type);