Added Alt+[key] and F10 handling to Windows Area key events. Also more TODOs.
This commit is contained in:
parent
efdd60375a
commit
bafb13dd2f
|
@ -465,6 +465,15 @@ func areaWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lPara
|
||||||
_MA_ACTIVATE = 1
|
_MA_ACTIVATE = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
defwndproc := func() _LRESULT {
|
||||||
|
r1, _, _ := defWindowProc.Call(
|
||||||
|
uintptr(hwnd),
|
||||||
|
uintptr(uMsg),
|
||||||
|
uintptr(wParam),
|
||||||
|
uintptr(lParam))
|
||||||
|
return _LRESULT(r1)
|
||||||
|
}
|
||||||
|
|
||||||
switch uMsg {
|
switch uMsg {
|
||||||
case _WM_PAINT:
|
case _WM_PAINT:
|
||||||
paintArea(s)
|
paintArea(s)
|
||||||
|
@ -479,22 +488,25 @@ func areaWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lPara
|
||||||
// TODO make this unnecessary
|
// TODO make this unnecessary
|
||||||
if s != nil && s.hwnd != 0 { // this message can be sent before s is assigned properly
|
if s != nil && s.hwnd != 0 { // this message can be sent before s is assigned properly
|
||||||
scrollArea(s, wParam, _SB_VERT)
|
scrollArea(s, wParam, _SB_VERT)
|
||||||
}
|
|
||||||
return 0
|
return 0
|
||||||
|
}
|
||||||
|
return defwndproc()
|
||||||
case _WM_SIZE:
|
case _WM_SIZE:
|
||||||
// TODO make this unnecessary
|
// TODO make this unnecessary
|
||||||
if s != nil && s.hwnd != 0 { // this message can be sent before s is assigned properly
|
if s != nil && s.hwnd != 0 { // this message can be sent before s is assigned properly
|
||||||
adjustAreaScrollbars(s)
|
adjustAreaScrollbars(s)
|
||||||
}
|
|
||||||
return 0
|
return 0
|
||||||
|
}
|
||||||
|
return defwndproc()
|
||||||
case _WM_MOUSEACTIVATE:
|
case _WM_MOUSEACTIVATE:
|
||||||
// register our window for keyboard input
|
// register our window for keyboard input
|
||||||
// (see http://www.catch22.net/tuts/custom-controls)
|
// (see http://www.catch22.net/tuts/custom-controls)
|
||||||
r1, _, err := _setFocus.Call(uintptr(s.hwnd))
|
r1, _, err := _setFocus.Call(uintptr(s.hwnd))
|
||||||
if r1 == 0 { // failure
|
if r1 == 0 { // failure
|
||||||
panic(fmt.Errorf("error giving Area keyboard focus: %v", err))
|
panic(fmt.Errorf("error giving Area keyboard focus: %v", err))
|
||||||
}
|
|
||||||
return _MA_ACTIVATE // TODO eat the click?
|
return _MA_ACTIVATE // TODO eat the click?
|
||||||
|
}
|
||||||
|
return defwndproc()
|
||||||
case _WM_MOUSEMOVE:
|
case _WM_MOUSEMOVE:
|
||||||
areaMouseEvent(s, 0, false, 0, wParam, lParam)
|
areaMouseEvent(s, 0, false, 0, wParam, lParam)
|
||||||
return 0
|
return 0
|
||||||
|
@ -532,6 +544,19 @@ func areaWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lPara
|
||||||
case _WM_KEYUP:
|
case _WM_KEYUP:
|
||||||
areaKeyEvent(s, true, wParam, lParam)
|
areaKeyEvent(s, true, wParam, lParam)
|
||||||
return 0
|
return 0
|
||||||
|
// Alt+[anything] and F10 send these instead
|
||||||
|
case _WM_SYSKEYDOWN:
|
||||||
|
handled := areaKeyEvent(s, false, wParam, lParam)
|
||||||
|
if handled {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return defwndproc()
|
||||||
|
case _WM_SYSKEYUP:
|
||||||
|
handled := areaKeyEvent(s, true, wParam, lParam)
|
||||||
|
if handled {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return defwndproc()
|
||||||
case msgSetAreaSize:
|
case msgSetAreaSize:
|
||||||
s.areawidth = int(wParam) // see setAreaSize() in sysdata_windows.go
|
s.areawidth = int(wParam) // see setAreaSize() in sysdata_windows.go
|
||||||
s.areaheight = int(lParam)
|
s.areaheight = int(lParam)
|
||||||
|
@ -539,12 +564,7 @@ func areaWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lPara
|
||||||
repaintArea(s) // this calls for an update
|
repaintArea(s) // this calls for an update
|
||||||
return 0
|
return 0
|
||||||
default:
|
default:
|
||||||
r1, _, _ := defWindowProc.Call(
|
return defwndproc()
|
||||||
uintptr(hwnd),
|
|
||||||
uintptr(uMsg),
|
|
||||||
uintptr(wParam),
|
|
||||||
uintptr(lParam))
|
|
||||||
return _LRESULT(r1)
|
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("areaWndProc message %d did not return: internal bug in ui library", uMsg))
|
panic(fmt.Sprintf("areaWndProc message %d did not return: internal bug in ui library", uMsg))
|
||||||
}
|
}
|
||||||
|
|
1
todo.md
1
todo.md
|
@ -87,6 +87,7 @@ super ultra important things:
|
||||||
- references: https://github.com/glfw/glfw/blob/master/src/win32_window.c#L182, http://www.catch22.net/tuts/custom-controls
|
- references: https://github.com/glfw/glfw/blob/master/src/win32_window.c#L182, http://www.catch22.net/tuts/custom-controls
|
||||||
- Area redraw on Windows is still a bit flaky, especially after changing the Area size to something larger than the window size and then resizing the window(???)
|
- Area redraw on Windows is still a bit flaky, especially after changing the Area size to something larger than the window size and then resizing the window(???)
|
||||||
- despite us explicitly clearing the clip area on Windows, Area still doesn't seem to draw alpha bits correctly... it appears as if we are drawing over the existing image each time
|
- despite us explicitly clearing the clip area on Windows, Area still doesn't seem to draw alpha bits correctly... it appears as if we are drawing over the existing image each time
|
||||||
|
- on Windows, Shift+(num pad key) triggers the shifted key code when num lock is off; will need to reorder key code tests on all platforms to fix this
|
||||||
|
|
||||||
important things:
|
important things:
|
||||||
- make specific wording in documentation consistent (make/create, etc.)
|
- make specific wording in documentation consistent (make/create, etc.)
|
||||||
|
|
Loading…
Reference in New Issue