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

Provide a mechanism to subscribe to new spaces being opened #668

Open
tinchodias opened this issue Dec 5, 2024 · 2 comments
Open

Provide a mechanism to subscribe to new spaces being opened #668

tinchodias opened this issue Dec 5, 2024 · 2 comments

Comments

@tinchodias
Copy link
Collaborator

Issue created from a comment in #624, where @labordep asked "for doing stuff when a space is open with Pyramid (to install a keyboard shortcut to edit it), what event can we used?"

We have to consider BlParallelUniverseErrorDuringPulseSignal.

@labordep
Copy link
Contributor

labordep commented Dec 6, 2024

Thanks @tinchodias!

@tinchodias
Copy link
Collaborator Author

Of course, a possibility to fix this issue is reverting the removal of the Beacon signal, so again each "parallel universe" will signal it, and Pyramid can listen again. But I for now I prefer to keep that change.

Another possibility is adding new BlEvents and introduce an inst var to BlParallelUniverse, add the trait TBlEventTarget, and use a BlDirectEventDispatcher. Users will subscribe with addEventHandler: like API. But I see cons to this approach, that are discussed in #702.

Third possibility: do it simpler with a plain Announcer and new Announcements. To explore this possibility, I wrote the following:

Imagine Pyramid toolset subscribes like:

BlOSWindowSDL2Host universe announcer weak
	when: BlParallelUniverseAttachedSpaceAnnoncement
	send: #onSpaceAttachedToUniverse:
	to: self.

where self is the instance of the Pyramid tool, and onSpaceAttachedToUniverse: receives an instance of an announcement that has a reference to the space, o add the shortcut as required by Pyramid. The purpose of weak is freeing the Pyramid instance to be garbage collected in the case it is not pointed by anyone else than the announcer subscription.

I used the word Attached, because it has been used already for the action that's being announced... Let's remember what's happening:

  1. There is a space with a given title, size, etc, that was requested to be be shown on its parallel universe (This means the space was enqueued to be shown)
  2. At some async moment (i.e. executed from another Process than it was requested, probably), the host is actually creating a SDL2 window with the specified size, title, etc.).

It is at 2 when a parallel universe was sending a Beacon signal (and now may announce it, or dispatch an event).

This BlParallelUniverseAttachedSpaceAnnoncement would be a direct subclass of Announcement, or subclass something intermediate like BlParallelUniverseAnnoncement .

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

2 participants