Skip to content

Removing support for older Mutter versions

Leonhard edited this page Mar 13, 2025 · 1 revision

If you've looked through Gala source code you probably have come across sections that looked like this:

#if HAS_MUTTER46
        display.get_compositor ().backend.ungrab_keyboard (display.get_current_time ());
#else
        display.ungrab_keyboard (display.get_current_time ());
#endif

These are required because for one Mutter allows API breaks every release. Additionally Mutter has a release cycle of 6 months whereas elementary - being based on Ubuntu LTS - currently has a release cycle of two years. So in order to prepare support for newer Mutter versions - but still being able to compile for the version that is shipped with the current elementary OS - these compile time conditions are required.

Now once a newer version of elementary is released the support for older Mutter versions can be removed (though it is recommended to check with third party packagers for other distros first).

Let's say the Mutter version shipped with the latest elementary OS is 46. Note here that while in most places it will say 46 in other places it will say 14 which is the actual library version. In the future the mapping should stay the same so 46 = 14, 47 = 15, etc.

  1. Now in order to remove support for all versions that are older than 46 you first run
python3 tools/remove_mutter_versions.py . 46

This will remove the if/else blocks from all .vala and .vapi files that support mutter versions older than 46.

  1. Next you update meson.build and remove all mutterX_dep where X < 46. Do the same in vapi/meson.build
  2. For the last step go into the vapi directoy and remove all files that are for versions < 14. You might have to relink the new oldest version so in this case 14 to the corresponding files without a version number.

That's it! Just to be safe you probably should do a manual check on the diff created by the script but now you should be good to go.

For an example see https://github.com/elementary/gala/pull/2221

Clone this wiki locally