Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
3f82ec23
Commit
3f82ec23
authored
Oct 15, 2012
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: fixed system idle behavior on 10.8
needs forward-port and testing on 10.5
parent
7e02b83e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
7 deletions
+45
-7
modules/gui/macosx/CompatibilityFixes.h
modules/gui/macosx/CompatibilityFixes.h
+8
-0
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+37
-7
No files found.
modules/gui/macosx/CompatibilityFixes.h
View file @
3f82ec23
...
...
@@ -79,6 +79,14 @@ extern OSErr UpdateSystemActivity(UInt8 activity);
@interface
NSURL
(
IntroducedInSnowLeopard
)
-
(
NSArray
*
)
pathComponents
;
@end
IOReturn
IOPMAssertionCreateWithName
(
CFStringRef
AssertionType
,
IOPMAssertionLevel
AssertionLevel
,
CFStringRef
AssertionName
,
IOPMAssertionID
*
AssertionID
);
#define kIOPMAssertionTypePreventUserIdleDisplaySleep CFSTR("PreventUserIdleDisplaySleep");
#define kIOPMAssertionTypePreventUserIdleSystemSleep CFSTR("PreventUserIdleSystemSleep");
#endif
#pragma mark -
...
...
modules/gui/macosx/intf.m
View file @
3f82ec23
...
...
@@ -1585,15 +1585,38 @@ unsigned int CocoaKeyToVLC( unichar i_key )
p_input
=
pl_CurrentInput
(
p_intf
);
if
(
p_input
)
{
IOReturn
success
;
int
state
=
var_GetInteger
(
p_input
,
"state"
);
if
(
state
==
PLAYING_S
)
{
/* check for previous blocker and release it if needed */
if
(
systemSleepAssertionID
>
0
)
{
msg_Dbg
(
VLCIntf
,
"releasing sleep blocker (%i)"
,
systemSleepAssertionID
);
success
=
IOPMAssertionRelease
(
systemSleepAssertionID
);
if
(
success
==
kIOReturnSuccess
)
systemSleepAssertionID
=
0
;
}
/* prevent the system from sleeping using the 10.5 API to be as compatible as possible */
IOReturn
success
;
if
(
[
self
activeVideoPlayback
]
)
success
=
IOPMAssertionCreate
(
kIOPMAssertionTypeNoDisplaySleep
,
kIOPMAssertionLevelOn
,
&
systemSleepAssertionID
);
else
success
=
IOPMAssertionCreate
(
kIOPMAssertionTypeNoIdleSleep
,
kIOPMAssertionLevelOn
,
&
systemSleepAssertionID
);
/* work-around a bug in 10.7.4 and 10.7.5, so check for 10.7.x < 10.7.4, 10.8 and 10.6 */
if
((
NSAppKitVersionNumber
>=
1115
.
2
&&
NSAppKitVersionNumber
<
1138
.
45
)
||
OSX_MOUNTAIN_LION
)
{
CFStringRef
reasonForActivity
=
CFStringCreateWithCString
(
kCFAllocatorDefault
,
"VLC media playback"
,
kCFStringEncodingUTF8
);
if
([
self
activeVideoPlayback
])
{
NSLog
(
@"kIOPMAssertionTypePreventUserIdleDisplaySleep"
);
success
=
IOPMAssertionCreateWithName
(
kIOPMAssertionTypePreventUserIdleDisplaySleep
,
kIOPMAssertionLevelOn
,
reasonForActivity
,
&
systemSleepAssertionID
);
}
else
{
NSLog
(
@"kIOPMAssertionTypePreventUserIdleSystemSleep"
);
success
=
IOPMAssertionCreateWithName
(
kIOPMAssertionTypePreventUserIdleSystemSleep
,
kIOPMAssertionLevelOn
,
reasonForActivity
,
&
systemSleepAssertionID
);
}
CFRelease
(
reasonForActivity
);
}
else
{
/* fall-back on the 10.5 mode, which also works on 10.7.4 and 10.7.5 */
if
([
self
activeVideoPlayback
])
success
=
IOPMAssertionCreate
(
kIOPMAssertionTypeNoDisplaySleep
,
kIOPMAssertionLevelOn
,
&
systemSleepAssertionID
);
else
success
=
IOPMAssertionCreate
(
kIOPMAssertionTypeNoIdleSleep
,
kIOPMAssertionLevelOn
,
&
systemSleepAssertionID
);
}
if
(
success
==
kIOReturnSuccess
)
msg_Dbg
(
VLCIntf
,
"prevented sleep through IOKit (%i)"
,
systemSleepAssertionID
);
...
...
@@ -1611,8 +1634,12 @@ unsigned int CocoaKeyToVLC( unichar i_key )
[
o_mainwindow
setPlay
];
/* allow the system to sleep again */
msg_Dbg
(
VLCIntf
,
"releasing sleep blocker (%i)"
,
systemSleepAssertionID
);
IOPMAssertionRelease
(
systemSleepAssertionID
);
if
(
systemSleepAssertionID
>
0
)
{
msg_Dbg
(
VLCIntf
,
"releasing sleep blocker (%i)"
,
systemSleepAssertionID
);
success
=
IOPMAssertionRelease
(
systemSleepAssertionID
);
if
(
success
==
kIOReturnSuccess
)
systemSleepAssertionID
=
0
;
}
}
vlc_object_release
(
p_input
);
}
...
...
@@ -1666,11 +1693,14 @@ unsigned int CocoaKeyToVLC( unichar i_key )
-
(
void
)
setActiveVideoPlayback
:(
BOOL
)
b_value
{
b_active_videoplayback
=
b_value
;
if
(
o_mainwindow
)
{
[
o_mainwindow
performSelectorOnMainThread
:
@selector
(
setVideoplayEnabled
)
withObject
:
nil
waitUntilDone
:
YES
];
[
o_mainwindow
performSelectorOnMainThread
:
@selector
(
togglePlaylist
:)
withObject
:
nil
waitUntilDone
:
NO
];
}
[
self
performSelectorOnMainThread
:
@selector
(
playbackStatusUpdated
)
withObject
:
nil
waitUntilDone
:
NO
];
}
-
(
void
)
setNativeVideoSize
:(
NSSize
)
size
...
...
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