Posts

Post not yet marked as solved
1 Replies
208 Views
Not sure why this has to be so obscure. But somehow adding the call into toggleFullscreen, even though this appDelegate doesn't have a window set, adds a menu item with the fn+F menu item. Posting this to save other pain. Plus the View menu doesn't even have a reference, and is empty otherwise. Pretty hard to polish something shippable with these unfixed outstanding flaws in the API. CommandGroup(after: .toolbar) { // must call through NSWindow Button("See Below") { // Window isn't set in AppDelegate, so menu item is skipped. // But add fn+F menu item into app. Suo many stupid hacks. appDelegate.window?.toggleFullScreen(nil) } }
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
1 Replies
134 Views
I create @State holding a WKWebView (heavyweight object), and then wrap that in a VKViewRepresentable, then @State var myWebView = newWebView(request: URLRequest(url:URL(string: request)!)) This is the only way I can then reference the webView late on to run javascript queries on it. Otherwise, it's embedded in the View/ContentView hierarchy. So then when I moved from Window to WindowGroup, only one of these WKWebView is created. This looks bad to have an empty detail panel in the previous Window. The docs on WindowGroup state that it makes new state to go with each Window in the WindowGroup, but in this case, that's not the case here.
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
0 Replies
121 Views
I have a webpage that needs to receive keypresses to zoom and scroll. This seems to be the only way to prevent the annoying NSBeep from occurring. Return true too much, and command keys stop working. So need to be explicit about which keys you want. Also no way to block delete/shift+delete from going fwd/back in the history using this same mechanism. func isKeyHandled(_ event: NSEvent) -> Bool { // can't block delete or shift+delete // so the WKWebView goes back/foward through it's 1 page history. // that loses all context for the user. // prevent super annoying bonk/NSBeep // if don't check modifier flags (can't check isEmpty since 256 is often set // then the cmd+S stops working if !(event.modifierFlags.contains(.command) || event.modifierFlags.contains(.control) || event.modifierFlags.contains(.option)) { // wasd if event.keyCode == Keycode.w || event.keyCode == Keycode.a || event.keyCode == Keycode.s || event.keyCode == Keycode.d { return true } } return false } // Apple doesn't want this to be overridden by user, but key handling // just doesn't work atop the WKWebView without this. KeyUp/KeyDown // overrides don't matter, since we need the WKWebView to forward them override func performKeyEquivalent(with event: NSEvent) -> Bool { if !isKeyHandled(event) { return super.performKeyEquivalent(with: event) } return true }
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
1 Replies
196 Views
I have the following set, but the WKWebView is losing the page content that I'm updating in a given page whenever the user presses the "delete" key. This is in SwiftUI, and I see no way to intercept and block this key. webView.allowsBackForwardNavigationGestures = false Isn't the whole point of setting this flag, to not just have "swipe" navigation stop, but all back/forward support stop? Also with the backForwardList immutable, it's not like I can delete an entry from it.
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
0 Replies
136 Views
Trying to create a List that sorts by some criteria and handles searchable without any samples is only made even more difficult by the textfield constantly refocusing itself. So I can't even tab away from it. This is some awful bug in SwiftUI. class FileSearcher: ObservableObject { @Published var searchIsActive = false @Published var searchText = "" var files: [File] = [] ... } NavigationSplitView() { } .searchablel(text: $fileSearcher.searchText, isPresented: $fileSearcher.searchIsActive, placement: .sidebar, prompt: "Filter")
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
0 Replies
212 Views
I have an app hosting a page with a 'drop' operation where the page accepts file drops. But I can't easily intercept that, nor seep to be able to block it in Javascript. Yet WKWebView has no way to disable the drop operation from settings, or intercept the url of the dropped file. Either would be useful here.
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
3 Replies
459 Views
Visual Studio, Stadia, and JetBrains are supporting natvis files, where Xcode is still stuck on lldb python files that even Xcode no longer uses to debug data structures. Apple has converted all of their scripts to native code, so there are no samples of how to write complex lldb visualizer rules. There is already an lldb-eval that can bring in natvis files, so something like this should be brought to Xcode. C++ packages like EASTL only ship with a natvis file, and it's far simpler to edit and write than the lldb rules and python scripting.
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
1 Replies
337 Views
Seems that metal-shaderconverter can build a metallib, but I need .air files. Then I link the .air files into a single metallib and metallibdsym file. HLSL -> dxc -> DXIL -> metal-shaderconverter -> .metallib But there's no way to link together multiple metallib into a single metallib is there?
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
4 Replies
1.8k Views
For as long as I've used Xcode, the Issue navigator shows stale errors and warnings even after the build is completely building and executing. It would be nice to have a way to retain file warnings without having to set "warnings as errors", but here the problems have already been fixed. Also need a "Reveal in Report Navigator" since half the time these errors/warnings lack 90% of the info needed to actually fix them. There's already a "Reveal in Project Navigator" that is almost never needed.
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
2 Replies
326 Views
My build generates 10 errors, and sometimes it halts the "build and run" as expected. Most of the time, it just runs the previously successful build anyways. Seems like a basic tenent of an IDE to not do this unless I've explicitly enabled the run.
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
1 Replies
313 Views
I have a UTI for "public.directory" and can drag-drop folders onto my app and open them. I also added this to the Info.plist to say the app supported directoryies. But the default "Open" command seems to popup up an NSOpenPanel with folders not selectable. The "Open" button stays disabled. How do I change this? I tried implementing "openDocument", but then it lets through any file type, not just the ones in my Info.plist. So I'd like to just use the default implementation, but need an override for the NSOpenPanel. (IBAction)openDocument:(id)sender { NSOpenPanel *panel = [NSOpenPanel openPanel]; [panel setCanChooseFiles:YES]; [panel setCanChooseDirectories:YES]; [panel setAllowsMultipleSelection:NO]; ... }
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
0 Replies
591 Views
How is this a valid stack trace with mangled symbol names and file/line information? I've already demangled the name, even though Windows does this for me. The recommended approach to get file/line seems to be to proc "atos" process repeatedly on the symbols to turn them all into file/line. But shouldn't there just be a function call for this, or option to backtrace_symbols() since it's looking up the symbol anyways. I don't get how this external process call would work for iOS, and it seems slow for macOS as well. Compare this with Window CaptureStackBackTrace, and then there is a simple function call via DbgHelp.lib to retrieve the file/line. Am I supposed to somehow use the CoreSymbolicate framework on macOS/iOS?
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
7 Replies
955 Views
Since this api requires &__dso_handle instead of the standard file/line/func, I had to modify my entire log system to pass this down from the macro call sites. I have many callbacks that typically just forward data from other C++ libraries that never supply a dso_handle. so it's great how this logging system breaks most logger systems and doesn't have a warning level to match fault/error. I have the forwarded threadName, timestamp, etc and no where to store that in os_log. syslog was more powerful and clear than os_log, but I'm sure it's now too late to head down a more reasonable path.. So I pass the &__dso_handle all the way to the log command and hand it into the macro #define my_os_log_with_type(dso, log, type, format, ...) __extension__({ \ os_log_t _log_tmp = (log); \ os_log_type_t _type_tmp = (type); \ if (os_log_type_enabled(_log_tmp, _type_tmp)) { \ OS_LOG_CALL_WITH_FORMAT(_os_log_impl, \ ((void*)dso, _log_tmp, _type_tmp), format, ##__VA_ARGS__); \ } \ }) Logger.mm // This doesn't work, logging the dso from the callsite. No file/line. my_os_log_with_type(entry.dso, os_log_create( "com.foo", entry.tag), logLevel(entry.level)), "%{public}s", text ); // This does work, but who wants to jump to the forwarding log implementation? os_log_with_type(os_log_create( "com.foo", entry.tag), logLevel(entry.level)), "%{public}s", text );
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
0 Replies
811 Views
The macOS screen recording tool doesn't appear to support recording HDR content (f.e. in QuickTime player). This tool can record from the camera using various YCbCr 422 and 420 formats needed for HVEC and ProRes HDR10 recording, but doesn't offer any options for screen recording HDR. So that leaves in-game screen recording with AVFoundation. Without any YCbCr formats exposed in Metal api, how do we use CVPixelBuffer with Metal, and then send these formats off to the video codes directly? Can we send Rec2020 RGB10A2Unorm data directly? I'd like the fewest conversions possible.
Posted
by Alecazam.
Last updated
.
Post not yet marked as solved
3 Replies
896 Views
There was a good 2021 WWDC presentation on using ProMotion on iOS, and using Adaptive Sync (ProMotion) on macOS. But while the macOS presentation showed how to detect ProMotion (fullscreen + min/maxInterval mismatch). The iOS side doesn't have this same mechanism. The talk mentions Metal sample code for the talk, but I don't see ProMotion mentioned anywhere in the Metal samples when I do search. https://developer.apple.com/videos/play/wwdc2021/10147/
Posted
by Alecazam.
Last updated
.