ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] [Patch] digraph support


From: Nikolai Weibull
Subject: [RP] [Patch] digraph support
Date: Sun, 25 Feb 2007 17:51:11 -0000

This patch adds two commands, 'digraph' and 'definedigraph'.

These two commands allow for digraphs to be entered through ratpoison,
which makes it possible for users to type a sequence of two characters
and have that be transformed into a third character that is
subsequently sent to the current window.  This is useful for entering
hard-to-type characters, like ", å, or █.

There's a default table of digraphs as defined in RFC 1345 (basically
ripped from Vim and transformed to use KeySyms instead of characters).
Not all characters have a KeySym, though, so some have been excluded.
There may be KeySyms available for these as well, however, I simply
haven't checked beyond having a program autogenerate them for me
(XStringToKeysym basically, passing in the string "Ux", for each
character x).

There are a couple of issues with this patch that someone more
knowledgeable with X11 can hopefully fix:

1.  The default table uses fixed values for the result keysyms.  I'm
not sure this is correct.  I simply took the Unicode value of each
character and turned them into a keysym using XStringToKeysym.  This
could be done at runtime, but I didn't want to do any sprintf() calls
followed by XStringToKeysym calls to do so.  This is an easy one to
fix, though, so if XStringToKeysym isn't guaranteed to return the same
value on all systems for a given input, this will have to be fixed.

2.  The function caseify_keysym() doesn't seem to be able to fix the
case of keysyms, so entering 'A', 'A' doesn't give you a capital å
(see?) as it should, instead resulting in å.  Probably an easy fix as
well, but I wasn't able to figure it out and I'm not going to bang my
head with my fists over this one any more.

3.  The function send_keys() doesn't restore the keyboard mapping
after it's done.  I had to remove the code that did that part as it
was hindering Firefox from receiving the correct keycode.  I have no
idea why this is.  Again, someone more knowledgeable with X11 can
hopefully shed some light.

4.  I'm not sure the interface definedigraph has is the best one.  It
takes three arguments, the two keysyms and a string fed to
XStringToKeysym.  It works, though, so I left it as is until someone
comes up with a better one.

I'm attaching the patch, as I'm not sure that GMail won't interfere
with the formatting.

 nikolai

Attachment: digraph.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]