Compare commits

...

2 Commits

Author SHA1 Message Date
7be8edada7 Add child window id to its parent
I had accidentally removed this in b228ef13c4 and it broke all programs
that were using child windows :D
2026-04-15 18:43:03 +03:00
07f2b5dbb7 Add hacky way to die when WindowServer dies
We keep a dummy window around which will receive a close event that
exits once WindowServer dies :^)
2026-04-15 18:21:03 +03:00
2 changed files with 34 additions and 12 deletions

View File

@@ -1400,6 +1400,8 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
if (event_mask != 0) if (event_mask != 0)
TRY(object_it->value->object.get<Object::Window>().event_masks.insert(&client_info, event_mask)); TRY(object_it->value->object.get<Object::Window>().event_masks.insert(&client_info, event_mask));
TRY(parent_window.children.push_back(request.wid));
if (gui_window_ptr) if (gui_window_ptr)
{ {
const WINDOW wid = request.wid; const WINDOW wid = request.wid;

View File

@@ -18,19 +18,20 @@
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
static const xRectangle s_screen_bounds = static BAN::UniqPtr<LibGUI::Window> s_dummy_window =
[]() { []() {
auto attributes = LibGUI::Window::default_attributes; auto attributes = LibGUI::Window::default_attributes;
attributes.shown = false; attributes.shown = false;
auto window = MUST(LibGUI::Window::create(0, 0, ""_sv, attributes)); return MUST(LibGUI::Window::create(0, 0, ""_sv, attributes));
return xRectangle {
.x = 0,
.y = 0,
.width = static_cast<CARD16>(window->width()),
.height = static_cast<CARD16>(window->height()),
};
}(); }();
static const xRectangle s_screen_bounds = {
.x = 0,
.y = 0,
.width = static_cast<CARD16>(s_dummy_window->width()),
.height = static_cast<CARD16>(s_dummy_window->height()),
};
const xPixmapFormat g_formats[6] { const xPixmapFormat g_formats[6] {
{ {
.depth = 1, .depth = 1,
@@ -172,11 +173,24 @@ int main()
return 1; return 1;
} }
epoll_event event { .events = EPOLLIN, .data = { .ptr = nullptr } };
if (epoll_ctl(g_epoll_fd, EPOLL_CTL_ADD, server_sock, &event) == -1)
{ {
perror("xbanan: epoll_ctl"); epoll_event event { .events = EPOLLIN, .data = { .ptr = nullptr } };
return 1; if (epoll_ctl(g_epoll_fd, EPOLL_CTL_ADD, server_sock, &event) == -1)
{
perror("xbanan: epoll_ctl");
return 1;
}
}
{
epoll_event event { .events = EPOLLIN, .data = { .ptr = (void*)1 } };
if (epoll_ctl(g_epoll_fd, EPOLL_CTL_ADD, s_dummy_window->server_fd(), &event) == -1)
{
perror("xbanan: epoll_ctl");
return 1;
}
s_dummy_window->request_resize(1, 1);
} }
#define APPEND_ATOM(name) do { \ #define APPEND_ATOM(name) do { \
@@ -397,6 +411,12 @@ int main()
continue; continue;
} }
if (events[i].data.ptr == (void*)1)
{
s_dummy_window->poll_events();
continue;
}
auto it = g_epoll_thingies.find(events[i].data.fd); auto it = g_epoll_thingies.find(events[i].data.fd);
if (it == g_epoll_thingies.end()) if (it == g_epoll_thingies.end())
continue; continue;