
Introduce some "best effort" conversion code to migrate monitor configurations from PHYSICAL (the old default) to LOGICAL (the new default on wayland) layout mode. This conversion will only be used when the old PHYSICAL layout-mode configuration is not compatible with the new LOGICAL layout-mode one. This only applies if 1) there's a monitor that needs scaling in the layout, and 2) the scaled monitor comes before other monitors in the coordinate system (ie. it's not the rightmost or bottommost monitor). There are two algorithms added here to convert monitor layouts: - One for "simple" 1-dimensional monitor layouts, where all monitors are aligned on a vertical or horizontal strip. Here's a few (inaccurate) examples of how this would look with different layouts (left side is PHYSICAL, right side is LOGICAL, x is the origin of the coordinate system, the numbers are scales of the monitors): ``` x──────┬──────┬──────┐ x ┌──────┐ │ 2 │ 1 │ 2 │ 2┌──┤ 1 ├──┐2 │ │ │ │ ──► └──┤ ├──┘ └──────┴──────┴──────┘ └──────┘ x ┌──────┐ x ┌──────┐ ┌────┤ 1 │ ┌──┤ 1 │ │ 2 │ │ ──► └──┤ │ └────┴──────┘ 2 └──────┘ x ┌────┐ ┌──────┤ │ x──────┐ │ │ │ │ ├─┬────┐ │ 1 │ 3 │ ──► │ 1 │3│ 1 │ │ │ │ │ ├─┴────┘ └──────┤ │ └──────┘ │ ├────┐ │ │ 1 │ └────┴────┘ ``` - A second more complex algorithm for 2-dimensional monitor layouts with a common baseline that all monitors are aligned to. And examples for this one: ``` x ┌──────┐ ┌──────┤ │ │ 1 │ 2 │ x──────┐ │ │ │ │ 1 ├────┐ └──┬───┴───┬──┘ ──► │ │ 2 │ │ 3 │ ├──┬───┴────┘ │ │ └──┘3 └───────┘ x ┌──────┬──────┐ │ 1 │ │ │ │ │ x──────┬──────┐ ┌─────┴──────┤ 1 │ │ 1 │ │ │ │ │ │ │ │ │ │ │ ──► └──┬───┤ 1 │ │ 3 │ │ │ 3 │ │ │ ├──────┘ └───┤ │ │ │ │ │ │ │ └──────┘ └────────────┘ x ┌───────┐ ┌──────┐ │ │ x ┌───────┐ │ 2 │ ┌──────┤ 1 │ │ │ │ │ │ 1 │ │ 2 ┌──────┤ 1 │ └────┬─┴────┴─┬────┴───────┘ ──► ┌──┤ 1 │ │ │ │ ├──┴┬─────┴───────┘ │ 2 │ │ 2 │ │ │ └───┘ └────────┘ ``` These algorithms will fail for any more complex 2d monitor layout, eg. ``` x ┌───┬────┐ │ 2 │ 1 │ │ ├────┘ ┌───┴┬──┘ │ 1 │ └────┘ x───┬───┬───┐ │ 1 │ 2 │ 1 │ ├───┼───┼───┤ │ 1 │ 1 │ 1 │ ├───┼───┼───┤ │ 1 │ 1 │ 1 │ └───┴───┴───┘ ``` In those cases where the conversion failed, we fall back to aligning the monitors on a horizontal line, preserving the scale, the primary monitor and the disabled monitors. Note that we also need to convert the scale factor in some cases, because LOGICAL layout mode also behaves different here: When the scale results in a fractional logical monitor size (eg. the native monitor width is 2560px, and a scale of 3 is set => 2560px / 3 = 853.333px), in LOGICAL mode we won't use that scale. Instead we have an algorithm (see meta_monitor_get_closest_scale_factor_for_resolution()) to find the nearest fractional scale factor which doesn't result in fractional logical monitor size. We reuse this algorithm here for the conversion. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3596>
Mutter
Mutter is a Wayland display server and X11 window manager and compositor library.
When used as a Wayland display server, it runs on top of KMS and libinput. It implements the compositor side of the Wayland core protocol as well as various protocol extensions. It also has functionality related to running X11 applications using Xwayland.
When used on top of Xorg it acts as a X11 window manager and compositing manager.
It contains functionality related to, among other things, window management, window compositing, focus tracking, workspace management, keybindings and monitor configuration.
Internally it uses a fork of Cogl, a hardware acceleration abstraction library used to simplify usage of OpenGL pipelines, as well as a fork of Clutter, a scene graph and user interface toolkit.
Mutter is used by, for example, GNOME Shell, the GNOME core user interface, and by Gala, elementary OS's window manager. It can also be run standalone, using the command "mutter", but just running plain mutter is only intended for debugging purposes.
Contributing
To contribute, open merge requests at https://gitlab.gnome.org/GNOME/mutter.
It can be useful to first look at the GNOME Handbook and the documentation and API references below first.
Documentation
- Coding style and conventions
- Git conventions
- Code overview
- Building and Running
- Debugging
- Monitor configuration
API Reference
- Meta: https://mutter.gnome.org/meta/
- Clutter: https://mutter.gnome.org/clutter/
- Cogl: https://mutter.gnome.org/cogl/
- CoglPango: https://mutter.gnome.org/cogl-pango/
- Mtk: https://mutter.gnome.org/mtk/
Meetings
There are recurring meetings to discuss development of GNOME Shell, mutter and related components.
License
Mutter is distributed under the terms of the GNU General Public License, version 2 or later. See the COPYING file for detalis.