Tangent128 / luasdl2

A pure C binding of SDL 2.0 for Lua 5.1, Lua 5.2, and LuaJIT.
ISC License
383 stars 73 forks source link

Has no member named ‘windowID’ #61

Closed HazMux closed 3 years ago

HazMux commented 7 years ago

2017-04-08 16-39-43

os: Ubuntu 16.04

Web-eWorks commented 7 years ago

According to SDL's docs, it does.

Check your system's SDL_events.h header (mine's in /usr/include/SDL2/) at around line 465 for the SDL_DropEvent struct. If the windowID member is there, something's wrong in the build process. If it's not, something's wrong in your distro's packaging process.

Tangent128 commented 7 years ago

I have observed this problem on a colleague's Debian Jessie (8.6) machine, and it was due to the installed SDL2 headers missing that field for whatever reason.

They did not observe the issue in Debian Stretch (9.0).

Does this describe your experience?

soverysour commented 7 years ago

Same problem here, looking through that header file, only SDL_DropEvent doesn't have that struct member when it should. I added that manually to the header file, compile worked, and all examples seem to work fine. I guess that's alright (maybe).

markand commented 7 years ago

I'll fix that.

Tangent128 commented 7 years ago

@markand That fix looks viable, and I'll merge it; there's one wrinkle before I can release, though-

This setup will only define HAVE_DROPEVENT_WINDOW_ID from a cmake build, since that's the one that has the smarts to check the header file for the needed field.

The LuaRocks build will thus omit that field on all platforms, not just the weird Debian version. We can either say that's fine (and make a major-version bump per semver), or unconditionally define HAVE_DROPEVENT_WINDOW_ID in the LuaRocks version.

My instinct says that it's a minor enough feature, and Debian important enough a target, that it's better to have the LuaRocks version drop the field. But it's not especially satisfying.

ghost commented 6 years ago

There's no need to test the existence of the struct member. It was added in SDL v2.0.5 (see https://hg.libsdl.org/SDL/log/f162f5d7798d/include/SDL_events.h), so a version check is enough.

Building with SDL v2.0.2 will fail in a few other places btw: src/gamecontroller.c:191:36: error: ‘l_gameControllerFromInstanceID’ undeclared here (not in a function) src/joystick.c:197:2: error: unknown type name ‘SDL_JoystickPowerLevel’ *src/joystick.c:199:49: error: ‘SDL_JOYSTICK_POWER_UNKNOWN’ undeclared (first use in this function) The joystick power thing is missing a check for v2.0.4, not sure what the gamecontroller one was.

markand commented 3 years ago

This was added later.