LibGUI: Add background color for windows

This is used when resizing a window to fill the empty space
This commit is contained in:
Bananymous 2025-05-05 03:12:31 +03:00
parent c0181820a9
commit fcfadd7c74
2 changed files with 6 additions and 1 deletions

View File

@ -355,7 +355,7 @@ namespace LibGUI
m_framebuffer_smo = nullptr;
BAN::Vector<uint32_t> framebuffer;
TRY(framebuffer.resize(event.width * event.height, 0xFFFFFFFF));
TRY(framebuffer.resize(event.width * event.height, m_bg_color));
void* framebuffer_addr = smo_map(event.smo_key);
if (framebuffer_addr == nullptr)

View File

@ -82,6 +82,9 @@ namespace LibGUI
uint32_t width() const { return m_width; }
uint32_t height() const { return m_height; }
// used on resize to fill empty space
void set_bg_color(uint32_t bg_color) { m_bg_color = bg_color; }
void poll_events();
void set_socket_error_callback(BAN::Function<void()> callback) { m_socket_error_callback = callback; }
void set_close_window_event_callback(BAN::Function<void()> callback) { m_close_window_event_callback = callback; }
@ -118,6 +121,8 @@ namespace LibGUI
uint32_t m_width { 0 };
uint32_t m_height { 0 };
uint32_t m_bg_color { 0xFFFFFFFF };
BAN::Function<void()> m_socket_error_callback;
BAN::Function<void()> m_close_window_event_callback;
BAN::Function<void()> m_resize_window_event_callback;