1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +00:00

Kernel+LibC: Rename shared buffer syscalls to use a prefix

This feels a lot more consistent and Unixy:

    create_shared_buffer()   => shbuf_create()
    share_buffer_with()      => shbuf_allow_pid()
    share_buffer_globally()  => shbuf_allow_all()
    get_shared_buffer()      => shbuf_get()
    release_shared_buffer()  => shbuf_release()
    seal_shared_buffer()     => shbuf_seal()
    get_shared_buffer_size() => shbuf_get_size()

Also, "shared_buffer_id" is shortened to "shbuf_id" all around.
This commit is contained in:
Andreas Kling 2020-02-28 11:45:19 +01:00
parent 8460d02651
commit f72e5bbb17
36 changed files with 549 additions and 549 deletions

View file

@ -46,9 +46,9 @@ Clipboard::Clipboard()
Clipboard::DataAndType Clipboard::data_and_type() const
{
auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::GetClipboardContents>();
if (response->shared_buffer_id() < 0)
if (response->shbuf_id() < 0)
return {};
auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(response->shared_buffer_id());
auto shared_buffer = SharedBuffer::create_from_shbuf_id(response->shbuf_id());
if (!shared_buffer) {
dbgprintf("GUI::Clipboard::data() failed to attach to the shared buffer\n");
return {};
@ -76,7 +76,7 @@ void Clipboard::set_data(const StringView& data, const String& type)
shared_buffer->seal();
shared_buffer->share_with(WindowServerConnection::the().server_pid());
WindowServerConnection::the().send_sync<Messages::WindowServer::SetClipboardContents>(shared_buffer->shared_buffer_id(), data.length(), type);
WindowServerConnection::the().send_sync<Messages::WindowServer::SetClipboardContents>(shared_buffer->shbuf_id(), data.length(), type);
}
void Clipboard::did_receive_clipboard_contents_changed(Badge<WindowServerConnection>, const String& data_type)

View file

@ -55,7 +55,7 @@ DragOperation::Outcome DragOperation::exec()
if (m_bitmap) {
shared_bitmap = m_bitmap->to_shareable_bitmap();
shared_bitmap->shared_buffer()->share_with(WindowServerConnection::the().server_pid());
bitmap_id = shared_bitmap->shared_buffer_id();
bitmap_id = shared_bitmap->shbuf_id();
bitmap_size = shared_bitmap->size();
}

View file

@ -128,7 +128,7 @@ int Menu::realize_menu()
if (action.icon()) {
ASSERT(action.icon()->format() == Gfx::BitmapFormat::RGBA32);
ASSERT(action.icon()->size() == Gfx::Size(16, 16));
if (action.icon()->shared_buffer_id() == -1) {
if (action.icon()->shbuf_id() == -1) {
auto shared_buffer = SharedBuffer::create_with_size(action.icon()->size_in_bytes());
ASSERT(shared_buffer);
auto shared_icon = Gfx::Bitmap::create_with_shared_buffer(Gfx::BitmapFormat::RGBA32, *shared_buffer, action.icon()->size());
@ -137,7 +137,7 @@ int Menu::realize_menu()
shared_buffer->share_with(WindowServerConnection::the().server_pid());
action.set_icon(shared_icon);
}
icon_buffer_id = action.icon()->shared_buffer_id();
icon_buffer_id = action.icon()->shbuf_id();
}
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String();
bool exclusive = action.group() && action.group()->is_exclusive() && action.is_checkable();

View file

@ -477,7 +477,7 @@ void Window::set_hovered_widget(Widget* widget)
void Window::set_current_backing_bitmap(Gfx::Bitmap& bitmap, bool flush_immediately)
{
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBackingStore>(m_window_id, 32, bitmap.pitch(), bitmap.shared_buffer_id(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately);
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBackingStore>(m_window_id, 32, bitmap.pitch(), bitmap.shbuf_id(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately);
}
void Window::flip(const Vector<Gfx::Rect, 32>& dirty_rects)
@ -551,17 +551,17 @@ void Window::apply_icon()
if (!m_window_id)
return;
int rc = seal_shared_buffer(m_icon->shared_buffer_id());
int rc = shbuf_seal(m_icon->shbuf_id());
ASSERT(rc == 0);
rc = share_buffer_globally(m_icon->shared_buffer_id());
rc = shbuf_allow_all(m_icon->shbuf_id());
ASSERT(rc == 0);
static bool has_set_process_icon;
if (!has_set_process_icon)
set_process_icon(m_icon->shared_buffer_id());
set_process_icon(m_icon->shbuf_id());
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->shared_buffer_id(), m_icon->size());
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowIconBitmap>(m_window_id, m_icon->shbuf_id(), m_icon->size());
}
void Window::start_wm_resize()

View file

@ -53,9 +53,9 @@ WindowServerConnection& WindowServerConnection::the()
return *s_connection;
}
static void set_system_theme_from_shared_buffer_id(int id)
static void set_system_theme_from_shbuf_id(int id)
{
auto system_theme = SharedBuffer::create_from_shared_buffer_id(id);
auto system_theme = SharedBuffer::create_from_shbuf_id(id);
ASSERT(system_theme);
Gfx::set_system_theme(*system_theme);
Application::the().set_system_palette(*system_theme);
@ -65,13 +65,13 @@ void WindowServerConnection::handshake()
{
auto response = send_sync<Messages::WindowServer::Greet>();
set_my_client_id(response->client_id());
set_system_theme_from_shared_buffer_id(response->system_theme_buffer_id());
set_system_theme_from_shbuf_id(response->system_theme_buffer_id());
Desktop::the().did_receive_screen_rect({}, response->screen_rect());
}
void WindowServerConnection::handle(const Messages::WindowClient::UpdateSystemTheme& message)
{
set_system_theme_from_shared_buffer_id(message.system_theme_buffer_id());
set_system_theme_from_shbuf_id(message.system_theme_buffer_id());
Window::update_all_windows({});
}