diff options
author | Lukas Rusak <lorusak@gmail.com> | 2018-04-30 12:01:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 12:01:06 -0700 |
commit | 96f15e00e5d302a19fe934817eb608c656472d1d (patch) | |
tree | a205e40c1d6b84855768e9b56353e864b0bca6d4 | |
parent | f23006c8f09cdd0de54f3e7b24668fedd4ca9dfe (diff) | |
parent | 5e5fae1140c1f2c9dde14e053e9b984b32b78917 (diff) |
Merge pull request #13817 from lrusak/libinput
[linux] libinput: remove dependency to CWinEventsLinux
33 files changed, 140 insertions, 142 deletions
diff --git a/xbmc/platform/linux/input/LibInputHandler.cpp b/xbmc/platform/linux/input/LibInputHandler.cpp index 68bd46ee06..426aead6d4 100644 --- a/xbmc/platform/linux/input/LibInputHandler.cpp +++ b/xbmc/platform/linux/input/LibInputHandler.cpp @@ -73,7 +73,7 @@ static void LogHandler(libinput __attribute__((unused)) *libinput, libinput_log } } -CLibInputHandler::CLibInputHandler(CWinEventsLinux *winEvents) +CLibInputHandler::CLibInputHandler() : CThread("libinput") { m_udev = udev_new(); if (!m_udev) @@ -98,31 +98,42 @@ CLibInputHandler::CLibInputHandler(CWinEventsLinux *winEvents) m_liFd = libinput_get_fd(m_li); - m_keyboard.reset(new CLibInputKeyboard(winEvents)); - m_pointer.reset(new CLibInputPointer(winEvents)); + m_keyboard.reset(new CLibInputKeyboard()); + m_pointer.reset(new CLibInputPointer()); m_touch.reset(new CLibInputTouch()); } CLibInputHandler::~CLibInputHandler() { + StopThread(); + libinput_unref(m_li); udev_unref(m_udev); } -void CLibInputHandler::OnReadyRead() +void CLibInputHandler::Start() { - auto ret = libinput_dispatch(m_li); - if (ret < 0) - { - CLog::Log(LOGERROR, "CLibInputHandler::%s - libinput_dispatch failed: %s", __FUNCTION__, strerror(-errno)); - return; - } + Create(); + SetPriority(GetMinPriority()); +} - libinput_event *ev; - while ((ev = libinput_get_event(m_li)) != nullptr) +void CLibInputHandler::Process() +{ + while (!m_bStop) { - ProcessEvent(ev); - libinput_event_destroy(ev); + auto ret = libinput_dispatch(m_li); + if (ret < 0) + { + CLog::Log(LOGERROR, "CLibInputHandler::%s - libinput_dispatch failed: %s", __FUNCTION__, strerror(-errno)); + return; + } + + libinput_event *ev; + while ((ev = libinput_get_event(m_li)) != nullptr) + { + ProcessEvent(ev); + libinput_event_destroy(ev); + } } } diff --git a/xbmc/platform/linux/input/LibInputHandler.h b/xbmc/platform/linux/input/LibInputHandler.h index 94fd517f0a..a0e817ee88 100644 --- a/xbmc/platform/linux/input/LibInputHandler.h +++ b/xbmc/platform/linux/input/LibInputHandler.h @@ -20,25 +20,27 @@ #pragma once +#include "threads/Thread.h" + #include <libinput.h> #include <libudev.h> #include <memory> #include <vector> -class CWinEventsLinux; class CLibInputKeyboard; class CLibInputPointer; class CLibInputTouch; -class CLibInputHandler +class CLibInputHandler : CThread { public: - CLibInputHandler(CWinEventsLinux *winEvents); + CLibInputHandler(); ~CLibInputHandler(); - void OnReadyRead(); + void Start(); private: + void Process() override; void ProcessEvent(libinput_event *ev); void DeviceAdded(libinput_device *dev); void DeviceRemoved(libinput_device *dev); diff --git a/xbmc/platform/linux/input/LibInputKeyboard.cpp b/xbmc/platform/linux/input/LibInputKeyboard.cpp index a82b5abfe2..717038f793 100644 --- a/xbmc/platform/linux/input/LibInputKeyboard.cpp +++ b/xbmc/platform/linux/input/LibInputKeyboard.cpp @@ -20,8 +20,9 @@ #include "LibInputKeyboard.h" +#include "AppInboundProtocol.h" +#include "ServiceBroker.h" #include "utils/log.h" -#include "windowing/WinEventsLinux.h" #include <algorithm> #include <fcntl.h> @@ -154,9 +155,8 @@ static const std::map<xkb_keysym_t, XBMCKey> xkbMap = // XBMCK_FASTFORWARD clashes with XBMCK_MEDIA_FASTFORWARD }; -CLibInputKeyboard::CLibInputKeyboard(CWinEventsLinux *winEvents) - : m_winEvents(winEvents) - , m_repeatTimer(std::bind(&CLibInputKeyboard::KeyRepeatTimeout, this)) +CLibInputKeyboard::CLibInputKeyboard() + : m_repeatTimer(std::bind(&CLibInputKeyboard::KeyRepeatTimeout, this)) { m_ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS); if (!m_ctx) @@ -271,7 +271,9 @@ void CLibInputKeyboard::ProcessKey(libinput_event_keyboard *e) event.key.keysym.scancode = scancode; event.key.keysym.unicode = unicode; - m_winEvents->MessagePush(&event); + std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); + if (appPort) + appPort->OnEvent(event); if (pressed && xkb_keymap_key_repeats(m_keymap, xkbkey)) { @@ -319,7 +321,10 @@ XBMCKey CLibInputKeyboard::XBMCKeyForKeysym(xkb_keysym_t sym, uint32_t scancode) void CLibInputKeyboard::KeyRepeatTimeout() { m_repeatTimer.RestartAsync(m_repeatRate); - m_winEvents->MessagePush(&m_repeatEvent); + + std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); + if (appPort) + appPort->OnEvent(m_repeatEvent); } void CLibInputKeyboard::UpdateLeds(libinput_device *dev) diff --git a/xbmc/platform/linux/input/LibInputKeyboard.h b/xbmc/platform/linux/input/LibInputKeyboard.h index c52527f9ea..3236b2f216 100644 --- a/xbmc/platform/linux/input/LibInputKeyboard.h +++ b/xbmc/platform/linux/input/LibInputKeyboard.h @@ -28,12 +28,10 @@ #include <vector> #include <xkbcommon/xkbcommon.h> -class CWinEventsLinux; - class CLibInputKeyboard { public: - CLibInputKeyboard(CWinEventsLinux *winEvents); + CLibInputKeyboard(); ~CLibInputKeyboard(); void ProcessKey(libinput_event_keyboard *e); @@ -52,8 +50,6 @@ private: int m_leds; - CWinEventsLinux *m_winEvents; - XBMC_Event m_repeatEvent; std::map<libinput_device*, std::vector<int>> m_repeatData; CTimer m_repeatTimer; diff --git a/xbmc/platform/linux/input/LibInputPointer.cpp b/xbmc/platform/linux/input/LibInputPointer.cpp index 5300e9f5fb..52d75bc48f 100644 --- a/xbmc/platform/linux/input/LibInputPointer.cpp +++ b/xbmc/platform/linux/input/LibInputPointer.cpp @@ -20,11 +20,11 @@ #include "LibInputPointer.h" +#include "AppInboundProtocol.h" #include "input/mouse/MouseStat.h" #include "ServiceBroker.h" #include "utils/log.h" #include "windowing/GraphicContext.h" -#include "windowing/WinEventsLinux.h" #include <algorithm> #include <linux/input.h> @@ -76,7 +76,9 @@ void CLibInputPointer::ProcessButton(libinput_event_pointer *e) CLog::Log(LOGDEBUG, "CLibInputPointer::%s - event.button.x: %i", __FUNCTION__, event.button.x); CLog::Log(LOGDEBUG, "CLibInputPointer::%s - event.button.y: %i", __FUNCTION__, event.button.y); - m_winEvents->MessagePush(&event); + std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); + if (appPort) + appPort->OnEvent(event); } void CLibInputPointer::ProcessMotion(libinput_event_pointer *e) @@ -106,7 +108,9 @@ void CLibInputPointer::ProcessMotion(libinput_event_pointer *e) CLog::Log(LOGDEBUG, "CLibInputPointer::%s - event.motion.x: %i", __FUNCTION__, event.motion.x); CLog::Log(LOGDEBUG, "CLibInputPointer::%s - event.motion.y: %i", __FUNCTION__, event.motion.y); - m_winEvents->MessagePush(&event); + std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); + if (appPort) + appPort->OnEvent(event); } void CLibInputPointer::ProcessAxis(libinput_event_pointer *e) @@ -133,9 +137,12 @@ void CLibInputPointer::ProcessAxis(libinput_event_pointer *e) CLog::Log(LOGDEBUG, "CLibInputPointer::%s - event.button.x: %i", __FUNCTION__, event.button.x); CLog::Log(LOGDEBUG, "CLibInputPointer::%s - event.button.y: %i", __FUNCTION__, event.button.y); - m_winEvents->MessagePush(&event); + std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); + if (appPort) + appPort->OnEvent(event); event.type = XBMC_MOUSEBUTTONUP; - m_winEvents->MessagePush(&event); + if (appPort) + appPort->OnEvent(event); } diff --git a/xbmc/platform/linux/input/LibInputPointer.h b/xbmc/platform/linux/input/LibInputPointer.h index 3c4842e1f4..4c1b9fc696 100644 --- a/xbmc/platform/linux/input/LibInputPointer.h +++ b/xbmc/platform/linux/input/LibInputPointer.h @@ -26,12 +26,10 @@ struct pos int Y; }; -class CWinEventsLinux; - class CLibInputPointer { public: - CLibInputPointer(CWinEventsLinux *winEvents) { m_winEvents = winEvents; }; + CLibInputPointer() = default; ~CLibInputPointer() = default; void ProcessButton(libinput_event_pointer *e); @@ -40,6 +38,4 @@ public: private: struct pos m_pos = { 0, 0 }; - - CWinEventsLinux *m_winEvents; }; diff --git a/xbmc/windowing/CMakeLists.txt b/xbmc/windowing/CMakeLists.txt index a01d0280d2..1904e2c0ff 100644 --- a/xbmc/windowing/CMakeLists.txt +++ b/xbmc/windowing/CMakeLists.txt @@ -11,11 +11,6 @@ set(HEADERS GraphicContext.h XBMC_events.h VideoSync.h) -if(CORE_PLATFORM_NAME_LC STREQUAL rbpi OR CORE_PLATFORM_NAME_LC STREQUAL gbm OR CORE_PLATFORM_NAME_LC STREQUAL aml) - list(APPEND SOURCES WinEventsLinux.cpp) - list(APPEND HEADERS WinEventsLinux.h) -endif() - if(CORE_PLATFORM_NAME_LC STREQUAL rbpi) add_subdirectory(rpi) endif() diff --git a/xbmc/windowing/WinEventsLinux.cpp b/xbmc/windowing/WinEventsLinux.cpp deleted file mode 100644 index d3a2476443..0000000000 --- a/xbmc/windowing/WinEventsLinux.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://kodi.tv - * - * 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 "WinEventsLinux.h" -#include "WinEvents.h" -#include "XBMC_events.h" -#include "input/XBMC_keysym.h" -#include "AppInboundProtocol.h" -#include "input/mouse/MouseStat.h" -#include "utils/log.h" -#include "ServiceBroker.h" - -CWinEventsLinux::CWinEventsLinux() - : m_libinput(new CLibInputHandler(this)) -{ -} - -bool CWinEventsLinux::MessagePump() -{ - m_libinput->OnReadyRead(); - - return true; -} - -void CWinEventsLinux::MessagePush(XBMC_Event* ev) -{ - std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); - if (appPort) - appPort->OnEvent(*ev); -} diff --git a/xbmc/windowing/WinEventsLinux.h b/xbmc/windowing/WinEventsLinux.h deleted file mode 100644 index 3ae5ef4b10..0000000000 --- a/xbmc/windowing/WinEventsLinux.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://kodi.tv - * - * 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/>. - * - */ - -#pragma once - -#include <memory> -#include <mutex> -#include <queue> - -#include "platform/linux/input/LibInputHandler.h" -#include "windowing/WinEvents.h" - -class CWinEventsLinux : public IWinEvents -{ -public: - CWinEventsLinux(); - - bool MessagePump(); - void MessagePush(XBMC_Event *ev); - -private: - - std::unique_ptr<CLibInputHandler> m_libinput; -}; diff --git a/xbmc/windowing/WinSystem.cpp b/xbmc/windowing/WinSystem.cpp index 68eb218d43..ccbe46b5ea 100644 --- a/xbmc/windowing/WinSystem.cpp +++ b/xbmc/windowing/WinSystem.cpp @@ -283,7 +283,7 @@ void CWinSystemBase::UnregisterRenderLoop(IRenderLoop *client) void CWinSystemBase::DriveRenderLoop() { - m_winEvents->MessagePump(); + MessagePump(); { CSingleLock lock(m_renderLoopSection); for (auto i = m_renderLoopClients.begin(); i != m_renderLoopClients.end(); ++i) diff --git a/xbmc/windowing/WinSystem.h b/xbmc/windowing/WinSystem.h index bfe99bc942..14d57bfc49 100644 --- a/xbmc/windowing/WinSystem.h +++ b/xbmc/windowing/WinSystem.h @@ -148,6 +148,9 @@ public: void UnregisterRenderLoop(IRenderLoop *client); void DriveRenderLoop(); + // winsystem events + virtual bool MessagePump() { return false; } + // Access render system interface CGraphicContext& GetGfxContext(); diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp index b58e7b7957..fb19613558 100644 --- a/xbmc/windowing/X11/WinSystemX11.cpp +++ b/xbmc/windowing/X11/WinSystemX11.cpp @@ -1056,3 +1056,8 @@ void CWinSystemX11::UpdateCrtc() m_crtc = g_xrandr.GetCrtc(posx+winattr.width/2, posy+winattr.height/2, fps); CServiceBroker::GetWinSystem()->GetGfxContext().SetFPS(fps); } + +bool CWinSystemX11::MessagePump() +{ + return m_winEvents->MessagePump(); +} diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h index 19cb43a9e7..73b9256b1f 100644 --- a/xbmc/windowing/X11/WinSystemX11.h +++ b/xbmc/windowing/X11/WinSystemX11.h @@ -72,6 +72,9 @@ public: void RecreateWindow(); int GetCrtc() { return m_crtc; } + // winevents override + bool MessagePump() override; + protected: std::unique_ptr<KODI::WINDOWING::IOSScreenSaver> GetOSScreenSaverImpl() override; diff --git a/xbmc/windowing/amlogic/WinSystemAmlogic.cpp b/xbmc/windowing/amlogic/WinSystemAmlogic.cpp index 1db2ba77c6..7683ea76e1 100644 --- a/xbmc/windowing/amlogic/WinSystemAmlogic.cpp +++ b/xbmc/windowing/amlogic/WinSystemAmlogic.cpp @@ -42,7 +42,6 @@ #include "utils/log.h" #include "utils/SysfsUtils.h" #include "threads/SingleLock.h" -#include "../WinEventsLinux.h" #include <linux/fb.h> @@ -50,7 +49,8 @@ using namespace KODI; -CWinSystemAmlogic::CWinSystemAmlogic() +CWinSystemAmlogic::CWinSystemAmlogic() : + m_libinput(new CLibInputHandler) { const char *env_framebuffer = getenv("FRAMEBUFFER"); @@ -75,11 +75,11 @@ CWinSystemAmlogic::CWinSystemAmlogic() aml_permissions(); aml_disable_freeScale(); - m_winEvents.reset(new CWinEventsLinux()); // Register sink AE::CAESinkFactory::ClearSinks(); CAESinkALSA::Register(); CLinuxPowerSyscall::Register(); + m_libinput->Start(); } CWinSystemAmlogic::~CWinSystemAmlogic() diff --git a/xbmc/windowing/amlogic/WinSystemAmlogic.h b/xbmc/windowing/amlogic/WinSystemAmlogic.h index cfe53d7107..8e0bbe4547 100644 --- a/xbmc/windowing/amlogic/WinSystemAmlogic.h +++ b/xbmc/windowing/amlogic/WinSystemAmlogic.h @@ -20,6 +20,7 @@ #pragma once +#include "platform/linux/input/LibInputHandler.h" #include "rendering/gles/RenderSystemGLES.h" #include "threads/CriticalSection.h" #include "windowing/WinSystem.h" @@ -63,4 +64,6 @@ protected: CCriticalSection m_resourceSection; std::vector<IDispResource*> m_resources; + + std::unique_ptr<CLibInputHandler> m_libinput; }; diff --git a/xbmc/windowing/android/WinSystemAndroid.cpp b/xbmc/windowing/android/WinSystemAndroid.cpp index f6ec82b0b4..b9ee4aac8e 100644 --- a/xbmc/windowing/android/WinSystemAndroid.cpp +++ b/xbmc/windowing/android/WinSystemAndroid.cpp @@ -267,3 +267,8 @@ void CWinSystemAndroid::MessagePush(XBMC_Event *newEvent) { dynamic_cast<CWinEventsAndroid&>(*m_winEvents).MessagePush(newEvent); } + +bool CWinSystemAndroid::MessagePump() +{ + return m_winEvents->MessagePump(); +} diff --git a/xbmc/windowing/android/WinSystemAndroid.h b/xbmc/windowing/android/WinSystemAndroid.h index 524dfcbe88..0778a5c4d6 100644 --- a/xbmc/windowing/android/WinSystemAndroid.h +++ b/xbmc/windowing/android/WinSystemAndroid.h @@ -55,6 +55,9 @@ public: void MessagePush(XBMC_Event *newEvent); + // winevents override + bool MessagePump() override; + protected: CAndroidUtils *m_android; diff --git a/xbmc/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp index 45783bd9f1..3cd93fbb1d 100644 --- a/xbmc/windowing/gbm/WinSystemGbm.cpp +++ b/xbmc/windowing/gbm/WinSystemGbm.cpp @@ -32,7 +32,6 @@ #include "settings/DisplaySettings.h" #include "utils/log.h" #include "utils/StringUtils.h" -#include "../WinEventsLinux.h" #include "DRMAtomic.h" #include "DRMLegacy.h" #include "messaging/ApplicationMessenger.h" @@ -41,7 +40,8 @@ CWinSystemGbm::CWinSystemGbm() : m_DRM(nullptr), m_GBM(new CGBMUtils), - m_delayDispReset(false) + m_delayDispReset(false), + m_libinput(new CLibInputHandler) { std::string envSink; if (getenv("AE_SINK")) @@ -69,9 +69,9 @@ CWinSystemGbm::CWinSystemGbm() : } } - m_winEvents.reset(new CWinEventsLinux()); CLinuxPowerSyscall::Register(); m_lirc.reset(OPTIONALS::LircRegister()); + m_libinput->Start(); } bool CWinSystemGbm::InitWindowSystem() diff --git a/xbmc/windowing/gbm/WinSystemGbm.h b/xbmc/windowing/gbm/WinSystemGbm.h index 90771df278..ddfc083185 100644 --- a/xbmc/windowing/gbm/WinSystemGbm.h +++ b/xbmc/windowing/gbm/WinSystemGbm.h @@ -23,6 +23,7 @@ #include <gbm.h> #include <EGL/egl.h> +#include "platform/linux/input/LibInputHandler.h" #include "platform/linux/OptionalsReg.h" #include "threads/CriticalSection.h" #include "windowing/WinSystem.h" @@ -71,4 +72,5 @@ protected: bool m_delayDispReset; XbmcThreads::EndTime m_dispResetTimer; std::unique_ptr<OPTIONALS::CLircContainer, OPTIONALS::delete_CLircContainer> m_lirc; + std::unique_ptr<CLibInputHandler> m_libinput; }; diff --git a/xbmc/windowing/mir/WinSystemMir.cpp b/xbmc/windowing/mir/WinSystemMir.cpp index c9c28e7975..47a64e5a37 100644 --- a/xbmc/windowing/mir/WinSystemMir.cpp +++ b/xbmc/windowing/mir/WinSystemMir.cpp @@ -182,3 +182,8 @@ void CWinSystemMir::Register(IDispResource * /*resource*/) void CWinSystemMir::Unregister(IDispResource * /*resource*/) { } + +bool CWinSystemMir::MessagePump() +{ + return m_winEvents->MessagePump(); +} diff --git a/xbmc/windowing/mir/WinSystemMir.h b/xbmc/windowing/mir/WinSystemMir.h index 6347e4642c..5d1744921e 100644 --- a/xbmc/windowing/mir/WinSystemMir.h +++ b/xbmc/windowing/mir/WinSystemMir.h @@ -53,6 +53,9 @@ public: virtual void Register(IDispResource *resource); virtual void Unregister(IDispResource *resource); + // winevents override + bool MessagePump() override; + protected: MirConnection* m_connection; MirWindow* m_window; diff --git a/xbmc/windowing/osx/WinSystemIOS.h b/xbmc/windowing/osx/WinSystemIOS.h index 70dc51574a..345dbb012a 100644 --- a/xbmc/windowing/osx/WinSystemIOS.h +++ b/xbmc/windowing/osx/WinSystemIOS.h @@ -77,6 +77,9 @@ public: bool IsBackgrounded() const { return m_bIsBackgrounded; } void* GetEAGLContextObj(); + // winevents override + bool MessagePump() override; + protected: void PresentRenderImpl(bool rendered) override; void SetVSyncImpl(bool enable) override; diff --git a/xbmc/windowing/osx/WinSystemIOS.mm b/xbmc/windowing/osx/WinSystemIOS.mm index 5a23febd61..0e24625c9e 100644 --- a/xbmc/windowing/osx/WinSystemIOS.mm +++ b/xbmc/windowing/osx/WinSystemIOS.mm @@ -509,3 +509,8 @@ std::unique_ptr<CVideoSync> CWinSystemIOS::GetVideoSync(void *clock) std::unique_ptr<CVideoSync> pVSync(new CVideoSyncIos(clock, *this)); return pVSync; } + +bool CWinSystemIOS::MessagePump() +{ + return m_winEvents->MessagePump(); +} diff --git a/xbmc/windowing/osx/WinSystemOSX.h b/xbmc/windowing/osx/WinSystemOSX.h index 7cdbbb8589..01d579aea5 100644 --- a/xbmc/windowing/osx/WinSystemOSX.h +++ b/xbmc/windowing/osx/WinSystemOSX.h @@ -80,6 +80,9 @@ public: void* GetCGLContextObj(); void* GetNSOpenGLContext(); + // winevents override + bool MessagePump() override; + protected: virtual std::unique_ptr<KODI::WINDOWING::IOSScreenSaver> GetOSScreenSaverImpl() override; diff --git a/xbmc/windowing/osx/WinSystemOSX.mm b/xbmc/windowing/osx/WinSystemOSX.mm index 2677c13ce3..3e3dcd9b63 100644 --- a/xbmc/windowing/osx/WinSystemOSX.mm +++ b/xbmc/windowing/osx/WinSystemOSX.mm @@ -1880,3 +1880,8 @@ std::unique_ptr<CVideoSync> CWinSystemOSX::GetVideoSync(void *clock) std::unique_ptr<CVideoSync> pVSync(new CVideoSyncOsx(clock)); return pVSync; } + +bool CWinSystemOSX::MessagePump() +{ + return m_winEvents->MessagePump(); +} diff --git a/xbmc/windowing/rpi/WinSystemRpi.cpp b/xbmc/windowing/rpi/WinSystemRpi.cpp index 82534f27c2..fac5cc49ef 100644 --- a/xbmc/windowing/rpi/WinSystemRpi.cpp +++ b/xbmc/windowing/rpi/WinSystemRpi.cpp @@ -32,7 +32,6 @@ #include "settings/DisplaySettings.h" #include "guilib/DispResource.h" #include "utils/log.h" -#include "../WinEventsLinux.h" #include "cores/AudioEngine/AESinkFactory.h" #include "cores/AudioEngine/Sinks/AESinkPi.h" #include "platform/linux/powermanagement/LinuxPowerSyscall.h" @@ -40,7 +39,8 @@ #include <EGL/egl.h> #include <EGL/eglplatform.h> -CWinSystemRpi::CWinSystemRpi() +CWinSystemRpi::CWinSystemRpi() : + m_libinput(new CLibInputHandler) { m_nativeDisplay = EGL_NO_DISPLAY; m_nativeWindow = EGL_NO_SURFACE; @@ -53,11 +53,11 @@ CWinSystemRpi::CWinSystemRpi() m_rpi = new CRPIUtils(); - m_winEvents.reset(new CWinEventsLinux()); AE::CAESinkFactory::ClearSinks(); CAESinkPi::Register(); CLinuxPowerSyscall::Register(); m_lirc.reset(OPTIONALS::LircRegister()); + m_libinput->Start(); } CWinSystemRpi::~CWinSystemRpi() diff --git a/xbmc/windowing/rpi/WinSystemRpi.h b/xbmc/windowing/rpi/WinSystemRpi.h index b002426c66..648f48516c 100644 --- a/xbmc/windowing/rpi/WinSystemRpi.h +++ b/xbmc/windowing/rpi/WinSystemRpi.h @@ -21,6 +21,7 @@ #pragma once #include "RPIUtils.h" +#include "platform/linux/input/LibInputHandler.h" #include "platform/linux/OptionalsReg.h" #include "rendering/gles/RenderSystemGLES.h" #include "threads/CriticalSection.h" @@ -67,4 +68,5 @@ protected: CCriticalSection m_resourceSection; std::vector<IDispResource*> m_resources; std::unique_ptr<OPTIONALS::CLircContainer, OPTIONALS::delete_CLircContainer> m_lirc; + std::unique_ptr<CLibInputHandler> m_libinput; }; diff --git a/xbmc/windowing/wayland/WinSystemWayland.cpp b/xbmc/windowing/wayland/WinSystemWayland.cpp index 53e71c822e..b89142fd33 100644 --- a/xbmc/windowing/wayland/WinSystemWayland.cpp +++ b/xbmc/windowing/wayland/WinSystemWayland.cpp @@ -1531,3 +1531,8 @@ void CWinSystemWayland::OnClose() { KODI::MESSAGING::CApplicationMessenger::GetInstance().PostMsg(TMSG_QUIT); } + +bool CWinSystemWayland::MessagePump() +{ + return m_winEvents->MessagePump(); +} diff --git a/xbmc/windowing/wayland/WinSystemWayland.h b/xbmc/windowing/wayland/WinSystemWayland.h index 786d8c722b..19d361906c 100644 --- a/xbmc/windowing/wayland/WinSystemWayland.h +++ b/xbmc/windowing/wayland/WinSystemWayland.h @@ -101,6 +101,9 @@ public: // Like CWinSystemX11 void GetConnectedOutputs(std::vector<std::string>* outputs); + // winevents override + bool MessagePump() override; + protected: std::unique_ptr<KODI::WINDOWING::IOSScreenSaver> GetOSScreenSaverImpl() override; CSizeInt GetBufferSize() const diff --git a/xbmc/windowing/win10/WinSystemWin10.cpp b/xbmc/windowing/win10/WinSystemWin10.cpp index e0884b449c..1843b28214 100644 --- a/xbmc/windowing/win10/WinSystemWin10.cpp +++ b/xbmc/windowing/win10/WinSystemWin10.cpp @@ -755,4 +755,9 @@ WINDOW_STATE CWinSystemWin10::GetState(bool fullScreen) const return static_cast<WINDOW_STATE>(fullScreen ? m_fullscreenState : m_windowState); } +bool CWinSystemWin10::MessagePump() +{ + return m_winEvents->MessagePump(); +} + #pragma pack(pop) diff --git a/xbmc/windowing/win10/WinSystemWin10.h b/xbmc/windowing/win10/WinSystemWin10.h index b988e0c911..d86cca34bd 100644 --- a/xbmc/windowing/win10/WinSystemWin10.h +++ b/xbmc/windowing/win10/WinSystemWin10.h @@ -125,6 +125,9 @@ public: bool CanDoWindowed() override; + // winevents override + bool MessagePump() override; + protected: bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override = 0; virtual void UpdateStates(bool fullScreen); diff --git a/xbmc/windowing/windows/WinSystemWin32.cpp b/xbmc/windowing/windows/WinSystemWin32.cpp index d0ac082c84..771a815c30 100644 --- a/xbmc/windowing/windows/WinSystemWin32.cpp +++ b/xbmc/windowing/windows/WinSystemWin32.cpp @@ -1170,3 +1170,8 @@ WINDOW_STATE CWinSystemWin32::GetState(bool fullScreen) const { return static_cast<WINDOW_STATE>(fullScreen ? m_fullscreenState : m_windowState); } + +bool CWinSystemWin32::MessagePump() +{ + return m_winEvents->MessagePump(); +} diff --git a/xbmc/windowing/windows/WinSystemWin32.h b/xbmc/windowing/windows/WinSystemWin32.h index 16ad8cb084..87e40470ec 100644 --- a/xbmc/windowing/windows/WinSystemWin32.h +++ b/xbmc/windowing/windows/WinSystemWin32.h @@ -218,6 +218,9 @@ public: void SetSizeMoveMode(bool mode) { m_bSizeMoveEnabled = mode; } bool IsInSizeMoveMode() const { return m_bSizeMoveEnabled; } + // winevents override + bool MessagePump() override; + protected: bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override = 0; virtual void UpdateStates(bool fullScreen); |