2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "WinEventsIOS.h"
11 #include "application/AppInboundProtocol.h"
12 #include "guilib/GUIWindowManager.h"
13 #include "input/InputManager.h"
14 #include "input/keyboard/XBMC_vkeys.h"
15 #include "threads/CriticalSection.h"
16 #include "utils/log.h"
21 static CCriticalSection g_inputCond;
23 static std::list<XBMC_Event> events;
25 bool CWinEventsIOS::MessagePump()
28 std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort();
30 // Do not always loop, only pump the initial queued count events. else if ui keep pushing
31 // events the loop won't finish then it will block xbmc main message loop.
32 for (size_t pumpEventCount = GetQueueSize(); pumpEventCount > 0; --pumpEventCount)
34 // Pop up only one event per time since in App::OnEvent it may init modal dialog which init
35 // deeper message loop and call the deeper MessagePump from there.
38 std::unique_lock<CCriticalSection> lock(g_inputCond);
41 pumpEvent = events.front();
46 ret = appPort->OnEvent(pumpEvent);
51 size_t CWinEventsIOS::GetQueueSize()
53 std::unique_lock<CCriticalSection> lock(g_inputCond);