[squeak-dev] Dependencies on Cursor

Juan Vuletich (mail lists) juanlists at jvuletich.org
Mon Jun 24 13:28:31 UTC 2013


I recently did something better fo Cuis. The idea is to let Morphic  
handle that. If Morphic frame rate drops below some threshold, show  
the wait cursor. This way, there are no 'bad' references to UI from  
non-UI code, and you only get the wait cursor if appropriate (for  
instance, not if the very same code is run on a forked process). It is  
trivial to add protocol to set the "wait cursor" to be used. This  
allowed me to clean a lot of methods.

It is in update #1704 at https://github.com/jvuletich/Cuis .

Cheers,
Juan Vuletich

Quoting Frank Shearar <frank.shearar at gmail.com>:

> Lots of code (174 senders) use something like:
>
>     Cursor wait showWhile: ["stuff"]
>
> That's great, and neat, and causes a dependency on the entire Graphics
> package. I propose breaking this dependency by extending UIManager's
> protocol. You would then write:
>
>     UIManager default showCursor: #wait during: ["stuff"]
>
> I use a Symbol to identify the cursor because that doesn't require
> depending on any particular classes. Perhaps UIManager >>
> #showCursor:during: can lay out the minimum expected set of labels
> (whatever Cursor currently lists). Then MorphicUIManager and
> MVCUIManager can implement this method in the existing way, with ^
> Cursor foo showWhile: aBlock
>
> One other change is needed, and that's to handle mistakes. So I propose
>
> Cursor class >> #named: aSymbol
>     ^ (self respondsTo: #named)
>         ifTrue: [self perform: aSymbol]
>         ifFalse: [self normal].
>
> The reason for the icky reflection is to fit in with the existing way
> cursors are used. I'd be happy to unroll the #perform: into a #caseOf:
> mapping explicitly to the existing cursors.
>
> Thoughts?
>
> frank
>
>



Cheers,
Juan Vuletich



More information about the Squeak-dev mailing list