mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
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:
committed by
Elias Naur
parent
b6e0376ad2
commit
cda73efa6a
+16
-14
@@ -304,16 +304,17 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr
|
|||||||
x, y := coordsFromlParam(lParam)
|
x, y := coordsFromlParam(lParam)
|
||||||
p := f32.Point{X: float32(x), Y: float32(y)}
|
p := f32.Point{X: float32(x), Y: float32(y)}
|
||||||
w.w.Event(pointer.Event{
|
w.w.Event(pointer.Event{
|
||||||
Type: pointer.Move,
|
Type: pointer.Move,
|
||||||
Source: pointer.Mouse,
|
Source: pointer.Mouse,
|
||||||
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.
|
||||||
@@ -533,12 +534,13 @@ func (w *window) scrollEvent(wParam, lParam uintptr, horizontal bool) {
|
|||||||
sp.Y = -dist
|
sp.Y = -dist
|
||||||
}
|
}
|
||||||
w.w.Event(pointer.Event{
|
w.w.Event(pointer.Event{
|
||||||
Type: pointer.Scroll,
|
Type: pointer.Scroll,
|
||||||
Source: pointer.Mouse,
|
Source: pointer.Mouse,
|
||||||
Position: p,
|
Position: p,
|
||||||
Buttons: w.pointerBtns,
|
Buttons: w.pointerBtns,
|
||||||
Scroll: sp,
|
Scroll: sp,
|
||||||
Time: windows.GetMessageTime(),
|
Modifiers: kmods,
|
||||||
|
Time: windows.GetMessageTime(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user