Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Direct access to window focus  (Read 6564 times)

0 Members and 1 Guest are viewing this topic.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 877
    • View Profile
Direct access to window focus
« 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).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Direct access to window focus
« Reply #1 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.
Laurent Gomila - SFML developer

watarok

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Direct access to window focus
« Reply #2 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10326
    • View Profile
    • development blog
    • Email
AW: Direct access to window focus
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://dev.my-gate.net/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6278
  • Thor Developer
    • View Profile
    • Bromeon
Re: AW: Direct access to window focus
« Reply #4 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 877
    • View Profile
Re: Direct access to window focus
« Reply #5 on: January 08, 2014, 11:50:02 am »
This now has an issue on the tracker: https://github.com/SFML/SFML/issues/518