Scott A Crosby wrote:
On Thu, 30 Aug 2001 sps2000@mail.com wrote:
My preferred focus policy is that focus follows mouse. (No click-to-focus), except that if the mouse pointer enters the root window, the focus does not leave the previous window.
Scott,
Here are some tips to get add the crosbyFocusPolicy option. First, you might want to take a quick glance at the spsFocusPolicy changeset (do a "browse code" on it from a file list), just to get a feel for the problem. I did a quick try at your policy, and got pretty close. So to get you started:
1. In PluggableListMorph>>mouseLeave: and PluggableTextMorph>>mouseLeave:, only allow the call to #releaseKeyboardFocus if Preferences>>crosbyFocusPolicy is not true.
2. In SystemWindow, add the following method:
mouseEnter: evt self activateRetainZOrder. ^super mouseEnter: evt.
3. Add another method to SystemWindow:
activateRetainZOrder "Bring me to the front and make me able to respond to mouse and keyboard"
| outerMorph | outerMorph _ self topRendererOrSelf. outerMorph owner ifNil: [^ self "avoid spurious activate when drop in trash"].
self submorphsDo: [:m | m unlock]. self isCollapsed ifFalse: [model modelWakeUpIn: self. self positionSubmorphs. labelArea ifNil: [self adjustBorderUponActivationWhenLabeless]].
That's enough to get pretty close to the focus style you're going for. I'm not posting it as a changeset -- it's only to get you started. For instance, the #activateRetainZOrder is just a stripped down version of #activate, and I may have stripped out too much (like the call to passivate to the previously active window).
With this kind of change to system, it's probably best to let it steap in your own environment for awhile to give it a chance to mature.
Good luck.