mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
LibGUI: Make the Clipboard API deal in raw byte buffers a bit more
To open up for putting not just text/plain content on the clipboard, let's make the GUI::Clipboard API a bit more raw-data-friendly. :^)
This commit is contained in:
parent
802f541184
commit
51146e3075
12 changed files with 43 additions and 38 deletions
|
@ -46,19 +46,19 @@ int main(int argc, char* argv[])
|
|||
auto& clipboard = GUI::Clipboard::the();
|
||||
auto data_and_type = clipboard.data_and_type();
|
||||
|
||||
if (data_and_type.type.is_null()) {
|
||||
if (data_and_type.mime_type.is_null()) {
|
||||
fprintf(stderr, "Nothing copied\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!print_type) {
|
||||
printf("%s", data_and_type.data.characters());
|
||||
printf("%s", data_and_type.data.data());
|
||||
// Append a newline to text contents, but
|
||||
// only if we're not asked not to do this.
|
||||
if (data_and_type.type.starts_with("text/") && !no_newline)
|
||||
if (data_and_type.mime_type.starts_with("text/") && !no_newline)
|
||||
putchar('\n');
|
||||
} else {
|
||||
printf("%s\n", data_and_type.type.characters());
|
||||
printf("%s\n", data_and_type.mime_type.characters());
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue