[fpc-pascal]RE: XTest extension for fpc

Marc Santhoff M.Santhoff at t-online.de
Wed Mar 17 14:13:56 CET 2004


Am Mi, den 17.03.2004 schrieb Marc Santhoff um 10:18:
[...]
> It does compile. Wow!
> 
> So I'll go testing, stay tuned for the result ...

It is only stupid rubbish, but i works.

For reference i use the source of the tool "xte" from the "xautomation"
suite (see: http://hoopajoo.net/projects/xautomation.html).

Look:

program xtesttest;

uses sysutils, x, xlib, XTest;
var
	toSend : AnsiString;
	ch	   : AnsiString;
	i	   : integer;
	dpy	   : PDisplay;
	ks	   : TKeySym;
	kc	   : TKeyCode;
	
BEGIN
	dpy := XOpenDisplay(NIL);
	if NOT(dpy = NIL) then begin
		toSend := 'lalalalala';
		for i:= 0 to length(toSend)-1 do begin
			ch := copy(toSend,i+1,1);
			writeln(ch);
			ks := XStringToKeysym(pchar(ch));
			kc := XKeySymToKeycode( dpy, ks );
			XTestFakeKeyEvent( dpy, kc, longint(TRUE), CurrentTime );
			XTestFakeKeyEvent( dpy, kc, longint(FALSE), CurrentTime );
		end;

		XCloseDisplay( dpy );
	end;
	
END.

As already written, link against Xtst (fpc -k-lXtst ...).

Have fun,
Marc





More information about the fpc-pascal mailing list