Fix macOS orcaslicer:// deep links after wxWidgets 3.3.2 upgrade Install an OrcaSlicer-owned kAEGetURL Apple Event handler from on_init_inner(). The wxWidgets 3.3.2 handler registered in applicationWillFinishLaunching: stopped delivering URL events to GUI_App::MacOpenURL on macOS (#13119), so links from Printables / Thingiverse opened a blank project instead of importing the model. Registering our own handler late in startup is last-writer-wins on NSAppleEventManager and routes back to the existing MacOpenURL -> start_download path, restoring the pre-upgrade behavior without touching wxWidgets. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
#import <AppKit/AppKit.h>
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#include <boost/log/trivial.hpp>
|
|
|
|
#include "DeepLinkHandlerMac.h"
|
|
#include "GUI_App.hpp"
|
|
|
|
@interface OrcaDeepLinkHandler : NSObject
|
|
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)reply;
|
|
@end
|
|
|
|
@implementation OrcaDeepLinkHandler
|
|
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)reply
|
|
{
|
|
NSString *url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
|
|
if (url == nil || url.length == 0)
|
|
return;
|
|
BOOST_LOG_TRIVIAL(info) << "Deep link received: " << [url UTF8String];
|
|
Slic3r::GUI::wxGetApp().MacOpenURL(wxString::FromUTF8([url UTF8String]));
|
|
}
|
|
@end
|
|
|
|
namespace Slic3r {
|
|
namespace GUI {
|
|
|
|
void register_mac_deep_link_handler()
|
|
{
|
|
static OrcaDeepLinkHandler *handler = nil;
|
|
if (handler == nil)
|
|
handler = [[OrcaDeepLinkHandler alloc] init];
|
|
|
|
[[NSAppleEventManager sharedAppleEventManager]
|
|
setEventHandler:handler
|
|
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
|
|
forEventClass:kInternetEventClass
|
|
andEventID:kAEGetURL];
|
|
}
|
|
|
|
} // namespace GUI
|
|
} // namespace Slic3r
|