mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
[Android] Implemented sf::Window::hasFocus()
This commit is contained in:
parent
53e3409cbf
commit
ab4d4d7477
@ -51,6 +51,7 @@ WindowImplAndroid::WindowImplAndroid(WindowHandle handle)
|
||||
: m_size(0, 0)
|
||||
, m_windowBeingCreated(false)
|
||||
, m_windowBeingDestroyed(false)
|
||||
, m_hasFocus(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,6 +61,7 @@ WindowImplAndroid::WindowImplAndroid(VideoMode mode, const String& title, unsign
|
||||
: m_size(mode.width, mode.height)
|
||||
, m_windowBeingCreated(false)
|
||||
, m_windowBeingDestroyed(false)
|
||||
, m_hasFocus(false)
|
||||
{
|
||||
ActivityStates* states = getActivity(NULL);
|
||||
Lock lock(states->mutex);
|
||||
@ -191,8 +193,7 @@ void WindowImplAndroid::requestFocus()
|
||||
////////////////////////////////////////////////////////////
|
||||
bool WindowImplAndroid::hasFocus() const
|
||||
{
|
||||
// Not applicable
|
||||
return false;
|
||||
return m_hasFocus;
|
||||
}
|
||||
|
||||
|
||||
@ -206,10 +207,12 @@ void WindowImplAndroid::forwardEvent(const Event& event)
|
||||
WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states->window);
|
||||
WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states->window);
|
||||
WindowImplAndroid::singleInstance->m_windowBeingCreated = true;
|
||||
WindowImplAndroid::singleInstance->m_hasFocus = true;
|
||||
}
|
||||
else if (event.type == Event::LostFocus)
|
||||
{
|
||||
WindowImplAndroid::singleInstance->m_windowBeingDestroyed = true;
|
||||
WindowImplAndroid::singleInstance->m_hasFocus = false;
|
||||
}
|
||||
|
||||
WindowImplAndroid::singleInstance->pushEvent(event);
|
||||
|
@ -222,6 +222,7 @@ private:
|
||||
Vector2u m_size;
|
||||
bool m_windowBeingCreated;
|
||||
bool m_windowBeingDestroyed;
|
||||
bool m_hasFocus;
|
||||
};
|
||||
|
||||
} // namespace priv
|
||||
|
Loading…
Reference in New Issue
Block a user