Kaydet (Commit) fbbcc07f authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

gbuildify apple_remote

üst e48d33bc
...@@ -1023,6 +1023,13 @@ $(call gb_LinkTarget_add_libs,$(1), \ ...@@ -1023,6 +1023,13 @@ $(call gb_LinkTarget_add_libs,$(1), \
endef endef
define gb_LinkTarget__use_iokit
$(call gb_LinkTarget_add_libs,$(1), \
-framework IOKit \
)
endef
define gb_LinkTarget__use_qtkit define gb_LinkTarget__use_qtkit
$(call gb_LinkTarget_add_libs,$(1), \ $(call gb_LinkTarget_add_libs,$(1), \
-framework QTKit \ -framework QTKit \
......
# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
#
# Version: MPL 1.1 / GPLv3+ / LGPLv3+
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License or as specified alternatively below. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Initial Developer of the Original Code is
# Norbert Thiebaud <nthiebaud@gmail.com>
# Portions created by the Initial Developer are Copyright (C) 2012 the
# Initial Developer. All Rights Reserved.
#
# For minor contributions see the git repository.
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
#
$(eval $(call gb_Library_Library,AppleRemote))
$(eval $(call gb_Library_set_include,AppleRemote,\
-I$(SRCDIR)/apple_remote/inc \
$$(INCLUDE) \
))
$(eval $(call gb_Library_use_externals,AppleRemote,\
cocoa \
carbon \
iokit \
))
$(eval $(call gb_Library_add_libs,AppleRemote,\
-framework Cocoa \
-framework Carbon \
-framework IOKit \
))
$(eval $(call gb_Library_add_objcobjects,AppleRemote,\
apple_remote/source/KeyspanFrontRowControl \
apple_remote/source/AppleRemote \
apple_remote/source/RemoteControl \
apple_remote/source/RemoteControlContainer \
apple_remote/source/GlobalKeyboardDevice \
apple_remote/source/HIDRemoteControlDevice \
apple_remote/source/MultiClickRemoteBehavior \
apple_remote/source/RemoteMainController \
))
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
include $(module_directory)/../solenv/gbuild/partial_build.mk
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
# Version: MPL 1.1 / GPLv3+ / LGPLv3+
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License or as specified alternatively below. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Initial Developer of the Original Code is
# Norbert Thiebaud <nthiebaud@gmail.com>
# Portions created by the Initial Developer are Copyright (C) 2012 the
# Initial Developer. All Rights Reserved.
#
# Major Contributor(s):
#
# For minor contributions see the git repository.
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
$(eval $(call gb_Module_Module,apple_remote))
ifeq ($(GUIBASE),aqua)
$(eval $(call gb_Module_add_targets,apple_remote,\
Library_AppleRemote \
Package_inc \
))
endif
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
# Version: MPL 1.1 / GPLv3+ / LGPLv3+
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License or as specified alternatively below. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Initial Developer of the Original Code is
# Norbert Thiebaud <nthiebaud@gmail.com>
# Portions created by the Initial Developer are Copyright (C) 2012 the
# Initial Developer. All Rights Reserved.
#
# Major Contributor(s):
#
# For minor contributions see the git repository.
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
$(eval $(call gb_Package_Package,apple_remote_inc,$(SRCDIR)/apple_remote/inc))
$(eval $(call gb_Package_add_file,apple_remote_inc,inc/apple_remote/RemoteControl.h,apple_remote/RemoteControl.h))
$(eval $(call gb_Package_add_file,apple_remote_inc,inc/apple_remote/RemoteMainController.h,apple_remote/RemoteMainController.h))
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
PRJ=.
PRJNAME=external
TARGET=AppleRemote
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
# --- Files --------------------------------------------------------
.IF "$(GUIBASE)"!="aqua"
dummy:
# nothing
.ELSE # "$(GUIBASE)"!="aqua"
SHL1STDLIBS+= \
-framework Cocoa -framework Carbon -framework IOKit
LIB1FILES+= \
$(SLB)$/AppleRemote.lib
SLOFILES= \
$(SLO)$/KeyspanFrontRowControl.obj \
$(SLO)$/AppleRemote.obj \
$(SLO)$/RemoteControl.obj \
$(SLO)$/RemoteControlContainer.obj \
$(SLO)$/GlobalKeyboardDevice.obj \
$(SLO)$/HIDRemoteControlDevice.obj \
$(SLO)$/MultiClickRemoteBehavior.obj \
$(SLO)$/RemoteMainController.obj
SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
SHL1OBJS= $(SLOFILES)
OUT2INC = \
$(BUILDDIR)$/KeyspaFrontRowControl.h \
$(BUILDDIR)$/AppleRemote.h \
$(BUILDDIR)$/RemoteControl.h \
$(BUILDDIR)$/RemoteControlContainer.h \
$(BUILDDIR)$/GlobalKeyboardDevice.h \
$(BUILDDIR)$/HIDRemoteControlDevice.h \
$(BUILDDIR)$/MultiClickRemoteBehavior.h \
$(BUILDDIR)$/RemoteMainController.h
.ENDIF # "$(GUIBASE)"!="aqua"
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
apr apple_remote : solenv soltools NULL apr apple_remote : solenv soltools NULL
apr apple_remote nmake - u apr_aprem NULL apr apple_remote\prj nmake - u apr_aprem NULL
mkdir: %_DEST%\inc\apple_remote
..\inc\*.h %_DEST%\inc\apple_remote\*
..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*****************************************************************************/ *****************************************************************************/
#import "RemoteControl.h" #import <apple_remote/RemoteControl.h>
#import <Carbon/Carbon.h> #import <Carbon/Carbon.h>
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* GlobalKeyboardDevice.m * GlobalKeyboardDevice.m
* RemoteControlWrapper * RemoteControlWrapper
* *
* Created by Martin Kahr on 11.03.06 under a MIT-style license. * Created by Martin Kahr on 11.03.06 under a MIT-style license.
* Copyright (c) 2006 martinkahr.com. All rights reserved. * Copyright (c) 2006 martinkahr.com. All rights reserved.
* *
* Code modified and adapted to OpenOffice.org * Code modified and adapted to OpenOffice.org
* by Eric Bachard on 11.08.2008 under the same license * by Eric Bachard on 11.08.2008 under the same license
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
/* /*
the following default keys are read and shall be used to change the keyboard mapping the following default keys are read and shall be used to change the keyboard mapping
mac.remotecontrols.GlobalKeyboardDevice.plus_modifiers mac.remotecontrols.GlobalKeyboardDevice.plus_modifiers
mac.remotecontrols.GlobalKeyboardDevice.plus_keycode mac.remotecontrols.GlobalKeyboardDevice.plus_keycode
mac.remotecontrols.GlobalKeyboardDevice.minus_modifiers mac.remotecontrols.GlobalKeyboardDevice.minus_modifiers
...@@ -62,19 +62,19 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*); ...@@ -62,19 +62,19 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*);
@implementation GlobalKeyboardDevice @implementation GlobalKeyboardDevice
- (id) initWithDelegate: (id) _remoteControlDelegate { - (id) initWithDelegate: (id) _remoteControlDelegate {
if ( (self = [super initWithDelegate: _remoteControlDelegate]) ) { if ( (self = [super initWithDelegate: _remoteControlDelegate]) ) {
hotKeyRemoteEventMapping = [[NSMutableDictionary alloc] init]; hotKeyRemoteEventMapping = [[NSMutableDictionary alloc] init];
unsigned int modifiers = cmdKey + shiftKey /*+ optionKey*/ + controlKey; unsigned int modifiers = cmdKey + shiftKey /*+ optionKey*/ + controlKey;
[self mapRemoteButton:kRemoteButtonPlus defaultKeycode:F1 defaultModifiers:modifiers]; [self mapRemoteButton:kRemoteButtonPlus defaultKeycode:F1 defaultModifiers:modifiers];
[self mapRemoteButton:kRemoteButtonMinus defaultKeycode:F2 defaultModifiers:modifiers]; [self mapRemoteButton:kRemoteButtonMinus defaultKeycode:F2 defaultModifiers:modifiers];
[self mapRemoteButton:kRemoteButtonPlay defaultKeycode:F3 defaultModifiers:modifiers]; [self mapRemoteButton:kRemoteButtonPlay defaultKeycode:F3 defaultModifiers:modifiers];
[self mapRemoteButton:kRemoteButtonLeft defaultKeycode:F4 defaultModifiers:modifiers]; [self mapRemoteButton:kRemoteButtonLeft defaultKeycode:F4 defaultModifiers:modifiers];
[self mapRemoteButton:kRemoteButtonRight defaultKeycode:F5 defaultModifiers:modifiers]; [self mapRemoteButton:kRemoteButtonRight defaultKeycode:F5 defaultModifiers:modifiers];
[self mapRemoteButton:kRemoteButtonMenu defaultKeycode:F6 defaultModifiers:modifiers]; [self mapRemoteButton:kRemoteButtonMenu defaultKeycode:F6 defaultModifiers:modifiers];
[self mapRemoteButton:kRemoteButtonPlay_Hold defaultKeycode:F7 defaultModifiers:modifiers]; [self mapRemoteButton:kRemoteButtonPlay_Hold defaultKeycode:F7 defaultModifiers:modifiers];
} }
return self; return self;
} }
...@@ -85,48 +85,48 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*); ...@@ -85,48 +85,48 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*);
} }
- (void) mapRemoteButton: (RemoteControlEventIdentifier) remoteButtonIdentifier defaultKeycode: (unsigned int) defaultKeycode defaultModifiers: (unsigned int) defaultModifiers { - (void) mapRemoteButton: (RemoteControlEventIdentifier) remoteButtonIdentifier defaultKeycode: (unsigned int) defaultKeycode defaultModifiers: (unsigned int) defaultModifiers {
NSString* defaultsKey = NULL; NSString* defaultsKey = NULL;
switch(remoteButtonIdentifier) { switch(remoteButtonIdentifier) {
case kRemoteButtonPlus: case kRemoteButtonPlus:
defaultsKey = @"plus"; defaultsKey = @"plus";
break; break;
case kRemoteButtonMinus: case kRemoteButtonMinus:
defaultsKey = @"minus"; defaultsKey = @"minus";
break; break;
case kRemoteButtonMenu: case kRemoteButtonMenu:
defaultsKey = @"menu"; defaultsKey = @"menu";
break; break;
case kRemoteButtonPlay: case kRemoteButtonPlay:
defaultsKey = @"play"; defaultsKey = @"play";
break; break;
case kRemoteButtonRight: case kRemoteButtonRight:
defaultsKey = @"right"; defaultsKey = @"right";
break; break;
case kRemoteButtonLeft: case kRemoteButtonLeft:
defaultsKey = @"left"; defaultsKey = @"left";
break; break;
case kRemoteButtonPlay_Hold: case kRemoteButtonPlay_Hold:
defaultsKey = @"playhold"; defaultsKey = @"playhold";
break; break;
default: default:
#ifdef DEBUG #ifdef DEBUG
NSLog(@"Unknown global keyboard defaults key for remote button identifier %d", remoteButtonIdentifier); NSLog(@"Unknown global keyboard defaults key for remote button identifier %d", remoteButtonIdentifier);
#endif #endif
break; break;
} }
NSNumber* modifiersCfg = [[NSUserDefaults standardUserDefaults] objectForKey: [NSString stringWithFormat: @"mac.remotecontrols.GlobalKeyboardDevice.%@_modifiers", defaultsKey]]; NSNumber* modifiersCfg = [[NSUserDefaults standardUserDefaults] objectForKey: [NSString stringWithFormat: @"mac.remotecontrols.GlobalKeyboardDevice.%@_modifiers", defaultsKey]];
NSNumber* keycodeCfg = [[NSUserDefaults standardUserDefaults] objectForKey: [NSString stringWithFormat: @"mac.remotecontrols.GlobalKeyboardDevice.%@_keycode", defaultsKey]]; NSNumber* keycodeCfg = [[NSUserDefaults standardUserDefaults] objectForKey: [NSString stringWithFormat: @"mac.remotecontrols.GlobalKeyboardDevice.%@_keycode", defaultsKey]];
unsigned int modifiers = defaultModifiers; unsigned int modifiers = defaultModifiers;
if (modifiersCfg) modifiers = [modifiersCfg unsignedIntValue]; if (modifiersCfg) modifiers = [modifiersCfg unsignedIntValue];
unsigned int keycode = defaultKeycode; unsigned int keycode = defaultKeycode;
if (keycodeCfg) keycode = [keycodeCfg unsignedIntValue]; if (keycodeCfg) keycode = [keycodeCfg unsignedIntValue];
[self registerHotKeyCode: keycode modifiers: modifiers remoteEventIdentifier: remoteButtonIdentifier]; [self registerHotKeyCode: keycode modifiers: modifiers remoteEventIdentifier: remoteButtonIdentifier];
} }
- (void) setListeningToRemote: (BOOL) value { - (void) setListeningToRemote: (BOOL) value {
if (value == [self isListeningToRemote]) return; if (value == [self isListeningToRemote]) return;
...@@ -136,26 +136,29 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*); ...@@ -136,26 +136,29 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*);
[self stopListening: self]; [self stopListening: self];
} }
} }
- (BOOL) isListeningToRemote { - (BOOL) isListeningToRemote {
return (eventHandlerRef!=NULL); return (eventHandlerRef!=NULL);
} }
- (void) startListening: (id) sender { - (void) startListening: (id) sender {
if (eventHandlerRef) return; if (eventHandlerRef) return;
EventTypeSpec eventSpec[2] = { EventTypeSpec eventSpec[2] = {
{ kEventClassKeyboard, kEventHotKeyPressed }, { kEventClassKeyboard, kEventHotKeyPressed },
{ kEventClassKeyboard, kEventHotKeyReleased } { kEventClassKeyboard, kEventHotKeyReleased }
}; };
InstallEventHandler( GetEventDispatcherTarget(), InstallEventHandler( GetEventDispatcherTarget(),
(EventHandlerProcPtr)hotKeyEventHandler, (EventHandlerProcPtr)hotKeyEventHandler,
2, eventSpec, self, &eventHandlerRef); 2, eventSpec, self, &eventHandlerRef);
(void)sender;
} }
- (void) stopListening: (id) sender { - (void) stopListening: (id) sender {
RemoveEventHandler(eventHandlerRef); RemoveEventHandler(eventHandlerRef);
eventHandlerRef = NULL; eventHandlerRef = NULL;
(void)sender;
} }
- (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier { - (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier {
...@@ -171,21 +174,21 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*); ...@@ -171,21 +174,21 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*);
return "Keyboard"; return "Keyboard";
} }
- (BOOL)registerHotKeyCode: (unsigned int) keycode modifiers: (unsigned int) modifiers remoteEventIdentifier: (RemoteControlEventIdentifier) identifier { - (BOOL)registerHotKeyCode: (unsigned int) keycode modifiers: (unsigned int) modifiers remoteEventIdentifier: (RemoteControlEventIdentifier) identifier {
OSStatus err; OSStatus err;
EventHotKeyID hotKeyID; EventHotKeyID hotKeyID;
EventHotKeyRef carbonHotKey; EventHotKeyRef carbonHotKey;
hotKeyID.signature = 'PTHk'; hotKeyID.signature = 'PTHk';
hotKeyID.id = (long)keycode; hotKeyID.id = (long)keycode;
err = RegisterEventHotKey(keycode, modifiers, hotKeyID, GetEventDispatcherTarget(), 0, &carbonHotKey ); err = RegisterEventHotKey(keycode, modifiers, hotKeyID, GetEventDispatcherTarget(), 0, &carbonHotKey );
if( err ) if( err )
return NO; return NO;
[hotKeyRemoteEventMapping setObject: [NSNumber numberWithInt:identifier] forKey: [NSNumber numberWithUnsignedInt: hotKeyID.id]]; [hotKeyRemoteEventMapping setObject: [NSNumber numberWithInt:identifier] forKey: [NSNumber numberWithUnsignedInt: hotKeyID.id]];
return YES; return YES;
} }
/* /*
...@@ -194,21 +197,21 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*); ...@@ -194,21 +197,21 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*);
OSStatus err; OSStatus err;
EventHotKeyRef carbonHotKey; EventHotKeyRef carbonHotKey;
NSValue* key; NSValue* key;
if( [[self allHotKeys] containsObject: hotKey] == NO ) if( [[self allHotKeys] containsObject: hotKey] == NO )
return; return;
carbonHotKey = [self _carbonHotKeyForHotKey: hotKey]; carbonHotKey = [self _carbonHotKeyForHotKey: hotKey];
NSAssert( carbonHotKey != nil, @"" ); NSAssert( carbonHotKey != nil, @"" );
err = UnregisterEventHotKey( carbonHotKey ); err = UnregisterEventHotKey( carbonHotKey );
//Watch as we ignore 'err': //Watch as we ignore 'err':
key = [NSValue valueWithPointer: carbonHotKey]; key = [NSValue valueWithPointer: carbonHotKey];
[mHotKeys removeObjectForKey: key]; [mHotKeys removeObjectForKey: key];
[self _updateEventHandler]; [self _updateEventHandler];
//See that? Completely ignored //See that? Completely ignored
} }
*/ */
...@@ -227,13 +230,14 @@ static RemoteControlEventIdentifier lastEvent; ...@@ -227,13 +230,14 @@ static RemoteControlEventIdentifier lastEvent;
static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void* userData ) static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void* userData )
{ {
(void)inHandlerRef;
GlobalKeyboardDevice* keyboardDevice = (GlobalKeyboardDevice*) userData; GlobalKeyboardDevice* keyboardDevice = (GlobalKeyboardDevice*) userData;
EventHotKeyID hkCom; EventHotKeyID hkCom;
GetEventParameter(inEvent,kEventParamDirectObject,typeEventHotKeyID,NULL,sizeof(hkCom),NULL,&hkCom); GetEventParameter(inEvent,kEventParamDirectObject,typeEventHotKeyID,NULL,sizeof(hkCom),NULL,&hkCom);
RemoteControlEventIdentifier identifier = [keyboardDevice remoteControlEventIdentifierForID:hkCom.id]; RemoteControlEventIdentifier identifier = [keyboardDevice remoteControlEventIdentifierForID:hkCom.id];
if (identifier == 0) return noErr; if (identifier == 0) return noErr;
BOOL pressedDown = YES; BOOL pressedDown = YES;
if (identifier != lastEvent) { if (identifier != lastEvent) {
lastEvent = identifier; lastEvent = identifier;
...@@ -242,7 +246,7 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef in ...@@ -242,7 +246,7 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef in
pressedDown = NO; pressedDown = NO;
} }
[keyboardDevice sendRemoteButtonEvent: identifier pressedDown: pressedDown]; [keyboardDevice sendRemoteButtonEvent: identifier pressedDown: pressedDown];
return noErr; return noErr;
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*****************************************************************************/ *****************************************************************************/
#import "RemoteControl.h" #import <apple_remote/RemoteControl.h>
#import <IOKit/hid/IOHIDLib.h> #import <IOKit/hid/IOHIDLib.h>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
*****************************************************************************/ *****************************************************************************/
#import "RemoteControl.h" #import <apple_remote/RemoteControl.h>
/** /**
A behavior that adds multiclick and hold events on top of a device. A behavior that adds multiclick and hold events on top of a device.
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* RemoteControl.m * RemoteControl.m
* RemoteControlWrapper * RemoteControlWrapper
* *
* Created by Martin Kahr on 11.03.06 under a MIT-style license. * Created by Martin Kahr on 11.03.06 under a MIT-style license.
* Copyright (c) 2006 martinkahr.com. All rights reserved. * Copyright (c) 2006 martinkahr.com. All rights reserved.
* *
* Code modified and adapted to OpenOffice.org * Code modified and adapted to OpenOffice.org
* by Eric Bachard on 11.08.2008 under the same License * by Eric Bachard on 11.08.2008 under the same License
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
...@@ -20,17 +20,17 @@ ...@@ -20,17 +20,17 @@
* *
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
* *
*****************************************************************************/ *****************************************************************************/
#import "RemoteControl.h"
// notifaction names that are being used to signal that an application wants to #import <apple_remote/RemoteControl.h>
// notifaction names that are being used to signal that an application wants to
// have access to the remote control device or if the application has finished // have access to the remote control device or if the application has finished
// using the remote control device // using the remote control device
NSString* REQUEST_FOR_REMOTE_CONTROL_NOTIFCATION = @"mac.remotecontrols.RequestForRemoteControl"; NSString* REQUEST_FOR_REMOTE_CONTROL_NOTIFCATION = @"mac.remotecontrols.RequestForRemoteControl";
...@@ -47,14 +47,14 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier"; ...@@ -47,14 +47,14 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
@implementation RemoteControl @implementation RemoteControl
// returns nil if the remote control device is not available // returns nil if the remote control device is not available
- (id) initWithDelegate: (id) _remoteControlDelegate { - (id) initWithDelegate: (id) _remoteControlDelegate {
if ( (self = [super init]) ) { if ( (self = [super init]) ) {
delegate = [_remoteControlDelegate retain]; delegate = [_remoteControlDelegate retain];
#ifdef DEBUG #ifdef DEBUG
NSLog(@"RemoteControl initWithDelegate ok"); NSLog(@"RemoteControl initWithDelegate ok");
#endif #endif
} }
return self; return self;
} }
- (void) dealloc { - (void) dealloc {
...@@ -66,33 +66,38 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier"; ...@@ -66,33 +66,38 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
#ifdef DEBUG #ifdef DEBUG
NSLog(@"setListeningToRemote ok"); NSLog(@"setListeningToRemote ok");
#endif #endif
(void)value;
} }
- (BOOL) isListeningToRemote { - (BOOL) isListeningToRemote {
return NO; return NO;
} }
- (void) startListening: (id) sender { - (void) startListening: (id) sender {
#ifdef DEBUG #ifdef DEBUG
NSLog(@"startListening ok"); NSLog(@"startListening ok");
#endif #endif
(void)sender;
} }
- (void) stopListening: (id) sender { - (void) stopListening: (id) sender {
#ifdef DEBUG #ifdef DEBUG
NSLog(@"stopListening ok"); NSLog(@"stopListening ok");
#endif #endif
(void)sender;
} }
- (BOOL) isOpenInExclusiveMode { - (BOOL) isOpenInExclusiveMode {
return YES; return YES;
} }
- (void) setOpenInExclusiveMode: (BOOL) value { - (void) setOpenInExclusiveMode: (BOOL) value {
(void)value;
} }
- (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier { - (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier {
#ifdef DEBUG #ifdef DEBUG
NSLog(@"sending event for button identifier \n"); NSLog(@"sending event for button identifier \n");
#endif #endif
return YES; (void)identifier;
return YES;
} }
+ (void) sendDistributedNotification: (NSString*) notificationName targetBundleIdentifier: (NSString*) targetIdentifier + (void) sendDistributedNotification: (NSString*) notificationName targetBundleIdentifier: (NSString*) targetIdentifier
...@@ -106,7 +111,7 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier"; ...@@ -106,7 +111,7 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
kTargetApplicationIdentifier /*targetBundleIdentifier -> does not appear, since the peer is nil*/, kTargetApplicationIdentifier /*targetBundleIdentifier -> does not appear, since the peer is nil*/,
nil]; nil];
#ifdef DEBUG #ifdef DEBUG
// Debug purpose: returns all the existing dictionary keys. // Debug purpose: returns all the existing dictionary keys.
NSString *s; NSString *s;
NSEnumerator *e = [userInfo keyEnumerator]; NSEnumerator *e = [userInfo keyEnumerator];
while ( (s = [e nextObject]) ) { while ( (s = [e nextObject]) ) {
...@@ -119,10 +124,10 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier"; ...@@ -119,10 +124,10 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
NSLog(@"sendDistributedNotification ..."); NSLog(@"sendDistributedNotification ...");
#endif #endif
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:notificationName [[NSDistributedNotificationCenter defaultCenter] postNotificationName:notificationName
object:nil object:nil
userInfo:userInfo userInfo:userInfo
deliverImmediately:YES]; deliverImmediately:YES];
} }
} }
...@@ -140,7 +145,7 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier"; ...@@ -140,7 +145,7 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
} }
+ (const char*) remoteControlDeviceName { + (const char*) remoteControlDeviceName {
return NULL; return NULL;
} }
@end @end
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
*****************************************************************************/ *****************************************************************************/
#import "RemoteControl.h" #import <apple_remote/RemoteControl.h>
@interface RemoteControlContainer : RemoteControl { @interface RemoteControlContainer : RemoteControl {
NSMutableArray* remoteControls; NSMutableArray* remoteControls;
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* RemoteControlContainer.m * RemoteControlContainer.m
* RemoteControlWrapper * RemoteControlWrapper
* *
* Created by Martin Kahr on 11.03.06 under a MIT-style license. * Created by Martin Kahr on 11.03.06 under a MIT-style license.
* Copyright (c) 2006 martinkahr.com. All rights reserved. * Copyright (c) 2006 martinkahr.com. All rights reserved.
* *
* Code modified and adapted to OpenOffice.org * Code modified and adapted to OpenOffice.org
* by Eric Bachard on 11.08.2008 under the same License * by Eric Bachard on 11.08.2008 under the same License
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
...@@ -33,23 +33,23 @@ ...@@ -33,23 +33,23 @@
@implementation RemoteControlContainer @implementation RemoteControlContainer
- (id) initWithDelegate: (id) _remoteControlDelegate { - (id) initWithDelegate: (id) _remoteControlDelegate {
if ( (self = [super initWithDelegate:_remoteControlDelegate]) ) { if ( (self = [super initWithDelegate:_remoteControlDelegate]) ) {
remoteControls = [[NSMutableArray alloc] init]; remoteControls = [[NSMutableArray alloc] init];
#ifdef DEBUG #ifdef DEBUG
NSLog(@"RemoteControlContainer initWithDelegate ok"); NSLog(@"RemoteControlContainer initWithDelegate ok");
} }
else { else {
NSLog(@"RemoteControlContainer initWithDelegate failed"); NSLog(@"RemoteControlContainer initWithDelegate failed");
#endif #endif
} }
return self; return self;
} }
- (void) dealloc { - (void) dealloc {
[self stopListening: self]; [self stopListening: self];
[remoteControls release]; [remoteControls release];
[super dealloc]; [super dealloc];
} }
- (BOOL) instantiateAndAddRemoteControlDeviceWithClass: (Class) clazz { - (BOOL) instantiateAndAddRemoteControlDeviceWithClass: (Class) clazz {
...@@ -58,83 +58,87 @@ ...@@ -58,83 +58,87 @@
if (remoteControl) { if (remoteControl) {
[remoteControls addObject: remoteControl]; [remoteControls addObject: remoteControl];
[remoteControl addObserver: self forKeyPath:@"listeningToRemote" options:NSKeyValueObservingOptionNew context:nil]; [remoteControl addObserver: self forKeyPath:@"listeningToRemote" options:NSKeyValueObservingOptionNew context:nil];
toReturn = YES; toReturn = YES;
} }
#ifdef DEBUG #ifdef DEBUG
else { else {
NSLog(@"RemoteControlContainer instantiateAndAddRemoteControlDeviceWithClass failed"); NSLog(@"RemoteControlContainer instantiateAndAddRemoteControlDeviceWithClass failed");
toReturn = NO; toReturn = NO;
} }
#endif #endif
return toReturn; return toReturn;
} }
- (unsigned int) count { - (unsigned int) count {
return [remoteControls count]; return [remoteControls count];
} }
- (void) reset { - (void) reset {
[self willChangeValueForKey:@"listeningToRemote"]; [self willChangeValueForKey:@"listeningToRemote"];
[self didChangeValueForKey:@"listeningToRemote"]; [self didChangeValueForKey:@"listeningToRemote"];
#ifdef DEBUG #ifdef DEBUG
// debug purpose // debug purpose
NSLog(@"reset... (after listening to remote)"); NSLog(@"reset... (after listening to remote)");
#endif #endif
} }
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
[self reset]; [self reset];
(void)keyPath;
(void)object;
(void)change;
(void)context;
} }
- (void) setListeningToRemote: (BOOL) value { - (void) setListeningToRemote: (BOOL) value {
int i; unsigned int i;
for(i=0; i < [remoteControls count]; i++) { for(i=0; i < [remoteControls count]; i++) {
[[remoteControls objectAtIndex: i] setListeningToRemote: value]; [[remoteControls objectAtIndex: i] setListeningToRemote: value];
} }
if (value && value != [self isListeningToRemote]) [self performSelector:@selector(reset) withObject:nil afterDelay:0.01]; if (value && value != [self isListeningToRemote]) [self performSelector:@selector(reset) withObject:nil afterDelay:0.01];
} }
- (BOOL) isListeningToRemote { - (BOOL) isListeningToRemote {
int i; unsigned int i;
for(i=0; i < [remoteControls count]; i++) { for(i=0; i < [remoteControls count]; i++) {
if ([[remoteControls objectAtIndex: i] isListeningToRemote]) { if ([[remoteControls objectAtIndex: i] isListeningToRemote]) {
return YES; return YES;
} }
} }
return NO; return NO;
} }
- (void) startListening: (id) sender { - (void) startListening: (id) sender {
#ifdef DEBUG #ifdef DEBUG
NSLog(@"startListening to events... "); NSLog(@"startListening to events... ");
#endif #endif
int i; unsigned int i;
for(i=0; i < [remoteControls count]; i++) { for(i=0; i < [remoteControls count]; i++) {
[[remoteControls objectAtIndex: i] startListening: sender]; [[remoteControls objectAtIndex: i] startListening: sender];
} }
} }
- (void) stopListening: (id) sender { - (void) stopListening: (id) sender {
#ifdef DEBUG #ifdef DEBUG
NSLog(@"stopListening to events... "); NSLog(@"stopListening to events... ");
#endif #endif
int i; unsigned int i;
for(i=0; i < [remoteControls count]; i++) { for(i=0; i < [remoteControls count]; i++) {
[[remoteControls objectAtIndex: i] stopListening: sender]; [[remoteControls objectAtIndex: i] stopListening: sender];
} }
} }
- (BOOL) isOpenInExclusiveMode { - (BOOL) isOpenInExclusiveMode {
BOOL mode = YES; BOOL mode = YES;
int i; unsigned int i;
for(i=0; i < [remoteControls count]; i++) { for(i=0; i < [remoteControls count]; i++) {
mode = mode && ([[remoteControls objectAtIndex: i] isOpenInExclusiveMode]); mode = mode && ([[remoteControls objectAtIndex: i] isOpenInExclusiveMode]);
} }
return mode; return mode;
} }
- (void) setOpenInExclusiveMode: (BOOL) value { - (void) setOpenInExclusiveMode: (BOOL) value {
int i; unsigned int i;
for(i=0; i < [remoteControls count]; i++) { for(i=0; i < [remoteControls count]; i++) {
[[remoteControls objectAtIndex: i] setOpenInExclusiveMode:value]; [[remoteControls objectAtIndex: i] setOpenInExclusiveMode:value];
} }
} }
@end @end
/***************************************************************************** /*****************************************************************************
* RemoteMainController.m * RemoteMainController.m
* *
* Created by Martin Kahr on 11.03.06 under a MIT-style license. * Created by Martin Kahr on 11.03.06 under a MIT-style license.
* Copyright (c) 2006 martinkahr.com. All rights reserved. * Copyright (c) 2006 martinkahr.com. All rights reserved.
* *
* Code modified and adapted to OpenOffice.org * Code modified and adapted to OpenOffice.org
* by Eric Bachard on 11.08.2008 under the same License * by Eric Bachard on 11.08.2008 under the same License
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* *
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* *
*****************************************************************************/ *****************************************************************************/
#import "RemoteMainController.h" #import <apple_remote/RemoteMainController.h>
#import "AppleRemote.h" #import "AppleRemote.h"
#import "KeyspanFrontRowControl.h" #import "KeyspanFrontRowControl.h"
#import "GlobalKeyboardDevice.h" #import "GlobalKeyboardDevice.h"
...@@ -41,15 +41,15 @@ ...@@ -41,15 +41,15 @@
@implementation MainController @implementation MainController
- (id) init { - (id) init {
self = [super init]; // because we redefined our own init instead of use the fu..nny awakeFromNib self = [super init]; // because we redefined our own init instead of use the fu..nny awakeFromNib
if (self != nil) { if (self != nil) {
// 1. instantiate the desired behavior for the remote control device // 1. instantiate the desired behavior for the remote control device
remoteControlBehavior = [[MultiClickRemoteBehavior alloc] init]; remoteControlBehavior = [[MultiClickRemoteBehavior alloc] init];
// 2. configure the behavior // 2. configure the behavior
[remoteControlBehavior setDelegate: self]; [remoteControlBehavior setDelegate: self];
// 3. a Remote Control Container manages a number of devices and conforms to the RemoteControl interface // 3. a Remote Control Container manages a number of devices and conforms to the RemoteControl interface
// Therefore you can enable or disable all the devices of the container with a single "startListening:" call. // Therefore you can enable or disable all the devices of the container with a single "startListening:" call.
RemoteControlContainer* container = [[RemoteControlContainer alloc] initWithDelegate: remoteControlBehavior]; RemoteControlContainer* container = [[RemoteControlContainer alloc] initWithDelegate: remoteControlBehavior];
...@@ -70,21 +70,21 @@ ...@@ -70,21 +70,21 @@
else { else {
NSLog(@"[container instantiateAndAddRemoteControlDeviceWithClass: [GlobalKeyboardDevice class]] failed"); NSLog(@"[container instantiateAndAddRemoteControlDeviceWithClass: [GlobalKeyboardDevice class]] failed");
#endif #endif
} }
// to give the binding mechanism a chance to see the change of the attribute // to give the binding mechanism a chance to see the change of the attribute
[self setValue: container forKey: @"remoteControl"]; [self setValue: container forKey: @"remoteControl"];
#ifdef DEBUG #ifdef DEBUG
NSLog(@"MainController init done"); NSLog(@"MainController init done");
#endif #endif
} }
else else
NSLog(@"MainController init failed"); NSLog(@"MainController init failed");
return self; return self;
} }
- (void) postTheEvent: (short int)buttonIdentifier modifierFlags:(int)modifierFlags - (void) postTheEvent: (short int)buttonIdentifier modifierFlags:(int)modifierFlags
{ {
[NSApp postEvent: [NSApp postEvent:
[NSEvent otherEventWithType:NSApplicationDefined [NSEvent otherEventWithType:NSApplicationDefined
location:NSZeroPoint location:NSZeroPoint
modifierFlags:modifierFlags modifierFlags:modifierFlags
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
windowNumber:[[NSApp keyWindow] windowNumber] windowNumber:[[NSApp keyWindow] windowNumber]
context:nil context:nil
subtype:AppleRemoteControlEvent subtype:AppleRemoteControlEvent
data1: buttonIdentifier data1: buttonIdentifier
data2: 0] data2: 0]
atStart: NO]; atStart: NO];
} }
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
- (void) remoteButton: (RemoteControlEventIdentifier)buttonIdentifier pressedDown: (BOOL) pressedDown clickCount: (unsigned int)clickCount - (void) remoteButton: (RemoteControlEventIdentifier)buttonIdentifier pressedDown: (BOOL) pressedDown clickCount: (unsigned int)clickCount
{ {
(void)clickCount;
NSString* pressed = @""; NSString* pressed = @"";
#ifdef DEBUG #ifdef DEBUG
NSString* buttonName = nil; NSString* buttonName = nil;
...@@ -109,7 +110,7 @@ ...@@ -109,7 +110,7 @@
pressed = @"(pressed)"; pressed = @"(pressed)";
#ifdef DEBUG #ifdef DEBUG
switch(buttonIdentifier) switch(buttonIdentifier)
{ {
case kRemoteButtonPlus: buttonName = @"Volume up"; break; // MEDIA_COMMAND_VOLUME_UP ( see vcl/inc/vcl/cmdevt.hxx ) case kRemoteButtonPlus: buttonName = @"Volume up"; break; // MEDIA_COMMAND_VOLUME_UP ( see vcl/inc/vcl/cmdevt.hxx )
case kRemoteButtonMinus: buttonName = @"Volume down"; break; // MEDIA_COMMAND_VOLUME_DOWN case kRemoteButtonMinus: buttonName = @"Volume down"; break; // MEDIA_COMMAND_VOLUME_DOWN
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment