[squeak-dev] The Trunk: Kernel-dtl.984.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Feb 2 17:30:54 UTC 2016

David T. Lewis uploaded a new version of Kernel to project The Trunk:

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

Name: Kernel-dtl.984
Author: dtl
Time: 30 January 2016, 2:37:27.663155 pm
UUID: 16c765b5-65b4-49ef-ba63-abceec7cd80e
Ancestors: Kernel-dtl.983

Remove InputSensor. EventSensor replaces InputSensor for both Morphic and MVC.

Note: requires update to SmalltalkImage class initialization methods in package System.

=============== Diff against Kernel-dtl.983 ===============

Item was changed:
+ Object subclass: #EventSensor
- InputSensor subclass: #EventSensor
  	instanceVariableNames: 'mouseButtons mousePosition keyboardBuffer interruptKey interruptSemaphore eventQueue inputSemaphore lastEventPoll hasInputSemaphore'
+ 	classVariableNames: 'ButtonDecodeTable EventPollPeriod EventTicklerProcess InterruptSemaphore InterruptWatcherProcess KeyDecodeTable'
- 	classVariableNames: 'EventPollPeriod EventTicklerProcess'
  	poolDictionaries: 'EventSensorConstants'
  	category: 'Kernel-Processes'!
  !EventSensor commentStamp: 'nk 4/13/2004 11:18' prior: 0!
  EventSensor is a replacement for InputSensor based on a set of (optional) event primitives. An EventSensor updates its state when events are received so that all state based users of Sensor (e.g., Sensor keyboard, Sensor leftShiftDown, Sensor mouseButtons) will work exactly as before, by moving the current VM mechanisms into EventSensor itself. An optional input semaphore is part of the new design.
  For platforms that support true asynchronous event notification, the semaphore will be signaled to indicate pending events.
  On platforms that do not support asynchronous notifications about events, the UI will have to poll EventSensor periodically to read events from the VM.
  Instance variables:
  	mouseButtons <Integer>	- mouse button state as replacement for primMouseButtons
  	mousePosition <Point>	- mouse position as replacement for primMousePt
  	keyboardBuffer <SharedQueue>	- keyboard input buffer
  	interruptKey <Integer>			- currently defined interrupt key
  	interruptSemaphore <Semaphore>	- the semaphore signaled when the interruptKey is detected
  	eventQueue <SharedQueue>	- an optional event queue for event driven applications
  	inputSemaphore <Semaphore>- the semaphore signaled by the VM if asynchronous event notification is supported
  	lastEventPoll <Integer>		- the last millisecondClockValue at which we called fetchMoreEvents
  	hasInputSemaphore <Boolean>	- true if my inputSemaphore has actually been signaled at least once.
  Class variables:
  	EventPollPeriod <Integer>	- the number of milliseconds to wait between polling for more events in the userInterruptHandler.
  	EventTicklerProcess <Process>	- the process that makes sure that events are polled for often enough (at least every EventPollPeriod milliseconds).
  Event format:
  The current event format is very simple. Each event is recorded into an 8 element array. All events must provide some SmallInteger ID (the first field in the event buffer) and a time stamp (the second field in the event buffer), so that the difference between the time stamp of an event and the current time can be reported.
  Currently, the following events are defined:
  Null event
  The Null event is returned when the ST side asks for more events but no more events are available.
  [1]		- event type 0
  [2-8]	- unused
  Mouse event structure
  Mouse events are generated when mouse input is detected.
  [1]	- event type 1
  [2]	- time stamp
  [3]	- mouse x position
  [4]	- mouse y position
  [5]	- button state; bitfield with the following entries:
  		1	-	yellow (e.g., right) button
  		2	-	blue (e.g., middle) button
  		4	-	red (e.g., left) button
  		[all other bits are currently undefined]
  [6]	- modifier keys; bitfield with the following entries:
  		1	-	shift key
  		2	-	ctrl key
  		4	-	(Mac specific) option key
  		8	-	Cmd/Alt key
  		[all other bits are currently undefined]
  [7]	- reserved.
  [8]	- reserved.
  Keyboard events
  Keyboard events are generated when keyboard input is detected.
  [1]	- event type 2
  [2]	- time stamp
  [3]	- character code
  		For now the character code is in Mac Roman encoding.
  [4]	- press state; integer with the following meaning
  		0	-	character
  		1	-	key press (down)
  		2	- 	key release (up)
  [5]	- modifier keys (same as in mouse events)
  [6]	- reserved.
  [7]	- reserved.
  [8]	- reserved.

Item was changed:
  ----- Method: EventSensor class>>initialize (in category 'class initialization') -----
+ 	Smalltalk addToStartUpList: self after: Cursor.
+ 	self installKeyDecodeTable.
+ 	self installMouseDecodeTable.
+ 	self install.
+ !
- 	Smalltalk addToStartUpList: self after: Cursor!

Item was removed:
- Object subclass: #InputSensor
- 	instanceVariableNames: ''
- 	classVariableNames: 'ButtonDecodeTable InterruptSemaphore InterruptWatcherProcess KeyDecodeTable'
- 	poolDictionaries: ''
- 	category: 'Kernel-Processes'!
- !InputSensor commentStamp: '<historical>' prior: 0!
- An InputSensor is an interface to the user input devices.
- There is at least one (sub)instance of InputSensor named Sensor in the system.
- Class variables:
- ButtonDecodeTable <ByteArray> - maps mouse buttons as reported by the VM to ones reported in the events.
- KeyDecodeTable <Dictionary<SmallInteger->SmallInteger>> - maps some keys and their modifiers to other keys (used for instance to map Ctrl-X to Alt-X)
- InterruptSemaphore <Semaphore> - signalled by the the VM and/or the event loop upon receiving an interrupt keystroke.
- InterruptWatcherProcess <Process> - waits on the InterruptSemaphore and then responds as appropriate.!

Item was removed:
- ----- Method: InputSensor class>>initialize (in category 'class initialization') -----
- initialize
- 	Smalltalk removeFromStartUpList: self!

Item was removed:
- ----- Method: InputSensor class>>shutDown (in category 'system startup') -----
- shutDown
- 	EventSensor shutDown!

Item was removed:
- ----- Method: InputSensor class>>startUp (in category 'system startup') -----
- startUp
- 	EventSensor startUp!

More information about the Squeak-dev mailing list