Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
0d24c85c
Commit
0d24c85c
authored
Oct 10, 2009
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: merge AppleRemote fixes from the Lunettes project
parent
9fa00260
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
50 deletions
+48
-50
modules/gui/macosx/AppleRemote.m
modules/gui/macosx/AppleRemote.m
+48
-50
No files found.
modules/gui/macosx/AppleRemote.m
View file @
0d24c85c
...
@@ -66,50 +66,49 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
...
@@ -66,50 +66,49 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
#pragma public interface
#pragma public interface
-
(
id
)
init
{
-
(
id
)
init
{
if
(
self
=
[
super
init
]
)
{
self
=
[
super
init
];
openInExclusiveMode
=
YES
;
openInExclusiveMode
=
YES
;
queue
=
NULL
;
queue
=
NULL
;
hidDeviceInterface
=
NULL
;
hidDeviceInterface
=
NULL
;
cookieToButtonMapping
=
[[
NSMutableDictionary
alloc
]
init
];
cookieToButtonMapping
=
[[
NSMutableDictionary
alloc
]
init
];
if
(
NSAppKitVersionNumber
<
1038
.
13
)
{
/* Leopard and early Snow Leopard Cookies */
msg_Dbg
(
VLCIntf
,
"using Leopard AR cookies"
);
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonVolume_Plus
]
forKey
:
@"31_29_28_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonVolume_Minus
]
forKey
:
@"31_30_28_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonMenu
]
forKey
:
@"31_20_18_31_20_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonPlay
]
forKey
:
@"31_21_18_31_21_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonRight
]
forKey
:
@"31_22_18_31_22_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonLeft
]
forKey
:
@"31_23_18_31_23_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonRight_Hold
]
forKey
:
@"31_18_4_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonLeft_Hold
]
forKey
:
@"31_18_3_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonMenu_Hold
]
forKey
:
@"31_18_31_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonPlay_Sleep
]
forKey
:
@"35_31_18_35_31_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteControl_Switched
]
forKey
:
@"19_"
];
}
else
{
/* current Snow Leopard cookies */
msg_Dbg
(
VLCIntf
,
"using Snow Leopard AR cookies"
);
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonVolume_Plus
]
forKey
:
@"33_31_30_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonVolume_Minus
]
forKey
:
@"33_32_30_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonMenu
]
forKey
:
@"33_22_21_20_2_33_22_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonPlay
]
forKey
:
@"33_23_21_20_2_33_23_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonRight
]
forKey
:
@"33_24_21_20_2_33_24_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonLeft
]
forKey
:
@"33_25_21_20_2_33_25_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonRight_Hold
]
forKey
:
@"33_21_20_14_12_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonLeft_Hold
]
forKey
:
@"33_21_20_13_12_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonMenu_Hold
]
forKey
:
@"33_21_20_2_33_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonPlay_Sleep
]
forKey
:
@"37_33_21_20_2_37_33_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteControl_Switched
]
forKey
:
@"19_"
];
}
/* defaults */
if
(
NSAppKitVersionNumber
<
1038
.
13
)
[
self
setSimulatesPlusMinusHold
:
YES
];
{
maxClickTimeDifference
=
DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE
;
/* Leopard and early Snow Leopard Cookies */
}
msg_Dbg
(
VLCIntf
,
"using Leopard AR cookies"
);
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonVolume_Plus
]
forKey
:
@"31_29_28_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonVolume_Minus
]
forKey
:
@"31_30_28_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonMenu
]
forKey
:
@"31_20_18_31_20_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonPlay
]
forKey
:
@"31_21_18_31_21_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonRight
]
forKey
:
@"31_22_18_31_22_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonLeft
]
forKey
:
@"31_23_18_31_23_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonRight_Hold
]
forKey
:
@"31_18_4_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonLeft_Hold
]
forKey
:
@"31_18_3_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonMenu_Hold
]
forKey
:
@"31_18_31_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonPlay_Sleep
]
forKey
:
@"35_31_18_35_31_18_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteControl_Switched
]
forKey
:
@"19_"
];
}
else
{
/* current Snow Leopard cookies */
msg_Dbg
(
VLCIntf
,
"using Snow Leopard AR cookies"
);
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonVolume_Plus
]
forKey
:
@"33_31_30_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonVolume_Minus
]
forKey
:
@"33_32_30_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonMenu
]
forKey
:
@"33_22_21_20_2_33_22_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonPlay
]
forKey
:
@"33_23_21_20_2_33_23_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonRight
]
forKey
:
@"33_24_21_20_2_33_24_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonLeft
]
forKey
:
@"33_25_21_20_2_33_25_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonRight_Hold
]
forKey
:
@"33_21_20_14_12_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonLeft_Hold
]
forKey
:
@"33_21_20_13_12_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonMenu_Hold
]
forKey
:
@"33_21_20_2_33_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteButtonPlay_Sleep
]
forKey
:
@"37_33_21_20_2_37_33_21_20_2_"
];
[
cookieToButtonMapping
setObject
:[
NSNumber
numberWithInt
:
kRemoteControl_Switched
]
forKey
:
@"42_33_21_20_14_12_2_"
];
}
/* defaults */
[
self
setSimulatesPlusMinusHold
:
YES
];
maxClickTimeDifference
=
DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE
;
return
self
;
return
self
;
}
}
...
@@ -348,7 +347,7 @@ static AppleRemote* sharedInstance=nil;
...
@@ -348,7 +347,7 @@ static AppleRemote* sharedInstance=nil;
if
(
cookieString
==
nil
||
[
cookieString
length
]
==
0
)
return
nil
;
if
(
cookieString
==
nil
||
[
cookieString
length
]
==
0
)
return
nil
;
NSEnumerator
*
keyEnum
=
[[
self
cookieToButtonMapping
]
keyEnumerator
];
NSEnumerator
*
keyEnum
=
[[
self
cookieToButtonMapping
]
keyEnumerator
];
NSString
*
key
;
NSString
*
key
;
while
(
key
=
[
keyEnum
nextObject
])
{
while
(
key
=
=
[
keyEnum
nextObject
])
{
NSRange
range
=
[
cookieString
rangeOfString
:
key
];
NSRange
range
=
[
cookieString
rangeOfString
:
key
];
if
(
range
.
location
==
0
)
return
key
;
if
(
range
.
location
==
0
)
return
key
;
}
}
...
@@ -459,7 +458,7 @@ static AppleRemote* sharedInstance=nil;
...
@@ -459,7 +458,7 @@ static AppleRemote* sharedInstance=nil;
// happen when the main thread is too busy to handle all incoming events in time.
// happen when the main thread is too busy to handle all incoming events in time.
NSString
*
subCookieString
;
NSString
*
subCookieString
;
NSString
*
lastSubCookieString
=
nil
;
NSString
*
lastSubCookieString
=
nil
;
while
(
subCookieString
=
[
self
validCookieSubstring
:
cookieString
])
{
while
(
subCookieString
=
=
[
self
validCookieSubstring
:
cookieString
])
{
cookieString
=
[
cookieString
substringFromIndex
:
[
subCookieString
length
]];
cookieString
=
[
cookieString
substringFromIndex
:
[
subCookieString
length
]];
lastSubCookieString
=
subCookieString
;
lastSubCookieString
=
subCookieString
;
if
(
processesBacklog
)
[
self
handleEventWithCookieString
:
subCookieString
sumOfValues
:
sumOfValues
];
if
(
processesBacklog
)
[
self
handleEventWithCookieString
:
subCookieString
sumOfValues
:
sumOfValues
];
...
@@ -597,7 +596,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
...
@@ -597,7 +596,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
memset(cookies, 0, sizeof(IOHIDElementCookie) * NUMBER_OF_APPLE_REMOTE_ACTIONS);
memset(cookies, 0, sizeof(IOHIDElementCookie) * NUMBER_OF_APPLE_REMOTE_ACTIONS);
*/
*/
allCookies
=
[[
NSMutableArray
alloc
]
init
];
allCookies
=
[[
NSMutableArray
alloc
]
init
];
int
i
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
[
elements
count
];
i
++
)
{
for
(
i
=
0
;
i
<
[
elements
count
];
i
++
)
{
element
=
[
elements
objectAtIndex
:
i
];
element
=
[
elements
objectAtIndex
:
i
];
...
@@ -638,7 +637,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
...
@@ -638,7 +637,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
if
(
queue
)
{
if
(
queue
)
{
result
=
(
*
queue
)
->
create
(
queue
,
0
,
12
);
//depth: maximum number of elements in queue before oldest elements in queue begin to be lost.
result
=
(
*
queue
)
->
create
(
queue
,
0
,
12
);
//depth: maximum number of elements in queue before oldest elements in queue begin to be lost.
int
i
=
0
;
unsigned
int
i
=
0
;
for
(
i
=
0
;
i
<
[
allCookies
count
];
i
++
)
{
for
(
i
=
0
;
i
<
[
allCookies
count
];
i
++
)
{
IOHIDElementCookie
cookie
=
(
IOHIDElementCookie
)[[
allCookies
objectAtIndex
:
i
]
intValue
];
IOHIDElementCookie
cookie
=
(
IOHIDElementCookie
)[[
allCookies
objectAtIndex
:
i
]
intValue
];
(
*
queue
)
->
addElement
(
queue
,
cookie
,
0
);
(
*
queue
)
->
addElement
(
queue
,
cookie
,
0
);
...
@@ -671,9 +670,8 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
...
@@ -671,9 +670,8 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
@implementation
AppleRemoteApplicationDelegate
@implementation
AppleRemoteApplicationDelegate
-
(
id
)
initWithApplicationDelegate
:
(
id
)
delegate
{
-
(
id
)
initWithApplicationDelegate
:
(
id
)
delegate
{
if
(
self
=
[
super
init
])
{
self
=
[
super
init
];
applicationDelegate
=
[
delegate
retain
];
applicationDelegate
=
[
delegate
retain
];
}
return
self
;
return
self
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment