A new extension called ntk is being written for Win32 and X11. Ntk is going to replace the Tk layer currently used by NexTk and the megaimagetk widget.

The code is hosted here: http://megapkg.googlecode.com/svn/trunk/csrc/ntk/

Ntk (.dll/.so) provides:

  • event handling for Win32 and X11 that evaluates Tcl-side callbacks.
  • fast megaimage display using XShm and DBE with X11
  • selection control (copy/paste)
  • the ability to create system windows to host NexTk windows.
  • window destruction
  • window movement/resize requests


George Peter Staplin April 11, 2008 - ntk.dll works much better for Windows. The speed is quite usuable on most modern machines. The default now uses OpenGL for the display backend, so the actual content is represented as an OpenGL texture. The OpenGL can be disabled if a DIB is better, at runtime via: set ::env(NTK_DISABLE_GL) 1

Ntk is now multiple-interp safe. It should be easy to make it thread safe too.

Ntk is being used for 2 portable webcam viewers in addition to NexTk.

George Peter Staplin Dec 19, 2007 - Ntk works much better in Windows. I'm using CreateDIBSection() for the bitmap, which has removed some indirection and improved performance.

I added XShm pixmap support to remove a little indirection in the cases where XShm pixmaps are available. The XShmPutImage path is still valid too. I reimplemented some of the double-buffering code that uses the X DBE extension.

The keyboard input for Win32 could use some improvement/polish. I'm not sure it works yet. I also need to test the selection and write a widget that allows for copying/pasting the selection. I also plan to add the ability to NexTk to copy and paste graphics (as megaimage buffers), and sounds.

The X11 code for selection is also not quite right yet. Who would have thought it would be so difficult to copy text in X11? Well apparently Keith Packard did. He wrote about paper about it here: http://keithp.com/~keithp/talks/selection.ps and in PDF form: http://www.msu.edu/~huntharo/xwin/docs/xwindows/selection.pdf

For more info, see NexTK.