# xclick: press the left button at screen points through the XTEST extension. # # Test harness only -- it never goes into an image. Psion's X server reads its # pointer through tslib, which accepts only a touchscreen, and QEMU's # versatilepb has none, so the emulator cannot click anything. XTEST injects # the press inside the X server instead, exactly as a tap would arrive. # # LD_LIBRARY_PATH=/guitest-lib DISPLAY=:0 /guitest-xclick 787 135 [x y ...] # # A "d" before a point double-clicks it (GtkTreeView activates rows that way): # /guitest-xclick 787 135 d 400 300 # # Psion's image has no libXtst, so the harness lends this chroot's copy too. set -x rm -rf /build/out; mkdir -p /build/out/bin /build/out/lib mkdir -p /build/xclick; cd /build/xclick cat > xclick.c <<'EOF' #include #include #include #include #include #include int main(int argc, char **argv) { int i, n, ev, er, maj, min, dbl = 0; Display *d = XOpenDisplay(NULL); if (!d) { fprintf(stderr, "xclick: cannot open display\n"); return 1; } if (!XTestQueryExtension(d, &ev, &er, &maj, &min)) { fprintf(stderr, "xclick: the X server has no XTEST\n"); return 1; } for (i = 1; i < argc; i++) { int x, y; if (strcmp(argv[i], "d") == 0) { dbl = 1; continue; } if (i + 1 >= argc) break; x = atoi(argv[i]); y = atoi(argv[++i]); XTestFakeMotionEvent(d, -1, x, y, CurrentTime); XSync(d, False); usleep(300000); for (n = 0; n < (dbl ? 2 : 1); n++) { XTestFakeButtonEvent(d, 1, True, CurrentTime); XSync(d, False); usleep(dbl ? 60000 : 150000); XTestFakeButtonEvent(d, 1, False, CurrentTime); XSync(d, False); usleep(dbl ? 60000 : 0); } printf("xclick: %s %d,%d\n", dbl ? "double-clicked" : "clicked", x, y); fflush(stdout); dbl = 0; sleep(10); } XCloseDisplay(d); return 0; } EOF gcc-3.4 -O2 -o xclick xclick.c -lXtst -lXext -lX11 echo "RC=$?" cp xclick /build/out/bin/ cat /usr/lib/libXtst.so.6 > /build/out/lib/libXtst.so.6 # busybox cp has no -L ls -l /build/out/bin /build/out/lib