mouse.events.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <planet/events/mouse.hpp>

#include <optional>


felspar::coro::stream<planet::events::click>
        planet::events::identify_clicks(felspar::coro::stream<mouse> events) {
    while (auto event = co_await events.next()) {
        if (event->action == action::up and event->clicks) {
            co_yield click{
                    event->button, event->location, event->clicks,
                    event->timestamp};
        }
    }
}