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

SDL_TOUCH_MOUSEID ? #1171

Open
gregbuchholz opened this issue Nov 25, 2021 · 2 comments
Open

SDL_TOUCH_MOUSEID ? #1171

gregbuchholz opened this issue Nov 25, 2021 · 2 comments

Comments

@gregbuchholz
Copy link

I'm not seeing "SDL_TOUCH_MOUSEID" in the Rust bindings. Am I overlooking something? The #define comes from C source at "./include/SDL_touch.h", and is used to differentiate between simulated mouse events and touch events on touch enabled devices.

/* Used as the device ID for mouse events simulated with touch input */
#define SDL_TOUCH_MOUSEID ((Uint32)-1)

/* Used as the SDL_TouchID for touch events simulated with mouse input */
#define SDL_MOUSE_TOUCHID ((Sint64)-1) 

See also: https://wiki.libsdl.org/SDL_MouseMotionEvent for more context. I'm not quite following how "sdl2-sys/sdl_bindings.rs" is generated (from "sdl2-sys/build.rs"?), or why it would be missing.

@Cobrand
Copy link
Member

Cobrand commented Nov 25, 2021

It's not defined in sdl_bindings.rs because it's generated via bindgen, which doesn't seem to support it yet: rust-lang/rust-bindgen#316

A solution can be to manually define pub const which those hardcoded values in rust-sdl2 itself (and not using bindgen for this one).

@gregbuchholz
Copy link
Author

Ah, good find. The exact same issue in this comment on that thread. Seems like a minor enough issue that it wouldn't be worth breaking the automated build. Easy enough to define in my program. For future searchers on this topic:

const SDL_TOUCH_MOUSEID:u32 = u32::MAX;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants