X-Git-Url: http://git.code-monkey.de/?p=ruby-ecore.git;a=blobdiff_plain;f=src%2Fecore_x%2Frb_cursor.c;h=14da4c76de70b3d50747768211fcd88e3fb6d9b9;hp=91091515d516fe6a0495e641d66bd89825910046;hb=0f8d24c745efc1057f8d25ada1375c88a1ab2ed7;hpb=ed7756f1892ec068be14445c39a86f14f7e76a46 diff --git a/src/ecore_x/rb_cursor.c b/src/ecore_x/rb_cursor.c index 9109151..14da4c7 100644 --- a/src/ecore_x/rb_cursor.c +++ b/src/ecore_x/rb_cursor.c @@ -1,6 +1,4 @@ /* - * $Id: rb_cursor.c 98 2004-08-26 13:12:55Z tilman $ - * * Copyright (C) 2004 ruby-ecore team (see AUTHORS) * * This library is free software; you can redistribute it and/or @@ -24,6 +22,7 @@ #include #define __RB_CURSOR_C +#include "../ecore/rb_ecore.h" #include "rb_ecore_x.h" #include "rb_cursor.h" @@ -37,18 +36,25 @@ static void c_free (RbCursor *c) free (c); } +static VALUE c_alloc (VALUE klass) +{ + RbCursor *cursor = NULL; + + return Data_Make_Struct (klass, RbCursor, NULL, c_free, cursor); +} + static VALUE c_new_from_shape (VALUE klass, VALUE shape) { VALUE self; RbCursor *cursor = NULL; - self = Data_Make_Struct (klass, RbCursor, NULL, c_free, cursor); + self = rb_class_new_instance (1, &shape, klass); + + Data_Get_Struct (self, RbCursor, cursor); cursor->real = ecore_x_cursor_shape_get (FIX2INT (shape)); cursor->need_free = false; - rb_obj_call_init (self, 0, NULL); - return self; } @@ -56,6 +62,7 @@ void Init_Cursor (void) { cCursor = rb_define_class_under (mX, "Cursor", rb_cObject); + rb_define_alloc_func (cCursor, c_alloc); rb_define_singleton_method (cCursor, "new_from_shape", c_new_from_shape, 1);