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

Author Topic: Loads of LostFocus/GainedFocus events  (Read 2917 times)

0 Members and 1 Guest are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Loads of LostFocus/GainedFocus events
« on: December 10, 2013, 01:25:29 pm »
Hi

I am getting spammed with loads of LostFocus/GainedFocus events every second in my app. I am drawing to 3 windows (two of which are touchscreens), and generally I am getting this:

LOSE FOCUS WINDOW 1
LOSE FOCUS WINDOW 2
GAIN FOCUS WINDOW 1
GAIN FOCUS WINDOW 2

The result of this, is, the first time I touch one window, then another, the screens flicker for a short time.

Does anyone have any ideas? This is a W7 PC.

Thanks
SFML 2.1

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Loads of LostFocus/GainedFocus events
« Reply #1 on: December 10, 2013, 01:36:56 pm »
Chances are high, that it's a driver issue... ;)

What kind of PC is it and what kind of display?
Are the drivers for the input and graphic card up to date?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: Loads of LostFocus/GainedFocus events
« Reply #2 on: December 10, 2013, 01:46:20 pm »
Hi

This is a kiosk style application, so I can't update the drivers etc. But PC specs are:

Intel Core 2 Duo @ 2.6 GHZ
4GB RAM
Radeon E6460 (512MB)

Displays are 2x 1680x1050 (1 is touchable) and 1x 1680x342 (touchable)
SFML 2.1

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: Loads of LostFocus/GainedFocus events
« Reply #3 on: December 11, 2013, 11:27:58 am »
Capturing all Windows messages to stderr in text form revealed the difference between running the game, pressing the screen, and running the game and NOT pressing the screen shows a WM_CAPTURECHANGED message (when screen is pressed), which according to MSDN, suggests you should redraw the screen.

Watch this space.
SFML 2.1

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
[SOLVED] Re: Loads of LostFocus/GainedFocus events
« Reply #4 on: December 11, 2013, 01:09:15 pm »
That has fixed it. You can redraw the screen, and (maybe or) just bring your window to the top/topmost on receiving this message.
SFML 2.1

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Loads of LostFocus/GainedFocus events
« Reply #5 on: December 11, 2013, 01:40:53 pm »
I'm not that I followed you there. How's the other message related to Gain/LostFocus? And what exactly is the fix?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything