SFML community forums

General => Feature requests => Topic started by: Mario on December 30, 2011, 12:16:10 pm

Title: Direct access to window focus
Post by: Mario on December 30, 2011, 12:16:10 pm
This is something I noticed lately. There doesn't seem to be any direct way to determine if some window is the active window or not (i.e. if it's focused) yet. This is partially exposed through SFML's event handling, but I really think this should be added as sf::Window members:
Code: [Select]
bool sf::Window::HasFocus(void);
void sf::Window::GetFocus(void);

While above might suggest something different, I agree, windows shouldn't bring themself on top on their own at an time, but that's actually something that should be handled by the OS anyway. I.e. under Windows the second call listed above should trigger the task bar entry of the window to be highlighted and/or flashing. In a similar way on Ubuntu the icon would shake (if I'm not mistaken), etc. without stealing focus of the active window (unless you just started the program).
Title: Direct access to window focus
Post by: Laurent on December 30, 2011, 06:05:09 pm
It won't be done for SFML 2.0, but I think it's worth adding a ticket to the task tracker. It's not the first time that focus issues are discussed.
Title: Re: Direct access to window focus
Post by: watarok on November 17, 2013, 04:04:52 am
This isn't present in SFML 2.1, but is still, I believe, a feature that should be added.
Title: AW: Direct access to window focus
Post by: eXpl0it3r on November 17, 2013, 12:30:35 pm
Seems like the ticket got never created. Not sure what Laurent's opinion on the topic is currently though.
I'd see a "hasFocus" function to be useful since there are ways where the window doesn't have the focus from the beginning.
Title: Re: AW: Direct access to window focus
Post by: Nexus on November 17, 2013, 01:16:50 pm
I'd see a "hasFocus" function to be useful since there are ways where the window doesn't have the focus from the beginning.
I agree. If there is a way to implement hasFocus() other than just tracking the focus events, it will definitely be worth a dedicated function.
Title: Re: Direct access to window focus
Post by: Mario on January 08, 2014, 11:50:02 am
This now has an issue on the tracker: https://github.com/SFML/SFML/issues/518