Skip to content

No way to get a window from a window_id. #573

Open
@ideasman42

Description

@ideasman42

Events expose their associated window, however I couldn't find a convenient way to get the window.

Using sdl2_sys this should be possible:

match sdl_event_generic {
    sdl2::event::Event::MouseMotion { x, y, window_id, .. } => {
        use sdl2_sys::video::SDL_GetWindowFromID;
        let win_ptr = SDL_GetWindowFromID(window_id);
        let win = sdl2::video::Window::from_ll(video_subsystem, win_ptr);
        /* ...etc */
    } /* ...etc */

However in this case the window video_subsystem takes a value. so sdl2::video::Window::from_ll can't be used to access windows multiple times.

Is this an intended API limitation? or are developers meant to maintain their own window data which can match against window ID's?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions