288{
290
292
293 while (true) {
294 if (
const auto pending = std::exchange(
m_focus_pending, std::nullopt)) {
295 if (pending->type == Type::WINDOW_FOCUS_LOST ||
m_focused == pending->id)
296 dispatch(pending->id, pending->type, pending->ndc);
297 continue;
298 }
299
301 return;
302
308 notify(it->second.focus_lost, lost);
309 } else {
315 notify(it->second.focus_gained, gained);
316 }
317 }
318}
std::optional< FocusNotice > m_focus_pending
std::optional< uint32_t > m_focus_notified
std::unordered_map< uint32_t, ElementCallbacks > m_callbacks
void dispatch(uint32_t id, Core::WindowEventType type, glm::vec2 ndc, Core::WindowEvent::EventData data={}, std::optional< IO::MouseButtons > button=std::nullopt, std::optional< IO::Keys > key=std::nullopt)
std::optional< uint32_t > m_focused
WindowEventType
Types of window and input events.
Focus notifications run user code that may move focus again, so move_focus() tracks what it has told ...