Skip to content

Commit

Permalink
more #383 ground work.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecil committed Nov 8, 2017
1 parent 23f5b1d commit e26774a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion shoes/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static void shoes_app_mark(shoes_app *app) {
rb_gc_mark_maybe(app->styles);
rb_gc_mark_maybe(app->groups);
rb_gc_mark_maybe(app->owner);
rb_gc_mark_maybe(app->event_handler);
}

static void shoes_app_free(shoes_app *app) {
Expand Down Expand Up @@ -61,6 +62,7 @@ VALUE shoes_app_alloc(VALUE klass) {
app->decorated = TRUE;
app->opacity = 1.0;
app->cursor = s_arrow;
app->event_handler = Qnil;
app->scratch = cairo_create(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1));
app->self = Data_Wrap_Struct(klass, shoes_app_mark, shoes_app_free, app);
rb_extend_object(app->self, cTypes);
Expand Down Expand Up @@ -730,7 +732,7 @@ VALUE shoes_app_terminal(int argc, VALUE *argv, VALUE self) {
return shoes_global_terminal ? Qtrue : Qfalse;
}

VALUE shoes_app_set_event_handler(VALUE self,VALUE blk) {
VALUE shoes_app_set_event_handler(VALUE self, VALUE blk) {
shoes_app *app;
Data_Get_Struct(self, shoes_app, app);
if (rb_obj_is_kind_of(blk, rb_cProc)) {
Expand All @@ -742,3 +744,9 @@ VALUE shoes_app_set_event_handler(VALUE self,VALUE blk) {
}
return Qnil;
}
VALUE shoes_app_playback(VALUE self, VALUE evt) {
// much TODO:
shoes_app *app;
Data_Get_Struct(self, shoes_app, app);
return Qtrue;
}
1 change: 1 addition & 0 deletions shoes/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ VALUE shoes_app_set_cache(VALUE app, VALUE setting);
VALUE shoes_app_get_cache(VALUE app);
VALUE shoes_app_clear_cache(VALUE app, VALUE opts);
VALUE shoes_app_set_event_handler(VALUE app, VALUE blk);
VALUE shoes_app_playback(VALUE app, VALUE evt);
// global var for image cache - declared in types/image.c
extern int shoes_cache_setting;
// global var for console up and running
Expand Down
1 change: 1 addition & 0 deletions shoes/ruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ void shoes_ruby_init() {
rb_define_method(cApp, "cache=", CASTHOOK(shoes_app_set_cache), 1);
rb_define_method(cApp, "cache_clear", CASTHOOK(shoes_app_clear_cache), 1);
rb_define_method(cApp, "events=", CASTHOOK(shoes_app_set_event_handler), 1);
rb_define_method(cApp, "playback", CASTHOOK(shoes_app_playback), 1);

cDialog = rb_define_class_under(cTypes, "Dialog", cApp);

Expand Down

0 comments on commit e26774a

Please sign in to comment.