mirror of
https://github.com/yattee/yattee.git
synced 2025-12-13 03:28:14 +00:00
Compare commits
1 Commits
update-int
...
changes-to
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e62010d5d5 |
@@ -4,7 +4,7 @@
|
||||
<dict>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.78Z5H3M6RJ.stream.yattee.app.urlbookmarks</string>
|
||||
<string>group.ZYMM2HKXY2.yattee.app.url</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -15,7 +15,7 @@ struct AppSidebarNavigation: View {
|
||||
|
||||
var body: some View {
|
||||
#if os(iOS)
|
||||
content.introspect(.viewController, on: .iOS(.v15, .v16, .v17, .v18)) { viewController in
|
||||
content.introspect(.viewController, on: .iOS(.v15, .v16, .v17)) { viewController in
|
||||
// workaround for an empty supplementary view on launch
|
||||
// the supplementary view is determined by the default selection inside the
|
||||
// primary view, but the primary view is not loaded so its selection is not read
|
||||
|
||||
@@ -11,6 +11,7 @@ final class MPVOGLView: GLKView {
|
||||
var mpvGL: UnsafeMutableRawPointer?
|
||||
var queue = DispatchQueue(label: "stream.yattee.opengl", qos: .userInteractive)
|
||||
var needsDrawing = true
|
||||
private var dirtyRegion: CGRect?
|
||||
|
||||
override init(frame: CGRect) {
|
||||
guard let context = EAGLContext(api: .openGLES2) else {
|
||||
@@ -85,6 +86,7 @@ final class MPVOGLView: GLKView {
|
||||
@objc private func updateFrame() {
|
||||
// Trigger the drawing process if needed
|
||||
if needsDrawing {
|
||||
markRegionAsDirty(bounds)
|
||||
setNeedsDisplay()
|
||||
}
|
||||
}
|
||||
@@ -100,16 +102,60 @@ final class MPVOGLView: GLKView {
|
||||
glClear(UInt32(GL_COLOR_BUFFER_BIT))
|
||||
}
|
||||
|
||||
// Function to set a dirty region when a part of the screen changes
|
||||
func markRegionAsDirty(_ region: CGRect) {
|
||||
if dirtyRegion == nil {
|
||||
dirtyRegion = region
|
||||
} else {
|
||||
// Expand the dirty region to include the new region
|
||||
dirtyRegion = dirtyRegion!.union(region)
|
||||
}
|
||||
}
|
||||
|
||||
// Logic to decide if only part of the screen needs updating
|
||||
private func needsPartialUpdate() -> Bool {
|
||||
// Check if there is a defined dirty region that needs updating
|
||||
if let dirtyRegion, !dirtyRegion.isEmpty {
|
||||
// Set up glScissor based on dirtyRegion coordinates
|
||||
glScissor(GLint(dirtyRegion.origin.x), GLint(dirtyRegion.origin.y), GLsizei(dirtyRegion.width), GLsizei(dirtyRegion.height))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Call this function when you know the entire screen needs updating
|
||||
private func clearDirtyRegion() {
|
||||
dirtyRegion = nil
|
||||
}
|
||||
|
||||
override func draw(_: CGRect) {
|
||||
guard needsDrawing, let mpvGL else { return }
|
||||
|
||||
// Ensure the correct context is set
|
||||
guard EAGLContext.setCurrent(context) else {
|
||||
logger.error("Failed to set current OpenGL context.")
|
||||
return
|
||||
}
|
||||
|
||||
// Bind the default framebuffer
|
||||
glGetIntegerv(UInt32(GL_FRAMEBUFFER_BINDING), &defaultFBO!)
|
||||
|
||||
// Ensure the framebuffer is valid
|
||||
guard defaultFBO != nil && defaultFBO! != 0 else {
|
||||
logger.error("Invalid framebuffer ID.")
|
||||
return
|
||||
}
|
||||
|
||||
// Get the current viewport dimensions
|
||||
var dims: [GLint] = [0, 0, 0, 0]
|
||||
glGetIntegerv(GLenum(GL_VIEWPORT), &dims)
|
||||
|
||||
// Check if we need partial updates
|
||||
if needsPartialUpdate() {
|
||||
logger.info("Performing partial update with scissor test.")
|
||||
glEnable(GLenum(GL_SCISSOR_TEST))
|
||||
}
|
||||
|
||||
// Set up the OpenGL FBO data
|
||||
var data = mpv_opengl_fbo(
|
||||
fbo: Int32(defaultFBO!),
|
||||
@@ -129,9 +175,23 @@ final class MPVOGLView: GLKView {
|
||||
mpv_render_param(type: MPV_RENDER_PARAM_FLIP_Y, data: flipPtr),
|
||||
mpv_render_param()
|
||||
]
|
||||
mpv_render_context_render(OpaquePointer(mpvGL), ¶ms)
|
||||
// Call the render function and check for errors
|
||||
let result = mpv_render_context_render(OpaquePointer(mpvGL), ¶ms)
|
||||
if result < 0 {
|
||||
logger.error("mpv_render_context_render() failed with error code: \(result)")
|
||||
} else {
|
||||
logger.info("mpv_render_context_render() called successfully.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Disable the scissor test after rendering if it was enabled
|
||||
if needsPartialUpdate() {
|
||||
glDisable(GLenum(GL_SCISSOR_TEST))
|
||||
}
|
||||
|
||||
// Clear dirty region after drawing
|
||||
clearDirtyRegion()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ struct FocusableSearchTextField: View {
|
||||
var body: some View {
|
||||
SearchTextField()
|
||||
#if os(macOS)
|
||||
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15)) { textField in
|
||||
.introspect(.textField, on: .macOS(.v12, .v13, .v14)) { textField in
|
||||
state.textField = textField
|
||||
}
|
||||
.onAppear {
|
||||
@@ -18,7 +18,7 @@ struct FocusableSearchTextField: View {
|
||||
}
|
||||
}
|
||||
#elseif os(iOS)
|
||||
.introspect(.textField, on: .iOS(.v15, .v16, .v17, .v18)) { textField in
|
||||
.introspect(.textField, on: .iOS(.v15, .v16, .v17)) { textField in
|
||||
state.textField = textField
|
||||
}
|
||||
.onChange(of: state.focused) { newValue in
|
||||
|
||||
@@ -4913,7 +4913,7 @@
|
||||
repositoryURL = "https://github.com/sindresorhus/Defaults";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 7.3.1;
|
||||
minimumVersion = 7.0.0;
|
||||
};
|
||||
};
|
||||
372AA40E286D067B0000B1DC /* XCRemoteSwiftPackageReference "Repeat" */ = {
|
||||
@@ -4928,8 +4928,8 @@
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/hyperoslo/Cache.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 7.4.0;
|
||||
branch = master;
|
||||
kind = branch;
|
||||
};
|
||||
};
|
||||
375B8AAF28B57F4200397B31 /* XCRemoteSwiftPackageReference "KeychainAccess" */ = {
|
||||
@@ -4944,16 +4944,16 @@
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/pinterest/PINCache";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 3.0.4;
|
||||
branch = master;
|
||||
kind = branch;
|
||||
};
|
||||
};
|
||||
379325D329A265A300181CF1 /* XCRemoteSwiftPackageReference "swift-log" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/apple/swift-log.git";
|
||||
repositoryURL = "https://github.com/yattee/swift-log.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 1.6.1;
|
||||
branch = main;
|
||||
kind = branch;
|
||||
};
|
||||
};
|
||||
3797104728D3D10600D5F53C /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = {
|
||||
@@ -4961,7 +4961,7 @@
|
||||
repositoryURL = "https://github.com/SDWebImage/SDWebImageSwiftUI.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 2.2.7;
|
||||
minimumVersion = 2.1.0;
|
||||
};
|
||||
};
|
||||
3797757B268922D100DD52A8 /* XCRemoteSwiftPackageReference "siesta" */ = {
|
||||
@@ -4969,7 +4969,7 @@
|
||||
repositoryURL = "https://github.com/bustoutsolutions/siesta";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 1.5.2;
|
||||
minimumVersion = 1.5.0;
|
||||
};
|
||||
};
|
||||
3799AC0728B03CEC001376F9 /* XCRemoteSwiftPackageReference "ActiveLabel.swift" */ = {
|
||||
@@ -4985,7 +4985,7 @@
|
||||
repositoryURL = "https://github.com/Alamofire/Alamofire.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 5.9.1;
|
||||
minimumVersion = 5.0.0;
|
||||
};
|
||||
};
|
||||
37BD07C52698B27B003EBB87 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
|
||||
@@ -4993,7 +4993,7 @@
|
||||
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 1.3.0;
|
||||
minimumVersion = 0.1.3;
|
||||
};
|
||||
};
|
||||
37CF8B8228535E4F00B71E37 /* XCRemoteSwiftPackageReference "SDWebImage" */ = {
|
||||
@@ -5001,7 +5001,7 @@
|
||||
repositoryURL = "https://github.com/SDWebImage/SDWebImage";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 5.19.7;
|
||||
minimumVersion = 5.19.1;
|
||||
};
|
||||
};
|
||||
37D4B19B2671817900C925CA /* XCRemoteSwiftPackageReference "SwiftyJSON" */ = {
|
||||
@@ -5009,7 +5009,7 @@
|
||||
repositoryURL = "https://github.com/SwiftyJSON/SwiftyJSON.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 5.0.2;
|
||||
minimumVersion = 5.0.0;
|
||||
};
|
||||
};
|
||||
37EE6DC328A305AD00BFD632 /* XCRemoteSwiftPackageReference "Reachability" */ = {
|
||||
@@ -5017,7 +5017,7 @@
|
||||
repositoryURL = "https://github.com/ashleymills/Reachability.swift";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 5.2.3;
|
||||
minimumVersion = 5.1.0;
|
||||
};
|
||||
};
|
||||
37FB2847272207F000A57617 /* XCRemoteSwiftPackageReference "SDWebImageWebPCoder" */ = {
|
||||
@@ -5025,7 +5025,7 @@
|
||||
repositoryURL = "https://github.com/SDWebImage/SDWebImageWebPCoder.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 0.14.6;
|
||||
minimumVersion = 0.8.4;
|
||||
};
|
||||
};
|
||||
37FB285227220D8400A57617 /* XCRemoteSwiftPackageReference "SDWebImagePINPlugin" */ = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"originHash" : "173de1b718eb898698eaba0221b46be9781899a652725709c8400d3ddfb01980",
|
||||
"originHash" : "515d8e68c4a31658288fb3f94789ee539399b042082c08c39f4c03c27fd8860c",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "activelabel.swift",
|
||||
@@ -24,8 +24,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/hyperoslo/Cache.git",
|
||||
"state" : {
|
||||
"revision" : "24e47109e31b2031cb26e25cc1b81b607496066c",
|
||||
"version" : "7.4.0"
|
||||
"branch" : "master",
|
||||
"revision" : "81a0277cbc6b63f4e0cd6f42c4abefa1011bbfa9"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -69,8 +69,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/pinterest/PINCache",
|
||||
"state" : {
|
||||
"revision" : "2fb85948463292c2e824148cf17dc62a4c217a94",
|
||||
"version" : "3.0.4"
|
||||
"branch" : "master",
|
||||
"revision" : "2fb85948463292c2e824148cf17dc62a4c217a94"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -148,10 +148,10 @@
|
||||
{
|
||||
"identity" : "swift-log",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-log.git",
|
||||
"location" : "https://github.com/yattee/swift-log.git",
|
||||
"state" : {
|
||||
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
|
||||
"version" : "1.6.1"
|
||||
"branch" : "main",
|
||||
"revision" : "3f3dc1390a2f116894887c352792dc8d5fa9e875"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -168,8 +168,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/siteline/SwiftUI-Introspect.git",
|
||||
"state" : {
|
||||
"revision" : "807f73ce09a9b9723f12385e592b4e0aaebd3336",
|
||||
"version" : "1.3.0"
|
||||
"revision" : "121c146fe591b1320238d054ae35c81ffa45f45a",
|
||||
"version" : "0.12.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user