Version 34 of TkXext

Updated 2006-11-21 18:12:37

TkXext is an extension to Tcl/Tk that provides the abilities to embed foreign applications (based on their title), record events to a script, and playback that script, and various other useful things related to these features.

  • Download: http://www.xmission.com/~georgeps/implementation/software/TkXext
  • What: TkXext
  • Description: Tk extension that can be used to automate applications for software testing, or application embedding.
  • Version: 3.6.11
  • Requires: X11 XTEST (usually part of the record module in XFree86)
  • Licensing: BSD/Tcl
  • Updated: Apr 17, 2006
  • Contact: george AT xmission DOT com

Partial Changes file:

3.6.11 - Tue Jun 6, 2006

I updated the build.SunOS.conf with an APP_CFLAGS example for the Sun C compiler.

I removed TkXext.make.window.exist from the TUTORIAL and demo.tcl. winfo id does its job for the cases in the TUTORIAL and the demo.

The demo is going to need some more work in the future. I noticed today that the xterm doesn't resize properly.

I updated the LICENSE with the year 2006.

3.6.10 - Fri Jun 2, 2006

I have added support for SunOS/Solaris thanks to Nick Matthews.

I have changed all build configuration files and tickmakefile, so that LD_RPATH is no longer hardcoded to use -rpath with ld. Apparently that is a GNU convention.

3.6.9 - Tue Apr 11, 2006

I added TkXext.delete.or.kill for sending the WM_DELETE_WINDOW message if the client supports it, or calling XKillClient if it doesn't.

I made TkXext use Tk's X error handler.

I cleaned up and improved the window find.c code. It now finds windows properly in Whim always. I also tested it in TWM.

I improved the embed_firefox.tcl example a great deal.

I upgraded the version number in all 3 places. We need a better mechanism for doing this I think.


TkXext is X-based; it's available only for Unix.

(more accurately, it's available as source, and good luck figuring out how to compile it under Microsoft Windows to work with Exceed [L1 ] or Reflection X [L2 ]... (do they even provide SDKs?) But if you do work it out, by all means let George know about it.)

George Peter Staplin: I didn't hear from you about any problems. I'd be glad to help you, so please let me know what problems you ran into with Exceed or Reflections/X. BTW I'll add a configure option for X11 header and library directories, because I would imagine you have problems related to that. When I originally wrote the configure script I didn't plan on supporting many systems.

(problems? no, I was just commenting that it was theoretically possible, and saying 'good luck' to whoever tries it... while I do have access to both of the above-named products, they are not part of my development enviroment. My comment about letting you know is because I'm sure you'd like to hear about it if someone does do that, and so that you can add any necessary stuff to your makefile to support that configuration. I note with some amusement that after I added my comment yesterday, I revised it slightly to correct a product name and add URL for Reflection X, and your adding of your response managed to zap my revision.)

escargo: What about Cygwin? I'm running the Blackbox Window Manager [L3 ] using Cygwin/XFree86 [L4 ] on Cygwin [L5 ].

George Peter Staplin: It probably would work under Cygwin's XFree86. I like Cygwin and their XFree86 port (used it for a while in NT 4), but for whatever reason the installer has a tendency to segfault in Windows XP Home. If it's fixed I may see what's needed (if anything) to make it work.

escargo: I am using Cygwin on Windows XP Professional. (I use the Blackbox Window Manager there; it makes people stare at my laptop, since it is obviously not Windows.) The only problems I had with setup were finding a reliable location on the internet to download from.

Here is a copy of the source and a binary shared library compiled on Slackware Linux 7.2 using Tcl/Tk 8.4a1. [L6 ] It compiled cleanly and worked great for me. I used it to embed the BRX web browser window into a frame inside a page in an Iwidget tabbed notebook.


JMN 2006-07-20

This built ok on FreeBSD-6.1-RELEASE, but I had to run 'brandelf -t Linux TkXext.so'. It also seemed a little big.. ~900KB.. so I ran 'strip --strip-unneeded' on it too and it shrank down to 15K.. I assume that won't cause any problems?

It seems to work just fine so far anyway - so thanks for the nice work! I'm using it to reparent qemu virtual machines. Unfortunately qemu doesn't seem to have an option to change it's window title. It's always just "QEMU". Is there any way to iterate over window titles to find window ids?

I also can't work out how to 'unparent' an application.. can that be done with TkXext at the moment?

George Peter Staplin 2006.07.20

That's odd JMN. I build it all the time in NetBSD (my default platform). The default build.conf uses -ggdb, because I wanted to make it easier to get debug information when bugs occur. So far I haven't heard about any bugs with the new features I added, so it can safely be removed. You shouldn't have to brandelf it as Linux. Try removing the -ggdb from LIB_CFLAGS and it should be tiny by default. If you want to reparent back to root then save the id from [TkXext.find.window], and then TkXext.reparent.window $id root. Root is a special window id name. That should do what you want. I could provide a way to fetch a list of window ids. If you have further ideas and descriptions of how you would use this I may add it.

JMN Strange.. I can't seem to duplicate that 'ELF' error I first got when trying to use it. Put it down to user error for now I guess!? It compiles smaller without -ggdb.. ta. The reparent to "root" is just what I wanted.. thanks.

As far as fetching a list of window ids.. would this be a slow operation? I notice TkExt.find.window takes many seconds to come back if you search for a nonexistant window title. I guess if the nature of the thing is that it can be slow.. some sort of callback operation would be nice.. so you could do a glob based search and get a callback for each hit... and presumably cancel the search if you find what you need early.. I don't know.. something like that.

What would make it really useful would be if you could get a little more than just the title back for each hit. I've no idea what sort of information is easily available - but at the very least, providing the current parent window id would mean I could reparent multiple QEMU windows and not accidentally grab one I've already reparented. Any other info about the window state, launch timestamp, or a link to the process id would of course also be nice. Just a list of lists suitable for accessing elements using dict or array get?

George Peter Staplin It takes some seconds, because TkXext.find.window assumes that if it doesn't find the window initially, that it hasn't been created yet. This is actually a feature in some cases. :) So it loops for a predetermined number of seconds "#define SEARCH_N_SECONDS_FOR_WINDOW 9", until it finds the window or returns None. I'll look into adding a way to get the list of windows associated with a certain window id. I've already written some code in the pwm.so extension I created for Whim in megapkg that does this. The pid of the associated window could be taken from the properties/hints (assuming that qemu sets a PID property of some kind). You can find out if the property is set with the xprop utility.


See also: Record and replay system for Tcl/Tk


[ Category Package | Category GUI ]