The Inbox: Morphic-ct.1715.mcz

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

The Inbox: Morphic-ct.1715.mcz

commits-2
Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1715.mcz

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

Name: Morphic-ct.1715
Author: ct
Time: 17 November 2020, 8:25:42.546431 pm
UUID: 4a1a9a9f-9ae1-0640-9f18-17e3c956fa0c
Ancestors: Morphic-mt.1713

Re-enables handling of #launchDrop events when the VM is configured as a singleton and has been invoked again, though currently only handled with a rudimentary fallback implementation.

See http://forum.world.st/Changeset-Enhanced-integration-of-drag-n-drop-from-host-tp5123857p5124332.html. Thanks to Jakob (jr) for the feedback!

=============== Diff against Morphic-mt.1713 ===============

Item was changed:
  ----- Method: HandMorph>>generateDropFilesEvent: (in category 'private events') -----
  generateDropFilesEvent: evtBuf
  "Generate the appropriate mouse event for the given raw event buffer."
 
  | position buttons modifiers stamp numFiles dragType |
  stamp := evtBuf second.
  stamp = 0 ifTrue: [stamp := Time eventMillisecondClock].
  dragType := evtBuf third.
  position := evtBuf fourth @ evtBuf fifth.
  buttons := MouseEvent redButton. "hacked because necessary for correct mouseMoveDragging handling"
  modifiers := evtBuf sixth.
  buttons := buttons bitOr: (modifiers bitShift: 3).
  numFiles := evtBuf seventh.
 
  dragType caseOf: {
  [1] -> [ "dragEnter"
  externalDropMorph := TransferMorph new
  dragTransferType: #filesAndDirectories;
  source: self;
  passenger: (numFiles = 0 "Usually, numFiles and drop paths are delivered on dragDrop only. Still reserving this possibility for able host implementations."
  ifTrue: [self flag: #vmCapabilityMissing. 'Unknown host content' translated]
  ifFalse: [self collectDropFilesAndDirectories: numFiles]);
  yourself.
 
  "During the drag operation, the host system is responsible for displaying the cursor."
  self grabMorph: externalDropMorph.
  self showTemporaryCursor: Cursor blank.
  externalDropMorph bottomRight: self topLeft. "Southeast area of the cursor is blocked by drawings from the source application. Display our drop morph at the opposite corner of the cursor." ].
  [2] -> [ "dragMove"
  ^ MouseMoveEvent new
  setType: #mouseMove
  startPoint: self position
  endPoint: position
  trail: "{self position. position}"(self mouseDragTrailFrom: evtBuf)
  buttons: buttons
  hand: self
  stamp: stamp ].
  [3]  -> [ "dragLeave"
  externalDropMorph ifNotNil: #abandon.
  externalDropMorph := nil.
  self showTemporaryCursor: nil ].
  [4] -> [ "dragDrop"
+ | oldButtons event |
+ oldButtons := lastEventBuffer fifth
+ bitOr: (lastEventBuffer sixth bitShift: 3).
+ event := MouseButtonEvent new
+ setType: #mouseUp
+ position: position
+ which: (oldButtons bitXor: buttons)
+ buttons: buttons
+ nClicks: 0
+ hand: self
+ stamp: stamp.
+
- | oldButtons |
  externalDropMorph ifNil: [
+ "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been invoked again with a new image file (aka #launchDrop, runAsSingleInstance on Unix, or RunSingleApp on Windows)."
+ self flag: #forLater. "ct: When we decouple event generation from Morphic, we will probably need to introduce a separate SystemLaunchEvent class for this event. See http://forum.world.st/Changeset-Enhanced-integration-of-drag-n-drop-from-host-tp5123857p5124332.html."
+ self world
+ launchSystemFiles: (self collectDropFilesAndDirectories: numFiles)
+ event: event.
+ ^ nil].
- "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been called again (aka #launchDrop)."
- ^ self error: 'Launch drop for singleton Squeak not yet implemented.'].
 
  self showTemporaryCursor: nil.
  externalDropMorph passenger isString ifTrue: [
  self flag: #vmCapabilityMissing. "See above."
  externalDropMorph passenger: (self collectDropFilesAndDirectories: numFiles)].
  externalDropMorph := nil.
 
  (Smalltalk classNamed: #DropFilesEvent) ifNotNil: [:eventClass |
  | classicEvent |
  "Generate classic DropFilesEvent, providing backward compatibility."
  classicEvent := eventClass new
  setPosition: position
  contents: numFiles
  hand: self.
  self processEvent: classicEvent.
  classicEvent wasHandled ifTrue: [^ nil]].
 
+ ^ event ].
- oldButtons := lastEventBuffer fifth
- bitOr: (lastEventBuffer sixth bitShift: 3).
- ^ MouseButtonEvent new
- setType: #mouseUp
- position: position
- which: (oldButtons bitXor: buttons)
- buttons: buttons
- nClicks: 0
- hand: self
- stamp: stamp ].
  [5] -> [ "drag request"
  "For dnd out. Not properly implemented at the moment."
  self shouldBeImplemented] }.
  ^ nil!

