mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
AK: Revert Eternal<T> for now since it doesn't work as intended.
This commit is contained in:
parent
fb6dc5350d
commit
bcc00857a4
14 changed files with 51 additions and 67 deletions
|
@ -3,7 +3,19 @@
|
|||
#include <WindowServer/WSAPITypes.h>
|
||||
#include <LibC/SharedBuffer.h>
|
||||
|
||||
String GClipboard::data()
|
||||
GClipboard& GClipboard::the()
|
||||
{
|
||||
static GClipboard* s_the;
|
||||
if (!s_the)
|
||||
s_the = new GClipboard;
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
GClipboard::GClipboard()
|
||||
{
|
||||
}
|
||||
|
||||
String GClipboard::data() const
|
||||
{
|
||||
WSAPI_ClientMessage request;
|
||||
request.type = WSAPI_ClientMessage::Type::GetClipboardContents;
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
class GClipboard {
|
||||
public:
|
||||
static String data();
|
||||
static void set_data(const String&);
|
||||
static GClipboard& the();
|
||||
|
||||
String data() const;
|
||||
void set_data(const String&);
|
||||
|
||||
private:
|
||||
GClipboard();
|
||||
};
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#include <LibGUI/GDesktop.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <AK/Eternal.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
GDesktop& GDesktop::the()
|
||||
{
|
||||
static Eternal<GDesktop> the;
|
||||
return the;
|
||||
static GDesktop* the;
|
||||
if (!the)
|
||||
the = new GDesktop;
|
||||
return *the;
|
||||
}
|
||||
|
||||
GDesktop::GDesktop()
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
#include <LibGUI/GFontDatabase.h>
|
||||
#include <SharedGraphics/Font.h>
|
||||
#include <AK/Eternal.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static GFontDatabase* s_the;
|
||||
|
||||
GFontDatabase& GFontDatabase::the()
|
||||
{
|
||||
static Eternal<GFontDatabase> the;
|
||||
return the;
|
||||
if (!s_the)
|
||||
s_the = new GFontDatabase;
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
GFontDatabase::GFontDatabase()
|
||||
|
|
|
@ -9,13 +9,13 @@ class Font;
|
|||
class GFontDatabase {
|
||||
public:
|
||||
static GFontDatabase& the();
|
||||
GFontDatabase();
|
||||
|
||||
RetainPtr<Font> get_by_name(const String&);
|
||||
void for_each_font(Function<void(const String&)>);
|
||||
void for_each_fixed_width_font(Function<void(const String&)>);
|
||||
|
||||
private:
|
||||
GFontDatabase();
|
||||
~GFontDatabase();
|
||||
|
||||
struct Metadata {
|
||||
|
|
|
@ -785,7 +785,7 @@ void GTextEditor::cut()
|
|||
{
|
||||
auto selected_text = this->selected_text();
|
||||
printf("Cut: \"%s\"\n", selected_text.characters());
|
||||
GClipboard::set_data(selected_text);
|
||||
GClipboard::the().set_data(selected_text);
|
||||
delete_selection();
|
||||
}
|
||||
|
||||
|
@ -793,12 +793,12 @@ void GTextEditor::copy()
|
|||
{
|
||||
auto selected_text = this->selected_text();
|
||||
printf("Copy: \"%s\"\n", selected_text.characters());
|
||||
GClipboard::set_data(selected_text);
|
||||
GClipboard::the().set_data(selected_text);
|
||||
}
|
||||
|
||||
void GTextEditor::paste()
|
||||
{
|
||||
auto paste_text = GClipboard::data();
|
||||
auto paste_text = GClipboard::the().data();
|
||||
printf("Paste: \"%s\"\n", paste_text.characters());
|
||||
insert_at_cursor_or_replace_selection(paste_text);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue