TIOCLINUX and gpm

ethan on 2005-03-03T06:56:17

For ages I've been looking for a way to make gpm's selection on the console available under X and vice versa. Yesterday I decided that I should take steps to rectify this. Looking at gpm's sources, it all looked straight-forward. With the TIOCLINUX ioctl one can put the current selection into the kernel's selection buffer or make the kernel paste it to a given file-descriptor.

At this point however the idiocy begins: There is no way to get a copy of the kernel's selection buffer. All you can do with it is having the kernel write it to a file-descriptor which has to be attached to a device capable of TIOCLINUX. This is not very helpful. I want to get the actual content of this buffer and pass it to an application such as xclip. But there is no infrastructure in the kernel for that. Even worse, after googling around a little I noticed that a few years ago someone actually provided a patch to console.c which would allow that. For some reason the kernel nitwits rejected it.

Fortunately my kernel is out-of-date anyway so I have to compile a new one. This time I'll make the necessary adjustments to the source, extend gpm a bit to pass the selection to xclip and then hopefully have a more useful mouse.