Marcel Taeumel uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-mt.257.mcz ==================== Summary ==================== Name: ST80-mt.257 Author: mt Time: 15 July 2020, 11:24:14.540718 am UUID: 0f736417-f062-483c-b2a3-9d1560a1bf1f Ancestors: ST80-mt.256 Complements Kernel-mt.1333. Fixes regression: mouse wheel works again in tools. =============== Diff against ST80-mt.256 =============== Item was added: + ----- Method: EventSensor>>characterForKeycode: (in category '*ST80-Support-keyboard') ----- + characterForKeycode: keycode + "Map the given keycode to a Smalltalk character object. Encoding: + A keycode is 12 bits: <4 modifer bits><8 bit ISO character> + Modifier bits are: <command><option><control><shift>" + + "NOTE: the command and option keys are specific to the Macintosh and may not have equivalents on other platforms." + + keycode = nil ifTrue: [ ^nil ]. + keycode class = Character ifTrue: [ ^keycode ]. "to smooth the transition!!" + ^ Character value: (keycode bitAnd: 16rFF)! Item was added: + ----- Method: EventSensor>>keyboard (in category '*ST80-Support-keyboard') ----- + keyboard + "Answer the next (single-byte or multi-byte) character from the keyboard." + + | firstCharacter secondCharactor stream multiCharacter converter | + "1) Consume next character from buffer." + (firstCharacter := self characterForKeycode: keyboardBuffer next) ifNil: [^ nil]. + + "2) Peek additional character and try to read multi-byte character." + (secondCharactor := self characterForKeycode: keyboardBuffer peek) ifNil: [^ firstCharacter]. + (converter := TextConverter defaultSystemConverter) ifNil: [^ firstCharacter]. + stream := ReadStream on: (String with: firstCharacter with: secondCharactor). + multiCharacter := [converter nextFromStream: stream] ifError: [firstCharacter]. + + "3) Only consume that additional character if we got a multi-byte character." + multiCharacter isOctetCharacter ifFalse: [keyboardBuffer next]. + + "4) Answer either single-byte or multi-byte character." + ^ multiCharacter + ! Item was added: + ----- Method: EventSensor>>keyboardPressed (in category '*ST80-Support-keyboard') ----- + keyboardPressed + "Answer true if keystrokes are available." + + ^self peekKeyboard notNil! Item was added: + ----- Method: EventSensor>>mouseWheelDelta (in category '*ST80-Support-mouse') ----- + mouseWheelDelta + + | delta | + delta := self peekMouseWheelDelta. + mouseWheelDelta := 0@0. + ^ delta! Item was added: + ----- Method: EventSensor>>mouseWheelDirection (in category '*ST80-Support-mouse') ----- + mouseWheelDirection + + | direction | + direction := self peekMouseWheelDirection. + mouseWheelDelta := 0@0. + ^ direction! Item was added: + ----- Method: EventSensor>>peekButtons (in category '*ST80-Support-mouse') ----- + peekButtons + + self fetchMoreEvents. + self eventQueue ifNotNil: [:queue | queue flush]. + ^ mouseButtons! Item was added: + ----- Method: EventSensor>>peekKeyboard (in category '*ST80-Support-keyboard') ----- + peekKeyboard + "Answer the next character in the keyboard buffer without removing it, or nil if it is empty." + + self fetchMoreEvents. + self eventQueue ifNotNil: [:queue | queue flush]. + ^ self characterForKeycode: keyboardBuffer peek! Item was added: + ----- Method: EventSensor>>peekMouseWheelDelta (in category '*ST80-Support-mouse') ----- + peekMouseWheelDelta + + self fetchMoreEvents. + self eventQueue ifNotNil: [:queue | queue flush]. + ^ mouseWheelDelta! Item was added: + ----- Method: EventSensor>>peekMouseWheelDirection (in category '*ST80-Support-mouse') ----- + peekMouseWheelDirection + + | delta | + delta := self peekMouseWheelDelta. + + delta x > 0 ifTrue: [^ #right]. + delta x < 0 ifTrue: [^ #left]. + + delta y > 0 ifTrue: [^ #up]. + delta y < 0 ifTrue: [^ #down]. + + ^ nil! Item was added: + ----- Method: EventSensor>>peekPosition (in category '*ST80-Support-mouse') ----- + peekPosition + + self fetchMoreEvents. + self eventQueue ifNotNil: [:queue | queue flush]. + ^ mousePosition! Item was changed: ----- Method: ListController>>controlActivity (in category 'control defaults') ----- controlActivity + self scrollByMouseWheel ifTrue: [^self]. self scrollByKeyboard ifTrue: [^self]. self processKeyboard. super controlActivity. ! Item was changed: ----- Method: MVCDebugger>>openNotifierNoSuspendContents:label: (in category 'initialize') ----- openNotifierNoSuspendContents: msgString label: label | builder spec view | + EventSensor default flushEvents. super openNotifierNoSuspendContents: msgString label: label. builder := ToolBuilder default. spec := self buildNotifierWith: builder label: label message: msgString. view := builder build: spec. view controller openNoTerminate. ^ view! Item was changed: ----- Method: MVCProject>>finalExitActions: (in category 'enter') ----- finalExitActions: enteringProject super finalExitActions: enteringProject. self world unCacheWindows. + EventSensor default flushEvents. - Sensor flushAllButDandDEvents. ScheduledControllers := nil.! Item was changed: ----- Method: ParagraphEditor>>undo (in category 'menu messages') ----- undo "Reset the state of the paragraph prior to the previous edit. If another ParagraphEditor instance did that edit, UndoInterval is invalid; just recover the contents of the undo-buffer at the start of the paragraph." + sensor flushEvents. "a way to flush stuck keys" - sensor flushKeyboard. "a way to flush stuck keys" self closeTypeIn. UndoParagraph == paragraph ifFalse: "Can't undo another paragraph's edit" [UndoMessage := Message selector: #undoReplace. UndoInterval := 1 to: 0. Undone := true]. UndoInterval ~= self selectionInterval ifTrue: "blink the actual target" [self selectInterval: UndoInterval; deselect]. "Leave a signal of which phase is in progress" UndoParagraph := Undone ifTrue: [#redoing] ifFalse: [#undoing]. UndoMessage sentTo: self. UndoParagraph := paragraph! Item was changed: ----- Method: ScrollController>>controlActivity (in category 'control defaults') ----- controlActivity + self scrollByMouseWheel ifTrue: [^ self]. self scrollByKeyboard ifTrue: [^ self]. self scrollBarContainsCursor ifTrue: [self scroll] ifFalse: [self normalActivity]! Item was changed: ----- Method: ScrollController>>scrollByKeyboard (in category 'scrolling') ----- scrollByKeyboard | keyEvent | keyEvent := sensor peekKeyboard. keyEvent ifNil: [^ false]. (sensor controlKeyPressed or:[sensor commandKeyPressed]) ifFalse: [^ false]. keyEvent asciiValue = 30 ifTrue: [sensor keyboard. + self scrollViewUp ifTrue: [self moveMarker]. - self scrollViewDown ifTrue: [self moveMarker]. ^ true]. keyEvent asciiValue = 31 ifTrue: [sensor keyboard. + self scrollViewDown ifTrue: [self moveMarker]. - self scrollViewUp ifTrue: [self moveMarker]. ^ true]. ^ false! Item was added: + ----- Method: ScrollController>>scrollByMouseWheel (in category 'scrolling') ----- + scrollByMouseWheel + | wheelDirection | + wheelDirection := sensor peekMouseWheelDirection. + wheelDirection = #up + ifTrue: + [sensor mouseWheelDirection. + self scrollViewUp ifTrue: [self moveMarker]. + ^ true]. + wheelDirection = #down + ifTrue: + [sensor mouseWheelDirection. + self scrollViewDown ifTrue: [self moveMarker]. + ^ true]. + ^ false! Item was changed: ----- Method: ScrollController>>scrollViewDown (in category 'scrolling') ----- scrollViewDown "Scroll the receiver's view down the default amount. Return true only if scrolling actually took place." + ^ self scrollView: self scrollAmount negated! - ^ self scrollView: self scrollAmount! Item was changed: ----- Method: ScrollController>>scrollViewUp (in category 'scrolling') ----- scrollViewUp "Scroll the receiver's view up the default amount. Return true only if scrolling actually took place." + ^ self scrollView: self scrollAmount! - ^ self scrollView: self scrollAmount negated! |
Free forum by Nabble | Edit this page |