mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[v3] Fix merge issues
This commit is contained in:
@@ -185,7 +185,6 @@ func (m *macosApp) run() error {
|
||||
C.setApplicationShouldTerminateAfterLastWindowClosed(C.bool(m.parent.options.Mac.ApplicationShouldTerminateAfterLastWindowClosed))
|
||||
C.setActivationPolicy(C.int(m.parent.options.Mac.ActivationPolicy))
|
||||
C.activateIgnoringOtherApps()
|
||||
globalApplication.activate()
|
||||
})
|
||||
m.setupCommonEvents()
|
||||
// setup event listeners
|
||||
|
||||
@@ -91,10 +91,6 @@ type macosSystemTray struct {
|
||||
isTemplateIcon bool
|
||||
}
|
||||
|
||||
func (s *macosSystemTray) setDarkModeIcon(icon []byte) {
|
||||
// Is this even possible?
|
||||
}
|
||||
|
||||
func (s *macosSystemTray) setIconPosition(position int) {
|
||||
s.iconPosition = position
|
||||
}
|
||||
|
||||
@@ -145,7 +145,11 @@ void printWindowStyle(void *window) {
|
||||
|
||||
// setInvisibleTitleBarHeight sets the invisible title bar height
|
||||
void setInvisibleTitleBarHeight(void* window, unsigned int height) {
|
||||
[(WebviewWindow*)window delegate].invisibleTitleBarHeight = height;
|
||||
WebviewWindow* nsWindow = (WebviewWindow*)window;
|
||||
// Get delegate
|
||||
WebviewWindowDelegate* delegate = (WebviewWindowDelegate*)[nsWindow delegate];
|
||||
// Set height
|
||||
delegate.invisibleTitleBarHeight = height;
|
||||
}
|
||||
|
||||
// Make NSWindow transparent
|
||||
@@ -155,7 +159,9 @@ void windowSetTransparent(void* nsWindow) {
|
||||
}
|
||||
|
||||
void windowSetInvisibleTitleBar(void* nsWindow, unsigned int height) {
|
||||
[(WebviewWindow*)nsWindow delegate].invisibleTitleBarHeight = height;
|
||||
WebviewWindow* window = (WebviewWindow*)nsWindow;
|
||||
WebviewWindowDelegate* delegate = (WebviewWindowDelegate*)[window delegate];
|
||||
delegate.invisibleTitleBarHeight = height;
|
||||
}
|
||||
|
||||
|
||||
@@ -627,34 +633,37 @@ static void startDrag(void *window) {
|
||||
// Credit: https://stackoverflow.com/q/33319295
|
||||
static void windowPrint(void *window) {
|
||||
|
||||
WebviewWindow* nsWindow = (WebviewWindow*)window;
|
||||
WebviewWindowDelegate* windowDelegate = (WebviewWindowDelegate*)[nsWindow delegate];
|
||||
WKWebView* webView = nsWindow.webView;
|
||||
// Check if macOS 11.0 or newer
|
||||
if (@available(macOS 11.0, *)) {
|
||||
WebviewWindow* nsWindow = (WebviewWindow*)window;
|
||||
WebviewWindowDelegate* windowDelegate = (WebviewWindowDelegate*)[nsWindow delegate];
|
||||
WKWebView* webView = nsWindow.webView;
|
||||
|
||||
// TODO: Think about whether to expose this as config
|
||||
NSPrintInfo *pInfo = [NSPrintInfo sharedPrintInfo];
|
||||
pInfo.horizontalPagination = NSPrintingPaginationModeAutomatic;
|
||||
pInfo.verticalPagination = NSPrintingPaginationModeAutomatic;
|
||||
pInfo.verticallyCentered = YES;
|
||||
pInfo.horizontallyCentered = YES;
|
||||
pInfo.orientation = NSPaperOrientationLandscape;
|
||||
pInfo.leftMargin = 30;
|
||||
pInfo.rightMargin = 30;
|
||||
pInfo.topMargin = 30;
|
||||
pInfo.bottomMargin = 30;
|
||||
// TODO: Think about whether to expose this as config
|
||||
NSPrintInfo *pInfo = [NSPrintInfo sharedPrintInfo];
|
||||
pInfo.horizontalPagination = NSPrintingPaginationModeAutomatic;
|
||||
pInfo.verticalPagination = NSPrintingPaginationModeAutomatic;
|
||||
pInfo.verticallyCentered = YES;
|
||||
pInfo.horizontallyCentered = YES;
|
||||
pInfo.orientation = NSPaperOrientationLandscape;
|
||||
pInfo.leftMargin = 30;
|
||||
pInfo.rightMargin = 30;
|
||||
pInfo.topMargin = 30;
|
||||
pInfo.bottomMargin = 30;
|
||||
|
||||
NSPrintOperation *po = [webView printOperationWithPrintInfo:pInfo];
|
||||
po.showsPrintPanel = YES;
|
||||
po.showsProgressPanel = YES;
|
||||
NSPrintOperation *po = [webView printOperationWithPrintInfo:pInfo];
|
||||
po.showsPrintPanel = YES;
|
||||
po.showsProgressPanel = YES;
|
||||
|
||||
// Without the next line you get an exception. Also it seems to
|
||||
// completely ignore the values in the rect. I tried changing them
|
||||
// in both x and y direction to include content scrolled off screen.
|
||||
// It had no effect whatsoever in either direction.
|
||||
po.view.frame = webView.bounds;
|
||||
// Without the next line you get an exception. Also it seems to
|
||||
// completely ignore the values in the rect. I tried changing them
|
||||
// in both x and y direction to include content scrolled off screen.
|
||||
// It had no effect whatsoever in either direction.
|
||||
po.view.frame = webView.bounds;
|
||||
|
||||
// [printOperation runOperation] DOES NOT WORK WITH WKWEBVIEW, use
|
||||
[po runOperationModalForWindow:window delegate:windowDelegate didRunSelector:nil contextInfo:nil];
|
||||
// [printOperation runOperation] DOES NOT WORK WITH WKWEBVIEW, use
|
||||
[po runOperationModalForWindow:window delegate:windowDelegate didRunSelector:nil contextInfo:nil];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -734,10 +743,6 @@ func (w *macosWebviewWindow) hide() {
|
||||
C.windowHide(w.nsWindow)
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) isNormal() bool {
|
||||
return !w.isMinimised() && !w.isMaximised() && !w.isFullscreen()
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) setFullscreenButtonEnabled(enabled bool) {
|
||||
C.setFullscreenButtonEnabled(w.nsWindow, C.bool(enabled))
|
||||
}
|
||||
@@ -869,12 +874,12 @@ func (w *macosWebviewWindow) execJS(js string) {
|
||||
|
||||
func (w *macosWebviewWindow) setURL(uri string) {
|
||||
if uri != "" {
|
||||
url, err := url.Parse(uri)
|
||||
if err == nil && url.Scheme == "" && url.Host == "" {
|
||||
parsedURL, err := url.Parse(uri)
|
||||
if err == nil && parsedURL.Scheme == "" && parsedURL.Host == "" {
|
||||
// TODO handle this in a central location, the scheme and host might be platform dependant.
|
||||
url.Scheme = "wails"
|
||||
url.Host = "wails"
|
||||
uri = url.String()
|
||||
parsedURL.Scheme = "wails"
|
||||
parsedURL.Host = "wails"
|
||||
uri = parsedURL.String()
|
||||
}
|
||||
}
|
||||
C.navigationLoadURL(w.nsWindow, C.CString(uri))
|
||||
|
||||
Reference in New Issue
Block a user