Skip to content

Qt: provide gtk based themes

Pierre Lamot requested to merge chub/vlc:qml/gtk-theme into master

This patch aims improve the system theme mechanism for gnome users

system theme are now provided in the form of modules

  • this would ease packager integration as only the module depends on GTK, we don't link the interface to both qt and gtk
  • this may be extended to provide better palette for other desktop (KDE, deepin, macos, EFL, whatever)
  • windows (dark/light auto selection) and the Qt palette are part of the qt module as they are shipped on windows where Qt is statically linked

these modules can provide:

  • dark/light theme preference
  • color palette
  • artworks (CSD icons at the moment)
  • metrics (only related to CSD at the moment)

The system backend is chosen by looking at the desktop enviroment used, on gnome based platforms it will try to use the gtk plugin if available, and fallback to the system palette if unavailable. If backend is available (unlikely as the palette is statically linked into the qt interface), a light theme will be used

Regarding the gtk code itself, most of the logic comes the chromium project. While I had to adapt parts of the code to work with our code base, I voluntarily kept their code structure and classes.

It works by defining CSS selector for the objects the want to introspect and querying properties on them of rendering them into framebuffer and analying the outcome. Artworks are done by rendering the desired widgets into a cairo surface for each state desired the buffer is then binded to a QImage that can be used as the source of a QML texture.

This patch doesn't aim to recreate the whole GTK components into QML (and never will), it is limited to colors and CSD. it will remain limited in terms of features and mostly aims to provide a more homogenous look and feel.

sample decoration with various GTK themes (dracula, Greybird, Adwaita:dark, Adwaita)

GTK

Merge request reports

Loading