Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3313 from t-nelson/winevents_refactor

CWinEvents refactor and allow CWinEvents to observe Peripherals changes
  • Loading branch information...
commit 36e301cc5ff292958dfb848864b81108426a5d97 2 parents e8a8f38 + cb85945
Trent Nelson authored
Showing with 192 additions and 97 deletions.
  1. +10 −0 XBMC.xcodeproj/project.pbxproj
  2. +1 −0  project/VS2010Express/XBMC.vcxproj
  3. +3 −0  project/VS2010Express/XBMC.vcxproj.filters
  4. +3 −2 xbmc/android/activity/AndroidMouse.cpp
  5. +1 −0  xbmc/input/linux/LinuxInputDevices.h
  6. +0 −2  xbmc/osx/IOSEAGLView.mm
  7. +7 −7 xbmc/osx/atv2/XBMCController.mm
  8. +3 −3 xbmc/osx/ios/XBMCController.mm
  9. +4 −0 xbmc/peripherals/Peripherals.cpp
  10. +3 −1 xbmc/peripherals/Peripherals.h
  11. +2 −0  xbmc/peripherals/bus/PeripheralBus.cpp
  12. +2 −0  xbmc/utils/Observer.h
  13. +1 −0  xbmc/windowing/Makefile
  14. +84 −0 xbmc/windowing/WinEvents.cpp
  15. +15 −31 xbmc/windowing/WinEvents.h
  16. +5 −0 xbmc/windowing/WinEventsLinux.cpp
  17. +4 −3 xbmc/windowing/WinEventsLinux.h
  18. +11 −0 xbmc/windowing/WinEventsSDL.cpp
  19. +6 −3 xbmc/windowing/WinEventsSDL.h
  20. +1 −0  xbmc/windowing/X11/WinSystemX11.h
  21. +2 −3 xbmc/windowing/android/WinEventsAndroid.cpp
  22. +4 −8 xbmc/windowing/android/WinEventsAndroid.h
  23. +4 −8 xbmc/windowing/osx/WinEventsIOS.h
  24. +2 −10 xbmc/windowing/osx/WinEventsIOS.mm
  25. +2 −4 xbmc/windowing/osx/WinEventsOSX.h
  26. +0 −7 xbmc/windowing/osx/WinEventsOSX.mm
  27. +7 −1 xbmc/windowing/windows/WinEventsWin32.cpp
  28. +4 −3 xbmc/windowing/windows/WinEventsWin32.h
  29. +1 −1  xbmc/windowing/windows/WinSystemWin32.cpp
