Skip to content

snowap: Add a weak version of the signaler#442

Merged
Ottatop merged 1 commit intopinnacle-comp:mainfrom
Ph4ntomas:snowcap_weak-signaler
Mar 28, 2026
Merged

snowap: Add a weak version of the signaler#442
Ottatop merged 1 commit intopinnacle-comp:mainfrom
Ph4ntomas:snowcap_weak-signaler

Conversation

@Ph4ntomas
Copy link
Copy Markdown
Contributor

@Ph4ntomas Ph4ntomas commented Mar 1, 2026

While porting Glacier's widgets to composable programs, I noticed there was no weak version of the Signaler.

My goal was to create a simple handle for some widget that would use the Signaler to emit messages targeted to the widget, but keeping the Signaler around is leaky.

The alternative are:
a. Make the widget state an Arc and the handle a Weak of that state
b. Pass the surface handle to subsystems that need to send message
c. Make the widget listen to some events and drive them via an external Signaler

I'd rather avoid (a) whenever possible, and (b) give more capabilities than strictly required.
(c) does works, but I'd prefer having the option to do both.

EDIT:
Regarding (c): while it does work, it's made easier to use with the PR since the signal handler can capture a WeakSignaler. The alternative implementation is to setup the signal after the surface Created event, so we can capture the surface handle instead, which is less than ideal.

@Ph4ntomas
Copy link
Copy Markdown
Contributor Author

I haven't check whether the lua side need something similar, I'm currently porting the rust code first. If needed, this MR can wait until after I'm done, otherwise I'll open another one for lua if I find the need to.

Copy link
Copy Markdown
Collaborator

@Ottatop Ottatop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Ottatop Ottatop force-pushed the snowcap_weak-signaler branch from 8774ac4 to aef2af2 Compare March 28, 2026 03:12
@Ottatop Ottatop enabled auto-merge (squash) March 28, 2026 03:12
@Ottatop Ottatop merged commit 8888990 into pinnacle-comp:main Mar 28, 2026
11 checks passed
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

Successfully merging this pull request may close these issues.

2 participants