[MacRuby-devel] [MacRuby] #648: (TypeError) "unrecognized runtime type" when receiving a CGEventTapProxy

MacRuby ruby-noreply at macosforge.org
Tue Apr 6 00:59:45 PDT 2010


#648: (TypeError) "unrecognized runtime type" when receiving a CGEventTapProxy
--------------------------------+-------------------------------------------
 Reporter:  kingding@…          |       Owner:  lsansonetti@…        
     Type:  defect              |      Status:  new                  
 Priority:  blocker             |   Milestone:  MacRuby 0.6          
Component:  MacRuby             |    Keywords:                       
--------------------------------+-------------------------------------------
 I'm trying to set up an Event Tap that watches KeyDown events:
 {{{
 #!ruby
 framework "ApplicationServices"
 framework "CoreFoundation"

 callback = lambda { |failing_tap_proxy, type, event, refcon| puts "Never
 get here." }

 mask = 1 << KCGEventKeyDown
 event_tap = CGEventTapCreate(KCGSessionEventTap, KCGHeadInsertEventTap,
                              KCGEventTapOptionDefault, mask, callback,
 nil)
 raise unless event_tap

 run_loop_source = CFMachPortCreateRunLoopSource(KCFAllocatorDefault,
 event_tap, 0)
 CFRunLoopAddSource(CFRunLoopGetCurrent(), run_loop_source,
 KCFRunLoopCommonModes)
 CGEventTapEnable(event_tap, true)
 CFRunLoopRun()

 }}}

 As soon as a key is pressed and the callback receives a CGEventTapProxy as
 its first argument, the following error is raised:
 {{{
 tap_demo.rb:1:in `<main>': unrecognized runtime type
 `{__CGEventTapProxy=}' (TypeError)
 }}}

 Thanks for MacRuby!

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/648>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list