10 XBMC.xcodeproj/project.pbxproj
View
@@ -3018,6 +3018,9 @@
E4E91BB80E7F7338001F0546 /* NptXbmcFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4E91BB70E7F7338001F0546 /* NptXbmcFile.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
EC720A8F155091BB00FFD782 /* ilog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC720A8D155091BB00FFD782 /* ilog.cpp */; };
EC720A9D1550927000FFD782 /* XbmcContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC720A9B1550927000FFD782 /* XbmcContext.cpp */; };
+ F500E35617F3412C004FC217 /* WinEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F500E35517F3412C004FC217 /* WinEvents.cpp */; };
+ F500E35717F3412C004FC217 /* WinEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F500E35517F3412C004FC217 /* WinEvents.cpp */; };
+ F500E35817F3412C004FC217 /* WinEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F500E35517F3412C004FC217 /* WinEvents.cpp */; };
F506297A0E57B9680066625A /* MultiPathFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50629780E57B9680066625A /* MultiPathFile.cpp */; };
F5071906175A26AD004C87D1 /* VideoDecodeAcceleration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5071905175A26AD004C87D1 /* VideoDecodeAcceleration.framework */; };
F50FDC5A119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50FDC59119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp */; };
@@ -5270,6 +5273,8 @@
EC720A8E155091BB00FFD782 /* ilog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ilog.h; path = commons/ilog.h; sourceTree = "<group>"; };
EC720A9B1550927000FFD782 /* XbmcContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XbmcContext.cpp; sourceTree = "<group>"; };
EC720A9C1550927000FFD782 /* XbmcContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XbmcContext.h; sourceTree = "<group>"; };
+ F500E35517F3412C004FC217 /* WinEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WinEvents.cpp; sourceTree = "<group>"; };
+ F500E35917F34132004FC217 /* WinEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WinEvents.h; sourceTree = "<group>"; };
F502BFDA160F34B900C96C76 /* CallbackHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CallbackHandler.cpp; path = python/CallbackHandler.cpp; sourceTree = "<group>"; };
F502BFDB160F34B900C96C76 /* CallbackHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CallbackHandler.h; path = python/CallbackHandler.h; sourceTree = "<group>"; };
F502BFE4160F34DC00C96C76 /* LanguageHook.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LanguageHook.cpp; path = python/LanguageHook.cpp; sourceTree = "<group>"; };
@@ -6582,6 +6587,8 @@
7C779E26104A57E500F444C4 /* WinEvents.h */,
7C779E27104A57E500F444C4 /* WinEventsSDL.cpp */,
7C779E28104A57E500F444C4 /* WinEventsSDL.h */,
+ F500E35517F3412C004FC217 /* WinEvents.cpp */,
+ F500E35917F34132004FC217 /* WinEvents.h */,
7C779E29104A57E500F444C4 /* WinSystem.cpp */,
7C779E2A104A57E500F444C4 /* WinSystem.h */,
7C779E2F104A57E500F444C4 /* XBMC_events.h */,
@@ -10616,6 +10623,7 @@
180F6C8117CE9A5700127892 /* smc.c in Sources */,
DFD882F817DD1A5B001516FE /* AddonPythonInvoker.cpp in Sources */,
DFD882E917DD189E001516FE /* StringValidation.cpp in Sources */,
+ F500E35617F3412C004FC217 /* WinEvents.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -11645,6 +11653,7 @@
DF28DF4F17B8379E0077F41A /* ProfilesOperations.cpp in Sources */,
DFD882F617DD1A5B001516FE /* AddonPythonInvoker.cpp in Sources */,
DFD882E717DD189E001516FE /* StringValidation.cpp in Sources */,
+ F500E35817F3412C004FC217 /* WinEvents.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -12676,6 +12685,7 @@
DF28DF4E17B8379E0077F41A /* ProfilesOperations.cpp in Sources */,
DFD882F717DD1A5B001516FE /* AddonPythonInvoker.cpp in Sources */,
DFD882E817DD189E001516FE /* StringValidation.cpp in Sources */,
+ F500E35717F3412C004FC217 /* WinEvents.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1  project/VS2010Express/XBMC.vcxproj
View
@@ -2000,6 +2000,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Testsuite|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\windowing\WinEvents.cpp" />
<ClCompile Include="..\..\xbmc\windowing\WinSystem.cpp" />
<ClCompile Include="..\..\xbmc\windows\GUIMediaWindow.cpp" />
<ClCompile Include="..\..\xbmc\windows\GUIWindowDebugInfo.cpp" />
3  project/VS2010Express/XBMC.vcxproj.filters
View
@@ -3073,6 +3073,9 @@
<ClCompile Include="..\..\xbmc\utils\StringValidation.cpp">
<Filter>utils</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\windowing\WinEvents.cpp">
+ <Filter>windowing</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
5 xbmc/android/activity/AndroidMouse.cpp
View
@@ -23,6 +23,7 @@
#include "Application.h"
#include "guilib/GUIWindowManager.h"
#include "windowing/WinEvents.h"
+#include "input/MouseStat.h"
CAndroidMouse::CAndroidMouse()
{
@@ -73,7 +74,7 @@ void CAndroidMouse::MouseMove(float x, float y)
newEvent.motion.y = y;
newEvent.motion.xrel = 0;
newEvent.motion.yrel = 0;
- CWinEventsAndroid::MessagePush(&newEvent);
+ CWinEvents::MessagePush(&newEvent);
}
void CAndroidMouse::MouseButton(float x, float y, int32_t action)
@@ -89,5 +90,5 @@ void CAndroidMouse::MouseButton(float x, float y, int32_t action)
newEvent.button.x = x;
newEvent.button.y = y;
newEvent.button.button = XBMC_BUTTON_LEFT;
- CWinEventsAndroid::MessagePush(&newEvent);
+ CWinEvents::MessagePush(&newEvent);
}
1  xbmc/input/linux/LinuxInputDevices.h
View
@@ -89,6 +89,7 @@ class CLinuxInputDevices
XBMC_Event ReadEvent();
bool IsRemoteLowBattery();
bool IsRemoteNotPaired();
+ size_t Size() { return m_devices.size(); }
private:
CCriticalSection m_devicesListLock;
bool CheckDevice(const char *device);
2  xbmc/osx/IOSEAGLView.mm
View
@@ -330,7 +330,6 @@ - (void) startAnimation
if (!animating && context)
{
animating = TRUE;
- CWinEventsIOS::Init();
// kick off an animation thread
animationThreadLock = [[NSConditionLock alloc] initWithCondition: FALSE];
@@ -358,7 +357,6 @@ - (void) stopAnimation
// wait for animation thread to die
if ([animationThread isFinished] == NO)
[animationThreadLock lockWhenCondition:TRUE];
- CWinEventsIOS::DeInit();
}
}
//--------------------------------------------------------------
14 xbmc/osx/atv2/XBMCController.mm
View
@@ -51,7 +51,7 @@
//hack around problem with xbmc's typedef int BOOL
// and obj-c's typedef unsigned char BOOL
#define BOOL XBMC_BOOL
-#import "WinEventsIOS.h"
+#import "WinEvents.h"
#import "XBMC_events.h"
#include "utils/log.h"
#include "osx/DarwinUtils.h"
@@ -728,7 +728,7 @@ -(void)flushDiskChanges;
newEvent.type = XBMC_USEREVENT;
newEvent.jbutton.which = eventId;
newEvent.jbutton.holdTime = holdTime;
- CWinEventsIOS::MessagePush(&newEvent);
+ CWinEvents::MessagePush(&newEvent);
}
static unsigned int XBMCController$appleModKeyToXbmcModKey(XBMCController* self, SEL _cmd, unsigned int appleModifier)
@@ -845,9 +845,9 @@ -(void)flushDiskChanges;
{
newEvent.key.keysym.mod = (XBMCMod)[self appleModKeyToXbmcModKey:modifier];
newEvent.type = XBMC_KEYDOWN;
- CWinEventsIOS::MessagePush(&newEvent);
+ CWinEvents::MessagePush(&newEvent);
newEvent.type = XBMC_KEYUP;
- CWinEventsIOS::MessagePush(&newEvent);
+ CWinEvents::MessagePush(&newEvent);
is_handled = TRUE;
}
}
@@ -921,7 +921,7 @@ -(void)flushDiskChanges;
{
//if queue is empty - skip this timer event
//for letting it process
- if(CWinEventsIOS::GetQueueSize())
+ if(CWinEvents::GetQueueSize())
return;
NSDate *startDate = [[theTimer userInfo] objectForKey:@"StartDate"];
@@ -1294,7 +1294,7 @@ - (XBMC_Event) translateCocoaToXBMCEvent: (unichar) c
newEvent.appcommand.type = XBMC_APPCOMMAND;
newEvent.appcommand.action = ACTION_PLAYER_PLAYPAUSE;
- CWinEventsIOS::MessagePush(&newEvent);
+ CWinEvents::MessagePush(&newEvent);
Sleep(2000);
[[self glView] pauseAnimation];
@@ -1309,7 +1309,7 @@ - (XBMC_Event) translateCocoaToXBMCEvent: (unichar) c
newEvent.appcommand.type = XBMC_APPCOMMAND;
newEvent.appcommand.action = ACTION_PLAYER_PLAY;
- CWinEventsIOS::MessagePush(&newEvent);
+ CWinEvents::MessagePush(&newEvent);
[[self glView] resumeAnimation];
}
6 xbmc/osx/ios/XBMCController.mm
View
@@ -255,10 +255,10 @@ @implementation XBMCController
- (void) sendKeypressEvent: (XBMC_Event) event
{
event.type = XBMC_KEYDOWN;
- CWinEventsIOS::MessagePush(&event);
+ CWinEvents::MessagePush(&event);
event.type = XBMC_KEYUP;
- CWinEventsIOS::MessagePush(&event);
+ CWinEvents::MessagePush(&event);
}
// START OF UIKeyInput protocol
@@ -666,7 +666,7 @@ - (void)postMouseMotionEvent:(CGPoint)point
newEvent.motion.y = point.y;
newEvent.motion.xrel = 0;
newEvent.motion.yrel = 0;
- CWinEventsIOS::MessagePush(&newEvent);
+ CWinEvents::MessagePush(&newEvent);
}
//--------------------------------------------------------------
- (IBAction)handleSingleFingerSingleTap:(UIGestureRecognizer *)sender
4 xbmc/peripherals/Peripherals.cpp
View
@@ -320,6 +320,8 @@ void CPeripherals::OnDeviceAdded(const CPeripheralBus &bus, const CPeripheral &p
CGUIMessage msg(GUI_MSG_UPDATE, WINDOW_SETTINGS_SYSTEM, 0);
g_windowManager.SendThreadMessage(msg, WINDOW_SETTINGS_SYSTEM);
+ SetChanged();
+
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35005), peripheral.DeviceName());
}
@@ -333,6 +335,8 @@ void CPeripherals::OnDeviceDeleted(const CPeripheralBus &bus, const CPeripheral
CGUIMessage msg(GUI_MSG_UPDATE, WINDOW_SETTINGS_SYSTEM, 0);
g_windowManager.SendThreadMessage(msg, WINDOW_SETTINGS_SYSTEM);
+ SetChanged();
+
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35006), peripheral.DeviceName());
}
4 xbmc/peripherals/Peripherals.h
View
@@ -25,6 +25,7 @@
#include "settings/ISettingCallback.h"
#include "threads/CriticalSection.h"
#include "threads/Thread.h"
+#include "utils/Observer.h"
class CFileItemList;
class CSetting;
@@ -37,7 +38,8 @@ namespace PERIPHERALS
{
#define g_peripherals CPeripherals::Get()
- class CPeripherals : public ISettingCallback
+ class CPeripherals : public ISettingCallback,
+ public Observable
{
public:
static CPeripherals &Get(void);
2  xbmc/peripherals/bus/PeripheralBus.cpp
View
@@ -127,6 +127,8 @@ bool CPeripheralBus::ScanForDevices(void)
UnregisterRemovedDevices(results);
RegisterNewDevices(results);
+ CPeripherals::Get().NotifyObservers(ObservableMessagePeripheralsChanged);
+
bReturn = true;
}
2  xbmc/utils/Observer.h
View
@@ -21,6 +21,7 @@
*/
#include "threads/CriticalSection.h"
+#include <vector>
class Observable;
class ObservableMessageJob;
@@ -38,6 +39,7 @@ typedef enum
ObservableMessageTimers,
ObservableMessageTimersReset,
ObservableMessageRecordings,
+ ObservableMessagePeripheralsChanged,
} ObservableMessage;
class Observer
1  xbmc/windowing/Makefile
View
@@ -1,6 +1,7 @@
SRCS=WinEventsSDL.cpp \
WinEventsLinux.cpp \
WinSystem.cpp \
+ WinEvents.cpp
LIB=windowing.a
84 xbmc/windowing/WinEvents.cpp
View
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "WinEvents.h"
+#include "peripherals/Peripherals.h"
+#include "threads/SingleLock.h"
+
+#if defined(TARGET_WINDOWS)
+#include "windows/WinEventsWin32.h"
+#define WinEventsType CWinEventsWin32
+
+#elif defined(TARGET_DARWIN_OSX)
+#include "osx/WinEventsOSX.h"
+#define WinEventsType CWinEventsOSX
+
+#elif defined(TARGET_DARWIN_IOS)
+#include "osx/WinEventsIOS.h"
+#define WinEventsType CWinEventsIOS
+
+#elif defined(TARGET_ANDROID)
+#include "android/WinEventsAndroid.h"
+#define WinEventsType CWinEventsAndroid
+
+#elif (defined(TARGET_FREEBSD) || defined(TARGET_LINUX)) && defined(HAS_SDL_WIN_EVENTS)
+#include "WinEventsSDL.h"
+#define WinEventsType CWinEventsSDL
+
+#elif defined(TARGET_LINUX) && defined(HAS_LINUX_EVENTS)
+#include "WinEventsLinux.h"
+#define WinEventsType CWinEventsLinux
+#endif
+
+static WinEventsType g_imp;
+static CCriticalSection g_lock;
+static bool g_init = false;
+
+void Init()
+{
+ CSingleLock lock(g_lock);
+ if (!g_init)
+ {
+ PERIPHERALS::CPeripherals::Get().RegisterObserver(&g_imp);
+ g_init = true;
+ }
+}
+
+void CWinEvents::MessagePush(XBMC_Event* ev)
+{
+ if (!g_init)
+ Init();
+ g_imp.MessagePush(ev);
+}
+
+bool CWinEvents::MessagePump()
+{
+ if (!g_init)
+ Init();
+ return g_imp.MessagePump();
+}
+
+size_t CWinEvents::GetQueueSize()
+{
+ if (!g_init)
+ Init();
+ return g_imp.GetQueueSize();
+}
+
46 xbmc/windowing/WinEvents.h
View
@@ -23,43 +23,27 @@
#pragma once
-#include "utils/StdString.h"
+#include "utils/Observer.h"
#include "XBMC_events.h"
typedef bool (* PHANDLE_EVENT_FUNC)(XBMC_Event& newEvent);
-class CWinEventsBase
+class IWinEvents : public Observer
{
+ public:
+ virtual ~IWinEvents() {};
+ virtual bool MessagePump() = 0;
+ virtual size_t GetQueueSize() = 0;
+ virtual void MessagePush(XBMC_Event* ev) {};
+ virtual void Notify(const Observable &obs, const ObservableMessage msg) {};
+};
+class CWinEvents
+{
+ public:
+ static void MessagePush(XBMC_Event* ev);
+ static bool MessagePump();
+ static size_t GetQueueSize();
};
-#if defined(TARGET_WINDOWS)
-#include "windows/WinEventsWin32.h"
-#define CWinEvents CWinEventsWin32
-
-#elif defined(TARGET_DARWIN_OSX)
-#include "osx/WinEventsOSX.h"
-#define CWinEvents CWinEventsOSX
-
-#elif defined(TARGET_DARWIN_IOS)
-#include "osx/WinEventsIOS.h"
-#define CWinEvents CWinEventsIOS
-
-#elif defined(TARGET_ANDROID)
-#include "android/WinEventsAndroid.h"
-#define CWinEvents CWinEventsAndroid
-
-#elif defined(TARGET_FREEBSD) && defined(HAS_SDL_WIN_EVENTS)
-#include "WinEventsSDL.h"
-#define CWinEvents CWinEventsSDL
-
-#elif defined(TARGET_LINUX) && defined(HAS_SDL_WIN_EVENTS)
-#include "WinEventsSDL.h"
-#define CWinEvents CWinEventsSDL
-
-#elif defined(TARGET_LINUX) && defined(HAS_LINUX_EVENTS)
-#include "WinEventsLinux.h"
-#define CWinEvents CWinEventsLinux
-
-#endif
#endif // WINDOW_EVENTS_H
5 xbmc/windowing/WinEventsLinux.cpp
View
@@ -74,4 +74,9 @@ bool CWinEventsLinux::MessagePump()
return ret;
}
+size_t CWinEventsLinux::GetQueueSize()
+{
+ return m_devices.Size();
+}
+
#endif
7 xbmc/windowing/WinEventsLinux.h
View
@@ -25,12 +25,13 @@
#include "windowing/WinEvents.h"
#include "input/linux/LinuxInputDevices.h"
-class CWinEventsLinux : public CWinEventsBase
+class CWinEventsLinux : public IWinEvents
{
public:
CWinEventsLinux();
- static bool MessagePump();
- static void RefreshDevices();
+ bool MessagePump();
+ size_t GetQueueSize();
+ void RefreshDevices();
static bool IsRemoteLowBattery();
private:
11 xbmc/windowing/WinEventsSDL.cpp
View
@@ -400,6 +400,17 @@ bool CWinEventsSDL::MessagePump()
return ret;
}
+size_t CWinEventsSDL::GetQueueSize()
+{
+ int ret;
+ SDL_Event event;
+
+ if (-1 == (ret = SDL_PeepEvents(&event, 0, SDL_PEEKEVENT, ~0)))
+ ret = 0;
+
+ return ret;
+}
+
#ifdef TARGET_DARWIN_OSX
bool CWinEventsSDL::ProcessOSXShortcuts(SDL_Event& event)
{
9 xbmc/windowing/WinEventsSDL.h
View
@@ -22,17 +22,20 @@
#ifndef WINDOW_EVENTS_SDL_H
#define WINDOW_EVENTS_SDL_H
+#include "system.h"
+
#ifdef HAS_SDL
#include <SDL/SDL_events.h>
#include "WinEvents.h"
-class CWinEventsSDL : public CWinEventsBase
+class CWinEventsSDL : public IWinEvents
{
public:
- static bool MessagePump();
+ virtual bool MessagePump();
+ virtual size_t GetQueueSize();
-protected:
+private:
#ifdef TARGET_DARWIN
static bool ProcessOSXShortcuts(SDL_Event& event);
#elif defined(TARGET_POSIX)
1  xbmc/windowing/X11/WinSystemX11.h
View
@@ -25,6 +25,7 @@
#include "system_gl.h"
#include <GL/glx.h>
+#include <SDL/SDL.h>
#include "windowing/WinSystem.h"
#include "utils/Stopwatch.h"
5 xbmc/windowing/android/WinEventsAndroid.cpp
View
@@ -20,7 +20,6 @@
#include "system.h"
#include <list>
-#include "windowing/WinEvents.h"
#include "WinEventsAndroid.h"
#include "Application.h"
#include "threads/CriticalSection.h"
@@ -49,7 +48,7 @@ bool CWinEventsAndroid::MessagePump()
// Do not always loop, only pump the initial queued count events. else if ui keep pushing
// events the loop won't finish then it will block xbmc main message loop.
- for (int pumpEventCount = GetQueueSize(); pumpEventCount > 0; --pumpEventCount)
+ for (size_t pumpEventCount = GetQueueSize(); pumpEventCount > 0; --pumpEventCount)
{
// Pop up only one event per time since in App::OnEvent it may init modal dialog which init
@@ -69,7 +68,7 @@ bool CWinEventsAndroid::MessagePump()
return ret;
}
-int CWinEventsAndroid::GetQueueSize()
+size_t CWinEventsAndroid::GetQueueSize()
{
CSingleLock lock(g_inputCond);
return events.size();
12 xbmc/windowing/android/WinEventsAndroid.h
View
@@ -24,19 +24,15 @@
#define WINDOW_EVENTS_ANDROID_H
#include "windowing/WinEvents.h"
-#include "input/MouseStat.h"
-class CWinEventsAndroid : public CWinEventsBase
+class CWinEventsAndroid : public IWinEvents
{
public:
static void Init();
static void DeInit();
- static void MessagePush(XBMC_Event *newEvent);
- static bool MessagePump();
-
-protected:
- static int GetQueueSize();
-
+ void MessagePush(XBMC_Event *newEvent);
+ bool MessagePump();
+ virtual size_t GetQueueSize();
};
#endif // WINDOW_EVENTS_ANDROID_H
12 xbmc/windowing/osx/WinEventsIOS.h
View
@@ -25,16 +25,12 @@
#include "windowing/WinEvents.h"
-class CWinEventsIOS : public CWinEventsBase
+class CWinEventsIOS : public IWinEvents
{
public:
- static void Init();
- static void DeInit();
- static void MessagePush(XBMC_Event *newEvent);
- static bool MessagePump();
- static int GetQueueSize();
-
-protected:
+ void MessagePush(XBMC_Event *newEvent);
+ bool MessagePump();
+ virtual size_t GetQueueSize();
};
#endif // WINDOW_EVENTS_IOS_H
12 xbmc/windowing/osx/WinEventsIOS.mm
View
@@ -32,14 +32,6 @@
static std::list<XBMC_Event> events;
-void CWinEventsIOS::DeInit()
-{
-}
-
-void CWinEventsIOS::Init()
-{
-}
-
void CWinEventsIOS::MessagePush(XBMC_Event *newEvent)
{
CSingleLock lock(g_inputCond);
@@ -53,7 +45,7 @@
// Do not always loop, only pump the initial queued count events. else if ui keep pushing
// events the loop won't finish then it will block xbmc main message loop.
- for (int pumpEventCount = GetQueueSize(); pumpEventCount > 0; --pumpEventCount)
+ for (size_t pumpEventCount = GetQueueSize(); pumpEventCount > 0; --pumpEventCount)
{
// Pop up only one event per time since in App::OnEvent it may init modal dialog which init
// deeper message loop and call the deeper MessagePump from there.
@@ -86,7 +78,7 @@
return ret;
}
-int CWinEventsIOS::GetQueueSize()
+size_t CWinEventsIOS::GetQueueSize()
{
CSingleLock lock(g_inputCond);
return events.size();
6 xbmc/windowing/osx/WinEventsOSX.h
View
@@ -20,13 +20,11 @@
*
*/
-#include "windowing/WinEvents.h"
+#include "windowing/WinEventsSDL.h"
-class CWinEventsOSX : public CWinEventsBase
+class CWinEventsOSX : public CWinEventsSDL
{
public:
CWinEventsOSX();
~CWinEventsOSX();
-
- static bool MessagePump();
};
7 xbmc/windowing/osx/WinEventsOSX.mm
View
@@ -19,9 +19,6 @@
*/
#define BOOL XBMC_BOOL
-#include "system.h"
-#include "utils/log.h"
-#include "windowing/WinEventsSDL.h"
#include "windowing/osx/WinEventsOSX.h"
#undef BOOL
@@ -35,7 +32,3 @@
{
}
-bool CWinEventsOSX::MessagePump()
-{
- return CWinEventsSDL::MessagePump();
-}
8 xbmc/windowing/windows/WinEventsWin32.cpp
View
@@ -25,7 +25,7 @@
#include "utils/log.h"
#include "Windowsx.h"
-#include "windowing/WinEvents.h"
+#include "WinEventsWin32.h"
#include "WIN32Util.h"
#include "storage/windows/Win32StorageProvider.h"
#include "Application.h"
@@ -392,6 +392,12 @@ bool CWinEventsWin32::MessagePump()
return true;
}
+size_t CWinEventsWin32::GetQueueSize()
+{
+ MSG msg;
+ return PeekMessage( &msg, NULL, 0U, 0U, PM_NOREMOVE );
+}
+
LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
XBMC_Event newEvent;
7 xbmc/windowing/windows/WinEventsWin32.h
View
@@ -29,11 +29,12 @@
class CGenericTouchSwipeDetector;
-class CWinEventsWin32 : public CWinEventsBase
+class CWinEventsWin32 : public IWinEvents
{
public:
- static void MessagePush(XBMC_Event *newEvent);
- static bool MessagePump();
+ void MessagePush(XBMC_Event *newEvent);
+ bool MessagePump();
+ virtual size_t GetQueueSize();
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
2  xbmc/windowing/windows/WinSystemWin32.cpp
View
@@ -89,7 +89,7 @@ bool CWinSystemWin32::CreateNewWindow(const CStdString& name, bool fullScreen, R
// Register the windows class
WNDCLASS wndClass;
wndClass.style = CS_OWNDC; // For OpenGL
- wndClass.lpfnWndProc = CWinEvents::WndProc;
+ wndClass.lpfnWndProc = CWinEventsWin32::WndProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = m_hInstance;
Please sign in to comment.
Something went wrong with that request. Please try again.