This commit is contained in:
Raphael Robatsch 2021-10-30 11:20:27 +02:00
parent a4cbf117c9
commit 7b31d4cc54
2 changed files with 10 additions and 16 deletions

View file

@ -39,11 +39,6 @@ extern wl_compositor* compositor;
extern wl_shm* shm; extern wl_shm* shm;
extern zwlr_layer_shell_v1* wlrLayerShell; extern zwlr_layer_shell_v1* wlrLayerShell;
void view(Monitor& m, const Arg& arg);
void toggleview(Monitor& m, const Arg& arg);
void setlayout(Monitor& m, const Arg& arg);
void tag(Monitor& m, const Arg& arg);
void toggletag(Monitor& m, const Arg& arg);
void spawn(Monitor&, const Arg& arg); void spawn(Monitor&, const Arg& arg);
[[noreturn]] void die(const char* why); [[noreturn]] void die(const char* why);

View file

@ -52,7 +52,7 @@ static void updatemon(Monitor &mon);
static void setupStatusFifo(); static void setupStatusFifo();
static void onStatus(); static void onStatus();
static void onStdin(); static void onStdin();
static void handleStdin(); static void handleStdin(const std::string& line);
static void cleanup(); static void cleanup();
static void requireGlobal(const void* p, const char* name); static void requireGlobal(const void* p, const char* name);
static void waylandFlush(); static void waylandFlush();
@ -208,14 +208,6 @@ static void onReady()
setupStatusFifo(); setupStatusFifo();
wl_display_roundtrip(display); // roundtrip so we receive all dwl tags etc. wl_display_roundtrip(display); // roundtrip so we receive all dwl tags etc.
epoll_event epollEv = {0};
epollEv.events = EPOLLIN;
epollEv.data.fd = 0;
fcntl(0, F_SETFL, O_NONBLOCK);
if (epoll_ctl(epoll, EPOLL_CTL_ADD, 0, &epollEv) < 0) {
diesys("epoll_ctl add stdin");
}
ready = true; ready = true;
for (auto& monitor : monitors) { for (auto& monitor : monitors) {
setupMonitor(monitor); setupMonitor(monitor);
@ -297,7 +289,7 @@ static void handleStdin(const std::string& line)
state |= TagState::Active; state |= TagState::Active;
if (urgent & tagMask) if (urgent & tagMask)
state |= TagState::Urgent; state |= TagState::Urgent;
mon->bar->setTag(i, state, occupied & tagMask ? 1 : 0, clientTags ? 1 : 0); mon->bar->setTag(i, state, occupied & tagMask ? 1 : 0, clientTags & tagMask ? 0 : -1);
} }
mon->tags = tags; mon->tags = tags;
} else if (command == "layout") { } else if (command == "layout") {
@ -485,6 +477,13 @@ int main(int argc, char* argv[])
diesys("epoll_ctl add wayland_display"); diesys("epoll_ctl add wayland_display");
} }
epollEv.events = EPOLLIN;
epollEv.data.fd = STDIN_FILENO;
if (epoll_ctl(epoll, EPOLL_CTL_ADD, STDIN_FILENO, &epollEv) < 0) {
diesys("epoll_ctl add stdin");
}
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK);
while (!quitting) { while (!quitting) {
waylandFlush(); waylandFlush();
auto res = epoll_wait(epoll, epollEvents.data(), epollEvents.size(), -1); auto res = epoll_wait(epoll, epollEvents.data(), epollEvents.size(), -1);
@ -508,7 +507,7 @@ int main(int argc, char* argv[])
} }
waylandFlush(); waylandFlush();
} }
} else if (ev.data.fd == 0) { } else if (ev.data.fd == STDIN_FILENO) {
onStdin(); onStdin();
} else if (ev.data.fd == statusFifoFd) { } else if (ev.data.fd == statusFifoFd) {
onStatus(); onStatus();