mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 20:03:01 +08:00

* Tidy up runtime JS * Initial implementation of runtime over http * Update runtime deps. Fix test task. * Support Clipboard. Message Processor refactor. * Add `Window.Screen()` Clipboard `GetText` -> `Text` * Support most dialogs Better JS->Go object mapping Implement Go->JS callback mechanism Rename `window.runtime` -> `window.wails` to better reflect the Go API * Support SaveFile dialog * Remove go.work * Tidy up * Event->CustomEvent to prevent potential clash with native JS Event object Support Eventing * Support application calls * Support logging * Support named windows Remove debug info * Update v3 changes
38 lines
811 B
Go
38 lines
811 B
Go
//go:build darwin
|
|
|
|
package application
|
|
|
|
/*
|
|
#cgo CFLAGS: -mmacosx-version-min=10.13 -x objective-c
|
|
#cgo LDFLAGS: -framework Cocoa
|
|
|
|
#include "Cocoa/Cocoa.h"
|
|
|
|
extern void dispatchOnMainThreadCallback(unsigned int);
|
|
|
|
static void dispatchOnMainThread(unsigned int id) {
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
dispatchOnMainThreadCallback(id);
|
|
});
|
|
}
|
|
|
|
*/
|
|
import "C"
|
|
|
|
func (m *macosApp) dispatchOnMainThread(id uint) {
|
|
C.dispatchOnMainThread(C.uint(id))
|
|
}
|
|
|
|
//export dispatchOnMainThreadCallback
|
|
func dispatchOnMainThreadCallback(callbackID C.uint) {
|
|
mainThreadFunctionStoreLock.RLock()
|
|
id := uint(callbackID)
|
|
fn := mainThreadFunctionStore[id]
|
|
if fn == nil {
|
|
Fatal("dispatchCallback called with invalid id: %v", id)
|
|
}
|
|
delete(mainThreadFunctionStore, id)
|
|
mainThreadFunctionStoreLock.RUnlock()
|
|
fn()
|
|
}
|