Skip to content

Commit

Permalink
[Android] Implemented sf::Window::hasFocus()
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioLiebisch authored and eXpl0it3r committed Oct 29, 2014
1 parent 53e3409 commit ab4d4d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/SFML/Window/Android/WindowImplAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ WindowImplAndroid::WindowImplAndroid(WindowHandle handle)
: m_size(0, 0)
, m_windowBeingCreated(false)
, m_windowBeingDestroyed(false)
, m_hasFocus(false)
{
}

Expand All @@ -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);
Expand Down Expand Up @@ -191,8 +193,7 @@ void WindowImplAndroid::requestFocus()
////////////////////////////////////////////////////////////
bool WindowImplAndroid::hasFocus() const
{
// Not applicable
return false;
return m_hasFocus;
}


Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/SFML/Window/Android/WindowImplAndroid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ class WindowImplAndroid : public WindowImpl
Vector2u m_size;
bool m_windowBeingCreated;
bool m_windowBeingDestroyed;
bool m_hasFocus;
};

} // namespace priv
Expand Down

0 comments on commit ab4d4d7

Please sign in to comment.