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

About switching host while space is opened #636

Closed
tinchodias opened this issue Oct 22, 2024 · 4 comments
Closed

About switching host while space is opened #636

tinchodias opened this issue Oct 22, 2024 · 4 comments

Comments

@tinchodias
Copy link
Collaborator

In BlParallelUniverse, closeSpaceSynchronously: and detachSpaceSynchronously: share most part of code (we should reuse more) BUT ALSO, the diff smells to bug:

Left: closeSpaceSynchronously: - Right: detachSpaceSynchronously:
Screenshot 2024-10-22 at 13 49 42

When are they used?

  • closeSpaceSynchronously:, when a space is closed.
  • detachSpaceSynchronously when a space is opened and you change the host (like switch from a SDL2 window to a Morphic window on the fly, while it's open). This is not usual, so this is the candidate to be buggy (it should be adapt to what happens in close).

In fact, I didn't know this was implemented. I knew that switching host was working but when you show, then close, then change host, and send show again... I mean, when it is closed you can switch host right now.

Foe exmaple, this is implemented but buggy:

space := BlSpace new.
space host: BlMorphicWindowHost new.
space root background: Color random.
space extent: 200 asPoint.
space show.

"wait, and evaluate:"
space host: BlOSWindowSDL2Host new.
@tinchodias
Copy link
Collaborator Author

Something similar happens in the counterpart operations: open and attach:

Left: openSpaceSynchronously: - Right: attachSpaceSynchronously:
Screenshot 2024-10-22 at 19 34 21

It's error prone to have this semi-duplicated code, and attachSpaceSynchronously: is only used in the case if switching hosts.

@tinchodias
Copy link
Collaborator Author

  • I don't find traces of tests on this feature.

@tinchodias
Copy link
Collaborator Author

I added a note in a line added in openSpaceSynchronously: in PR #619

@tinchodias
Copy link
Collaborator Author

Fixed with e2550e8 + 47df523 + 0a80636.

I'm missing an automatized test yet.
Tested manually with:

space := BlSpace new.
space host: BlMorphicWindowHost new.
space root background: Color random.
space extent: 400 asPoint.
space title: 'hello'.
space show.

"wait, and evaluate:"
space host: BlOSWindowSDL2Host new.

"wait, and evaluate:"
space useMorphicHost 
Screen.Recording.2024-10-23.at.23.54.05.mov

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

1 participant