[Cuis-dev] Recent changes in MouseEvent dispatching and Kayboard focus and events

Juan Vuletich juan at cuis.st
Tue Sep 23 07:14:50 PDT 2025


Hi Folks,

During the last 3 weeks, what started with the intent to have more 
flexible handling of keyboard shortcuts, ended being a complete rewrite 
of the dispatching of Morphic events. The old code from Squeak was very 
difficult to understand and improve. It took 3 weeks and 120 change sets 
to improve the situation.

My idea was to make the changes transparent to application code, but 
there are some that may impact your code. The following list may not be 
complete. If you find breakage in your morphic event related code, 
please check what follows, and tell here in the list. So, the main 
changes that could affect your code are:

- MouseMoveEvent. Before, only morphs that answered true to 
#handlesMouseDown: would get them. Except for InnerTextMorph that used 
them to highlight and enable links in text. This made me think that any 
morph could make good use of MouseMove event if no mouse button is 
pressed. So I made that change. Now, most implementors of 
#mouseMove:localPosition: need to ask `aMouseMoveEvent anyButtonPressed` 
before doing their stuff. Your morphs should most likely do the same.

- Any morph can now be the hand's keyboard focus and receive 
#keyStroke:, #keyDown: and #keyUp:. I don't expect breackage with this, 
but this new flexibility may be useful. For example, the cmd-w window 
shortcut, and the world global cmd-b, cmd-f and cmd-F shortcuts are now 
handled via #windowMenuSpec and #worldMenuSpec.

- Unhandled keyboard shortcuts "buble-up" through the owner chain. So 
the above mentioned shortcuts may be intercepted by a widget, but the 
global handler will be used if not.

- Click-to-focus behavior changed quite a bit, trying to better mimic 
what mainstream GUIs do. For example, if some widget doesn't have a 
selection, the click that gives focus is also used to modify selection 
or position cursor. But if there is already a selection, then only focus 
is set, and you need another click to select something or position the 
mouse. This is to avoid the annoying losing of selection when you only 
want to focus, but to also avoid the annoying need to do a second click 
in many cases.

As I always say, I'm trying to make compatibility breaking changes to be 
as few as possible, and to be worth their weight. Thanks for dealing 
with them when needed.

Cheers,

-- 
Juan Vuletich
www.cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich



More information about the Cuis-dev mailing list