Mantis - Squeak
Viewing Issue Advanced Details
7181 Morphic minor always 09-10-08 22:27 10-03-09 19:33
Pascal Vollmer  
assigned 3.9  
none 3.11  
0007181: improve HandMorph>>shadowForm
Say you want to know which is the color of the morph under the mouse pointer. Also say that the mouse pointer has no morphs attached to it.
You might use touchesColor: in order to do this.
When sending touchesColor: to a HandMorph-object you will send shadowForm to this HandMorph-object.
If at this moment the mouse pointer has no submorphs shadowForm will fail.
The remedy in this case is to send shadowForm to super."
child of 0006635new  Mother of Squeak UI annoyances 
 HandMorph-shadowForm-M7181-pv.1.cs.gz [^] (636 bytes) 09-10-08 22:30
 HandMorphTest-M7181-pv.1.cs.gz [^] (492 bytes) 09-22-08 20:22

Pascal Vollmer   
09-10-08 22:31   
Added a fix. (Thanks to Ken Causey for his video how to report bugs !)

09-12-08 22:47   
Hi Pascal,

Thanks for the fix.

It would be good if you could also include an Sunit test. One which fails before the fix is installed and passes afterwards.
This will build confidence in the fix. It will also stop someone from removing the fix w/o noticing that they have done so.

I have been asking this of all submitters so as to make life easier on harvesters.

Yours in curiosity and service, --Jerome Peace
09-12-08 23:56   

Without the patch ActiveHand shadowForm raises an error and with the patch it does not. So that could be the basis for a test.

I did take a look at the patch. It is an improvement of the current state of affairs.

I am not sure how it handles the case when the cursor is blank and there are also no submorphs. But that would be a bug in its own right. I have known it to happen. A handle is used as a submorph. The cursor is set to
blank and something causes the handle to be removed.

So I am wondering if instead of calling super a onebit shadowForm with an offset equal to the cursor position would not be a good alternative?

That is as far as I have gotten in my thinking.

If you have time to spend on this I would suggest making the tests first then fiddling (iff you wish) with the code itself. Your current patch is still an improvement.

Cheers -Jer
Pascal Vollmer   
09-22-08 20:26   
Hi Jerome,
I've added a unit test as you requested. It tests touchesColor: with and w/o the fix and shows that the fix is useful for this use case.
cheers, Pascal
10-01-08 02:24   
"fix begin"
Installer mantis bug: 7181 fix: 'HandMorph-shadowForm-M7181-pv.1.cs.gz'.
"fix test"
Installer mantis bug: 7181 fix: 'HandMorphTest-M7181-pv.1.cs.gz'.
"fix end"