From a71b3a497be48316ab1ba8863f314ea018cb7674 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 12d24305b..3d04e3a74 100644 --- a/src/SFML/Window/Android/InputImpl.cpp +++ b/src/SFML/Window/Android/InputImpl.cpp @@ -159,7 +159,8 @@ void InputImpl::setVirtualKeyboardVisible(bool visible) //////////////////////////////////////////////////////////// bool InputImpl::isMouseButtonPressed(Mouse::Button button) { - ALooper_pollAll(0, NULL, NULL, NULL); + while (ALooper_pollOnce(0, NULL, NULL, NULL) >= 0) + ; priv::ActivityStates& states = priv::getActivity(); Lock lock(states.mutex); @@ -171,7 +172,8 @@ bool InputImpl::isMouseButtonPressed(Mouse::Button button) //////////////////////////////////////////////////////////// Vector2i InputImpl::getMousePosition() { - ALooper_pollAll(0, NULL, NULL, NULL); + while (ALooper_pollOnce(0, NULL, NULL, NULL) >= 0) + ; priv::ActivityStates& states = priv::getActivity(); Lock lock(states.mutex); @@ -204,7 +206,8 @@ void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& /* //////////////////////////////////////////////////////////// bool InputImpl::isTouchDown(unsigned int finger) { - ALooper_pollAll(0, NULL, NULL, NULL); + while (ALooper_pollOnce(0, NULL, NULL, NULL) >= 0) + ; priv::ActivityStates& states = priv::getActivity(); Lock lock(states.mutex); @@ -216,7 +219,8 @@ bool InputImpl::isTouchDown(unsigned int finger) //////////////////////////////////////////////////////////// Vector2i InputImpl::getTouchPosition(unsigned int finger) { - ALooper_pollAll(0, NULL, NULL, NULL); + while (ALooper_pollOnce(0, NULL, NULL, NULL) >= 0) + ; priv::ActivityStates& states = priv::getActivity(); Lock lock(states.mutex); diff --git a/src/SFML/Window/Android/SensorImpl.cpp b/src/SFML/Window/Android/SensorImpl.cpp index 8f6c880df..720f9f52c 100644 --- a/src/SFML/Window/Android/SensorImpl.cpp +++ b/src/SFML/Window/Android/SensorImpl.cpp @@ -123,7 +123,8 @@ void SensorImpl::close() Vector3f SensorImpl::update() { // Update our sensor data list - ALooper_pollAll(0, NULL, NULL, NULL); + while (ALooper_pollOnce(0, NULL, NULL, NULL) >= 0) + ; return sensorData[m_index]; } diff --git a/src/SFML/Window/Android/WindowImplAndroid.cpp b/src/SFML/Window/Android/WindowImplAndroid.cpp index 6455be1f0..001a272b4 100644 --- a/src/SFML/Window/Android/WindowImplAndroid.cpp +++ b/src/SFML/Window/Android/WindowImplAndroid.cpp @@ -102,7 +102,8 @@ WindowHandle WindowImplAndroid::getSystemHandle() const void WindowImplAndroid::processEvents() { // Process incoming OS events - ALooper_pollAll(0, NULL, NULL, NULL); + while (ALooper_pollOnce(0, NULL, NULL, NULL) >= 0) + ; ActivityStates& states = getActivity(); Lock lock(states.mutex);