| 1478 | } |
| 1479 | |
| 1480 | void ImGuiIO::AddFocusEvent(bool focused) |
| 1481 | { |
| 1482 | ImGuiContext& g = *GImGui; |
| 1483 | IM_ASSERT(&g.IO == this && "Can only add events to current context."); |
| 1484 | |
| 1485 | // Filter duplicate |
| 1486 | const ImGuiInputEvent* latest_event = FindLatestInputEvent(ImGuiInputEventType_Focus); |
| 1487 | const bool latest_focused = latest_event ? latest_event->AppFocused.Focused : !g.IO.AppFocusLost; |
| 1488 | if (latest_focused == focused) |
| 1489 | return; |
| 1490 | |
| 1491 | ImGuiInputEvent e; |
| 1492 | e.Type = ImGuiInputEventType_Focus; |
| 1493 | e.AppFocused.Focused = focused; |
| 1494 | g.InputEventsQueue.push_back(e); |
| 1495 | } |
| 1496 | |
| 1497 | //----------------------------------------------------------------------------- |
| 1498 | // [SECTION] MISC HELPERS/UTILITIES (Geometry functions) |
no test coverage detected