From ece931a1194db9f2c9db8c9bb35fb0b33ba1b8fa Mon Sep 17 00:00:00 2001 From: omartelo Date: Sun, 8 Nov 2026 17:53:43 -0300 Subject: [PATCH] gesture: raise the double click window to 400 ms --- gesture/gesture.go | 4 ++-- gesture/gesture_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gesture/gesture.go b/gesture/gesture.go index cf761f1d..7bb18022 100644 --- a/gesture/gesture.go +++ b/gesture/gesture.go @@ -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 { diff --git a/gesture/gesture_test.go b/gesture/gesture_test.go index ce6403fe..516f4161 100644 --- a/gesture/gesture_test.go +++ b/gesture/gesture_test.go @@ -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