Item was added:
+ ----- Method: PasteUpMorph>>launchSystemFiles:event: (in category 'event handling') -----
+ launchSystemFiles: fileStreams event: anEvent
+ "Handle a number of files the singleton VM was invoked with again."
+
+ self flag: #todo. "Do something more useful with the image here, e. g. tell the VM to load it."
+ ^ self dropFiles: fileStreams event: anEvent!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1715.mcz

marcel.taeumel
Hi Christoph.

Re-enables handling of #launchDrop events ...

It still looks like a proposal of having PasteUpMorph >> #launchSystemEventFiles:event: to me. :-) I would rather like to see such a send happen to the current project, not the world.

Best,
Marcel

Am 17.11.2020 20:26:13 schrieb [hidden email] <[hidden email]>:

Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1715.mcz

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

Name: Morphic-ct.1715
Author: ct
Time: 17 November 2020, 8:25:42.546431 pm
UUID: 4a1a9a9f-9ae1-0640-9f18-17e3c956fa0c
Ancestors: Morphic-mt.1713

Re-enables handling of #launchDrop events when the VM is configured as a singleton and has been invoked again, though currently only handled with a rudimentary fallback implementation.

See http://forum.world.st/Changeset-Enhanced-integration-of-drag-n-drop-from-host-tp5123857p5124332.html. Thanks to Jakob (jr) for the feedback!

=============== Diff against Morphic-mt.1713 ===============

Item was changed:
----- Method: HandMorph>>generateDropFilesEvent: (in category 'private events') -----
generateDropFilesEvent: evtBuf
"Generate the appropriate mouse event for the given raw event buffer."

| position buttons modifiers stamp numFiles dragType |
stamp := evtBuf second.
stamp = 0 ifTrue: [stamp := Time eventMillisecondClock].
dragType := evtBuf third.
position := evtBuf fourth @ evtBuf fifth.
buttons := MouseEvent redButton. "hacked because necessary for correct mouseMoveDragging handling"
modifiers := evtBuf sixth.
buttons := buttons bitOr: (modifiers bitShift: 3).
numFiles := evtBuf seventh.

dragType caseOf: {
[1] -> [ "dragEnter"
externalDropMorph := TransferMorph new
dragTransferType: #filesAndDirectories;
source: self;
passenger: (numFiles = 0 "Usually, numFiles and drop paths are delivered on dragDrop only. Still reserving this possibility for able host implementations."
ifTrue: [self flag: #vmCapabilityMissing. 'Unknown host content' translated]
ifFalse: [self collectDropFilesAndDirectories: numFiles]);
yourself.

"During the drag operation, the host system is responsible for displaying the cursor."
self grabMorph: externalDropMorph.
self showTemporaryCursor: Cursor blank.
externalDropMorph bottomRight: self topLeft. "Southeast area of the cursor is blocked by drawings from the source application. Display our drop morph at the opposite corner of the cursor." ].
[2] -> [ "dragMove"
^ MouseMoveEvent new
setType: #mouseMove
startPoint: self position
endPoint: position
trail: "{self position. position}"(self mouseDragTrailFrom: evtBuf)
buttons: buttons
hand: self
stamp: stamp ].
[3] -> [ "dragLeave"
externalDropMorph ifNotNil: #abandon.
externalDropMorph := nil.
self showTemporaryCursor: nil ].
[4] -> [ "dragDrop"
+ | oldButtons event |
+ oldButtons := lastEventBuffer fifth
+ bitOr: (lastEventBuffer sixth bitShift: 3).
+ event := MouseButtonEvent new
+ setType: #mouseUp
+ position: position
+ which: (oldButtons bitXor: buttons)
+ buttons: buttons
+ nClicks: 0
+ hand: self
+ stamp: stamp.
+
- | oldButtons |
externalDropMorph ifNil: [
+ "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been invoked again with a new image file (aka #launchDrop, runAsSingleInstance on Unix, or RunSingleApp on Windows)."
+ self flag: #forLater. "ct: When we decouple event generation from Morphic, we will probably need to introduce a separate SystemLaunchEvent class for this event. See http://forum.world.st/Changeset-Enhanced-integration-of-drag-n-drop-from-host-tp5123857p5124332.html."
+ self world
+ launchSystemFiles: (self collectDropFilesAndDirectories: numFiles)
+ event: event.
+ ^ nil].
- "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been called again (aka #launchDrop)."
- ^ self error: 'Launch drop for singleton Squeak not yet implemented.'].

self showTemporaryCursor: nil.
externalDropMorph passenger isString ifTrue: [
self flag: #vmCapabilityMissing. "See above."
externalDropMorph passenger: (self collectDropFilesAndDirectories: numFiles)].
externalDropMorph := nil.

(Smalltalk classNamed: #DropFilesEvent) ifNotNil: [:eventClass |
| classicEvent |
"Generate classic DropFilesEvent, providing backward compatibility."
classicEvent := eventClass new
setPosition: position
contents: numFiles
hand: self.
self processEvent: classicEvent.
classicEvent wasHandled ifTrue: [^ nil]].

+ ^ event ].
- oldButtons := lastEventBuffer fifth
- bitOr: (lastEventBuffer sixth bitShift: 3).
- ^ MouseButtonEvent new
- setType: #mouseUp
- position: position
- which: (oldButtons bitXor: buttons)
- buttons: buttons
- nClicks: 0
- hand: self
- stamp: stamp ].
[5] -> [ "drag request"
"For dnd out. Not properly implemented at the moment."
self shouldBeImplemented] }.
^ nil!

