mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-16 07:35:51 +01:00
Add WKUIDelegate protocol support to handle runOpenPanelWithParameters delegate method, which is required for <input type="file"> elements to work in WKWebView on macOS. This was a regression from V2 which had this implementation. Changes: - Add WKUIDelegate to WebviewWindowDelegate protocol list - Set UIDelegate on WKWebView during window creation - Implement runOpenPanelWithParameters to show NSOpenPanel for file selection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
1.6 KiB
Objective-C
45 lines
1.6 KiB
Objective-C
//go:build darwin && !ios
|
|
|
|
#ifndef WebviewWindowDelegate_h
|
|
#define WebviewWindowDelegate_h
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#import <WebKit/WebKit.h>
|
|
|
|
@interface WebviewWindow : NSWindow
|
|
- (BOOL) canBecomeKeyWindow;
|
|
- (BOOL) canBecomeMainWindow;
|
|
- (BOOL) acceptsFirstResponder;
|
|
- (BOOL) becomeFirstResponder;
|
|
- (BOOL) resignFirstResponder;
|
|
- (WebviewWindow*) initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation;
|
|
|
|
@property (assign) WKWebView* webView; // We already retain WKWebView since it's part of the Window.
|
|
|
|
@end
|
|
|
|
@interface WebviewWindowDelegate : NSObject <NSWindowDelegate, WKScriptMessageHandler, WKNavigationDelegate, WKURLSchemeHandler, NSDraggingDestination, WKUIDelegate>
|
|
|
|
@property unsigned int windowId;
|
|
@property (retain) NSEvent* leftMouseEvent;
|
|
@property unsigned int invisibleTitleBarHeight;
|
|
@property BOOL showToolbarWhenFullscreen;
|
|
@property NSWindowStyleMask previousStyleMask; // Used to restore the window style mask when using frameless
|
|
|
|
- (void)handleLeftMouseUp:(NSWindow *)window;
|
|
- (void)handleLeftMouseDown:(NSEvent*)event;
|
|
- (void)startDrag:(WebviewWindow*)window;
|
|
|
|
@end
|
|
|
|
void windowSetScreen(void* window, void* screen, int yOffset);
|
|
|
|
// Liquid Glass support functions
|
|
bool isLiquidGlassSupported();
|
|
void windowSetLiquidGlass(void* window, int style, int material, double cornerRadius,
|
|
int r, int g, int b, int a,
|
|
const char* groupID, double groupSpacing);
|
|
void windowRemoveVisualEffects(void* window);
|
|
void configureWebViewForLiquidGlass(void* window);
|
|
|
|
#endif /* WebviewWindowDelegate_h */
|