mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:57:44 +00:00
Userland: Unbreak "copy" and "paste" after GEventLoop removal
Have these programs instantiate a GApplication to ensure they get a connection to the WindowServer, otherwise the clipboard will not work. Sorry Sergey! :^)
This commit is contained in:
parent
a1907011b2
commit
87e768f0e3
2 changed files with 10 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibCore/CEventLoop.h>
|
|
||||||
#include <LibCore/CFile.h>
|
#include <LibCore/CFile.h>
|
||||||
|
#include <LibGUI/GApplication.h>
|
||||||
#include <LibGUI/GClipboard.h>
|
#include <LibGUI/GClipboard.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -86,10 +86,12 @@ Options parse_options(int argc, char* argv[])
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
Options options = parse_options(argc, argv);
|
GApplication app(argc, argv);
|
||||||
|
|
||||||
CEventLoop loop;
|
Options options = parse_options(argc, argv);
|
||||||
|
|
||||||
GClipboard& clipboard = GClipboard::the();
|
GClipboard& clipboard = GClipboard::the();
|
||||||
clipboard.set_data(options.data, options.type);
|
clipboard.set_data(options.data, options.type);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibCore/CEventLoop.h>
|
#include <LibGUI/GApplication.h>
|
||||||
#include <LibGUI/GClipboard.h>
|
#include <LibGUI/GClipboard.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -62,9 +62,9 @@ Options parse_options(int argc, char* argv[])
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
Options options = parse_options(argc, argv);
|
GApplication app(argc, argv);
|
||||||
|
|
||||||
CEventLoop loop;
|
Options options = parse_options(argc, argv);
|
||||||
|
|
||||||
GClipboard& clipboard = GClipboard::the();
|
GClipboard& clipboard = GClipboard::the();
|
||||||
auto data_and_type = clipboard.data_and_type();
|
auto data_and_type = clipboard.data_and_type();
|
||||||
|
@ -78,4 +78,6 @@ int main(int argc, char* argv[])
|
||||||
} else {
|
} else {
|
||||||
printf("%s\n", data_and_type.type.characters());
|
printf("%s\n", data_and_type.type.characters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue