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

Prevent double draw when alt-tabbing from fullscreen applications #11

Open
FrigoCoder opened this issue Jan 4, 2018 · 2 comments
Open
Labels
bug Something isn't working enhancement New feature or request

Comments

@FrigoCoder
Copy link
Owner

We first construct our form, and only then switch from the fullscreen application to our form. This triggers a resolution change, which causes our form to be redrawn. Find a way to prevent this double draw.

@FrigoCoder
Copy link
Owner Author

I managed to solve the issue. Instead of trying to detect fullscreen applications, I simply send an inactivation message to the foreground application, which triggers an early resolution change:

SendMessage(GetForegroundWindow(), WM_ACTIVATEAPP, false, GetCurrentThreadId());

This exact same message is also sent during application switches, so I essentially emulate one before it actually happens. I have not encountered any side effects yet.

Mind you however, that this does not solve DWM issues. Windows 7 automatically disables DWM composition for compatibility launches, or when it detects direct access to the primary display surface. It does not allow you to re-enable, and I do not see an easy solution to this problem. Thankfully this issue will eventually go away since DWM composition is always enabled in Windows 8 and newer.

@FrigoCoder FrigoCoder reopened this Jan 4, 2018
@FrigoCoder
Copy link
Owner Author

Issue arises again after changing SendMessage to PostMessage so we do not wait for the foreground window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant