[squeak-dev] The Trunk: Kernel-mt.1391.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Nov 16 13:34:45 UTC 2021


Hi Marcel,


phew, this is harder to debug than I expected. 😅


My image in question was at Kernel-nice.1402 before I started the update and while processing update-mt.490.mcm, my working copy needed a merge. While loading this merge, #startUp was renamed to #startUp:, and then the postscript from Kernel-mt.1403 with the now useless #startUp was evaluated. So I guess that this version (Kernel-mt.1391) does not have anything to do with all this but in Kernel-mt.1403, you forgot to update the postscript. Should this be fixed?


By the way, I did not find out how I can inspect the update stream using the Monticello tools.


Best,

Christoph


________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Dienstag, 16. November 2021 11:20:43
An: squeak-dev
Betreff: Re: [squeak-dev] The Trunk: Kernel-mt.1391.mcz

Hi Christoph --

I already did that back then. See "update-mt.487.mcm" and the postscript in "Kernel-mt.1391". Well, we changed #startUp to #startUp: later, but that checkpoint should still apply when updating an image from before "Kernel-mt.1391".

Maybe it is a different issue?

Best,
Marcel

Am 14.11.2021 17:36:30 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>:

Hi Marcel,

I have an older Trunk image that needs to be restarted after installing this patch before the right keyboard preferences are set correctly according to my host system (Windows). Do you think this inconvenience would be worth an additional postscripts for the Kernel package which automatically applies these changes?

Best,
Christoph

---
Sent from Squeak Inbox Talk<https://github.com/hpi-swa-lab/squeak-inbox-talk>

On 2021-04-25T06:25:10+00:00, commits at source.squeak.org wrote:

> Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-mt.1391.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-mt.1391
> Author: mt
> Time: 25 April 2021, 8:25:06.787934 am
> UUID: 9ab61f3b-e0c8-c545-82fd-49bf4a28fbf4
> Ancestors: Kernel-nice.1390
>
> Changes keystroke mappings for better cross-platform compatibility. See http://forum.world.st/Please-try-it-out-Fixing-the-input-mapping-for-keystroke-events-td5129004.html
>
> =============== Diff against Kernel-nice.1390 ===============
>
> Item was changed:
> Object subclass: #EventSensor
>     instanceVariableNames: 'mouseButtons mousePosition mouseWheelDelta keyboardBuffer interruptKey interruptSemaphore eventQueue inputSemaphore lastEventPoll hasInputSemaphore lastEventTime'
> +     classVariableNames: 'ButtonDecodeTable EventPollPeriod EventTicklerProcess InterruptWatcherProcess KeyDecodePreferences KeyDecodeTable'
> -     classVariableNames: 'ButtonDecodeTable EventPollPeriod EventTicklerProcess InterruptWatcherProcess KeyDecodeTable'
>     poolDictionaries: 'EventSensorConstants'
>     category: 'Kernel-Processes'!
>
> !EventSensor commentStamp: 'mt 12/13/2019 14:38' prior: 0!
> An EventSensor is an interface to the user input devices.
> There is at least one instance of EventSensor named Sensor in the system.
>
> EventSensor is a replacement for the earlier InputSensor implementation 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:
>     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.
>     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.
> Structure:
> [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    -    2r001    yellow (e.g., right) button
>         2    -    2r010    blue (e.g., middle) button
>         4    -    2r100    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]    - host window id.
>
> Keyboard events
> ====================
> Keyboard events are generated when keyboard input is detected.
> [1]    - event type 2
> [2]    - time stamp
> [3]    - character code (Ascii)
>         For now the character code is in Mac Roman encoding. See #macToSqueak.
>         For key press/release (see [4]), character codes are normalized.
> [4]    - press state; integer with the following meaning
>         0    -    character (aka. key stroke or key still pressed)
>         1    -    key press (aka. key down)
>         2    -     key release (aka. key up)
> [5]    - modifier keys (same as in mouse events)
>         For key press/release (see [4]), modifier keys are still accessible.
> [6]    - character code (Unicode UTF32)
>         Manual decoding via KeyboardInputInterpreter possible.
>         For key press/release (see [4]), character codes are normalized.
> [7]    - reserved.
> [8]    - host window id.
>
> Mouse-wheel event structure
> ==========================
> Mouse-wheel events are generated when mouse-wheel input is detected.
> [1] - event type 7
> [2] - time stamp
> [3] - horizontal scroll delta
> [4] - vertical scroll delta
> [5] - button state (same as in mouse events)
> [6] - modifier keys (same as in mouse events)
> [7] - reserved.
> [8] - host window id.
> !
>
> Item was removed:
> - ----- 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 removed:
> - ----- Method: EventSensor class>>duplicateAllControlAndAltKeysChanged (in category 'preference change notification') -----
> - duplicateAllControlAndAltKeysChanged
> -     "The Preference for duplicateAllControlAndAltKeys has changed; reset the other two."
> -     "At some point the various exclusive CtrlAlt-key prefs should become a radio button set, then these methods wouldn't be needed."
> -     (Preferences
> -         valueOfFlag: #swapControlAndAltKeys
> -         ifAbsent: [false]) ifTrue: [
> -             self inform: 'Resetting swapControlAndAltKeys preference'.
> -             (Preferences preferenceAt: #swapControlAndAltKeys) rawValue: false.
> -         ].
> -     (Preferences
> -         valueOfFlag: #duplicateControlAndAltKeys
> -         ifAbsent: [false]) ifTrue: [
> -             self inform: 'Resetting duplicateControlAndAltKeys preference'.
> -             (Preferences preferenceAt: #duplicateControlAndAltKeys) rawValue: false.
> -         ].
> -     self installKeyDecodeTable.
> - !
>
> Item was changed:
> ----- Method: EventSensor class>>duplicateControlAndAltKeys: (in category 'public') -----
> duplicateControlAndAltKeys: aBoolean
>     "EventSensor duplicateControlAndAltKeys: true"
>
> +     self flag: #deprecated.
> +     self
> +         mapControlKeysToCommandKeys: aBoolean;
> +         mapAltKeysToOptionKeys: false.!
> -     Preferences setPreference: #duplicateControlAndAltKeys toValue: aBoolean.
> -     self installKeyDecodeTable
> - !
>
> Item was removed:
> - ----- Method: EventSensor class>>duplicateControlAndAltKeysChanged (in category 'preference change notification') -----
> - duplicateControlAndAltKeysChanged
> -     "The Preference for duplicateControlAndAltKeys has changed; reset the other two."
> -     (Preferences
> -         valueOfFlag: #swapControlAndAltKeys
> -         ifAbsent: [false]) ifTrue: [
> -             self inform: 'Resetting swapControlAndAltKeys preference'.
> -             (Preferences preferenceAt: #swapControlAndAltKeys) rawValue: false.
> -         ].
> -     (Preferences
> -         valueOfFlag: #duplicateAllControlAndAltKeys
> -         ifAbsent: [false]) ifTrue: [
> -             self inform: 'Resetting duplicateAllControlAndAltKeys preference'.
> -             (Preferences preferenceAt: #duplicateAllControlAndAltKeys) rawValue: false.
> -         ].
> -     self installKeyDecodeTable.
> - !
>
> Item was added:
> + ----- Method: EventSensor class>>fixControlCharacters (in category 'key decode table') -----
> + fixControlCharacters
> +     "Assure that all keyboard events that arrive with the CONTROL modifier actually have control characters set."
> +
> +     64 "$@" to: 95 "$_"do: [:upper |
> +         KeyDecodeTable
> +             at: { upper . 2 bitOr: 1 "ctrl+shift" }
> +             put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }].
> +     96 "$`" to: 126 "$~" do: [:lower | "Ignore 127"
> +         KeyDecodeTable
> +             at: { lower . 2 "ctrl" }
> +             put: { lower bitAnd: 16r9F . 2 "ctrl" }].
> +
> +     self flag: #linuxOnly. "mt: For Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
> +     self flag: #windowsOnly. "mt: CTRL+m would not arrive as CTRL+CR, which is rather inconsistent."!
>
> Item was changed:
> ----- Method: EventSensor class>>initialize (in category 'class initialization') -----
> initialize
> +
> -
>     Smalltalk addToStartUpList: self before: ProcessorScheduler.
>     Smalltalk addToShutDownList: self.
>
> +     KeyDecodePreferences := Dictionary new.
> +
>     self installKeyDecodeTable.
> +     self installMouseDecodeTable.!
> -     self installMouseDecodeTable.
> -     self install.
> -
> - !
>
> Item was removed:
> - ----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
> - installDuplicateKeyEntryFor: aPrintableCharacter
> -     "Updates the key-decode table, which maps between pairs of {character code . modifier code}.
> -     See the class comment for more information.
> -     The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
> -     It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
> -     Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert control characters to printable characters in this mapping table."
> -
> -     | upper lower |
> -     upper := aPrintableCharacter asUppercase asInteger.
> -     lower := aPrintableCharacter asLowercase asInteger.
> -
> -     KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
> -     KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
>
> Item was changed:
> ----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
> installKeyDecodeTable
>     "Create a decode table that swaps or duplicates some keys if the respective preference is set."
>
>     KeyDecodeTable := Dictionary new.
>
> +     self mapControlKeysToCommandKeys
> +         ifTrue: [self installMappingToCommandKeys]
> +         ifFalse: [self mapControlCharactersToPrintableCharacters
> +             ifTrue: [self installMappingToPrintableCharacters]
> +             ifFalse: [self fixControlCharacters "mt: Due to platform-specific VM behavior."]].
> -     Preferences swapControlAndAltKeys
> -         ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
> -                 [ :c | self installSwappedKeyEntryFor: c ] ].
> -     Preferences duplicateAllControlAndAltKeys
> -         ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
> -                 [ :c | self installDuplicateKeyEntryFor: c ] ].
>
> +     self mapAltKeysToOptionKeys
> +         ifTrue: [self installMappingToOptionKeys].!
> -     self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
> -     Preferences duplicateControlAndAltKeys
> -         ifTrue: [ self defaultCrossPlatformKeys do:
> -                 [ :c | self installDuplicateKeyEntryFor: c ] ].
> - !
>
> Item was added:
> + ----- Method: EventSensor class>>installMappingToCommandKeys (in category 'key decode table') -----
> + installMappingToCommandKeys
> +     "Maps all keyboard events that arrive with the CONTROL modifier to also have the COMMAND modifier set. This mapping also considers the preference #mapControlCharactersToPrintableCharacters."
> +
> +     | controlMask |
> +     0 "NUL" to: 27 "ESC" do: [:control |
> +         controlMask := self mapControlCharactersToPrintableCharacters
> +             ifTrue: [16r60] ifFalse: [0].
> +         KeyDecodeTable
> +             at: { control . 2r0010 "ctrl" }
> +             put: { control bitOr: controlMask . 2r1010 "cmd+ctrl" }.
> +         controlMask := self mapControlCharactersToPrintableCharacters
> +             ifTrue: [16r40] ifFalse: [0].
> +         KeyDecodeTable
> +             at: { control . 2r0011 "ctrl+shift" }
> +             put: { control bitOr: controlMask . 2r1011 "cmd+ctrl+shift" }].
> +
> +     28 "arrow keys" to: 126 "$~" do: [:arrowAndPrintable |
> +             KeyDecodeTable
> +                 at: { arrowAndPrintable . 2r0010 "ctrl" }
> +                 put: { arrowAndPrintable . 2r1010 "cmd+ctrl" }.
> +             KeyDecodeTable
> +                 at: { arrowAndPrintable . 2r0011 "ctrl + shift" }
> +                 put: { arrowAndPrintable . 2r1011 "cmd + shift" }].!
>
> Item was added:
> + ----- Method: EventSensor class>>installMappingToOptionKeys (in category 'key decode table') -----
> + installMappingToOptionKeys
> +     "Maps all keyboard events that arrive with the COMMAND modifier to also have the OPTION modifier set. See preference #mapAltKeysToOptionKeys."
> +
> +     self flag: #windowsOnly. "mt: In Windows VMs version 202104182333, pressing the (physical) ALT key arrives as CMD modifier in the image. Should this ever change, this mapping MUST be adapted, too."
> +     self flag: #linuxOnly. "mt: See #windowsOnly."
> +     self flag: #macOSOnly. "mt: This mapping should be ignored to not overshadow events that have the actual OPTION modifier set."
> +
> +     CharacterSet ascii do: [:character |
> +         KeyDecodeTable
> +             at: { character asInteger . 2r1000 "cmd" }
> +             put: { character asInteger . 2r1100 "cmd+opt" }.
> +         KeyDecodeTable
> +             at: { character asInteger . 2r1001 "cmd + shift" }
> +             put: { character asInteger . 2r1101 "cmd + opt + shift" }].!
>
> Item was added:
> + ----- Method: EventSensor class>>installMappingToPrintableCharacters (in category 'key decode table') -----
> + installMappingToPrintableCharacters
> +     "Only applies when the CONTROL modifier is present!! Control characters that can directly be triggered -- such as CR, ENTER, BS, DEL, POS1, END -- will not be mapped."
> +
> +     self flag: #windowsOnly. "mt: The CONTROL modifier might directly change the control character. Examples: CTRL+CR(13) arrives as CTRL+LF(10), CTRL+BS(8) arrives as CTRL+DEL(127). If you have no other means to input LF(10) or DEL(127), you might have to disable this mapping to printable characters."
> +
> +     0 "NUL" to: 27 "ESC" do: [:control |
> +         KeyDecodeTable
> +             at: { control . 2r0010 "ctrl" }
> +             put: { control bitOr: 16r60 "+96" . 2 "ctrl" }.
> +         KeyDecodeTable
> +             at: { control . 2r0011 "ctrl+shift" }
> +             put: { control bitOr: 16r40 "+64" . 2r0011 "ctrl+shift" }].!
>
> Item was removed:
> - ----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
> - installSwappedKeyEntryFor: aPrintableCharacter
> -     "Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
> -     Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
> -
> -     | upper lower |
> -     upper := aPrintableCharacter asUppercase asInteger.
> -     lower := aPrintableCharacter asLowercase asInteger.
> -
> -     KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
> -     KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
> -     KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
> -     KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
>
> Item was added:
> + ----- Method: EventSensor class>>mapAltKeysToOptionKeys (in category 'preferences') -----
> + mapAltKeysToOptionKeys
> +     <preference: 'Map ALT keys to OPTION keys'
> +         categoryList: #(keyboard events input)
> +         description: 'On platforms other than macOS, keystrokes involving the (physical) ALT modifier typically arrive as COMMAND modifier. If you now also map CONTROL keys to COMMAND keys, you disable potential input. If you enable this preference, you preserve the possibility of reacting to two different modifiers -- CMD and OPT -- in your code, on all platforms. (This preference replaces older duplicate/swap preferences.)'
> +         type: #Boolean>
> +
> +     ^ KeyDecodePreferences
> +         at: #mapAltKeysToOptionKeys
> +         ifAbsent: [false]!
>
> Item was added:
> + ----- Method: EventSensor class>>mapAltKeysToOptionKeys: (in category 'preferences') -----
> + mapAltKeysToOptionKeys: aBooleanOrNil
> +
> +     aBooleanOrNil = self mapAltKeysToOptionKeys
> +         ifTrue: [^ self].
> +
> +     aBooleanOrNil
> +         ifNil: [
> +             KeyDecodePreferences
> +                 removeKey: #mapAltKeysToOptionKeys]
> +         ifNotNil: [
> +             KeyDecodePreferences
> +                 at: #mapAltKeysToOptionKeys
> +                 put: aBooleanOrNil].
> +
> +     self installKeyDecodeTable.!
>
> Item was added:
> + ----- Method: EventSensor class>>mapControlCharactersToPrintableCharacters (in category 'preferences') -----
> + mapControlCharactersToPrintableCharacters
> +     <preference: 'Map ASCII control characters to printable characters'
> +         categoryList: #(keyboard events input)
> +         description: 'Keystrokes involving the (physical) CONTROL modifier typically have characters codes from 00 to 31 when pressing the physical keys labeled A to Z (or actually ASCII 64 to 95). This means that, for example in CTRL+C, client code cannot check for "anEvent controlKeyPressed and: [anEvent keyCharacter = $C]" but has to resort to "anEvent controlKeyPressed and: [keyCharacter = 3]." If you enable this preference all control characters will be mapped to printable characters.'
> +         type: #Boolean>
> +
> +     ^ KeyDecodePreferences
> +         at: #mapControlCharactersToPrintableCharacters
> +         ifAbsent: [true]!
>
> Item was added:
> + ----- Method: EventSensor class>>mapControlCharactersToPrintableCharacters: (in category 'preferences') -----
> + mapControlCharactersToPrintableCharacters: aBooleanOrNil
> +
> +     aBooleanOrNil
> +         ifNil: [
> +             KeyDecodePreferences
> +                 removeKey: #mapControlCharactersToPrintableCharacters]
> +         ifNotNil: [
> +             KeyDecodePreferences
> +                 at: #mapControlCharactersToPrintableCharacters
> +                 put: aBooleanOrNil].
> +
> +     self installKeyDecodeTable.!
>
> Item was added:
> + ----- Method: EventSensor class>>mapControlKeysToCommandKeys (in category 'preferences') -----
> + mapControlKeysToCommandKeys
> +     <preference: 'Map CONTROL keys to COMMAND keys'
> +         categoryList: #(keyboard events input)
> +         description: 'On platforms other than macOS, users use the CONTROL modifier for many common shortcuts around text editing such as CTRL+C and CTRL+V for copy and paste. For the sake of cross-platform compatibility, however, many tools in this system will check for CMD+C and CMD+V instead. Note that on Linux and Windows platforms, keystrokes involving the (physical) ALT modifier typically arrive as COMMAND modifier. Thus, enable this preference if you still want to use CONTROL key instead of the ALT key for such shortcuts. (This preference replaces older duplicate/swap preferences.)'
> +         type: #Boolean>
> +
> +     ^ KeyDecodePreferences
> +         at: #mapControlKeysToCommandKeys
> +         ifAbsent: [true]!
>
> Item was added:
> + ----- Method: EventSensor class>>mapControlKeysToCommandKeys: (in category 'preferences') -----
> + mapControlKeysToCommandKeys: aBooleanOrNil
> +
> +     aBooleanOrNil
> +         ifNil: [
> +             KeyDecodePreferences
> +                 removeKey: #mapControlKeysToCommandKeys]
> +         ifNotNil: [
> +             KeyDecodePreferences
> +                 at: #mapControlKeysToCommandKeys
> +                 put: aBooleanOrNil].
> +
> +     self installKeyDecodeTable.!
>
> Item was changed:
> ----- Method: EventSensor class>>startUp (in category 'system startup') -----
> startUp
>
> +     Smalltalk platformName = 'Mac OS'
> +         ifTrue: [
> +             self mapAltKeysToOptionKeys: false.
> +             self mapControlKeysToCommandKeys: false]
> +         ifFalse: [
> +             self mapAltKeysToOptionKeys: true.
> +             self mapControlKeysToCommandKeys: true].
> +
> +     self default startUp.!
> -     self installMouseDecodeTable.
> -     self installKeyDecodeTable.
> -     self default startUp!
>
> Item was changed:
> ----- Method: EventSensor class>>swapControlAndAltKeys: (in category 'public') -----
> swapControlAndAltKeys: aBoolean
> -     "EventSensor swapControlAndAltKeys: true"
>
> +     self deprecated: 'You cannnot swap CONTROL and ALT modifiers anymore. Please use other key-mapping preferences to fit your needs.'.!
> -     Preferences setPreference: #swapControlAndAltKeys toValue: aBoolean.
> -     self installKeyDecodeTable!
>
> Item was removed:
> - ----- Method: EventSensor class>>swapControlAndAltKeysChanged (in category 'preference change notification') -----
> - swapControlAndAltKeysChanged
> -     "The Preference for swapControlAndAltKeys has changed; reset the other two."
> -     (Preferences
> -         valueOfFlag: #duplicateControlAndAltKeys
> -         ifAbsent: [false]) ifTrue: [
> -             self inform: 'Resetting duplicateControlAndAltKeys preference'.
> -             (Preferences preferenceAt: #duplicateControlAndAltKeys) rawValue: false.
> -         ].
> -     (Preferences
> -         valueOfFlag: #duplicateAllControlAndAltKeys
> -         ifAbsent: [false]) ifTrue: [
> -             self inform: 'Resetting duplicateAllControlAndAltKeys preference'.
> -             (Preferences preferenceAt: #duplicateAllControlAndAltKeys) rawValue: false.
> -         ].
> -     self installKeyDecodeTable.
> - !
>
> Item was changed:
> ----- Method: EventSensor>>anyModifierKeyPressed (in category 'modifier keys') -----
> anyModifierKeyPressed
> +     "ignore, however, the shift keys 'cause that's not REALLY a modifier key"
> -     "ignore, however, the shift keys 'cause that's not REALLY a command key"
>
> +     ^ self peekButtons anyMask: (2r1110 "cmd | opt | ctrl" bitShift: MouseEvent numButtons)!
> -     ^ self peekButtons anyMask: 16r70    "cmd | opt | ctrl"!
>
> Item was changed:
> ----- Method: EventSensor>>commandKeyPressed (in category 'modifier keys') -----
> commandKeyPressed
>     "Answer whether the command key on the keyboard is being held down."
>
> +     ^ self peekButtons anyMask: (2r1000 "cmd" bitShift: MouseEvent numButtons)!
> -     ^ self peekButtons anyMask: (1 bitShift: MouseEvent numButtons + 3)!
>
> Item was changed:
> ----- Method: EventSensor>>controlKeyPressed (in category 'modifier keys') -----
> controlKeyPressed
>     "Answer whether the control key on the keyboard is being held down."
>
> +     ^ self peekButtons anyMask: (2r0010 "ctrl" bitShift: MouseEvent numButtons)!
> -     ^self peekButtons anyMask: (1 bitShift: MouseEvent numButtons + 1)!
>
> Item was added:
> + ----- Method: EventSensor>>optionKeyPressed (in category 'modifier keys') -----
> + optionKeyPressed
> +     "Answer whether the option key on the Macintosh keyboard is being held down. Macintosh specific. Clients are discouraged from calling this directly, since it circumvents bert's attempt to eradicate option-key checks"
> +
> +     ^ self peekButtons anyMask: (2r0100 "opt" bitShift: MouseEvent numButtons)!
>
> Item was changed:
> ----- Method: EventSensor>>processEvent: (in category 'private-I/O') -----
> processEvent: evt
>     "Process a single event. This method is run at high priority."
>     | type buttons window |
>     type := evt at: 1.
>     lastEventTime := evt at: 2.
>
>     "Only process main window events, forward others to host window proxies"
>     window := evt at: 8.
>     (window isNil or: [window isZero]) ifTrue:
>         [window := 1.
>         evt at: 8 put: window].
>     window = 1 ifFalse: [
>         ^Smalltalk at: #HostWindowProxy ifPresent: [:w | w processEvent: evt]].
>
>     "Tackle mouse events and mouse wheel events first"
>     (type = EventTypeMouse or: [type = EventTypeMouseWheel])
>         ifTrue: [buttons := (ButtonDecodeTable at: (evt at: 5) + 1).
>                 evt at: 5 put: (Smalltalk platformName = 'Mac OS'
>                             ifTrue: [ buttons ]
>                             ifFalse: [ self mapButtons: buttons modifiers: (evt at: 6) ]).
>                 self queueEvent: evt.
>                 type = EventTypeMouseWheel
>                     ifTrue: [^ self processMouseWheelEvent: evt].
>                 type = EventTypeMouse
>                     ifTrue: [^ self processMouseEvent: evt]].
>
>     "Store the event in the queue if there's any"
>     type = EventTypeKeyboard
>         ifTrue: [ "Check if the event is a user interrupt"
>             ((evt at: 4) = EventKeyChar
>                 and: [((evt at: 3)
>                         bitOr: (((evt at: 5)
>                             bitAnd: 8)
>                             bitShift: 8))
>                             = interruptKey])
>                     ifTrue: ["interrupt key is meta - not reported as event"
>                             ^ interruptSemaphore signal].
> +             "Decode keys for characters (e.g., map ctrl -> cmd)."
> -             "Decode keys for characters (i.e., duplicate or swap, ctrl <-> alt/cmd)."
>             (evt at: 4) = EventKeyChar
>                 ifTrue: [ | unicode ascii |
>                     "Copy lookup key first in case of key swap."
>                     unicode := {evt at: 6. evt at: 5}.
>                     ascii := {evt at: 3. evt at: 5}.
>                     KeyDecodeTable "Unicode character first"
>                         at: unicode
>                         ifPresent: [:a | evt at: 6 put: a first;
>                                  at: 5 put: a second].
>                     KeyDecodeTable "ASCII character second"
>                         at: ascii
>                         ifPresent: [:a | evt at: 3 put: a first;
>                                  at: 5 put: a second]].
>             self queueEvent: evt.
>             self processKeyboardEvent: evt .
>             ^self ].
>
>     "Handle all events other than Keyboard or Mouse."
>     self queueEvent: evt.
>     !
>
> Item was changed:
> ----- Method: EventSensor>>rawMacOptionKeyPressed (in category 'modifier keys') -----
> rawMacOptionKeyPressed
>     "Answer whether the option key on the Macintosh keyboard is being held down. Macintosh specific. Clients are discouraged from calling this directly, since it circumvents bert's attempt to eradicate option-key checks"
>
> +     self deprecated: 'Use #optionKeyPressed instead.'.
> +     ^ self optionKeyPressed!
> -     ^ self peekButtons anyMask: 32!
>
> Item was changed:
> ----- Method: EventSensor>>shiftPressed (in category 'modifier keys') -----
> shiftPressed
>     "Answer whether the shift key on the keyboard is being held down."
>
> +     ^ self peekButtons anyMask: (2r0001 "shift" bitShift: MouseEvent numButtons)!
> -     ^ self peekButtons anyMask: (1 bitShift: MouseEvent numButtons)!
>
> Item was changed:
> + (PackageInfo named: 'Kernel') postscript: 'EventSensor initialize.
> + EventSensor startUp.'!
> - (PackageInfo named: 'Kernel') postscript: '"recompile all methods containing blocks with the wrong outerCode"
> - (self systemNavigation allMethodsSelect: [:m| m literals anySatisfy: [:l| l isCompiledCode and: [l isCompiledBlock and: [l outerCode ~~ m]]]]) do:
> -     [:mr| mr actualClass recompile: mr selector]'!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211116/a204cc64/attachment-0001.html>


More information about the Squeak-dev mailing list