Skip to content

build: Add a Meta Toolkit private library

Bilal Elmoussaoui requested to merge bilelmoussaoui/meta-base-library into main

Currently, Cogl/Clutter makes use of cairo_rectangle_int_t despite the existence of MetaRectangle. Clutter also has a bunch of cairo_rectangle_int_t helper functions that are basically a copy of what exists in Meta.

We have discussed few weeks ago in IRC/Matrix that having a low level library containing common and shared types (like x11 trap errors?) between Meta/Clutter/Cogl would be a good approach.

This PR introduces Mtk (name to be discussed) with only MtkRectangle. Some of the commits could possibly be squashed as they are just moving things around and renaming but they would make the review simpler.

My main motivation here is to reduce the usage of Cairo in Mutter, I know MtkRectangle is still just a typedef of a cairo_rectangle_int_t but that will hopefully change once we either have a cairo_region_t replacement in graphene or we could have a very thin wrapper on top of Pixman that would be easy to replace once something better exists.

Still TODO:

  • Decide on a library name/namespace

  • Add docs for $Mtk

  • Clutter still has three rectangle related helpers, should those also be moved to mtk? i guess so

      * `_clutter_util_rect_from_rectangle` which seems to be `meta_rectangle_to_graphene_rect` with different signature (taking a pointer instead of returning the resulting graphene_rect_t)
      * `_clutter_util_rectangle_int_extents`, seems to be exactly like `meta_rectangle_from_graphene_rect` with `META_ROUNDING_STRATEGY_GROW`
      * `_clutter_util_rectangle_offset`, has no equivalent in meta
  • Meta still has various private meta_rectangle helpers, some of them should very probably be renamed to meta_region.... The remaining helpers could be moved later when/if needed.

  • Should some of the tests be moved from boxes-tests to some new tests/mtk?

  • Clean up the commits

GNOME Shell PR gnome-shell!2873 (merged)

Edited by Bilal Elmoussaoui

Merge request reports