4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
24 #include <boost/weak_ptr.hpp>
26 #include "utils/Stopwatch.h"
28 #include "EventListener.h"
29 #include "EventQueueStrategy.h"
30 #include "TimeoutManager.h"
32 class IDllWaylandClient;
42 class IEventQueueStrategy;
44 /* Loop encapsulates the entire process of dispatching
45 * wayland events and timers that might be in place for duplicate
46 * processing. Calling its Dispatch() method will cause any pending
47 * timers and events to be dispatched. It implements ITimeoutManager
48 * and timeouts can be added directly to it */
50 public xbmc::IEventListener,
51 public xbmc::ITimeoutManager
55 Loop(xbmc::IEventListener &listener,
56 IEventQueueStrategy &strategy);
60 struct CallbackTracker
62 typedef boost::weak_ptr <Callback> CallbackObserver;
64 CallbackTracker(uint32_t time,
66 const CallbackPtr &callback);
70 CallbackObserver callback;
75 CallbackPtr RepeatAfterMs(const Callback &callback,
78 void DispatchTimers();
80 void OnEvent(XBMC_Event &);
84 std::vector<CallbackTracker> m_callbackQueue;
85 CStopWatch m_stopWatch;
87 IEventQueueStrategy &m_eventQueue;
88 xbmc::IEventListener &m_queueListener;