Refactor the backend loading code

Review Request #127387 - Created March 15, 2016 and submitted

Information
Sebastian Kügler
libkscreen
master
Reviewers
plasma, solid
dvratil, graesslin

Refactor the backend loading code

Untangle the large plugin loading logic in the BackendManager static
into  separate bits. This makes the code clearer and easier to auto-test.

- listBackends() compiles a list of backends from the plugin paths
- preferredBackend() picks the backend, in this priority:
    - if KSCREEN_BACKEND is set in the environment, this is the only
      used method to find the backend plugin
    - if platform is X11, the XRandR backend is picked
        - if platform is wayland, KWayland backend is picked
        - if neither is the case, QScreen backend is picked

It does introduce a slight behavioral change: The mechanism was based on
falling through, so it would consider another backend if the logically
picked on fails to load. This is undesired behavior, however, since the
backendloader may be able to load the plugin, but that doesn't mean that
the plugin actually work.

Parsing of the KSCREEN_BACKEND variable is kept case-insensitive.

autotests for new backend loading logic

- makes sure we find plugins installed
- pick plugins from env var

We can't sensible test all the runtime cases yet, but this at least
covers the code paths around those few lines that do runtime detection
of x11 and wayland.

manual runtime tests and autotests pass

Issues

  • 0
  • 17
  • 2
  • 19
Description From Last Updated
David Edmundson
Martin Flöser
Kai Uwe Broulik
Sebastian Kügler
Sebastian Kügler
Martin Flöser
Sebastian Kügler
Daniel Vrátil
Martin Flöser
Sebastian Kügler
Review request changed

Status: Closed (submitted)

Loading...