Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up openInNewSpace, openInSpace, showSpace:, etc. #431

Open
tinchodias opened this issue Jan 30, 2024 · 8 comments
Open

Clean up openInNewSpace, openInSpace, showSpace:, etc. #431

tinchodias opened this issue Jan 30, 2024 · 8 comments

Comments

@tinchodias
Copy link
Collaborator

I propose to deprecate this method I added to BlElement (if I remember well):

openInNewSpace
	"Add self to a new BlSpace and show it. Answer such space."
	
	| aSpace |
	aSpace := BlSpace new.
	aSpace root addChild: self.
	aSpace show.
	^ aSpace

In favor of:

openInSpace
	"Add self to a new BlSpace and show it. Answer such space."
	| sp |
	sp := self inSpace.
	sp show.
	^ sp

inSpace
	"Add self to a new BlSpace. Answer such space."
	| sp |
	sp := BlSpace new.
	sp root addChild: self.
	^ sp

It can be the opposite, too. But no reason to have both.

@tinchodias
Copy link
Collaborator Author

Additionally, we can rename to showInSpace or showInNewSpace, since that's the term used in the API of BlSpace.

@plantec
Copy link
Collaborator

plantec commented Jan 30, 2024

showInSpace and inSpace are ok for me.
thanks

@tinchodias
Copy link
Collaborator Author

@Ducasse what do you think?

@Ducasse
Copy link
Contributor

Ducasse commented Jan 31, 2024

Trying to get smart :)
When reading openInSpace I was expecting an argument (the space).
If I understand correctly you want to have

  • place an child in a space
  • open the space.

Now why would we need place child in space because we have addChild:
so this is only when we need to create a space. So the new in the name seems important to me.

So may be we should name them
inNewSpace and openInNewSpace like that we know that they work together.

@tinchodias
Copy link
Collaborator Author

Thanks... But do you prefer openInNewSpace over showInNewSpace?
I think the second since BlSpace has #show, not #open.

@tinchodias
Copy link
Collaborator Author

tinchodias commented Jan 31, 2024

Bahhh, we can also discuss if "show" is the good term... BlSpace has show, hide and close.

I've just discovered that after "hide", then "show" doesn't work :-/

s := BlSpace new.
s show.
s hide.
s show.
  • SDL host: doesn't show it after hide.
  • Morphic host: error on hide.

Reported here: #434

@tinchodias
Copy link
Collaborator Author

Let's include in the fix for this issue this (unsent) method in BlElement:

showSpace: aSpace
	self hasParent
		ifTrue: [ self parent showSpace: aSpace ]
		ifFalse: [
			self isAttachedToSceneGraph
				ifTrue: [ self space showSpace: aSpace ]
				ifFalse: [ aSpace show ] ]

@tinchodias tinchodias changed the title Deprecate openInNewSpace in favor of openInSpace? Clean up openInNewSpace, openInSpace, showSpace:, etc. Jan 31, 2024
@tinchodias
Copy link
Collaborator Author

Additional input for the discussion:

First. There are separate testing methods for the concepts of being visible and being opened:

s := BlSpace new.
{ s isOpened. s isVisible }. "#(false false)"
s show.
{ s isOpened. s isVisible }. "#(true true)"
s hide.
{ s isOpened. s isVisible }. "#(true false)"

Second. The comment of BlSpace>>show is "Open me in a window and show it to the user", and it only sends openSpace: to its universe, which sends openSpaceSynchronously:, which:

  • sends becomeVisible to the space.
  • adds the space to a list so that it will receive pulse on new system events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants