Comment I just added to gpmevent.c after trying to get the mouse cursor
drawing correctly. This only happens if you attach to a running XEmacs.
/* Ok, now this is just freaky. Bear with me though.
**
** If you run gnuclient and attach to a XEmacs running in
** X or on another TTY, the mouse cursor does not get
** drawn correctly. This is because the ioctl() fails
** with EPERM because the TTY specified is not our
** controlling terminal. If you are the superuser, it
** will work just spiffy. The appropriate source file (at
** least in linux 2.2.x) is
** .../linux/drivers/char/console.c in the function
** tioclinux(). The following bit of code is brutal to
** us:
**
** if (current->tty != tty && !suser())
** return -EPERM;
**
** I even tried setting us as a process leader, removing
** our controlling terminal, and then using the TIOCSCTTY
** to set up a new controlling terminal, all with no luck.
**
** What is even weirder is if you run XEmacs in a VC, and
** attach to it from another VC with gnuclient, go back to
** the original VC and hit a key, the mouse pointer
** displays (in BOTH VCs), until you hit a key in the
** second VC, after which it does not display in EITHER
** VC. Bizarre, no?
**
** All I can say is thank god Linux comes with source code
** or I would have been completely confused. Well, ok,
** I'm still completely confused. I don't see why they
** don't just check the permissions on the device
** (actually, if you have enough access to it to get the
** console's file descriptor, you should be able to do
** with it as you wish, but maybe that is just me).
**
** William M. Perry - Nov 9, 1999
*/
If anybody cares to wade through linux/drivers/char/ and show me a way to
get this working, the appropriate files are tty_io.c and console.c.
The reason they do the check (I think) is that so somebody can't just call
an ioctl() to set the selection on a VC that they do not own, and then call
the ioctl() to do a paste, in effect getting a screendump of that other
VC. It is still annoying though.
*sigh*
Any Linux kernel jockeys out there that can get this working? Without a
kernel patch? :)
-Bill P.