2 * Copyright (C) 2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "WinEvents.h"
22 #include "peripherals/Peripherals.h"
23 #include "threads/SingleLock.h"
25 #if defined(TARGET_WINDOWS)
26 #include "windows/WinEventsWin32.h"
27 #define WinEventsType CWinEventsWin32
29 #elif defined(TARGET_DARWIN_OSX)
30 #include "osx/WinEventsOSX.h"
31 #define WinEventsType CWinEventsOSX
33 #elif defined(TARGET_DARWIN_IOS)
34 #include "osx/WinEventsIOS.h"
35 #define WinEventsType CWinEventsIOS
37 #elif defined(TARGET_ANDROID)
38 #include "android/WinEventsAndroid.h"
39 #define WinEventsType CWinEventsAndroid
41 #elif (defined(TARGET_FREEBSD) || defined(TARGET_LINUX)) && defined(HAS_SDL_WIN_EVENTS)
42 #include "WinEventsSDL.h"
43 #define WinEventsType CWinEventsSDL
45 #elif defined(HAVE_WAYLAND)
46 #include "WinEventsWayland.h"
47 #define WinEventsType CWinEventsWayland
49 #elif defined(TARGET_LINUX) && defined(HAS_LINUX_EVENTS)
50 #include "WinEventsLinux.h"
51 #define WinEventsType CWinEventsLinux
54 static WinEventsType g_imp;
55 static CCriticalSection g_lock;
56 static bool g_init = false;
60 CSingleLock lock(g_lock);
63 PERIPHERALS::CPeripherals::Get().RegisterObserver(&g_imp);
68 void CWinEvents::MessagePush(XBMC_Event* ev)
72 g_imp.MessagePush(ev);
75 bool CWinEvents::MessagePump()
79 return g_imp.MessagePump();
82 size_t CWinEvents::GetQueueSize()
86 return g_imp.GetQueueSize();