Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active window loses focus when screen is turned off and then on again #2339

Closed
2 tasks done
pan2357 opened this issue Mar 30, 2024 · 14 comments
Closed
2 tasks done

Active window loses focus when screen is turned off and then on again #2339

pan2357 opened this issue Mar 30, 2024 · 14 comments
Labels
question Further information is requested

Comments

@pan2357
Copy link

pan2357 commented Mar 30, 2024

Rules

  • I made myself familiar with the Readme, FAQ and Troubleshooting.
  • I understand that, if insufficient information or no app logs will be provided, my issue will be closed without an answer.

What's wrong?

On new versions of g-helper, when the display is turned off then on again, the active window will lose focus.
The last known version to not have this issue is 0.141, which I am currently using.

I have set the Fn+F11 (sleep) button to "Turn off the display" in Control Panel.
I also sometimes use an AutoHotkey script SendMessage 0x112, 0xF170, 2,, "Program Manager" to turn off the display.
All these does is turn off the display.
The display can be turned on again by pressing any key on the keyboard or moving the mouse pointer.

Please see the example in the attached videos.

How to reproduce the bug?

Set the sleep key to turn off the display for ease of testing

  1. Go to "Control Panel"
  2. Go to "System and Security"
  3. Go to "Power Options"
  4. Go to "Choose what the power buttons do" on the upper left corner
  5. Change "When I press the sleep button" to "Turn off the display"

Actual testing

  1. Go to any window
  2. Click anywhere inside the window
  3. Press tab a few times until you see some text being highlighted
  4. Press your sleep button, e.g. Fn+F11 on my 2020 model
  5. The screen will turn off
  6. Wait a few seconds
  7. Move your mouse pointer
  8. The screen will turn on
  9. The highlighted text in step 3. is not highlighted anymore
  10. Press tab a few times, there will not be any changes on the active window (as in no text will be highlighted like before we turn off the screen in step 3.)

Logs

log.txt

I have turned the screen off then on at

  • 0.141 => 2024-03-30 20:38:49
  • 0.164 => 2024-03-30 20:39:32

Device and Model

Asus Zephyrus G14 GA401IH

Additional information.

Normal behavior

normal_muted.mp4

Has issue

has_issue_muted.mp4

Note

Sorry for the poor quality of the video as I cannot find a way to directly record the screen and show that it is off.

Armoury Crate

Never installed

Asus Services

0

Version

0.164

OS

Windows 11 23H2

@seerge
Copy link
Owner

seerge commented Mar 30, 2024

@pan2357 hello, I don't really think it's something connected with G-Helper honestly :)

Hotkey Fn-F11 just emits an asus own sleep command. That's it. Nothing else.

2024-03-30 20:38:58: Key: 108
2024-03-30 20:38:58: Sleep = 108 : 0

And it's same in 0.141 as now (more over it didn't really change since was added)

static void SleepEvent()

case 108: // FN+F11

Can you just quit g-helper and put your device to sleep and see if that window focus changes or not ?
Can you run older version (0.141 as you say) of the app now and see if it's same ?

@seerge seerge added the question Further information is requested label Mar 30, 2024
@seerge
Copy link
Owner

seerge commented Mar 30, 2024

@pan2357 on a side note I don't have "turn off display" option for sleep button in control panel settings
Screenshot 2024-03-30 150206

And I have tried it on my device, active window stays active even after waking up ...

@pan2357
Copy link
Author

pan2357 commented Mar 30, 2024

Strange.
I have these
image

@seerge
Copy link
Owner

seerge commented Mar 30, 2024

@pan2357 but anyway I can't reproduce it

I have even tried SendMessage 0x112, 0xF170, 2,, "Program Manager" method (under Extra you can bind macro keys to "Toggle Screen" and under the hood it does exactly that).

My windows always stay in focus :) And it's actually logical. G-Helper doesn't really touch focus from other windows anyhow ...

P.S. What window does get focus instead ?

@pan2357
Copy link
Author

pan2357 commented Mar 30, 2024

@seerge
I have tried to put the device to sleep, by pressing the power button, then turn it back on.
The results are

  • No g-helper is running => focus does not change
  • g-helper 0.141 => focus does not change
  • g-helper 0.164 => focus does not change

However, if I try the same thing with Fn+F11

  • No g-helper is running => nothing happen
  • g-helper 0.141 => focus does not change
  • g-helper 0.164 => focus does not change

Looks like Fn+F11 will not register any command if g-helper is not running.

P.S. I am not sure which window does get focused either.
On the taskbar, the current window is still highlighted.
However, the title bar's color is a bit lighter than normal, which suggests that it is not focused.

@seerge
Copy link
Owner

seerge commented Mar 30, 2024

@pan2357

However, if I try the same thing with Fn+F11
No g-helper is running => nothing happen
g-helper 0.141 => focus does not change
g-helper 0.164 => focus does not change

So both versions work correct ?

FN+F11 won't work without G-Helper or Asus Services running

@pan2357
Copy link
Author

pan2357 commented Mar 30, 2024

@seerge

So both versions work correct ?

Yes, that is if you use it to put the computer to sleep.

P.S. What window does get focus instead ?

I have tried again. After the screen is turned on, it is g-helper that get focused.
I always run it minimized in the taskbar, so I did not see this.

@seerge
Copy link
Owner

seerge commented Mar 30, 2024

@pan2357 ok, can you find first version (i.e. 0.142 ?) where this behavior changes ? Then I will be able to compare changes and at least try to guess a reasons for you.

As currently gap between 0.141 and 0.164 is huge :)

@pan2357
Copy link
Author

pan2357 commented Mar 30, 2024

@pan2357 ok, can you find first version (i.e. 0.142 ?) where this behavior changes ? Then I will be able to compare changes and at least try to guess a reasons for you.

As currently gap between 0.141 and 0.164 is huge :)

You mean run the test (turn off the screen then on) and upload the log file here?

@seerge
Copy link
Owner

seerge commented Mar 30, 2024

@pan2357 you say that it works OK in 0.141. So try to find first build (after 0.141) that doesn't work as you want.

@pan2357
Copy link
Author

pan2357 commented Mar 30, 2024

@seerge
Found it, 0.143 is the first one that does not work.

@seerge
Copy link
Owner

seerge commented Mar 30, 2024

@pan2357 ok, it was a lot of changes in the app to support blind people and narrator support.

Nothing related to sleep / screen off

It could be that something related to narrator triggers windows to set focus to g-helper window instead

Try this build

GHelper.zip

@pan2357
Copy link
Author

pan2357 commented Mar 30, 2024

@seerge

Try this build

GHelper.zip

This build works (focus does not change to g-helper).

@seerge seerge closed this as completed in ed8f056 Mar 30, 2024
@seerge
Copy link
Owner

seerge commented Mar 30, 2024

@pan2357 ok, that was fast . I was expecting to test more things ....

Github has closed it automatically when I pushed tweak :) but i guess that's ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants