Event subscriptions#122
Merged
Merged
Conversation
I am not sure why I had to use it in the first place...
Contributor
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
sctk: Use empty input region for subsurfaces This seems to work, and is a better way to deal with subsurface input if there aren't any problems. This way, input events simply go to the parent surface, so we don't have to deal with various edge cases related to that. (Though for compositor-side issues, we still need to fix those for other clients.) This helps with an issue with drag-and-drop and subsurfaces on Smithay, and a different issue on Kwin (in KDE 5.27, at least). sctk: Fix handling of DnD with subsurfaces (iced-rs#122) Map subsurface to parent and add offset. fixes for dnd Send `DataSource` events to all surfaces Previously these events are directed to the first surface, then removed from `sctk_events`. Which is definitely not right. fix(sctk): nested popup parent
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
sctk: Use empty input region for subsurfaces This seems to work, and is a better way to deal with subsurface input if there aren't any problems. This way, input events simply go to the parent surface, so we don't have to deal with various edge cases related to that. (Though for compositor-side issues, we still need to fix those for other clients.) This helps with an issue with drag-and-drop and subsurfaces on Smithay, and a different issue on Kwin (in KDE 5.27, at least). sctk: Fix handling of DnD with subsurfaces (iced-rs#122) Map subsurface to parent and add offset. fixes for dnd Send `DataSource` events to all surfaces Previously these events are directed to the first surface, then removed from `sctk_events`. Which is definitely not right. fix(sctk): nested popup parent
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
sctk: Use empty input region for subsurfaces This seems to work, and is a better way to deal with subsurface input if there aren't any problems. This way, input events simply go to the parent surface, so we don't have to deal with various edge cases related to that. (Though for compositor-side issues, we still need to fix those for other clients.) This helps with an issue with drag-and-drop and subsurfaces on Smithay, and a different issue on Kwin (in KDE 5.27, at least). sctk: Fix handling of DnD with subsurfaces (iced-rs#122) Map subsurface to parent and add offset. fixes for dnd Send `DataSource` events to all surfaces Previously these events are directed to the first surface, then removed from `sctk_events`. Which is definitely not right. fix(sctk): nested popup parent
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
sctk: Use empty input region for subsurfaces This seems to work, and is a better way to deal with subsurface input if there aren't any problems. This way, input events simply go to the parent surface, so we don't have to deal with various edge cases related to that. (Though for compositor-side issues, we still need to fix those for other clients.) This helps with an issue with drag-and-drop and subsurfaces on Smithay, and a different issue on Kwin (in KDE 5.27, at least). sctk: Fix handling of DnD with subsurfaces (iced-rs#122) Map subsurface to parent and add offset. fixes for dnd Send `DataSource` events to all surfaces Previously these events are directed to the first surface, then removed from `sctk_events`. Which is definitely not right. fix(sctk): nested popup parent
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
sctk: Use empty input region for subsurfaces This seems to work, and is a better way to deal with subsurface input if there aren't any problems. This way, input events simply go to the parent surface, so we don't have to deal with various edge cases related to that. (Though for compositor-side issues, we still need to fix those for other clients.) This helps with an issue with drag-and-drop and subsurfaces on Smithay, and a different issue on Kwin (in KDE 5.27, at least). sctk: Fix handling of DnD with subsurfaces (iced-rs#122) Map subsurface to parent and add offset. fixes for dnd Send `DataSource` events to all surfaces Previously these events are directed to the first surface, then removed from `sctk_events`. Which is definitely not right. fix(sctk): nested popup parent
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
sctk: Use empty input region for subsurfaces This seems to work, and is a better way to deal with subsurface input if there aren't any problems. This way, input events simply go to the parent surface, so we don't have to deal with various edge cases related to that. (Though for compositor-side issues, we still need to fix those for other clients.) This helps with an issue with drag-and-drop and subsurfaces on Smithay, and a different issue on Kwin (in KDE 5.27, at least). sctk: Fix handling of DnD with subsurfaces (iced-rs#122) Map subsurface to parent and add offset. fixes for dnd Send `DataSource` events to all surfaces Previously these events are directed to the first surface, then removed from `sctk_events`. Which is definitely not right. fix(sctk): nested popup parent
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
sctk: Use empty input region for subsurfaces This seems to work, and is a better way to deal with subsurface input if there aren't any problems. This way, input events simply go to the parent surface, so we don't have to deal with various edge cases related to that. (Though for compositor-side issues, we still need to fix those for other clients.) This helps with an issue with drag-and-drop and subsurfaces on Smithay, and a different issue on Kwin (in KDE 5.27, at least). sctk: Fix handling of DnD with subsurfaces (iced-rs#122) Map subsurface to parent and add offset. fixes for dnd Send `DataSource` events to all surfaces Previously these events are directed to the first surface, then removed from `sctk_events`. Which is definitely not right. fix(sctk): nested popup parent
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
ryanabx
pushed a commit
to ryanabx-contrib/iced
that referenced
this pull request
Jul 29, 2024
Map subsurface to parent and add offset.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #29, closes #109, and fixes #123.
This PR adds support for event subscriptions. Event subscriptions are inspired by Elm's subscriptions and can be used to listen to external events that do not necessarily occur as a response to some interaction or command. For instance, you can use event subscriptions to create a websocket connection, listen to incoming messages, and even handle reconnects graciously.
Event subscriptions are built on top of
futures::stream::Stream. The messages produced by a subscription are provided toApplication::updateand, of course, can be used to change the state of theApplication.The
iced_winitshell keeps a subscription alive as long as the user returns it in the newApplication::subscriptionmethod. Therefore, unsubscribing simply consists in not returning the subscription anymore.Moreover, subscriptions can be created by libraries and/or end-users using the new
subscription::Recipetrait (name subject to change), which requires just a couple of methods.For now, there is only one built-in
Subscriptioniniced_native:subscription::events. This subscription will notify an application of all the runtime events that occur, producingEventvalues. It can be useful if you want to listen to keyboard or mouse events (and most likely window events soon):Two examples have been added that showcase event subscriptions:
events, which uses the new built-insubscription::events.stopwatch, which showcases a custom event subscription that produces messages periodically at a configurable time interval.