forked from Bananymous/banan-os
LibGUI: Window Creation takes attributes as an argument
This reduces windows showing/moving once they are opened and setting their attributes.
This commit is contained in:
@@ -22,15 +22,14 @@ int main()
|
||||
|
||||
auto font = MUST(LibFont::Font::load("/usr/share/fonts/lat0-16.psfu"_sv));
|
||||
|
||||
auto window = MUST(LibGUI::Window::create(0, font.height() + 2 * padding, "TaskBar"));
|
||||
|
||||
auto attributes = LibGUI::Window::default_attributes;
|
||||
attributes.title_bar = false;
|
||||
attributes.movable = false;
|
||||
attributes.focusable = false;
|
||||
attributes.alpha_channel = false;
|
||||
attributes.rounded_corners = false;
|
||||
window->set_attributes(attributes);
|
||||
|
||||
auto window = MUST(LibGUI::Window::create(0, font.height() + 2 * padding, "TaskBar", attributes));
|
||||
|
||||
window->set_close_window_event_callback([]() {});
|
||||
|
||||
|
||||
@@ -110,12 +110,10 @@ void Terminal::run()
|
||||
m_bg_color = s_colors_dark[0];
|
||||
m_fg_color = s_colors_bright[7];
|
||||
|
||||
m_window = MUST(LibGUI::Window::create(600, 400, "Terminal"_sv));
|
||||
|
||||
auto attributes = LibGUI::Window::default_attributes;
|
||||
attributes.alpha_channel = true;
|
||||
m_window->set_attributes(attributes);
|
||||
|
||||
m_window = MUST(LibGUI::Window::create(600, 400, "Terminal"_sv, attributes));
|
||||
m_window->fill(m_bg_color);
|
||||
m_window->invalidate();
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ void WindowServer::on_window_create(int fd, const LibGUI::WindowPacket::WindowCr
|
||||
return;
|
||||
}
|
||||
|
||||
window->set_attributes(packet.attributes);
|
||||
window->set_position({
|
||||
static_cast<int32_t>((m_framebuffer.width - window->client_width()) / 2),
|
||||
static_cast<int32_t>((m_framebuffer.height - window->client_height()) / 2),
|
||||
|
||||
Reference in New Issue
Block a user