-/* Called for clicks on the dock icon. Can be used to unminimize or
- * create a new window for example.
- */
-
-static OSErr
-handle_reopen_application (const AppleEvent *inAppleEvent,
- AppleEvent *outAppleEvent,
- long inHandlerRefcon)
-{
- return noErr;
-}
-
-
-static OSErr
-handle_print_documents (const AppleEvent *inAppleEvent,
- AppleEvent *outAppleEvent,
- long inHandlerRefcon)
-{
- return noErr;
-}
-
-
-static OSErr
-handle_open_documents (const AppleEvent *inAppleEvent,
- AppleEvent *outAppleEvent,
- long inHandlerRefcon)
-{
- AEDescList docs;
-
- if (AEGetParamDesc(inAppleEvent, keyDirectObject, typeAEList, &docs) == noErr) {
- long n = 0;
- AECountItems(&docs, &n);
- UInt8 strBuffer[PATH_MAX+1];
-
- /* ardour only opens 1 session at a time */
-
- FSRef ref;
-
- if (AEGetNthPtr(&docs, 1, typeFSRef, 0, 0, &ref, sizeof(ref), 0) == noErr) {
- if (FSRefMakePath(&ref, strBuffer, sizeof(strBuffer)) == noErr) {
- Glib::ustring utf8_path ((const char*) strBuffer);
- ARDOUR_UI::instance()->idle_load (utf8_path);
- }
- }
- }
-
- return noErr;
-}
-
-static OSErr
-handle_open_application (const AppleEvent *inAppleEvent,
- AppleEvent *outAppleEvent,
- long inHandlerRefcon)
-{
- return noErr;
-}
-
-static OSStatus
-application_event_handler (EventHandlerCallRef nextHandlerRef, EventRef event, void *userData)
-{
- UInt32 eventKind = GetEventKind (event);
-
- switch (eventKind) {
- case kEventAppActivated:
- ApplicationActivationChanged (true); // EMIT SIGNAL
- return eventNotHandledErr;
-
- case kEventAppDeactivated:
- ApplicationActivationChanged (false); // EMIT SIGNAL
- return eventNotHandledErr;
-
- default:
- // pass-thru all kEventClassApplication events we're not interested in.
- break;
- }
- return eventNotHandledErr;
-}