slang 2
Did some upgrading to slang 2 in my packages today. It was fairly painless, except in pdmenu, which got a bit too close to slang's internals in its shadow generation code to survive the upgrade.
Pdmenu used to use SLSMG_BUILD_CHAR
to construct a raw character, after
using SLSMG_EXTRACT_CHAR
to pull the character that needed to be shadowed
from the screen. But slang 2's UTF-8 support means that SLSMG_EXTRACT_CHAR
doesn't always work, and SLSMG_BUILD_CHAR
is removed entirely. Since
SLsmg_Char_Type
is now a structure, I hoped I could just call
SLsmg_char_at
, set its color to black and SLsmg_write_raw
the character
back to the screen, but this doesn't work right for line drawing
characters. I put in a quick workaround of just drawing a pure black
character for a shadow, instead of the nice black background with dim
character that pdmenu was able to display before. Probably there's an easy
way that I'm missing.
(Thanks to JED and since this is getting passed around a bit, the answer is
SLsmg_set_color_in_region
)
On the very much plus side, I recompiled aalib with slang 2 and it just worked. Including supporting binaries built for the old slang 1 aalib; and even binaries built against the new aalib work with the old one. So messy incompatable updates of the aalib/sdl library chain seem to have been avoided.
Upgrading Term::Slang to slang2 was interesting. Thought I'd forgotten all that perl XS stuff.