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

◆ text_input()

MAYAFLUX_API Vruta::Event MayaFlux::Kriya::text_input ( std::shared_ptr< Core::Window >  window,
std::function< void(uint32_t)>  callback 
)

Creates an Event coroutine that triggers on resolved text input.

Delivers composed Unicode codepoints (shift, layout, dead-key/compose, and IME already resolved by the backend), distinct from key_pressed's raw keycodes. See Core::WindowEventType::TEXT_INPUT.

Parameters
windowWindow to listen to.
callbackCalled with the resolved Unicode codepoint.
Returns
Event coroutine that can be added to EventManager.

Definition at line 79 of file InputEvents.cpp.

82{
83 auto& promise = co_await GetEventPromise {};
84 auto& source = window->get_event_source();
85
87 filter.event_type = Core::WindowEventType::TEXT_INPUT;
88
89 while (true) {
90 if (promise.should_terminate) {
91 break;
92 }
93
94 auto event = co_await WindowEventAwaiter(source, filter);
95
96 if (auto* text_data = std::get_if<Core::WindowEvent::TextData>(&event.data)) {
97 callback(text_data->codepoint);
98 }
99 }
100}
PickCallback callback
Definition Picker.cpp:22
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
Event-domain promise accessor with optional NetworkSource ownership transfer.
std::optional< Core::WindowEventType > event_type
Filter criteria for window input events.

References callback, MayaFlux::Vruta::WindowEventFilter::event_type, MayaFlux::Core::TEXT_INPUT, and window.

Referenced by MayaFlux::Portal::Forma::Context::register_handlers().

+ Here is the caller graph for this function: