The Inbox: Kernel-dtl.983.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Kernel-dtl.983.mcz

commits-2
David T. Lewis uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-dtl.983.mcz

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

Name: Kernel-dtl.983
Author: dtl
Time: 30 January 2016, 2:12:42.962584 pm
UUID: 5083c482-91e7-4fc6-b812-ed73abcbd69c
Ancestors: Kernel-dtl.982

InputSensor removal.

Consolidate class methods. Remove InputSensor from that system startup list, and add EventSensor.

=============== Diff against Kernel-dtl.982 ===============

Item was added:
+ ----- Method: EventSensor class>>default (in category 'public') -----
+ default
+ "Answer the default system input sensor, Sensor."
+
+ ^ Sensor!

Item was added:
+ ----- Method: EventSensor class>>defaultCrossPlatformKeys (in category 'class initialization') -----
+ defaultCrossPlatformKeys
+ "Answer a list of key letters that are used for common editing operations
+ on different platforms."
+ ^{ $c . $x . $v . $a . $s . $f . $g . $z }
+ !

Item was changed:
  ----- Method: EventSensor class>>initialize (in category 'class initialization') -----
  initialize
 
+ Smalltalk addToStartUpList: self after: Cursor!
- self flag: #REMOVE. "temporary initialization method to support InputSensor removal"
- "Update the preferences"
- { #swapMouseButtons . #swapControlAndAltKeys . #duplicateControlAndAltKeys . #duplicateAllControlAndAltKeys }
- do: [ :key | | pref changeSelector |
- pref := Preferences preferenceAt: key.
- changeSelector := (key , #Changed) asSymbol.
- pref ifNotNil: [ pref changeInformee: EventSensor changeSelector: changeSelector ] ].
- !

Item was added:
+ ----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
+ installDuplicateKeyEntryFor: c
+ | key |
+ key := c asInteger.
+ "first do control->alt key"
+ KeyDecodeTable at: { key bitAnd: 16r9F . 2 } put: { key . 8 }.
+ "then alt->alt key"
+ KeyDecodeTable at: { key . 8 } put: { key . 8 }
+ !

Item was added:
+ ----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
+ installKeyDecodeTable
+ "Create a decode table that swaps some keys if
+ Preferences swapControlAndAltKeys is set"
+ KeyDecodeTable := Dictionary new.
+ Preferences duplicateControlAndAltKeys
+ ifTrue: [ self defaultCrossPlatformKeys do:
+ [ :c | self installDuplicateKeyEntryFor: c ] ].
+ Preferences swapControlAndAltKeys
+ ifTrue: [ self defaultCrossPlatformKeys do:
+ [ :c | self installSwappedKeyEntryFor: c ] ].
+ Preferences duplicateAllControlAndAltKeys
+ ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
+ [ :c | self installDuplicateKeyEntryFor: c ] ].
+ !

Item was added:
+ ----- Method: EventSensor class>>installMouseDecodeTable (in category 'class initialization') -----
+ installMouseDecodeTable
+ "Create a decode table that swaps the lowest-order 2 bits if
+ Preferences swapMouseButtons is set"
+ ButtonDecodeTable := Preferences swapMouseButtons
+ ifTrue: [ByteArray withAll:
+ ((0 to: 255) collect: [:ea |
+ ((ea bitAnd: 1) << 1
+ bitOr: (ea bitAnd: 2) >> 1)
+ bitOr: (ea bitAnd: 16rFC) ])]
+ ifFalse: [ByteArray
+ withAll: (0 to: 255)]!

Item was added:
+ ----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
+ installSwappedKeyEntryFor: c
+ | key |
+ key := c asInteger.
+ "first do control->alt key"
+ KeyDecodeTable at: { key bitAnd: 16r9F . 2 } put: { key . 8 }.
+ "then alt->control key"
+ KeyDecodeTable at: { key . 8 } put: { key bitAnd: 16r9F . 2 }!

Item was added:
+ ----- Method: EventSensor class>>keyDecodeTable (in category 'key decode table') -----
+ keyDecodeTable
+ ^KeyDecodeTable ifNil: [ self installKeyDecodeTable ]!

Item was added:
+ ----- Method: EventSensor class>>shutDown (in category 'system startup') -----
+ shutDown
+ self default shutDown.!

Item was added:
+ ----- Method: EventSensor class>>startUp (in category 'system startup') -----
+ startUp
+
+ self installMouseDecodeTable.
+ self installKeyDecodeTable.
+ self default startUp!

Item was added:
+ ----- Method: EventSensor>>installInterruptWatcher (in category 'user interrupts') -----
+ installInterruptWatcher
+ "Initialize the interrupt watcher process. Terminate the old process if any."
+ "Sensor installInterruptWatcher"
+
+ InterruptWatcherProcess ifNotNil: [InterruptWatcherProcess terminate].
+ InterruptSemaphore := Semaphore new.
+ InterruptWatcherProcess := [self userInterruptWatcher] forkAt: Processor lowIOPriority.
+ self primInterruptSemaphore: InterruptSemaphore.!

Item was added:
+ ----- Method: EventSensor>>interruptWatcherProcess (in category 'user interrupts') -----
+ interruptWatcherProcess
+ "Answer my interrupt watcher process, if any"
+ ^InterruptWatcherProcess!

Item was added:
+ ----- Method: EventSensor>>setInterruptKey: (in category 'user interrupts') -----
+ setInterruptKey: anInteger
+ "Register the given keycode as the user interrupt key."
+
+ self primSetInterruptKey: anInteger.
+ !

Item was changed:
  ----- Method: EventSensor>>shutDown (in category 'initialize') -----
  shutDown
+ InterruptWatcherProcess ifNotNil: [
+ InterruptWatcherProcess terminate.
+ InterruptWatcherProcess := nil ].!
- super shutDown.
- EventTicklerProcess ifNotNil: [
- EventTicklerProcess terminate.
- EventTicklerProcess := nil. ].
- inputSemaphore ifNotNil:[Smalltalk unregisterExternalObject: inputSemaphore].
- !

Item was changed:
  ----- Method: EventSensor>>startUp (in category 'initialize') -----
  startUp
+ self installInterruptWatcher.!
- "Run the I/O process"
- self initialize.
- self primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore).
- super startUp.
- self installEventTickler.
- Smalltalk isMorphic ifTrue:[self flushAllButDandDEvents].
-
- "Attempt to discover whether the input semaphore is actually being signaled."
- hasInputSemaphore := false.
- inputSemaphore initSignals.
- !

Item was added:
+ ----- Method: EventSensor>>userInterruptWatcher (in category 'user interrupts') -----
+ userInterruptWatcher
+ "Wait for user interrupts and open a notifier on the active process when one occurs."
+ [ InterruptSemaphore wait.
+ Display deferUpdates: false.
+ SoundService defaultOrNil ifNotNil: [ : soundSystem | soundSystem shutDown ].
+ Smalltalk handleUserInterrupt ] repeat!

Item was removed:
- ----- Method: InputSensor class>>default (in category 'public') -----
- default
- "Answer the default system InputSensor, Sensor."
-
- ^ Sensor!

Item was removed:
- ----- Method: InputSensor class>>defaultCrossPlatformKeys (in category 'class initialization') -----
- defaultCrossPlatformKeys
- "Answer a list of key letters that are used for common editing operations
- on different platforms."
- ^{ $c . $x . $v . $a . $s . $f . $g . $z }
- !

Item was removed:
- ----- Method: InputSensor class>>duplicateControlAndAltKeys: (in category 'public') -----
- duplicateControlAndAltKeys: aBoolean
- "InputSensor duplicateControlAndAltKeys: true"
-
- Preferences setPreference: #duplicateControlAndAltKeys toValue: aBoolean.
- self installKeyDecodeTable
- !

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

Item was removed:
- ----- Method: InputSensor class>>installDuplicateKeyEntryFor: (in category 'public') -----
- installDuplicateKeyEntryFor: c
- | key |
- key := c asInteger.
- "first do control->alt key"
- KeyDecodeTable at: { key bitAnd: 16r9F . 2 } put: { key . 8 }.
- "then alt->alt key"
- KeyDecodeTable at: { key . 8 } put: { key . 8 }
- !

Item was removed:
- ----- Method: InputSensor class>>installKeyDecodeTable (in category 'class initialization') -----
- installKeyDecodeTable
- "Create a decode table that swaps some keys if
- Preferences swapControlAndAltKeys is set"
- KeyDecodeTable := Dictionary new.
- Preferences duplicateControlAndAltKeys
- ifTrue: [ self defaultCrossPlatformKeys do:
- [ :c | self installDuplicateKeyEntryFor: c ] ].
- Preferences swapControlAndAltKeys
- ifTrue: [ self defaultCrossPlatformKeys do:
- [ :c | self installSwappedKeyEntryFor: c ] ].
- Preferences duplicateAllControlAndAltKeys
- ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
- [ :c | self installDuplicateKeyEntryFor: c ] ].
- !

