From ac6f9f5e7711521455b83ceb843a25e091646d43 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 17:08:48 +0300 Subject: Report the system double-click interval wsap_term hardcodes 400 ms in three places to count clicks. yasl_display_double_click_ms() reads the interval from the system. X11 parses Net/DoubleClickTime from the XSETTINGS owner's property. Wayland has no protocol for it, so it asks the Settings portal for KDE's DoubleClickInterval, which KDE sends as a string and which exists only when the user set it, then GNOME's double-click. X11 without XSETTINGS asks the portal too. Cocoa reads NSEvent.doubleClickInterval. Missing or implausible values give YASL_DOUBLE_CLICK_MS_DEFAULT, 400 ms. The X11 state test covers the XSETTINGS parser in both byte orders and with truncation. The Xwayland test owns the settings selection. The desktop test serves both portal keys. The Cocoa path is not built or run here. Co-Authored-By: Claude Opus 5.5 --- include/yasl/yasl.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/yasl/yasl.h b/include/yasl/yasl.h index 973c39d..7c9bfbd 100644 --- a/include/yasl/yasl.h +++ b/include/yasl/yasl.h @@ -568,6 +568,20 @@ YASL_API void yasl_display_flush(struct yasl_display *d); * For an individual event use its own mods field instead. */ YASL_API int yasl_display_modifiers(const struct yasl_display *d); +/** Double-click interval used when the system reports none. */ +#define YASL_DOUBLE_CLICK_MS_DEFAULT 400 +/** + * Read the system's double-click interval. + * @param d Display, or NULL. + * @return Maximum milliseconds between the clicks of a double click, or + * YASL_DOUBLE_CLICK_MS_DEFAULT when d is NULL or the system reports none. + * X11 reads the XSETTINGS Net/DoubleClickTime value. Wayland, and X11 without + * XSETTINGS, read the KDE or GNOME setting through the XDG Settings portal, + * which needs D-Bus and can wait briefly. Cocoa reads the system interval. + * The user can change it at any time; read it again when a window gains focus + * rather than on every click. + */ +YASL_API int yasl_display_double_click_ms(const struct yasl_display *d); /* Unsupported/invalid selections are no-ops, never clipboard aliases. */ /** * Offer a copy of a NUL-terminated UTF-8 string as a selection. -- cgit v1.2.3