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

Pass window id to event functions #851

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nohenry
Copy link

@nohenry nohenry commented May 9, 2022

This allows the event and raw_event handler functions to access the id of the window the event is being fired on.

This is useful for supporting multiple windows and being able to handle their events separately. Unless I'm missing something I don't think there is any other way to do this.

Event handlers would look like:

fn raw_window_event(app: &App, model: &mut Model, event: &ui::RawWindowEvent, id: WindowId) {
       ...
}

fn window_event(app: &App, model: &mut Model, event: &ui::RawWindowEvent, id: WindowId) {
       ...
}

These ids can be used to index into a hash map that contains specific window information.

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.

None yet

1 participant