Item was added:
+ ----- Method: PasteUpMorph>>launchSystemFiles:event: (in category 'event handling') -----
+ launchSystemFiles: fileStreams event: anEvent
+ "Handle a number of files the singleton VM was invoked with again."
+
+ self flag: #todo. "Do something more useful with the image here, e. g. tell the VM to load it."
+ ^ self dropFiles: fileStreams event: anEvent!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1715.mcz

Christoph Thiede

Hi Marcel,


do you really think that it would be a good idea to couple HandMorph directly to MorphicProject? I always thought the world should be the only object to communicate with the world - except for accessing a small set of global interfaces such as #world, #addDeferredUIMessage: and #uiManager. :-)


Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Mittwoch, 18. November 2020 09:48:41
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1715.mcz
 
Hi Christoph.

Re-enables handling of #launchDrop events ...

It still looks like a proposal of having PasteUpMorph >> #launchSystemEventFiles:event: to me. :-) I would rather like to see such a send happen to the current project, not the world.

Best,
Marcel

Am 17.11.2020 20:26:13 schrieb [hidden email] <[hidden email]>:

Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1715.mcz

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

Name: Morphic-ct.1715
Author: ct
Time: 17 November 2020, 8:25:42.546431 pm
UUID: 4a1a9a9f-9ae1-0640-9f18-17e3c956fa0c
Ancestors: Morphic-mt.1713

Re-enables handling of #launchDrop events when the VM is configured as a singleton and has been invoked again, though currently only handled with a rudimentary fallback implementation.

See http://forum.world.st/Changeset-Enhanced-integration-of-drag-n-drop-from-host-tp5123857p5124332.html. Thanks to Jakob (jr) for the feedback!

=============== Diff against Morphic-mt.1713 ===============

Item was changed:
----- Method: HandMorph>>generateDropFilesEvent: (in category 'private events') -----
generateDropFilesEvent: evtBuf
"Generate the appropriate mouse event for the given raw event buffer."

| position buttons modifiers stamp numFiles dragType |
stamp := evtBuf second.
stamp = 0 ifTrue: [stamp := Time eventMillisecondClock].
dragType := evtBuf third.
position := evtBuf fourth @ evtBuf fifth.
buttons := MouseEvent redButton. "hacked because necessary for correct mouseMoveDragging handling"
modifiers := evtBuf sixth.
buttons := buttons bitOr: (modifiers bitShift: 3).
numFiles := evtBuf seventh.

