aboutsummaryrefslogtreecommitdiffstats
path: root/win/events.go
diff options
context:
space:
mode:
authorfaiface <faiface@ksp.sk>2017-08-23 23:23:40 +0200
committerfaiface <faiface@ksp.sk>2017-08-23 23:23:40 +0200
commitf9580b1ec7d503ae1a38f92bfeae16f081c580e2 (patch)
tree2e9f7921a9b348f0aabb98d4cd2dbc42307e7dd4 /win/events.go
parent453fca4f6ebc50b7ed8f31a04efe7edf4749c4dc (diff)
downloadgui-f9580b1ec7d503ae1a38f92bfeae16f081c580e2.zip
win: more solid events -> handlers -> flushing concurrency handling
Diffstat (limited to 'win/events.go')
-rw-r--r--win/events.go43
1 files changed, 0 insertions, 43 deletions
diff --git a/win/events.go b/win/events.go
deleted file mode 100644
index 47ed02c..0000000
--- a/win/events.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package win
-
-import (
- "github.com/faiface/gui/event"
- "github.com/go-gl/glfw/v3.2/glfw"
-)
-
-func (w *Win) setUpMainthreadEvents() {
- var moX, moY int
-
- w.w.SetMouseButtonCallback(func(_ *glfw.Window, button glfw.MouseButton, action glfw.Action, mod glfw.ModifierKey) {
- switch action {
- case glfw.Press:
- w.mainthreadEvent("mo", "down", moX, moY)
- case glfw.Release:
- w.mainthreadEvent("mo", "up", moX, moY)
- }
- })
-
- w.w.SetCursorPosCallback(func(_ *glfw.Window, x, y float64) {
- moX, moY = int(x), int(y)
- w.mainthreadEvent("mo", "move", moX, moY)
- })
-
- w.w.SetCharCallback(func(_ *glfw.Window, r rune) {
- w.mainthreadEvent("kb", "type", r)
- })
-
- w.w.SetSizeCallback(func(_ *glfw.Window, width, height int) {
- w.resize(width, height)
- w.mainthreadEvent("resize", 0, 0, width, height)
- })
-
- w.w.SetCloseCallback(func(_ *glfw.Window) {
- w.mainthreadEvent("wi", "close")
- })
-}
-
-func (w *Win) mainthreadEvent(a ...interface{}) {
- go func() {
- w.mainthreadEvents <- event.Sprint(a...)
- }()
-}