Merge pull request #4775 from jmarshallnz/empty_episode_playcount
[vuplus_xbmc] / xbmc / windowing / WinEventsLinux.cpp
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://xbmc.org
4  *
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)
8  *  any later version.
9  *
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.
14  *
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/>.
18  *
19  */
20 #include "system.h"
21
22 #if defined(HAS_LINUX_EVENTS)
23
24 #include "WinEventsLinux.h"
25 #include "WinEvents.h"
26 #include "XBMC_events.h"
27 #include "input/XBMC_keysym.h"
28 #include "Application.h"
29 #include "input/MouseStat.h"
30 #include "utils/log.h"
31 #include "powermanagement/PowerManager.h"
32
33 bool CWinEventsLinux::m_initialized = false;
34 CLinuxInputDevices CWinEventsLinux::m_devices;
35
36 CWinEventsLinux::CWinEventsLinux()
37 {
38 }
39
40 void CWinEventsLinux::RefreshDevices()
41 {
42   m_devices.InitAvailable();
43 }
44
45 bool CWinEventsLinux::IsRemoteLowBattery()
46 {
47   return m_devices.IsRemoteLowBattery();
48   return false;
49 }
50
51 bool CWinEventsLinux::MessagePump()
52 {
53   if (!m_initialized)
54   {
55     m_devices.InitAvailable();
56     m_initialized = true;
57   }
58
59   bool ret = false;
60   XBMC_Event event = {0};
61   while (1)
62   {
63     event = m_devices.ReadEvent();
64     if (event.type != XBMC_NOEVENT)
65     {
66       ret |= g_application.OnEvent(event);
67     }
68     else
69     {
70       break;
71     }
72   }
73
74   return ret;
75 }
76
77 size_t CWinEventsLinux::GetQueueSize()
78 {
79   return m_devices.Size();
80 }
81
82 #endif