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

system.HasFocus returning true when minimized with task-bar while in Windowed-mode #2424

Closed
yupi2 opened this issue Feb 1, 2016 · 6 comments

Comments

@yupi2
Copy link

yupi2 commented Feb 1, 2016

Windows 7 with non-Dev branch.

] version
Protocol version 24
Exe version 16.01.01 (garrysmod)
Exe build: 09:39:42 Jan 13 2016 (6276) (4000)

Reproduction steps:

  • Start single-player server.
  • Open console.
  • sv_cheats 1
  • lua_run_cl timer.Simple(4, function() chat.AddText(tostring(system.HasFocus())) end)
  • Close console so game resumes & open the chat-box to free the mouse cursor.
  • Click on the GMOD icon in the task-bar to minimize GMOD.
  • Wait a moment.
  • Open GMOD's window and see "true" in chat.

It's obviously not a game-breaking bug, but it might as well be reported.

@WinterPhoenix
Copy link

This doesn't seem to happen anymore, or doesn't happen on Windows 10.

] version
Protocol version 24
Exe version 2020.03.17 (garrysmod)
Exe build: 19:20:26 Jun 10 2020 (7881) (4000)

Can anybody else confirm?

@robotboy655
Copy link
Contributor

It definitely happens for me on Win10, but only if I actually click on the game in the taskbar, it doesn't happen if I minimize it from top right corner.

@robotboy655
Copy link
Contributor

robotboy655 commented Jul 7, 2020

It's an issue with WM_ACTIVATEAPP being called back with "activating" state immediately after being called with the "deactivating" state, so this is more of a Windows issue. I have tested this with a 3rd party application, and the same issue persists, so not it's not just GMod. I guess it may actually be fixed on a newer Windows version, as I am not running the most up to date version.

Still would like some confirmations from other people, one way or the other.

@WinterPhoenix
Copy link

On Windows 10 1909 at least, it looks like you're right. Interesting bug.

@viral32111
Copy link
Contributor

Still would like some confirmations from other people, one way or the other.

I've just tested the steps in the original post and I can confirm it does happen. I'm on Windows 10 20H2 (Build 19042.330) using Garry's Mod 2020.06.26 (Main branch) (-noaddons & -noworkshop). I got the exact same results as you did, true when minimised by clicking the game on the taskbar, but false when minimised using actual minimise button on the window.

aa

@robotboy655
Copy link
Contributor

robotboy655 commented Jul 8, 2020

I guess I will try replacing WM_ACTIVATEAPP with WM_ACTIVATE which doesn't seem to suffer from this issue.

Let me know if any issues arise from this.

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

No branches or pull requests

4 participants