mirror of
https://github.com/RGBCube/serenity
synced 2025-06-12 04:32:07 +00:00
LibWeb: Port the WebContent service to Core::AnonymousBuffer for themes
This commit is contained in:
parent
04f95f9160
commit
d846808122
4 changed files with 7 additions and 12 deletions
|
@ -73,13 +73,8 @@ OwnPtr<Messages::WebContentServer::GreetResponse> ClientConnection::handle(const
|
||||||
|
|
||||||
void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemTheme& message)
|
void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemTheme& message)
|
||||||
{
|
{
|
||||||
auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id());
|
Gfx::set_system_theme(message.theme_buffer());
|
||||||
if (!shared_buffer) {
|
auto impl = Gfx::PaletteImpl::create_with_anonymous_buffer(message.theme_buffer());
|
||||||
dbgln("WebContentServer::UpdateSystemTheme: SharedBuffer already gone! Ignoring :^)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Gfx::set_system_theme(*shared_buffer);
|
|
||||||
auto impl = Gfx::PaletteImpl::create_with_shared_buffer(*shared_buffer);
|
|
||||||
m_page_host->set_palette_impl(*impl);
|
m_page_host->set_palette_impl(*impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,11 @@ PageHost::~PageHost()
|
||||||
void PageHost::setup_palette()
|
void PageHost::setup_palette()
|
||||||
{
|
{
|
||||||
// FIXME: Get the proper palette from our peer somehow
|
// FIXME: Get the proper palette from our peer somehow
|
||||||
auto buffer = SharedBuffer::create_with_size(sizeof(Gfx::SystemTheme));
|
auto buffer = Core::AnonymousBuffer::create_with_size(sizeof(Gfx::SystemTheme));
|
||||||
auto* theme = buffer->data<Gfx::SystemTheme>();
|
auto* theme = buffer.data<Gfx::SystemTheme>();
|
||||||
theme->color[(int)Gfx::ColorRole::Window] = Color::Magenta;
|
theme->color[(int)Gfx::ColorRole::Window] = Color::Magenta;
|
||||||
theme->color[(int)Gfx::ColorRole::WindowText] = Color::Cyan;
|
theme->color[(int)Gfx::ColorRole::WindowText] = Color::Cyan;
|
||||||
m_palette_impl = Gfx::PaletteImpl::create_with_shared_buffer(*buffer);
|
m_palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::Palette PageHost::palette() const
|
Gfx::Palette PageHost::palette() const
|
||||||
|
|
|
@ -2,7 +2,7 @@ endpoint WebContentServer = 89
|
||||||
{
|
{
|
||||||
Greet(i32 client_pid) => (i32 client_id, i32 server_pid)
|
Greet(i32 client_pid) => (i32 client_id, i32 server_pid)
|
||||||
|
|
||||||
UpdateSystemTheme(i32 shbuf_id) =|
|
UpdateSystemTheme(Core::AnonymousBuffer theme_buffer) =|
|
||||||
|
|
||||||
LoadURL(URL url) =|
|
LoadURL(URL url) =|
|
||||||
LoadHTML(String html, URL url) =|
|
LoadHTML(String html, URL url) =|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
Core::EventLoop event_loop;
|
Core::EventLoop event_loop;
|
||||||
if (pledge("stdio sendfd shared_buffer accept unix rpath recvfd", nullptr) < 0) {
|
if (pledge("stdio recvfd sendfd shared_buffer accept unix rpath recvfd", nullptr) < 0) {
|
||||||
perror("pledge");
|
perror("pledge");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue