Compare commits

..

No commits in common. "0228cd4f31f3304090a4ce44fc4eb86f58acd0ac" and "04eee2ea75e965c0d14024a794b1a83d8dc5172b" have entirely different histories.

7 changed files with 21 additions and 23 deletions

View File

@ -103,8 +103,8 @@ namespace Kernel
// {kernel,userspace}_stack has to be destroyed before page table
BAN::UniqPtr<PageTable> m_keep_alive_page_table;
static constexpr size_t m_kernel_stack_size { PAGE_SIZE * 8 };
static constexpr size_t m_userspace_stack_size { PAGE_SIZE * 128 };
static constexpr size_t m_kernel_stack_size { PAGE_SIZE * 64 };
static constexpr size_t m_userspace_stack_size { PAGE_SIZE * 64 };
BAN::UniqPtr<VirtualRange> m_kernel_stack;
BAN::UniqPtr<VirtualRange> m_userspace_stack;
const pid_t m_tid { 0 };

View File

@ -62,7 +62,7 @@ namespace LibGUI
cleanup();
}
BAN::ErrorOr<BAN::UniqPtr<Window>> Window::create(uint32_t width, uint32_t height, BAN::StringView title, Attributes attributes)
BAN::ErrorOr<BAN::UniqPtr<Window>> Window::create(uint32_t width, uint32_t height, BAN::StringView title)
{
int server_fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (server_fd == -1)
@ -101,7 +101,7 @@ namespace LibGUI
TRY(create_packet.title.append(title));
TRY(create_packet.send_serialized(server_fd));
auto window = TRY(BAN::UniqPtr<Window>::create(server_fd, attributes));
auto window = TRY(BAN::UniqPtr<Window>::create(server_fd));
bool resized = false;
window->set_resize_window_event_callback([&]() { resized = true; });

View File

@ -178,20 +178,10 @@ namespace LibGUI
namespace WindowPacket
{
struct Attributes
{
bool title_bar;
bool movable;
bool focusable;
bool rounded_corners;
bool alpha_channel;
};
DEFINE_PACKET(
WindowCreate,
uint32_t, width,
uint32_t, height,
Attributes, attributes,
BAN::String, title
);
@ -209,8 +199,15 @@ namespace LibGUI
int32_t, y
);
DEFINE_PACKET(
DEFINE_PACKET_EXTRA(
WindowSetAttributes,
struct Attributes {
bool title_bar;
bool movable;
bool focusable;
bool rounded_corners;
bool alpha_channel;
},
Attributes, attributes
);

View File

@ -14,7 +14,7 @@ namespace LibGUI
class Window
{
public:
using Attributes = WindowPacket::Attributes;
using Attributes = WindowPacket::WindowSetAttributes::Attributes;
static constexpr Attributes default_attributes = {
.title_bar = true,
@ -27,7 +27,7 @@ namespace LibGUI
public:
~Window();
static BAN::ErrorOr<BAN::UniqPtr<Window>> create(uint32_t width, uint32_t height, BAN::StringView title, Attributes attributes = default_attributes);
static BAN::ErrorOr<BAN::UniqPtr<Window>> create(uint32_t width, uint32_t height, BAN::StringView title);
void set_pixel(uint32_t x, uint32_t y, uint32_t color)
{
@ -87,9 +87,8 @@ namespace LibGUI
int server_fd() const { return m_server_fd; }
private:
Window(int server_fd, Attributes attributes)
Window(int server_fd)
: m_server_fd(server_fd)
, m_attributes(attributes)
{ }
bool clamp_to_framebuffer(int32_t& x, int32_t& y, uint32_t& width, uint32_t& height) const;

View File

@ -22,14 +22,15 @@ 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;
auto window = MUST(LibGUI::Window::create(0, font.height() + 2 * padding, "TaskBar", attributes));
window->set_attributes(attributes);
window->set_close_window_event_callback([]() {});

View File

@ -110,10 +110,12 @@ 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();

View File

@ -67,7 +67,6 @@ 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),