dragType caseOf: {
[1] -> [ "dragEnter"
externalDropMorph := TransferMorph new
dragTransferType: #filesAndDirectories;
source: self;
passenger: (numFiles = 0 "Usually, numFiles and drop paths are delivered on dragDrop only. Still reserving this possibility for able host implementations."
ifTrue: [self flag: #vmCapabilityMissing. 'Unknown host content' translated]
ifFalse: [self collectDropFilesAndDirectories: numFiles]);
yourself.

"During the drag operation, the host system is responsible for displaying the cursor."
self grabMorph: externalDropMorph.
self showTemporaryCursor: Cursor blank.
externalDropMorph bottomRight: self topLeft. "Southeast area of the cursor is blocked by drawings from the source application. Display our drop morph at the opposite corner of the cursor." ].
[2] -> [ "dragMove"
^ MouseMoveEvent new
setType: #mouseMove
startPoint: self position
endPoint: position
trail: "{self position. position}"(self mouseDragTrailFrom: evtBuf)
buttons: buttons
hand: self
stamp: stamp ].
[3] -> [ "dragLeave"
externalDropMorph ifNotNil: #abandon.
externalDropMorph := nil.
self showTemporaryCursor: nil ].
[4] -> [ "dragDrop"
+ | oldButtons event |
+ oldButtons := lastEventBuffer fifth
+ bitOr: (lastEventBuffer sixth bitShift: 3).
+ event := MouseButtonEvent new
+ setType: #mouseUp
+ position: position
+ which: (oldButtons bitXor: buttons)
+ buttons: buttons
+ nClicks: 0
+ hand: self
+ stamp: stamp.
+
- | oldButtons |
externalDropMorph ifNil: [
+ "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been invoked again with a new image file (aka #launchDrop, runAsSingleInstance on Unix, or RunSingleApp on Windows)."
+ self flag: #forLater. "ct: When we decouple event generation from Morphic, we will probably need to introduce a separate SystemLaunchEvent class for this event. See http://forum.world.st/Changeset-Enhanced-integration-of-drag-n-drop-from-host-tp5123857p5124332.html."
+ self world
+ launchSystemFiles: (self collectDropFilesAndDirectories: numFiles)
+ event: event.
+ ^ nil].
- "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been called again (aka #launchDrop)."
- ^ self error: 'Launch drop for singleton Squeak not yet implemented.'].

self showTemporaryCursor: nil.
externalDropMorph passenger isString ifTrue: [
self flag: #vmCapabilityMissing. "See above."
externalDropMorph passenger: (self collectDropFilesAndDirectories: numFiles)].
externalDropMorph := nil.

(Smalltalk classNamed: #DropFilesEvent) ifNotNil: [:eventClass |
| classicEvent |
"Generate classic DropFilesEvent, providing backward compatibility."
classicEvent := eventClass new
setPosition: position
contents: numFiles
hand: self.
self processEvent: classicEvent.
classicEvent wasHandled ifTrue: [^ nil]].

+ ^ event ].
- oldButtons := lastEventBuffer fifth
- bitOr: (lastEventBuffer sixth bitShift: 3).
- ^ MouseButtonEvent new
- setType: #mouseUp
- position: position
- which: (oldButtons bitXor: buttons)
- buttons: buttons
- nClicks: 0
- hand: self
- stamp: stamp ].
[5] -> [ "drag request"
"For dnd out. Not properly implemented at the moment."
self shouldBeImplemented] }.
^ nil!

Item was added:
+ ----- Method: PasteUpMorph>>launchSystemFiles:event: (in category 'event handling') -----
+ launchSystemFiles: fileStreams event: anEvent
+ "Handle a number of files the singleton VM was invoked with again."
+
+ self flag: #todo. "Do something more useful with the image here, e. g. tell the VM to load it."
+ ^ self dropFiles: fileStreams event: anEvent!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1715.mcz

marcel.taeumel
> ... do you really think that it would be a good idea to couple HandMorph directly to MorphicProject?

Yes, because it couples with the OO event handling stuff, which should be extracted from Morphic anyway.

Best,
Marcel

Am 20.11.2020 13:15:33 schrieb Thiede, Christoph <[hidden email]>:

Hi Marcel,


do you really think that it would be a good idea to couple HandMorph directly to MorphicProject? I always thought the world should be the only object to communicate with the world - except for accessing a small set of global interfaces such as #world, #addDeferredUIMessage: and #uiManager. :-)


Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Mittwoch, 18. November 2020 09:48:41
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1715.mcz
 
Hi Christoph.

Re-enables handling of #launchDrop events ...

It still looks like a proposal of having PasteUpMorph >> #launchSystemEventFiles:event: to me. :-) I would rather like to see such a send happen to the current project, not the world.

Best,
Marcel

Am 17.11.2020 20:26:13 schrieb [hidden email] <[hidden email]>:

Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1715.mcz

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

Name: Morphic-ct.1715
Author: ct
Time: 17 November 2020, 8:25:42.546431 pm
UUID: 4a1a9a9f-9ae1-0640-9f18-17e3c956fa0c
Ancestors: Morphic-mt.1713

Re-enables handling of #launchDrop events when the VM is configured as a singleton and has been invoked again, though currently only handled with a rudimentary fallback implementation.

See http://forum.world.st/Changeset-Enhanced-integration-of-drag-n-drop-from-host-tp5123857p5124332.html. Thanks to Jakob (jr) for the feedback!