Item was removed:
- ----- Method: InputSensor class>>installMouseDecodeTable (in category 'class initialization') -----
- installMouseDecodeTable
- "Create a decode table that swaps the lowest-order 2 bits if
- Preferences swapMouseButtons is set"
- ButtonDecodeTable := Preferences swapMouseButtons
- ifTrue: [ByteArray withAll:
- ((0 to: 255) collect: [:ea |
- ((ea bitAnd: 1) << 1
- bitOr: (ea bitAnd: 2) >> 1)
- bitOr: (ea bitAnd: 16rFC) ])]
- ifFalse: [ByteArray
- withAll: (0 to: 255)]!

Item was removed:
- ----- Method: InputSensor class>>installSwappedKeyEntryFor: (in category 'public') -----
- installSwappedKeyEntryFor: c
- | key |
- key := c asInteger.
- "first do control->alt key"
- KeyDecodeTable at: { key bitAnd: 16r9F . 2 } put: { key . 8 }.
- "then alt->control key"
- KeyDecodeTable at: { key . 8 } put: { key bitAnd: 16r9F . 2 }!

Item was removed:
- ----- Method: InputSensor class>>keyDecodeTable (in category 'public') -----
- keyDecodeTable
- ^KeyDecodeTable ifNil: [ self installKeyDecodeTable ]!

Item was changed:
  ----- Method: InputSensor class>>shutDown (in category 'system startup') -----
  shutDown
+ EventSensor shutDown!
- self default shutDown.!

Item was changed:
  ----- Method: InputSensor class>>startUp (in category 'system startup') -----
  startUp
+ EventSensor startUp!
-
- self installMouseDecodeTable.
- self installKeyDecodeTable.
- self default startUp!

Item was removed:
- ----- Method: InputSensor class>>swapControlAndAltKeys: (in category 'public') -----
- swapControlAndAltKeys: aBoolean
- "InputSensor swapControlAndAltKeys: true"
-
- Preferences setPreference: #swapControlAndAltKeys toValue: aBoolean.
- self installKeyDecodeTable!

Item was removed:
- ----- Method: InputSensor class>>swapMouseButtons: (in category 'public') -----
- swapMouseButtons: aBoolean
- "InputSensor swapMouseButtons: true"
-
- Preferences setPreference: #swapMouseButtons toValue: aBoolean.
- self installMouseDecodeTable.!

Item was removed:
- ----- Method: InputSensor>>flushEvents (in category 'initialize') -----
- flushEvents
- "Do nothing"!

Item was removed:
- ----- Method: InputSensor>>installInterruptWatcher (in category 'user interrupts') -----
- installInterruptWatcher
- "Initialize the interrupt watcher process. Terminate the old process if any."
- "Sensor installInterruptWatcher"
-
- InterruptWatcherProcess ifNotNil: [InterruptWatcherProcess terminate].
- InterruptSemaphore := Semaphore new.
- InterruptWatcherProcess := [self userInterruptWatcher] forkAt: Processor lowIOPriority.
- self primInterruptSemaphore: InterruptSemaphore.!

Item was removed:
- ----- Method: InputSensor>>interruptWatcherProcess (in category 'user interrupts') -----
- interruptWatcherProcess
- "Answer my interrupt watcher process, if any"
- ^InterruptWatcherProcess!

Item was removed:
- ----- Method: InputSensor>>setInterruptKey: (in category 'user interrupts') -----
- setInterruptKey: anInteger
- "Register the given keycode as the user interrupt key."
-
- self primSetInterruptKey: anInteger.
- !

Item was removed:
- ----- Method: InputSensor>>shutDown (in category 'initialize') -----
- shutDown
- InterruptWatcherProcess ifNotNil: [
- InterruptWatcherProcess terminate.
- InterruptWatcherProcess := nil ].!

Item was removed:
- ----- Method: InputSensor>>startUp (in category 'initialize') -----
- startUp
- self installInterruptWatcher.!

Item was removed:
- ----- Method: InputSensor>>userInterruptWatcher (in category 'user interrupts') -----
- userInterruptWatcher
- "Wait for user interrupts and open a notifier on the active process when one occurs."
- [ InterruptSemaphore wait.
- Display deferUpdates: false.
- SoundService defaultOrNil ifNotNil: [ : soundSystem | soundSystem shutDown ].
- Smalltalk handleUserInterrupt ] repeat!