exp/shiny/x11driver: Correctly convert mousewheel events

Change-Id: I4672445bd38c7622be085688020209e898581d38
Reviewed-on: https://go-review.googlesource.com/19893
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This commit is contained in:
Alessandro Arzilli 2016-02-25 13:04:18 +01:00 коммит произвёл Nigel Tao
Родитель 3b75128ce7
Коммит 6322a217d3
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -187,10 +187,17 @@ func (w *windowImpl) handleKey(detail xproto.Keycode, state uint16, dir key.Dire
func (w *windowImpl) handleMouse(x, y int16, b xproto.Button, state uint16, dir mouse.Direction) {
// TODO: should a mouse.Event have a separate MouseModifiers field, for
// which buttons are pressed during a mouse move?
btn := mouse.Button(b)
switch b {
case 4:
btn = mouse.ButtonWheelUp
case 5:
btn = mouse.ButtonWheelDown
}
w.Send(mouse.Event{
X: float32(x),
Y: float32(y),
Button: mouse.Button(b),
Button: btn,
Modifiers: x11key.KeyModifiers(state),
Direction: dir,
})