diff -u -p -x configure -x autom4te.cache -x .DS_Store -x .cvsignore -r -N -x Makefile.in -x lib-src orig/ffidl/configure.in ffidl/configure.in --- orig/ffidl/configure.in Fri Apr 29 15:01:51 2005 +++ ffidl/configure.in Thu May 5 09:17:37 2005 @@ -181,7 +181,7 @@ AC_MSG_CHECKING([whether to build ffidl AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test], [build ffidl test functions [--disable-test]]), - [tcl_ok=$enableval], [tcl_ok=yes]) + [tcl_ok=$enableval], [tcl_ok=no]) AC_MSG_RESULT([$tcl_ok]) if test "$tcl_ok" = "yes"; then TEA_ADD_SOURCES([ffidl_test.c]) diff -u -p -x configure -x autom4te.cache -x .DS_Store -x .cvsignore -r -N -x Makefile.in -x lib-src orig/ffidl/demos/carbonFfidlDemo.tcl ffidl/demos/carbonFfidlDemo.tcl --- orig/ffidl/demos/carbonFfidlDemo.tcl Thu Jan 1 10:00:00 1970 +++ ffidl/demos/carbonFfidlDemo.tcl Thu May 5 01:38:02 2005 @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Let's ffidl with Carbon HotKeys! +# +# Copyright (c) 2005, Daniel A. Steffen +# BSD License: c.f. +# +#\ +exec wish $0 "$@" + +package require Tk +package require Ffidl + +namespace eval carbon { + + ::ffidl::typedef EventHotKeyID {unsigned long} uint32 + ::ffidl::typedef EventTypeSpec uint32 uint32 + ::ffidl::typedef EventTargetRef pointer + ::ffidl::typedef OSStatus sint32 + + ::ffidl::callout RegisterEventHotKey {uint32 uint32 EventHotKeyID EventTargetRef \ + uint32 pointer-var} OSStatus \ + [::ffidl::symbol Carbon.framework/Carbon RegisterEventHotKey] + + ::ffidl::callout GetApplicationEventTarget {} EventTargetRef \ + [::ffidl::symbol Carbon.framework/Carbon GetApplicationEventTarget] + + ::ffidl::callout InstallEventHandler {EventTargetRef pointer-proc uint32 pointer-byte \ + pointer pointer-var} OSStatus \ + [::ffidl::symbol Carbon.framework/Carbon InstallEventHandler] + + ::ffidl::callout XKeysymToKeycode {pointer {unsigned long}} {unsigned long} \ + [::ffidl::stubsymbol tk intXLibStubs 35]; #XKeysymToKeycode + + ::ffidl::callout TkStringToKeysym {pointer-utf8} {unsigned long} \ + [::ffidl::stubsymbol tk intStubs 86]; #TkStringToKeysym +} + +proc hotkeyHandler {handlerCallRef event userData} { + .l configure -bg red + after 200 .l configure -bg blue + return 0 +} + +proc installHotKey {key} { + labelframe .l -width 100 -height 100 -bg blue + pack .l + + ::ffidl::callback hotkeyHandler {pointer pointer pointer} OSStatus + + set EventHandlerRef [binary format I 0] + set res [carbon::InstallEventHandler [carbon::GetApplicationEventTarget] hotkeyHandler 1 \ + [binary format a4I keyb 5] 0 EventHandlerRef] + if {$res} {puts stderr "InstallEventHandler failed: $res"; exit -1} + + set keycode [expr {[carbon::XKeysymToKeycode 0 [carbon::TkStringToKeysym $key]]>>16}] + set modifiers [expr {1 << 8 | 1 << 9}]; #Cmd-Shift + #set modifiers [expr {1 << 8}]; #Cmd + + set EventHotKeyRef [binary format I 0] + set res [carbon::RegisterEventHotKey $keycode $modifiers [binary format a4I wish 1] \ + [carbon::GetApplicationEventTarget] 0 EventHotKeyRef] + if {$res} {puts stderr "RegisterEventHotKey failed: $res"; exit -1} +} + +installHotKey A