github.com/as/shiny@v0.8.2/driver/win32/scroll.go (about)

     1  // +build windows
     2  
     3  package win32
     4  
     5  import (
     6  	"syscall"
     7  
     8  	"github.com/as/shiny/event/mouse"
     9  	"github.com/as/shiny/screen"
    10  )
    11  
    12  type Scroll = mouse.Event
    13  
    14  func sendScrollEvent(hwnd syscall.Handle, _ uint32, wp, lp uintptr) (lResult uintptr) {
    15  
    16  	// Convert from screen to window coordinates.
    17  	p := Point{int32(uint16(lp)), int32(uint16(lp >> 16))}
    18  	ScreenToClient(hwnd, &p)
    19  
    20  	e := mouse.Event{
    21  		X:         float32(p.X),
    22  		Y:         float32(p.Y),
    23  		Modifiers: keyModifiers(),
    24  		Direction: mouse.DirStep,
    25  		Button:    mouse.ButtonWheelDown,
    26  	}
    27  	if int16(wp>>16) > 0 {
    28  		e.Button = mouse.ButtonWheelUp
    29  	}
    30  
    31  	screen.SendScroll(e)
    32  	return
    33  }