summaryrefslogtreecommitdiff
path: root/tests/x11/test_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/x11/test_input.c')
-rw-r--r--tests/x11/test_input.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/x11/test_input.c b/tests/x11/test_input.c
index bbcbf45..95943d1 100644
--- a/tests/x11/test_input.c
+++ b/tests/x11/test_input.c
@@ -65,6 +65,37 @@ static void check_selection_encoding(struct x11_display *d, struct x11_surface *
}
}
+/* Own the XSETTINGS selection with one Net/DoubleClickTime value. */
+static void check_double_click(struct x11_display *d)
+{
+ /* No settings owner and no portal: the default applies. */
+ unsetenv("DBUS_SESSION_BUS_ADDRESS");
+ unsetenv("XDG_RUNTIME_DIR");
+ assert(yasl_display_double_click_ms(&d->base) == YASL_DOUBLE_CLICK_MS_DEFAULT);
+
+ char name[32];
+ snprintf(name, sizeof(name), "_XSETTINGS_S%d", d->screen);
+ Atom selection = XInternAtom(d->native, name, False);
+ Atom property = XInternAtom(d->native, "_XSETTINGS_SETTINGS", False);
+ Window owner = XCreateSimpleWindow(d->native, DefaultRootWindow(d->native),
+ 0, 0, 1, 1, 0, 0, 0);
+ XSetSelectionOwner(d->native, selection, owner, CurrentTime);
+ static const unsigned char blob[] = {
+ LSBFirst, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 19, 0, 'N', 'e', 't', '/', 'D', 'o', 'u', 'b', 'l', 'e',
+ 'C', 'l', 'i', 'c', 'k', 'T', 'i', 'm', 'e', 0, 0, 0, 0, 0,
+ 250, 0, 0, 0,
+ };
+ XChangeProperty(d->native, owner, property, property, 8, PropModeReplace,
+ blob, sizeof(blob));
+ XSync(d->native, False);
+ assert(yasl_display_double_click_ms(&d->base) == 250);
+
+ XDestroyWindow(d->native, owner);
+ XSync(d->native, False);
+ assert(yasl_display_double_click_ms(&d->base) == YASL_DOUBLE_CLICK_MS_DEFAULT);
+}
+
int main(void)
{
struct yasl_display_spec ds = {.backend = YASL_BACKEND_X11};
@@ -117,6 +148,7 @@ int main(void)
XFree(saved);
s->ic = saved_ic;
check_selection_encoding(d, s);
+ check_double_click(d);
/* Test CSD interactive actions, window menu, and IME caret */
assert(yasl_display_caps(base) & YASL_CAP_CSD);