MayaFlux 0.4.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 46 of file EventAwaiter.cpp.

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