feat: Ruby 3.4 support — migrate to TypedData API#2
Merged
Conversation
Replace all deprecated Data_Wrap_Struct/Data_Get_Struct with TypedData_Wrap_Struct/TypedData_Get_Struct across all source files. Add DEFINE_DATA_TYPE helper macro to rubysdl2_internal.h for easy rb_data_type_t definition. Eliminates all deprecation warnings on Ruby 3.4.x while maintaining backward compatibility with Ruby 3.3.x. Files changed: - rubysdl2_internal.h: DEFINE_DATA_TYPE macro, DEFINE_GETTER uses TypedData - video.c.m4: Window, Renderer, Texture, Surface, DisplayMode, Rect, Point - event.c: SDL_Event (EVENT_READER/EVENT_WRITER macros + all event types) - mixer.c.m4: Chunk, Music - ttf.c.m4: TTF - joystick.c.m4: Joystick - gamecontroller.c.m4: GameController - gl.c.m4: GLContext Closes #1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate all
Data_Wrap_Struct/Data_Get_StructtoTypedData_Wrap_Struct/TypedData_Get_Structfor Ruby 3.4 compatibility.Ruby 3.4 deprecates the old
Data_Wrap_Struct/Data_Get_StructAPI in favor ofTypedData. This PR eliminates all deprecation warnings (previously 90+) while maintaining backward compatibility with Ruby 3.3.x.Changes
rubysdl2_internal.h: AddDEFINE_DATA_TYPEhelper macro; updateDEFINE_GETTERto useTypedData_Get_Structvideo.c.m4: Window, Renderer, Texture, Surface, DisplayMode, Rect, Point + FIELD_ACCESSOR macroevent.c: SDL_Event + EVENT_READER/EVENT_WRITER macrosmixer.c.m4: Chunk, Musicttf.c.m4: TTFjoystick.c.m4: Joystickgamecontroller.c.m4: GameControllergl.c.m4: GLContextTesting
Closes #1