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

Author Topic: KeyReleased event missed when going from fullscreen to windowed  (Read 1343 times)

0 Members and 1 Guest are viewing this topic.

DrifterRLDev

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hi, I think this could be a bug, but please let me know if I'm just misguided  :)

I'm noticing that when I go from fullscreen to windowed, the key that I use to trigger the fullscreen toggle does not fire a KeyReleased event.

Repro should be simple enough: just set a key to toggle fullscreen on/off and breakpoint on the KeyReleased event.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11192
    • View Profile
    • development blog
    • Email
Re: KeyReleased event missed when going from fullscreen to windowed
« Reply #1 on: March 06, 2025, 06:54:16 pm »
This likely caused, because switching mode is done through recreation of the window, so you'll end up with a new window handle and the event will likely be sent to the old one. I guess you could try and hold the key until the new window is ready an see if it then triggers correctly.

If you're tracking key states, you may want to reset the states once you recreate the window, since you might have also missed other events.

I don't know the specific APIs (yet), but the plan is, if the API allows it, to allow switching between windowed and fullscreen without recreating the window.
Official FAQ: https://www.sfml-dev.org/faq/
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

DrifterRLDev

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: KeyReleased event missed when going from fullscreen to windowed
« Reply #2 on: March 06, 2025, 08:46:18 pm »
Thanks for the quick response. I am tracking key states, so I'll just clear my input buffer after going fullscreen - thanks for the suggestion.