wind: Add debug keybind
This commit is contained in:
parent
7e7f0a96f5
commit
6375fb965a
@ -18,6 +18,34 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
static void debug(const Vector<Client>& clients)
|
||||||
|
{
|
||||||
|
os::println("--- wind: DEBUG OUTPUT ---");
|
||||||
|
|
||||||
|
os::println("-- wind: Listing clients --");
|
||||||
|
|
||||||
|
for (const auto& client : clients)
|
||||||
|
{
|
||||||
|
os::println("Client with fd %d, owns %zu windows", client.conn.fd(), client.windows.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
os::println("-- wind: Listing windows --");
|
||||||
|
|
||||||
|
for (const auto& window : g_windows)
|
||||||
|
{
|
||||||
|
os::println("Window of client (fd %d), id %d, %sdecorated, %sdirty (\"%s\") (%d,%d,%d,%d)",
|
||||||
|
window->client->conn.fd(), window->id, window->decorated ? "" : "not ", window->dirty ? "" : "not ",
|
||||||
|
window->name.chars(), window->surface.pos.x, window->surface.pos.y, window->surface.width,
|
||||||
|
window->surface.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
os::println("-- wind: Listing processes --");
|
||||||
|
|
||||||
|
system("ps");
|
||||||
|
|
||||||
|
os::println("--- wind: END DEBUG OUTPUT ---");
|
||||||
|
}
|
||||||
|
|
||||||
Result<int> luna_main(int argc, char** argv)
|
Result<int> luna_main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
srand((unsigned)time(NULL));
|
srand((unsigned)time(NULL));
|
||||||
@ -91,7 +119,7 @@ Result<int> luna_main(int argc, char** argv)
|
|||||||
TRY(fds.try_append({ .fd = keyboard->fd(), .events = POLLIN, .revents = 0 }));
|
TRY(fds.try_append({ .fd = keyboard->fd(), .events = POLLIN, .revents = 0 }));
|
||||||
TRY(fds.try_append({ .fd = server->fd(), .events = POLLIN, .revents = 0 }));
|
TRY(fds.try_append({ .fd = server->fd(), .events = POLLIN, .revents = 0 }));
|
||||||
|
|
||||||
TRY(os::Security::pledge("stdio rpath wpath cpath unix signal proc", NULL));
|
TRY(os::Security::pledge("stdio rpath wpath cpath unix signal proc exec", NULL));
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -117,6 +145,7 @@ Result<int> luna_main(int argc, char** argv)
|
|||||||
moon::KeyboardPacket packet;
|
moon::KeyboardPacket packet;
|
||||||
TRY(keyboard->read_typed(packet));
|
TRY(keyboard->read_typed(packet));
|
||||||
os::println("%s key %d", packet.released ? "Released" : "Pressed", packet.key);
|
os::println("%s key %d", packet.released ? "Released" : "Pressed", packet.key);
|
||||||
|
if (!packet.released && packet.key == moon::K_Tab) debug(clients);
|
||||||
}
|
}
|
||||||
for (usize i = 0; i < clients.size(); i++)
|
for (usize i = 0; i < clients.size(); i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user