[ Home : Programs | libCVD | Hardware hacks | Publications | Teaching | TooN | Research ]

X11 programs

Clipboard and Drag 'n Drop

Fork me on Github!

A (nearly---the ICCCM specifies some modes which I've never seen in the wild and so I haven't implemented) complete demonstration of how to use the X11 clipboard and drag and drop systems. The paste program can ask for any kind of data from any clipboard and will output the data on the standard output. The XDnD (drag and drop) protocol exchanges data using the clipboard mechanism and the paste program includes the XDnD logic required to perform an XDnD transaction.

selection places an image in to any clipboard. Applications wishing to paste can paste it as an image or as the URL of the image. This program also includes XDnD logic, and can drop types on to a target.

Both programs can make use of either clipboard (in fact any clipboard for copy/paste operations). The only missing feature is the ability to handle very large selections, i.e. ones which are too large to fit in to a single property. Both programs print out all the salient data transmitted and received with respect to selections. It is quite interesting to see how different programs operate, and how they don't obey the ICCCM.

Both programs are written in C++ (mostly for convenience of C++ strings, and file handling and a few containers). All the X11 interaction code is in plain C, so it should be understandable to anyone without C++ experience.

Extensive documentation about the workings is included in paste.cc.
Download: x_clipboard-1.1.tar.gz
Browse: x_clipboard-1.1
Changelog: ChangeLog

Known bugs

Scribe

A stroke based input program. This program uses libstroke to recognise strokes drawn in its window, and then sends the key stroke corresponding to the stroke to the relevant window.
Download: scribe.tar.gz
Browse: scribe

Usage

scribe < letters > new_letters

The list of strokes is read from the standard input. These are written one per line, with the keysym name first and the stroke next. The stroke is written in libstroke format. New strokes are written to the standard output. If a stroke is unrecognised, then the window will flash. At this point, if you type a key in the window, then it will assosciate that key with the stroke.

Type "f" in the window to select which window keystrokes will be sent to.

Press "Escape" to exit cleanly and save the all strokes including any new ones.

Libstroke is required for this! The library seems to be stalled at 0.5.1, and not updated since 2001. But don't be fooled: this is because it works and is essentially finished.

It comes with a file called "letters" containing strokes for my handwriting.

Greasymouse

This program makes the mouse act as if it was on a greased surface. It makes clicking on buttons and icons something of an art-form. It's also a good illustration of why you should use X11 security. A variant of this program was also a winning entry in the 2001 IOCCC.
Download: greasymouse-1.0.tar.gz
Browse: greasymouse-1.0

Mousealert

This program draws converging concentric circles around the mouse cursor, making it easy to find the mouse.
Download: mousealert-1.0.tar.gz
Browse: mousealert-1.0

Shaped Windows

This program illustrates how to use the XShape extension. It is a silly program which draws an "Access Denied" window complete with sounds (on some systems). Look at line 48 if you want to know about shaped windows.
Download: shape.tar.gz
Browse: shape

Updated October 10th 2013, 11:22


Home : Programs | libCVD | Hardware hacks | Publications | Teaching | TooN | Research
* Programs : EPS to ARTK | Autoconf tutorial | Awk | Numerical Disasters in C | Floating point templates in C++ | Gnokiifs | Parallel | PostScript | Sed Hacking | X11 programs


ed (at) edwardrosten . com
Check HTML compliance