nannou icon indicating copy to clipboard operation
nannou copied to clipboard

Pass window id to event functions

Open nohenry opened this issue 2 years ago • 0 comments

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.

nohenry avatar May 09 '22 03:05 nohenry