mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 14:35:07 +00:00
LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
This commit is contained in:
parent
2d39da5405
commit
c5bd9d4ed1
337 changed files with 5400 additions and 4816 deletions
|
@ -28,30 +28,32 @@
|
|||
#include <LibGUI/GClipboard.h>
|
||||
#include <LibGUI/GWindowServerConnection.h>
|
||||
|
||||
GClipboard& GClipboard::the()
|
||||
namespace GUI {
|
||||
|
||||
Clipboard& Clipboard::the()
|
||||
{
|
||||
static GClipboard* s_the;
|
||||
static Clipboard* s_the;
|
||||
if (!s_the)
|
||||
s_the = new GClipboard;
|
||||
s_the = new Clipboard;
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
GClipboard::GClipboard()
|
||||
Clipboard::Clipboard()
|
||||
{
|
||||
}
|
||||
|
||||
GClipboard::DataAndType GClipboard::data_and_type() const
|
||||
Clipboard::DataAndType Clipboard::data_and_type() const
|
||||
{
|
||||
auto response = GWindowServerConnection::the().send_sync<WindowServer::GetClipboardContents>();
|
||||
auto response = WindowServerConnection::the().send_sync<WindowServer::GetClipboardContents>();
|
||||
if (response->shared_buffer_id() < 0)
|
||||
return {};
|
||||
auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(response->shared_buffer_id());
|
||||
if (!shared_buffer) {
|
||||
dbgprintf("GClipboard::data() failed to attach to the shared buffer\n");
|
||||
dbgprintf("GUI::Clipboard::data() failed to attach to the shared buffer\n");
|
||||
return {};
|
||||
}
|
||||
if (response->content_size() > shared_buffer->size()) {
|
||||
dbgprintf("GClipboard::data() clipping contents size is greater than shared buffer size\n");
|
||||
dbgprintf("GUI::Clipboard::data() clipping contents size is greater than shared buffer size\n");
|
||||
return {};
|
||||
}
|
||||
auto data = String((const char*)shared_buffer->data(), response->content_size());
|
||||
|
@ -59,11 +61,11 @@ GClipboard::DataAndType GClipboard::data_and_type() const
|
|||
return { data, type };
|
||||
}
|
||||
|
||||
void GClipboard::set_data(const StringView& data, const String& type)
|
||||
void Clipboard::set_data(const StringView& data, const String& type)
|
||||
{
|
||||
auto shared_buffer = SharedBuffer::create_with_size(data.length() + 1);
|
||||
if (!shared_buffer) {
|
||||
dbgprintf("GClipboard::set_data() failed to create a shared buffer\n");
|
||||
dbgprintf("GUI::Clipboard::set_data() failed to create a shared buffer\n");
|
||||
return;
|
||||
}
|
||||
if (!data.is_empty())
|
||||
|
@ -71,13 +73,15 @@ void GClipboard::set_data(const StringView& data, const String& type)
|
|||
else
|
||||
((u8*)shared_buffer->data())[0] = '\0';
|
||||
shared_buffer->seal();
|
||||
shared_buffer->share_with(GWindowServerConnection::the().server_pid());
|
||||
shared_buffer->share_with(WindowServerConnection::the().server_pid());
|
||||
|
||||
GWindowServerConnection::the().send_sync<WindowServer::SetClipboardContents>(shared_buffer->shared_buffer_id(), data.length(), type);
|
||||
WindowServerConnection::the().send_sync<WindowServer::SetClipboardContents>(shared_buffer->shared_buffer_id(), data.length(), type);
|
||||
}
|
||||
|
||||
void GClipboard::did_receive_clipboard_contents_changed(Badge<GWindowServerConnection>, const String& data_type)
|
||||
void Clipboard::did_receive_clipboard_contents_changed(Badge<WindowServerConnection>, const String& data_type)
|
||||
{
|
||||
if (on_content_change)
|
||||
on_content_change(data_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue