app: [Windows] include keyboard modifiers in move, drag, and scroll pointer events

This matches the behavior on Linux and macOS.

Signed-off-by: Dominik Honnef <dominik@honnef.co>
This commit is contained in:
Dominik Honnef
2023-04-15 01:11:15 +02:00
committed by Elias Naur
parent b6e0376ad2
commit cda73efa6a
+5 -3
View File
@@ -309,11 +309,12 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr
Position: p, Position: p,
Buttons: w.pointerBtns, Buttons: w.pointerBtns,
Time: windows.GetMessageTime(), Time: windows.GetMessageTime(),
Modifiers: getModifiers(),
}) })
case windows.WM_MOUSEWHEEL: case windows.WM_MOUSEWHEEL:
w.scrollEvent(wParam, lParam, false) w.scrollEvent(wParam, lParam, false, getModifiers())
case windows.WM_MOUSEHWHEEL: case windows.WM_MOUSEHWHEEL:
w.scrollEvent(wParam, lParam, true) w.scrollEvent(wParam, lParam, true, getModifiers())
case windows.WM_DESTROY: case windows.WM_DESTROY:
w.w.Event(ViewEvent{}) w.w.Event(ViewEvent{})
w.w.Event(system.DestroyEvent{}) w.w.Event(system.DestroyEvent{})
@@ -518,7 +519,7 @@ func coordsFromlParam(lParam uintptr) (int, int) {
return x, y return x, y
} }
func (w *window) scrollEvent(wParam, lParam uintptr, horizontal bool) { func (w *window) scrollEvent(wParam, lParam uintptr, horizontal bool, kmods key.Modifiers) {
x, y := coordsFromlParam(lParam) x, y := coordsFromlParam(lParam)
// The WM_MOUSEWHEEL coordinates are in screen coordinates, in contrast // The WM_MOUSEWHEEL coordinates are in screen coordinates, in contrast
// to other mouse events. // to other mouse events.
@@ -538,6 +539,7 @@ func (w *window) scrollEvent(wParam, lParam uintptr, horizontal bool) {
Position: p, Position: p,
Buttons: w.pointerBtns, Buttons: w.pointerBtns,
Scroll: sp, Scroll: sp,
Modifiers: kmods,
Time: windows.GetMessageTime(), Time: windows.GetMessageTime(),
}) })
} }