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

[ Focus Stealing ] HashTWM handling windows stealing focus #11

Open
sirjaren opened this issue May 29, 2013 · 4 comments
Open

[ Focus Stealing ] HashTWM handling windows stealing focus #11

sirjaren opened this issue May 29, 2013 · 4 comments

Comments

@sirjaren
Copy link

It seems applications may steal focus for various reasons, leaving HashTWM almost unusable for any reasonable length of time.

With Windows 7, the various tweaks/fixes to prevent windows from stealing focus have been removed and/or unchangeable.

I've noticed this happening a lot with KiTTY (PuTTY) as well as with Outlook 2010, as example applications.

Some applications have fine-grained controls in handling how pop-ups and window focus affect the user. Unfortunately, it appears HashTWM is fleshing out the bugs with the various applications' settings or there is a bug within HashTWM.

Would a command line argument to ignore any and all applications from stealing focus be something reasonable to implement? I'd prefer to only focus on the window I've highlighted with mod+j or mod+k.

Thank you.

@ZaneA
Copy link
Owner

ZaneA commented May 29, 2013

I certainly agree that you shouldn't have to be fighting against windows that are stealing focus. I'll look into it and see what I can do!

@ZaneA
Copy link
Owner

ZaneA commented Jun 2, 2013

Hi there,

So far I'm unable to reproduce the focus stealing... I wrote an example to open a MessageBox to try and steal focus, if I run this from the command-line it DOES take focus, but this is to be expected as I'm invoking it directly. However if I change this utility to wait 10 seconds before opening the MessageBox, then it does NOT steal focus, even if I add a flag telling it to set itself as the foreground window.

I tried out PuTTY as well by trying to open a connection to a non-existing address, if I switch to another window and wait for it to timeout it still does not steal focus while opening its error dialog.

I have however noticed that the usual WINDOWACTIVATED hook does not seem to get called at all on newer versions of Windows, and have added the RUDEAPPACTIVATED hook there which does get called. I don't expect this to help in this case however.

If you're able to reproduce the focus stealing through some code then that would be the best chance for me to be able to fix it, otherwise I will keep investigating.

For what it's worth the examples I tried were:

#include <windows.h>

int main() {
    MessageBox(NULL, "test", "test", MB_OK);
    return 0;
}

followed by:

#include <windows.h>

int main() {
    Sleep(10000);
    MessageBox(NULL, "test", "test", MB_OK | MB_SETFOREGROUND);
    return 0;
}

@ZaneA
Copy link
Owner

ZaneA commented May 10, 2023

This should be fixed as of the most recent commit (assuming it is the same issue as #30), have pushed a new binary here https://github.com/ZaneA/HashTWM/blob/master/hashtwm.exe (although I suspect you would have well moved on by now :D)

@sirjaren
Copy link
Author

Unbelievable!

Almost exactly 10 years!

Yes, my workflow is different these days but what a fond blast from the past!

Congratulations on fixing 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

2 participants