=============== Diff against Morphic-mt.1713 ===============

Item was changed:
----- Method: HandMorph>>generateDropFilesEvent: (in category 'private events') -----
generateDropFilesEvent: evtBuf
"Generate the appropriate mouse event for the given raw event buffer."

| position buttons modifiers stamp numFiles dragType |
stamp := evtBuf second.
stamp = 0 ifTrue: [stamp := Time eventMillisecondClock].
dragType := evtBuf third.
position := evtBuf fourth @ evtBuf fifth.
buttons := MouseEvent redButton. "hacked because necessary for correct mouseMoveDragging handling"
modifiers := evtBuf sixth.
buttons := buttons bitOr: (modifiers bitShift: 3).
numFiles := evtBuf seventh.

dragType caseOf: {
[1] -> [ "dragEnter"
externalDropMorph := TransferMorph new
dragTransferType: #filesAndDirectories;
source: self;
passenger: (numFiles = 0 "Usually, numFiles and drop paths are delivered on dragDrop only. Still reserving this possibility for able host implementations."
ifTrue: [self flag: #vmCapabilityMissing. 'Unknown host content' translated]
ifFalse: [self collectDropFilesAndDirectories: numFiles]);
yourself.

"During the drag operation, the host system is responsible for displaying the cursor."
self grabMorph: externalDropMorph.
self showTemporaryCursor: Cursor blank.
externalDropMorph bottomRight: self topLeft. "Southeast area of the cursor is blocked by drawings from the source application. Display our drop morph at the opposite corner of the cursor." ].
[2] -> [ "dragMove"
^ MouseMoveEvent new
setType: #mouseMove
startPoint: self position
endPoint: position
trail: "{self position. position}"(self mouseDragTrailFrom: evtBuf)
buttons: buttons
hand: self
stamp: stamp ].
[3] -> [ "dragLeave"
externalDropMorph ifNotNil: #abandon.
externalDropMorph := nil.
self showTemporaryCursor: nil ].
[4] -> [ "dragDrop"
+ | oldButtons event |
+ oldButtons := lastEventBuffer fifth
+ bitOr: (lastEventBuffer sixth bitShift: 3).
+ event := MouseButtonEvent new
+ setType: #mouseUp
+ position: position
+ which: (oldButtons bitXor: buttons)
+ buttons: buttons
+ nClicks: 0
+ hand: self
+ stamp: stamp.
+
- | oldButtons |
externalDropMorph ifNil: [
+ "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been invoked again with a new image file (aka #launchDrop, runAsSingleInstance on Unix, or RunSingleApp on Windows)."
+ self flag: #forLater. "ct: When we decouple event generation from Morphic, we will probably need to introduce a separate SystemLaunchEvent class for this event. See http://forum.world.st/Changeset-Enhanced-integration-of-drag-n-drop-from-host-tp5123857p5124332.html."
+ self world
+ launchSystemFiles: (self collectDropFilesAndDirectories: numFiles)
+ event: event.
+ ^ nil].
- "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been called again (aka #launchDrop)."
- ^ self error: 'Launch drop for singleton Squeak not yet implemented.'].

self showTemporaryCursor: nil.
externalDropMorph passenger isString ifTrue: [
self flag: #vmCapabilityMissing. "See above."
externalDropMorph passenger: (self collectDropFilesAndDirectories: numFiles)].
externalDropMorph := nil.

(Smalltalk classNamed: #DropFilesEvent) ifNotNil: [:eventClass |
| classicEvent |
"Generate classic DropFilesEvent, providing backward compatibility."
classicEvent := eventClass new
setPosition: position
contents: numFiles
hand: self.
self processEvent: classicEvent.
classicEvent wasHandled ifTrue: [^ nil]].

+ ^ event ].
- oldButtons := lastEventBuffer fifth
- bitOr: (lastEventBuffer sixth bitShift: 3).
- ^ MouseButtonEvent new
- setType: #mouseUp
- position: position
- which: (oldButtons bitXor: buttons)
- buttons: buttons
- nClicks: 0
- hand: self
- stamp: stamp ].
[5] -> [ "drag request"
"For dnd out. Not properly implemented at the moment."
self shouldBeImplemented] }.
^ nil!

Item was added:
+ ----- Method: PasteUpMorph>>launchSystemFiles:event: (in category 'event handling') -----
+ launchSystemFiles: fileStreams event: anEvent
+ "Handle a number of files the singleton VM was invoked with again."
+
+ self flag: #todo. "Do something more useful with the image here, e. g. tell the VM to load it."
+ ^ self dropFiles: fileStreams event: anEvent!