2015/07/25

libtickit terminal size handling

I've recently been working on the Window layer in the C library libtickit (a migration to C from my Tickit perl distribution). It's very-almost ready now - I think we have all the code and tests ported from Perl (with the single exception of the extended drag-and-drop events whose names start "drag_..."). I haven't yet done the docs though.

I've also been adding/fixing a few other bits in the core code. Two new term-related functions make actually writing programs a little neater:

void tickit_term_observe_sigwinch(TickitTerm *tt, bool observe);
manpage
TickitTerm *tickit_term_open_stdio(void);
manpage

This latter convenience function makes all the examples a few lines shorter, and while it's at it, enables the SIGWINCH behaviour. That ensures that the TickitTerm instance actually sends EV_RESIZE events when the terminal is resized. Previously C programs couldn't actually detect that one; it was done in the Perl layer using a handler on $SIG{WINCH}.

2 comments:

  1. I'm glad you're doing this. I plan to port my application tdiff3 to libtickit and remove the dodgy mix of ncurses/libtermkey that I'm using now.

    ReplyDelete
    Replies
    1. That's good, because libtermkey is dead, EOL. It will be merged in to libtickit and stop living as its own entity.

      I should write a post about that too in fact.

      Delete