forked from Cuis-Smalltalk/Cuis-Smalltalk-Dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
6 changed files
with
470 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
CoreUpdates/6353-Fix-6326-BrokeHalos-JuanVuletich-2024May10-16h15m-jmv.001.cs.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
'From Cuis6.3 [latest update: #6352] on 10 May 2024 at 4:17:47 pm'! | ||
|
||
!MouseClickState methodsFor: 'actions' stamp: 'jmv 5/10/2024 16:11:48'! | ||
handleEvent: aMouseEvent from: aHand | ||
"Process the given mouse event to detect a click, double-click, or drag | ||
(for any of the three mouse buttons, be either real or emulated). | ||
Return true if the event was consumed (don't further process it). | ||
Return false if the event should be processed by the sender. | ||
NOTE: This method heavily relies on getting *all* mouse button events." | ||
|
||
| timedOut distance | | ||
timedOut := (aMouseEvent timeStamp - lastClickDown timeStamp) > self class doubleClickTimeout. | ||
distance := (aMouseEvent eventPosition - lastClickDown eventPosition) r. | ||
|
||
aMouseEvent isMouseDown ifTrue: [ | ||
"If it is a different button, it is not multiple click." | ||
aMouseEvent buttons = lastClickDown buttons ifFalse: [ | ||
aHand dontWaitForMoreClicks. | ||
^false ]. | ||
lastClickDown := aMouseEvent ]. | ||
|
||
"Real action dispatch might be done after the triggering event, for example, because of waiting for timeout. | ||
So, count the button downs and ups(clicks), to be processed, maybe later, maybe in a mouseMove..." | ||
aMouseEvent isMouseDown ifTrue: [ | ||
buttonDownCount := buttonDownCount + 1 ]. | ||
aMouseEvent isMouseUp ifTrue: [ | ||
buttonUpCount := buttonUpCount + 1 ]. | ||
|
||
"Drag, or tap & hold" | ||
(buttonDownCount = 1 and: [ buttonUpCount = 0]) ifTrue: [ | ||
distance > 0 ifTrue: [ | ||
aHand dontWaitForMoreClicks. | ||
dragSelector | ||
ifNotNil: [ self didDrag ] | ||
"If we have already moved, then it won't be a double or triple click... why wait?" | ||
ifNil: [ self didClick ]. | ||
^ false ]. | ||
timedOut ifTrue: [ | ||
aHand dontWaitForMoreClicks. | ||
"Simulate button 2 via tap & hold. Useful for opening menus on pen computers." | ||
sendMouseButton2Activity ifTrue: [ | ||
clickClient mouseButton2Activity ]. | ||
^ false ]]. | ||
|
||
"If we're over triple click, or timed out, or mouse moved, don't allow more clicks (distance must be significant, the movement needs to be intentional)." | ||
(buttonDownCount = 4 or: [ timedOut or: [ distance > 2 ]]) ifTrue: [ | ||
aHand dontWaitForMoreClicks. | ||
^ false ]. | ||
|
||
"Simple click." | ||
(buttonDownCount = 1 and: [ buttonUpCount = 1 ]) ifTrue: [ | ||
self didClick ]. | ||
|
||
"Click & hold" | ||
(buttonDownCount = 2 and: [ buttonUpCount = 1]) ifTrue: [ | ||
self didClickAndHalf ]. | ||
|
||
"Double click." | ||
(buttonDownCount = 2 and: [ buttonUpCount = 2]) ifTrue: [ | ||
self didDoubleClick ]. | ||
|
||
"Double click & hold." | ||
(buttonDownCount = 3 and: [ buttonUpCount = 2]) ifTrue: [ | ||
self didDoubleClickAndHalf ]. | ||
|
||
"Triple click" | ||
(buttonDownCount = 3 and: [ buttonUpCount = 3]) ifTrue: [ | ||
self didTripleClick ]. | ||
|
||
timedOut ifTrue: [ | ||
aHand dontWaitForMoreClicks ]. | ||
|
||
"This means: if a mouseDown, then don't further process this event (so we can turn it into a double or triple click on next buttonUp)" | ||
^ aMouseEvent isMouseDown! ! | ||
|
24 changes: 24 additions & 0 deletions
24
CoreUpdates/6354-FileInConvertsLineEndings-JuanVuletich-2024May10-16h39m-jmv.001.cs.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'From Cuis6.3 [latest update: #6353] on 10 May 2024 at 4:42:36 pm'! | ||
|
||
!ClassCategoryReader methodsFor: 'fileIn/Out' stamp: 'jmv 5/10/2024 16:41:57'! | ||
scanFrom: aStream | ||
"File in methods from the stream, aStream. | ||
Convert line endings to Cuis convention." | ||
| methodSource | | ||
[ | ||
methodSource := aStream nextChunk withCuisLineEndings. | ||
methodSource size > 0 ] whileTrue: [ | ||
class compile: methodSource classified: category | ||
withStamp: changeStamp | ||
notifying: nil ]! ! | ||
|
||
!methodRemoval: ClassCategoryReader #theClass stamp: 'jmv 5/10/2024 16:39:45'! | ||
ClassCategoryReader removeSelector: #theClass! | ||
!methodRemoval: ClassCategoryReader #changeStamp stamp: 'jmv 5/10/2024 16:40:50'! | ||
ClassCategoryReader removeSelector: #changeStamp! | ||
|
||
!ClassCategoryReader reorganize! | ||
('fileIn/Out' scanFrom:) | ||
('private' setClass:category: setClass:category:changeStamp:) | ||
! | ||
|
Oops, something went wrong.