Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gesture/gesture.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"gioui.org/unit"
)

// The duration is somewhat arbitrary.
const doubleClickDuration = 200 * time.Millisecond
// 400 ms is GTK's default gtk-double-click-time.
const doubleClickDuration = 400 * time.Millisecond

// Hover detects the hover gesture for a pointer area.
type Hover struct {
Expand Down
10 changes: 10 additions & 0 deletions gesture/gesture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ func TestMouseClicks(t *testing.T) {
100*time.Millisecond+doubleClickDuration+1),
clicks: []int{1, 1},
},
{
label: "double click 300ms apart",
events: mouseClickEvents(100*time.Millisecond, 400*time.Millisecond),
clicks: []int{1, 2},
},
{
label: "two single clicks 500ms apart",
events: mouseClickEvents(100*time.Millisecond, 600*time.Millisecond),
clicks: []int{1, 1},
},
} {
t.Run(tc.label, func(t *testing.T) {
var click Click
Expand Down