Skip to content

Instantly share code, notes, and snippets.

@phurley
Created July 23, 2008 20:26
Show Gist options
  • Save phurley/1892 to your computer and use it in GitHub Desktop.
Save phurley/1892 to your computer and use it in GitHub Desktop.
require 'dl/import'
require "dl/struct"
module Hotkey
extend DL::Importable
# dlload "Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox"
dlload "Carbon.framework/Carbon"
# OSStatus RegisterEventHotKey (
# UInt32 inHotKeyCode,
# UInt32 inHotKeyModifiers,
# EventHotKeyID inHotKeyID,
# EventTargetRef inTarget,
# OptionBits inOptions,
# EventHotKeyRef *outRef
# );
typealias("OSStatus", "unsigned long")
OSType = struct [
"char a",
"char b",
"char c",
"char d",
]
typealias("UInt32", "unsigned long")
EventHotKeyID = struct [
"UInt32 signature",
"UInt32 id"
]
typealias("EventHotKeyID", "void *")
typealias("EventTargetRef", "void *")
typealias("OptionBits", "UInt32")
typealias("EventHotKeyRef", "void **")
extern "OSStatus RegisterEventHotKey (
UInt32 inHotKeyCode,
UInt32 inHotKeyModifiers,
EventHotKeyID inHotKeyID,
EventTargetRef inTarget,
OptionBits inOptions,
EventHotKeyRef outRef
)"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment