summaryrefslogtreecommitdiff
path: root/redo/area_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-21 05:37:24 -0400
committerPietro Gagliardi <[email protected]>2014-08-21 05:37:24 -0400
commite5c74b832be68fdbefb9c7527c2367dba1cec7a8 (patch)
treebff78082b8666a04ce42b815b11a65ddee77821d /redo/area_windows.go
parentf3ca234dda0c34c2bd11acee414111d1c745422d (diff)
Changed AreaHandler.Key() to return a boolean value indicating if the event was handled; implemented this on Windows. It does sledgehammer some edge cases I wanted to avoid, but it also avoids fussing about scrolling and focus and what not.
Diffstat (limited to 'redo/area_windows.go')
-rw-r--r--redo/area_windows.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/redo/area_windows.go b/redo/area_windows.go
index 05f0274..877f8b6 100644
--- a/redo/area_windows.go
+++ b/redo/area_windows.go
@@ -152,7 +152,7 @@ func finishAreaMouseEvent(data unsafe.Pointer, cbutton C.DWORD, up C.BOOL, heldB
}
//export areaKeyEvent
-func areaKeyEvent(data unsafe.Pointer, up C.BOOL, wParam C.WPARAM, lParam C.LPARAM) {
+func areaKeyEvent(data unsafe.Pointer, up C.BOOL, wParam C.WPARAM, lParam C.LPARAM) C.BOOL {
var ke KeyEvent
a := (*area)(data)
@@ -180,10 +180,14 @@ func areaKeyEvent(data unsafe.Pointer, up C.BOOL, wParam C.WPARAM, lParam C.LPAR
ke.ExtKey = xke.ExtKey
} else if ke.Modifiers == 0 {
// no key, extkey, or modifiers; do nothing
- return
+ return C.FALSE
}
ke.Up = up != C.FALSE
- a.handler.Key(ke)
+ handled := a.handler.Key(ke)
+ if handled {
+ return C.TRUE
+ }
+ return C.FALSE
}
// all mappings come from GLFW - https://github.com/glfw/glfw/blob/master/src/win32_window.c#L152