fix(macos): stop CPU spin when display sleeps with video paused

When the display/system sleeps with a video paused, the window server
stops completing CAMetalLayer presents and mpv's MoltenVK swapchain wedges,
pinning one core at 100% until the app exits. occlusionState does not
reliably change on display sleep, so observe NSWorkspace screensDidSleep/
Wake to hide the metal layer (and drop the playback activity) while dark,
restoring on wake with a forced redraw when paused to avoid a stale frame.

Pairs with MPVKit v1.0.10, which gates libmpv presentation on the layer's
hidden state (check_visible) so presents actually stop while hidden.
This commit is contained in:
edde746
2026-07-09 11:56:13 +02:00
parent 574b8d524f
commit 71d644c4ae
7 changed files with 97 additions and 17 deletions
+1 -1
View File
@@ -801,7 +801,7 @@
repositoryURL = "https://github.com/edde746/MPVKit";
requirement = {
kind = exactVersion;
version = 1.0.9;
version = 1.0.10;
};
};
/* End XCRemoteSwiftPackageReference section */
@@ -40,8 +40,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/edde746/MPVKit",
"state" : {
"revision" : "206ba4a9f8f8191f18cabfdc025bfa512729af58",
"version" : "1.0.9"
"revision" : "bdc3a651c17c01d3985828bdc07b716786992259",
"version" : "1.0.10"
}
},
{
@@ -40,8 +40,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/edde746/MPVKit",
"state" : {
"revision" : "206ba4a9f8f8191f18cabfdc025bfa512729af58",
"version" : "1.0.9"
"revision" : "bdc3a651c17c01d3985828bdc07b716786992259",
"version" : "1.0.10"
}
},
{