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

Event::TextDrop enum struct has incorrect field 'filename', should be 'text' #1401

Open
dylanopen opened this issue May 26, 2024 · 1 comment

Comments

@dylanopen
Copy link

dylanopen commented May 26, 2024

The sdl2::event::Event::TextDrop enum defines an enum with the following definition:

DropText {
    timestamp: u32,
    window_id: u32,
    filename: String,
},

However, the actual definition should instead read:

DropText {
        timestamp: u32,
        window_id: u32,
        text: String,
},

Clearly, the DropText definition above was copied and pasted and wasn't changed properly for the DropFile enum variant. I hope this makes sense!

This is a very minor issue but it confused me a little! I understand that fixing this may require refactoring projects, but it would be worth fixing in the next release of the sdl2 crate.

I would fix it with a PR, but it's not really worth it just to change a single line :)

Thanks, Dylan

Source: event.rs, line 895.

@Cobrand
Copy link
Member

Cobrand commented May 27, 2024

I think it still warrants a PR, but not in the sense that you are thinking of. Changing this field would require refactoring, however, adding a doc comment saying something along the lines of "due to backward compatbility issues, this field was not renamed, but its actual name should be "text", because it holds the text being dropped".

Something like that :)

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

No branches or pull requests

2 participants