From 846ea53d8844b42ac85bcf3a4c8307212c2c5075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 11 Apr 2011 23:07:16 +0200 Subject: add main_loop function to ecore --- lib/efl/ecore.rb | 8 ++++++++ spec/ecore_spec.rb | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/lib/efl/ecore.rb b/lib/efl/ecore.rb index 209d7a5..5583a5a 100644 --- a/lib/efl/ecore.rb +++ b/lib/efl/ecore.rb @@ -8,12 +8,17 @@ module EFL # extend FFI::Library # + callback:ecore_select_function, [ :int, :pointer, :pointer, :pointer, :pointer], :int + # ffi_lib 'ecore' functions = [ [ :ecore_init, [ ], :int ], [ :ecore_shutdown, [], :int ], + [ :ecore_main_loop_iterate, [], :void], [ :ecore_main_loop_begin, [], :void], [ :ecore_main_loop_quit, [], :void], + [ :ecore_main_loop_select_func_set, [], :void], # TODO spec + [ :ecore_main_loop_select_func_get, [], :void], # TODO spec ].each do |func| begin attach_function *func @@ -25,8 +30,11 @@ module EFL class << self alias init ecore_init alias shutdown ecore_shutdown + alias main_loop_iterate ecore_main_loop_iterate alias main_loop_begin ecore_main_loop_begin alias main_loop_quit ecore_main_loop_quit + alias main_loop_select_func_set ecore_main_loop_select_func_set + alias main_loop_select_func_get ecore_main_loop_select_func_get end # end diff --git a/spec/ecore_spec.rb b/spec/ecore_spec.rb index a2ae2fd..e1260fc 100644 --- a/spec/ecore_spec.rb +++ b/spec/ecore_spec.rb @@ -19,4 +19,9 @@ describe EFL::ECORE do ECORE.shutdown.should eql 0 end # + it "should run a single iteration of the mainloop" do + ECORE.init.should eql 1 + ECORE.main_loop_iterate + ECORE.shutdown.should eql 0 + end end -- cgit v1.1-2-g2b99