quick hack to replace epoll with poll

This commit is contained in:
2026-06-04 03:26:29 +03:00
parent e843be0a1c
commit f5a6fe4497
5 changed files with 58 additions and 166 deletions

View File

@@ -12,7 +12,6 @@
#include <X11/Xatom.h>
#include <time.h>
#include <sys/epoll.h>
struct Selection
{
@@ -1814,9 +1813,9 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
(void)TRY_REF(get_window(client_info, wid, X_SendEvent));
Client* target_client = nullptr;
for (auto& [_, thingy] : g_epoll_thingies)
for (auto& [_, thingy] : g_pollables)
{
if (thingy.type != EpollThingy::Type::Client)
if (thingy.type != Pollable::Type::Client)
continue;
auto& other_client = thingy.value.get<Client>();
if (!other_client.objects.contains(wid))
@@ -1938,47 +1937,11 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
case X_GrabServer:
{
g_server_grabber_fd = client_info.fd;
for (const auto& [_, thingy] : g_epoll_thingies)
{
if (thingy.type != EpollThingy::Type::Client)
continue;
auto& other_client = thingy.value.get<Client>();
if (client_info.fd == other_client.fd)
continue;
uint32_t events = 0;
if (other_client.has_epollout)
events |= EPOLLOUT;
epoll_event event { .events = events, .data = { .fd = other_client.fd } };
epoll_ctl(g_epoll_fd, EPOLL_CTL_MOD, other_client.fd, &event);
}
break;
}
case X_UngrabServer:
{
g_server_grabber_fd = -1;
for (const auto& [_, thingy] : g_epoll_thingies)
{
if (thingy.type != EpollThingy::Type::Client)
continue;
auto& other_client = thingy.value.get<Client>();
if (client_info.fd == other_client.fd)
continue;
uint32_t events = EPOLLIN;
if (other_client.has_epollout)
events |= EPOLLOUT;
epoll_event event { .events = events, .data = { .fd = other_client.fd } };
epoll_ctl(g_epoll_fd, EPOLL_CTL_MOD, other_client.fd, &event);
}
break;
}
case X_QueryPointer: