Skip to content

Instantly share code, notes, and snippets.

@rhenium
Created December 26, 2013 08:03
Show Gist options
  • Save rhenium/8131080 to your computer and use it in GitHub Desktop.
Save rhenium/8131080 to your computer and use it in GitHub Desktop.
gtk2 2.0.2 を Ruby 2.1.0p0 対応 RBASIC_SET_CLASS_RAW は internal.h より
diff --git a/gtk2/ext/gtk2/rbgdkevent.c b/gtk2/ext/gtk2/rbgdkevent.c
index 6a5d068..08b437a 100644
--- a/gtk2/ext/gtk2/rbgdkevent.c
+++ b/gtk2/ext/gtk2/rbgdkevent.c
@@ -32,6 +32,12 @@ static VALUE gdkevents[35];
static VALUE gdkevents[34];
#endif
+struct RBasicRaw {
+ VALUE flags;
+ VALUE klass;
+};
+#define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
+
/***********************************************/
VALUE
@@ -41,7 +47,7 @@ make_gdkevent(GdkEvent *ev)
if (ev == NULL) return Qnil;
obj = BOXED2RVAL(ev, GDK_TYPE_EVENT);
- RBASIC(obj)->klass = gdkevents[ev->type]; /* hack */
+ RBASIC_SET_CLASS_RAW(obj, gdkevents[ev->type]); /* hack */
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment