Skip to content

x/exp/shiny: MacOS driver does not fire mousewheel events with single or slow clicks #16152

@driusan

Description

@driusan

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

go version go1.6.2 darwin/amd64

  1. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GOOS="darwin"
    GOPATH="/Users/driusan/Code/Go"
    GORACE=""
    GOROOT="/usr/local/go"
    GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
    GO15VENDOREXPERIMENT="1"
    CC="clang"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
    CXX="clang++"
    CGO_ENABLED="1"
  2. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

Ran x/exp/shiny/example/basic, scrolled mouse a single click with the scroll wheel on a mouse

  1. What did you expect to see?

Output similar to:

got mouse.Event{X:824, Y:452, Button:-1, Modifiers:0x0, Direction:0x0}

in the console.

  1. What did you see instead?

Nothing.

Adding some debug statements, it seems that the issue is that this line:

for delta := int(dy); delta != 0; delta--

in driver/gldriver/cocoa.go:/func mouseEvent/ isn't iterating at all when dy < 1 and the conversion is rounding to 0 when it casts to an int.

Changing it to:
for delta := int(math.Ceil(float64(dy))); delta != 0; delta--

if a little inelegant, fixed the issue for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Darwin

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions