[Tickit-dev] Released: Tickit 0.57 / Tickit::Window complications

Paul "LeoNerd" Evans leonerd at leonerd.org.uk
Mon Aug 8 11:59:29 BST 2016


On Wed, 10 Feb 2016 00:25:33 +0000
"Paul \"LeoNerd\" Evans" <leonerd at leonerd.org.uk> wrote:

> With these changes in place, I've been able to update all the
> remaining parts of my code that was relying on the Perl
> implementation of Tickit::Window. That still remains in 0.55, but I
> am hoping this will be the last release to be using a
> Perl-implemented Window layer.

Ahhh, the naive optimism of youth.

Turns out this is going to be a harder transition than first thought.
The principle blocking factor is the fact that a program using the
tickit_window(7) API can discover new window instances (via
tickit_window_parent(3), tickit_window_root(3), and others) that other
bits of code created, whereas terms, renderbufs, etc... only come into
existence by explicit request. This puts awkward complications on the
Tickit::Window XS code.

These issues are made easier if the perl level doesn't need any extra
fields on top of what's available in C, and so the XS wrapping wouldn't
need to wrap them. Currently there's a few extra bits of data, which
this release, Tickit 0.57, is starting to address.

  * Add $win->bind_event; announce the legacy $win->set_on_* as
    deprecated

    This release of Tickit adds to Tickit::Window the same ->bind_event
    API that's been in Tickit::Term for a while. The intention here is
    to switch widget classes into using that ASAP, so that the previous
    versions of set_on_* can be removed. This API then matches the C
    library, which will make wrapping it easier.

In addition, Tickit 0.56 performed more deprecations:

  * Remove pen observers

    Without observers, pens are more amenable to shared references,
    because it's even less likely they'll be mutated. At some point the
    C library will gain reference counts on pen instances, allowing
    them to be shared rather than copied by the renderbuffer, for a
    nice performance boost.

      https://blueprints.launchpad.net/libtickit/+spec/immutable-pens
      https://blueprints.launchpad.net/libtickit/+spec/refcount-pens

  * Remove guarantee that perl-level IO handles are preserved by
    Tickit::Term

    With this in place, we no longer guarantee that fetching the IO
    handle back out of a Tickit::Term will necessarily give the same
    perl-level handle instance. This lets us forget what the object
    instance actually was and re-create another one from the C level
    functions. This allows us to remove the extra data that did store
    the Perl-level handle.

  * Add deprecations warnings to Tickit::Term ->set_on_* event handlers

    Allowing us to eventually remove the set_on_* event handlers from
    the Term level, which lets us remove more extra data that the Perl
    level has to store, being the bind IDs for each event type.

At this point, existing widget classes should be updated to use the new
$win->bind_event API rather than the legacy ->set_on_* event handlers.
The old ones are going to be removed soon, according to the deprecation
policy list:

  https://github.com/ingydotnet/tickit-info/blob/master/TickitDeprecations.md

-- 
Paul "LeoNerd" Evans

leonerd at leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://mail.leonerd.org.uk/pipermail/tickit-dev/attachments/20160808/062517b0/attachment.sig>


More information about the Tickit-dev mailing list