Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
vlc-fork
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vibhoothi
vlc-fork
Commits
7d109ecf
Commit
7d109ecf
authored
5 years ago
by
Felix Paul Kühne
Browse files
Options
Downloads
Patches
Plain Diff
macosx: fix legacy media key support activation
This also fixes
#21358
.
parent
d6f65fd0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/gui/macosx/os-integration/VLCClickerManager.m
+46
-11
46 additions, 11 deletions
modules/gui/macosx/os-integration/VLCClickerManager.m
with
46 additions
and
11 deletions
modules/gui/macosx/os-integration/VLCClickerManager.m
+
46
−
11
View file @
7d109ecf
...
...
@@ -65,6 +65,14 @@
selector:
@selector
(
coreChangedMediaKeySupportSetting
:)
name:
VLCMediaKeySupportSettingChangedNotification
object:
nil
];
[
notificationCenter
addObserver
:
self
selector:
@selector
(
playlistUpdated
:)
name:
VLCPlaylistItemsAdded
object:
nil
];
[
notificationCenter
addObserver
:
self
selector:
@selector
(
playlistUpdated
:)
name:
VLCPlaylistItemsRemoved
object:
nil
];
[
notificationCenter
addObserver
:
self
selector:
@selector
(
coreChangedAppleRemoteSetting
:)
name:
VLCAppleRemoteSettingChangedNotification
...
...
@@ -115,24 +123,51 @@
VLCMain
*
main
=
[
VLCMain
sharedInstance
];
if
(
b_mediaKeySupport
&&
([[[
main
playlistController
]
playlistModel
]
numberOfPlaylistItems
]
>
0
))
{
if
(
!
b_mediaKeyTrapEnabled
)
{
msg_Dbg
(
p_intf
,
"Enabling media key support"
);
if
([
_mediaKeyController
startWatchingMediaKeys
])
{
b_mediaKeyTrapEnabled
=
YES
;
}
else
{
msg_Warn
(
p_intf
,
"Failed to enable media key support, likely "
"app needs to be whitelisted in Security Settings."
);
}
[
self
enableMediaKeySupport
];
}
}
else
{
if
(
b_mediaKeyTrapEnabled
)
{
b_mediaKeyTrapEnabled
=
NO
;
msg_Dbg
(
p_intf
,
"Disabling media key support"
);
[
_mediaKeyController
stopWatchingMediaKeys
];
[
self
disableMediaKeySupport
];
}
_mediaKeyController
=
nil
;
}
}
-
(
void
)
enableMediaKeySupport
{
intf_thread_t
*
p_intf
=
getIntf
();
msg_Dbg
(
p_intf
,
"Enabling media key support"
);
if
([
_mediaKeyController
startWatchingMediaKeys
])
{
b_mediaKeyTrapEnabled
=
YES
;
}
else
{
msg_Warn
(
p_intf
,
"Failed to enable media key support, likely "
"app needs to be whitelisted in Security Settings."
);
}
}
-
(
void
)
disableMediaKeySupport
{
b_mediaKeyTrapEnabled
=
NO
;
msg_Dbg
(
getIntf
(),
"Disabling media key support"
);
[
_mediaKeyController
stopWatchingMediaKeys
];
}
-
(
void
)
playlistUpdated
:(
NSNotification
*
)
aNotification
{
if
(
!
_mediaKeyController
)
{
return
;
}
BOOL
numberOfMediaLargerThanZero
=
[[[[
VLCMain
sharedInstance
]
playlistController
]
playlistModel
]
numberOfPlaylistItems
]
>
0
;
if
(
b_mediaKeyTrapEnabled
&&
!
numberOfMediaLargerThanZero
)
{
[
self
disableMediaKeySupport
];
}
else
if
(
!
b_mediaKeyTrapEnabled
&&
numberOfMediaLargerThanZero
)
{
[
self
enableMediaKeySupport
];
}
}
-
(
void
)
mediaKeyTap
:(
SPMediaKeyTap
*
)
keyTap
receivedMediaKeyEvent
:(
NSEvent
*
)
event
-
(
void
)
mediaKeyTap
:(
SPMediaKeyTap
*
)
keyTap
receivedMediaKeyEvent
:(
NSEvent
*
)
event
{
if
(
b_mediaKeySupport
)
{
assert
([
event
type
]
==
NSSystemDefined
&&
[
event
subtype
]
==
SPSystemDefinedEventMediaKeys
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment