From 6b4da70e153dbd3e2716750aa07907a883730488 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Mon, 5 Aug 2024 15:15:31 -0600 Subject: [PATCH] Remove use of deprecated `ALooper_pollAll` --- src/SFML/Window/Android/InputImpl.cpp | 12 ++++++++---- src/SFML/Window/Android/SensorImpl.cpp | 3 ++- src/SFML/Window/Android/WindowImplAndroid.cpp | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/SFML/Window/Android/InputImpl.cpp b/src/SFML/Window/Android/InputImpl.cpp index e2b4d2eae..d54448f7a 100644 --- a/src/SFML/Window/Android/InputImpl.cpp +++ b/src/SFML/Window/Android/InputImpl.cpp @@ -166,7 +166,8 @@ void setVirtualKeyboardVisible(bool visible) //////////////////////////////////////////////////////////// bool isMouseButtonPressed(Mouse::Button button) { - ALooper_pollAll(0, nullptr, nullptr, nullptr); + while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0) + ; ActivityStates& states = getActivity(); const std::lock_guard lock(states.mutex); @@ -178,7 +179,8 @@ bool isMouseButtonPressed(Mouse::Button button) //////////////////////////////////////////////////////////// Vector2i getMousePosition() { - ALooper_pollAll(0, nullptr, nullptr, nullptr); + while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0) + ; ActivityStates& states = getActivity(); const std::lock_guard lock(states.mutex); @@ -211,7 +213,8 @@ void setMousePosition(Vector2i position, const WindowBase& /* relativeTo */) //////////////////////////////////////////////////////////// bool isTouchDown(unsigned int finger) { - ALooper_pollAll(0, nullptr, nullptr, nullptr); + while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0) + ; ActivityStates& states = getActivity(); const std::lock_guard lock(states.mutex); @@ -223,7 +226,8 @@ bool isTouchDown(unsigned int finger) //////////////////////////////////////////////////////////// Vector2i getTouchPosition(unsigned int finger) { - ALooper_pollAll(0, nullptr, nullptr, nullptr); + while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0) + ; ActivityStates& states = getActivity(); const std::lock_guard lock(states.mutex); diff --git a/src/SFML/Window/Android/SensorImpl.cpp b/src/SFML/Window/Android/SensorImpl.cpp index ca43b6d50..3ddd7c430 100644 --- a/src/SFML/Window/Android/SensorImpl.cpp +++ b/src/SFML/Window/Android/SensorImpl.cpp @@ -120,7 +120,8 @@ void SensorImpl::close() Vector3f SensorImpl::update() const { // Update our sensor data list - ALooper_pollAll(0, nullptr, nullptr, nullptr); + while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0) + ; return sensorData[m_type]; } diff --git a/src/SFML/Window/Android/WindowImplAndroid.cpp b/src/SFML/Window/Android/WindowImplAndroid.cpp index 69e66b993..ab9d11f64 100644 --- a/src/SFML/Window/Android/WindowImplAndroid.cpp +++ b/src/SFML/Window/Android/WindowImplAndroid.cpp @@ -101,7 +101,8 @@ WindowHandle WindowImplAndroid::getNativeHandle() const void WindowImplAndroid::processEvents() { // Process incoming OS events - ALooper_pollAll(0, nullptr, nullptr, nullptr); + while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0) + ; ActivityStates& states = getActivity(); const std::lock_guard lock(states.mutex);