slang-users mailing list

[2001 Date Index] [2001 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Access to terminfo-specific capabilities


Hello, John!

> Pavel Roskin <proski@xxxxxxx> wrote:
> >SLtt_tigetstr() in S-Lang 1.4.4 accepts termcap names only and doesn't
> >fallback to the raw terminfo names, such as "kmous".
>
> Use "Km".  Most terminfo man pages give both the terminfo names and
> their termcap equivalents.

Thank you.  Sorry that I missed this.  Now CVS version of Midnight
Commander uses "Km" if it's linked with S-Lang.

> Incidently, I looked into writing a wrapper around the "kmous"
> capability sometime last year.  However, I concluded that either I did
> not understand how to use this terminfo feature (its poorly
> documented), or that its addition to the terminfo database was poorly
> thought out.  As I recall, there was a terminfo capability to enable
> mouse use ("Gm"), but no corresponding ability to disable it.  A
> properly behaved program needs to do both.  In addition, there was no
> specification on how one is to parse the escape sequence to determine
> the mouse position.  In other words, one pretty much has to assume the
> xterm mouse protocol, and hard-code support for it, which defeats the
> purpose of having its specification in the terminfo database.

Midnight Commander used only hardcoded values.  Now the "kmous" capability
will be used if available, but all other sequences remain hardcoded.

By the way, I was very surprised to find the "kmous" capability defined
for TERM=linux on RedHat 7.1 (packages termcap-11.0.1-8 and
ncurses-5.2-8).  It looks like that gpm can emulate xterm-style mouse
reporting, but MC is linked with libgpm and does something on the low
level instead.

> Finally, the meaning of the "kmous" capability appears to be open to
> interpretation making its use somewhat non-portable.  The following
> text was extracted from the terminfo man page:
>
>        Be  careful  assigning  the kmous capability.  The ncurses
>        wants to interpret it as KEY_MOUSE, for use  by  terminals
>        and  emulators  like  xterm that can return mouse-tracking
>        information in the keyboard-input stream.

Actually, MC didn't support KEY_MOUSE until recently.  Instead, it tried
to turn of KEY_MOUSE interpretation by ncurses using keyok().  Since
keyok() didn't exist before ncurses-4.2, it was reimplemented using
redefined private "struct screen".  This structure was different in
different versions of ncurses, so the padding was dependent on the ncurses
version.  A test in configure.in checked version of ncurses for that
purpose.  Also there was a special case for QNX :-)

A few days ago I added support KEY_MOUSE (one line) and removed all that
ugly stuff (about 3k, I believe).  That's the difference between porting
and makeing code portable.

Just for your information (and amusement).

-- 
Regards,
Pavel Roskin


[2001 date index] [2001 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]