MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ filter_matches()

bool MayaFlux::Kriya::WindowEventAwaiter::filter_matches ( const void *  event) const
overridevirtual

Casts event to Core::WindowEvent and checks against stored filter.

Parameters
eventType-erased pointer to Core::WindowEvent.

Implements MayaFlux::Kriya::EventAwaiter.

Definition at line 45 of file EventAwaiter.cpp.

46{
47 const auto* ev = static_cast<const Core::WindowEvent*>(event);
48
49 if (m_filter.event_type && ev->type != *m_filter.event_type)
50 return false;
51
52 if (m_filter.key_code) {
53 const auto* kd = std::get_if<Core::WindowEvent::KeyData>(&ev->data);
54 if (!kd || kd->key != static_cast<int16_t>(*m_filter.key_code))
55 return false;
56 }
57
58 if (m_filter.button) {
59 const auto* bd = std::get_if<Core::WindowEvent::MouseButtonData>(&ev->data);
60 if (!bd || bd->button != static_cast<int>(*m_filter.button))
61 return false;
62 }
63
64 return true;
65}
Vruta::WindowEventFilter m_filter
std::optional< Core::WindowEventType > event_type
std::optional< IO::MouseButtons > button

References MayaFlux::Vruta::WindowEventFilter::button, MayaFlux::Vruta::WindowEventFilter::event_type, MayaFlux::Vruta::WindowEventFilter::key_code, and m_filter.

Referenced by try_resume().

+ Here is the caller graph for this function: