[squeak-dev] The Inbox: ToolBuilder-Morphic-ct.278.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Aug 23 15:05:05 UTC 2021

A new version of ToolBuilder-Morphic was added to project The Inbox:

==================== Summary ====================

Name: ToolBuilder-Morphic-ct.278
Author: ct
Time: 23 August 2021, 5:05:03.885565 pm
UUID: 11672978-6add-0747-a391-a7bb517eb028
Ancestors: ToolBuilder-Morphic-mt.277

Proposal: When #openToolsAttachedToMouseCursor is enabled, always open tools under the hand.

I have been trying out this patch for several months in my image and overall found it very convenient for a number of reasons:

1. It feels much more familiar if tools *always* open under hand, not only sometimes (following some kind of, maybe non-straightforward, heuristic). The former #currentEvent hack was a nice idea but eventually, such as distinction was less intuitive for me.

2. The former #currentEvent hack does not always work: Already some time ago, I experienced a small number of situations where - after triggering a tool via keyboard - #currentEvent sent from #openAsTool already answered a newer mouse move event (maybe a threading issue? I never managed to trace this down). A more significant observation is that since #currentEvent is implemented as a dynamic variable [1], its return value is not always the same as the latest user event. You can see this in effect when you do-it the following via keyboard before loading this patch:

	self inform: #foo.
	Workspace open.
(In this situation, one could argue that not opening the workspace under the cursor would be the right behavior because there is no current mouse event on the stack at this moment, but my intuition does not think so.)

3. If you have this preference enabled, you are probably a mouse user, and your next action after opening the tool will most likely be a mouse action anyway. Thus initially having the tool under hand does not harm, but it is a nice utility because you can immediately control the spatial arrangement without extra effort.

[1] http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-September/211392.html

=============== Diff against ToolBuilder-Morphic-mt.277 ===============

Item was changed:
  ----- Method: SystemWindow>>openAsTool (in category '*ToolBuilder-Morphic-opening') -----
  	"Open this window as a tool, that is, honor the preferences such as #reuseWindows and #openToolsAttachedToMouseCursor."
  	| meOrSimilarWindow |
  	meOrSimilarWindow := self openInWorldExtent: self extent.
+ 	Project uiManager openToolsAttachedToMouseCursor
- 	(Project uiManager openToolsAttachedToMouseCursor
- 		and: [ | event |
- 			event := self currentEvent.
- 			event isMouse and: [event isMouseUp]])
  				ifTrue: [
  					meOrSimilarWindow setProperty: #initialDrop toValue: true.
  					meOrSimilarWindow hasDropShadow: false.
  					self currentHand attachMorph: meOrSimilarWindow].
  	^ meOrSimilarWindow

More information about the Squeak-dev mailing list