summaryrefslogtreecommitdiff
path: root/uitask_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-03 11:04:07 -0400
committerPietro Gagliardi <[email protected]>2014-07-03 11:04:07 -0400
commit1238936a16170757104879d9593ba9440c70e8cd (patch)
treeeade2af3e7602a986dd7144032c72a18f59c9825 /uitask_windows.go
parentf7dedc8cb05960134234f242042a4f00d88aaf9e (diff)
Added Post() and implemented it on Windows.
Diffstat (limited to 'uitask_windows.go')
-rw-r--r--uitask_windows.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/uitask_windows.go b/uitask_windows.go
index f260e79..ca00d3a 100644
--- a/uitask_windows.go
+++ b/uitask_windows.go
@@ -29,6 +29,7 @@ const (
msgQuit = _WM_APP + iota + 1 // + 1 just to be safe
msgSetAreaSize
msgRepaintAll
+ msgPost
)
func uiinit() error {
@@ -66,6 +67,15 @@ func ui() {
msgloop()
}
+// we'll use SendMessage() here, which will do a thread switch, call the function immediately, and wait for it to return, so we don't have to worry about the garbage collector collecting data
+func uipost(w *Window, data interface{}) {
+ _sendMessage.Call(
+ uintptr(w.sysData.hwnd), // note: we pass this directly to the window
+ msgPost,
+ 0,
+ uintptr(unsafe.Pointer(&data)))
+}
+
var (
_dispatchMessage = user32.NewProc("DispatchMessageW")
_getActiveWindow = user32.NewProc("GetActiveWindow")