|April 6th, 2011|
|focus, mouse, osx, tech|
Recently, though, I noticed something strange: focus will follow the mouse into terminal almost all the time. Supposedly, the way focus follows mouse works for terminal (and x11) is that within one application you can do whatever you want with your keystrokes and the multiple windows of terminal or x11 are all running as one application. So if I have terminal up I can type into any terminal windows just by moving the mouse. I shouldn't be able to go from typing an email to typing in terminal; that's supposed to be impossible.
What I see instead is that whatever program I have focused, if I move the mouse into terminal then type, that typing shows up. This includes proper handling of the shift and control keys, but command is a little weird (command-N opens a new window correctly, command-T opens a new window instead of a new tab, command-V does nothing). This appears to work all the time except when the previously focused window is on a different physical screen than the terminal.
This indicates that there's something terminal is doing that's different than what steve yegge tried, because he found:
I start my little app (which has no UI), move the mouse into a window from a non-foreground application, and I can type into it!So maybe there's still hope for focus follows mouse on mac osx? How does terminal do it?
Except I can only type unmodified keys. It's completely ignoring my keyboard event posts for Shift, Control, Alt and Command. That's the lie part. They said they'd generate flags changed events. They lied.
 This is where you choose which window your typing goes into by putting the mouse over that window. To switch from typing in firefox to typing in my email client, I'd just need to slide the mouse over. Both windows and mac by default make you click to choose the window, which is usually called click-to-focus.
Comment via: facebook