mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[v3 mac] Fix merge issues
This commit is contained in:
@@ -70,13 +70,24 @@ static void* createAlert(int alertType, char* title, char *message, void *icon,
|
||||
static int dialogRunModal(void *dialog, void *parent) {
|
||||
NSAlert *alert = (__bridge NSAlert *)dialog;
|
||||
|
||||
long response;
|
||||
if( parent != NULL ) {
|
||||
NSWindow *window = (__bridge NSWindow *)parent;
|
||||
response = [alert runModalSheetForWindow:window];
|
||||
} else {
|
||||
__block long response;
|
||||
//if( parent != NULL ) {
|
||||
// NSWindow *window = (__bridge NSWindow *)parent;
|
||||
// response = [alert runModalSheetForWindow:window];
|
||||
//} else {
|
||||
// response = [alert runModal];
|
||||
//}
|
||||
|
||||
// If the parent is NULL, we are running a modal dialog, otherwise attach the alert to the parent
|
||||
if( parent == NULL ) {
|
||||
response = [alert runModal];
|
||||
} else {
|
||||
NSWindow *window = (__bridge NSWindow *)parent;
|
||||
[alert beginSheetModalForWindow:window completionHandler:^(NSModalResponse returnCode) {
|
||||
response = returnCode;
|
||||
}];
|
||||
}
|
||||
|
||||
int result;
|
||||
|
||||
if( response == NSAlertFirstButtonReturn ) {
|
||||
@@ -350,9 +361,10 @@ func (m *macosDialog) show() {
|
||||
iconLength = C.int(len(globalApplication.options.Icon))
|
||||
}
|
||||
}
|
||||
var parent unsafe.Pointer
|
||||
if m.dialog.window != nil {
|
||||
// get NSWindow from window
|
||||
nsWindow = m.dialog.window.impl.(*macosWebviewWindow).nsWindow
|
||||
parent = m.dialog.window.impl.(*macosWebviewWindow).nsWindow
|
||||
}
|
||||
|
||||
alertType, ok := alertTypeMap[m.dialog.DialogType]
|
||||
@@ -360,7 +372,7 @@ func (m *macosDialog) show() {
|
||||
alertType = C.NSAlertStyleInformational
|
||||
}
|
||||
|
||||
m.nsDialog = C.createAlert(alertType, title, message, iconData, iconLength, nsWindow)
|
||||
m.nsDialog = C.createAlert(alertType, title, message, iconData, iconLength)
|
||||
|
||||
// Reverse the Buttons so that the default is on the right
|
||||
reversedButtons := make([]*Button, len(m.dialog.Buttons))
|
||||
@@ -372,7 +384,7 @@ func (m *macosDialog) show() {
|
||||
count++
|
||||
}
|
||||
|
||||
buttonPressed := int(C.dialogRunModal(m.nsDialog, nsWindow))
|
||||
buttonPressed := int(C.dialogRunModal(m.nsDialog, parent))
|
||||
if len(m.dialog.Buttons) > buttonPressed {
|
||||
button := reversedButtons[buttonPressed]
|
||||
if button.Callback != nil {
|
||||
|
||||
@@ -130,6 +130,10 @@ func (s *macosSystemTray) setIcon(icon []byte) {
|
||||
})
|
||||
}
|
||||
|
||||
func (s *macosSystemTray) setDarkModeIcon(icon []byte) {
|
||||
s.setIcon(icon)
|
||||
}
|
||||
|
||||
func (s *macosSystemTray) setTemplateIcon(icon []byte) {
|
||||
s.icon = icon
|
||||
s.isTemplateIcon = true
|
||||
|
||||
@@ -685,6 +685,10 @@ void setWindowEnabled(void *window, bool enabled) {
|
||||
[nsWindow setIgnoresMouseEvents:!enabled];
|
||||
}
|
||||
|
||||
void windowSetEnabled(void *window, bool enabled) {
|
||||
// TODO: Implement
|
||||
}
|
||||
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
@@ -702,6 +706,10 @@ type macosWebviewWindow struct {
|
||||
parent *WebviewWindow
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) setAbsolutePosition(x int, y int) {
|
||||
C.windowSetAbsolutePosition(w.nsWindow, C.int(x), C.int(y))
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) print() error {
|
||||
C.windowPrint(w.nsWindow)
|
||||
return nil
|
||||
@@ -959,9 +967,6 @@ func (w *macosWebviewWindow) setRelativePosition(x, y int) {
|
||||
C.windowSetRelativePosition(w.nsWindow, C.int(x), C.int(y))
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) setRelativePosition(x, y int) {
|
||||
C.windowSetAbsolutePosition(w.nsWindow, C.int(x), C.int(y))
|
||||
}
|
||||
func (w *macosWebviewWindow) width() int {
|
||||
var width C.int
|
||||
var wg sync.WaitGroup
|
||||
|
||||
Reference in New Issue
Block a user