Skip to content

APlatformAbstractionOptions#

Defines core platform API priority and options for your application.

Header:#include <AUI/Platform/linux/APlatformAbstractionOptions.h>
CMake:aui_link(my_target PUBLIC aui::views)

Public Types#

X11#


struct APlatformAbstractionOptions::X11

Corresponds to X11 (legacy) mode. While being deprecated, this is still a useful fallback option. If user uses Wayland (which is likely on a modern Linux (-based desktop OSes) system), X11 application still work good enough, thanks to Xwayland compatibility layer.

Empty structure.

Gtk4#


struct APlatformAbstractionOptions::Gtk4

Uses gtk4 as core platform API. Default option on non-GNOME desktop environments.

Empty structure.

Adwaita1#


struct APlatformAbstractionOptions::Adwaita1

Uses libadwaita as core platform API, which is based on Gtk4. Default option on GNOME desktop environments.

Empty structure.

Public fields and Signals#


initializationOrder#

AVector<InitializationVariant> initializationOrder

Defines APIs to try to use (first is prioritized).

Defines a list of APIs to use. If the first API fails to initialize, the next one is probed, and so on, until a successful API initialization is found.

By default, this field is initialized as such:

if (auto auiPa = std::getenv("AUI_PA")) {
    if (auiPa == "adw1"sv) {
        return { Adwaita1 {} };
    }
    if (auiPa == "gtk4"sv) {
        return { Gtk4 {} };
    }
    if (auiPa == "x11"sv) {
        return { X11 {} };
    }
    ALogger::err("APlatformAbstractionOptions") << "Unknown AUI_PA \"" << auiPa << "\", ignoring";
}
// TODO at the moment, lets deploy gtk/libadwaita support as an experimental feature, which can be enabled with AUI_PA.
return { X11{} };
/*
Future order:
AVector<APlatformAbstractionOptions::InitializationVariant> defaultOrder = {
    Gtk4{},
    X11{},
};

if (auto xdgCurrentDesktop = std::getenv("XDG_CURRENT_DESKTOP")) {
    if (xdgCurrentDesktop == "GNOME"sv) {
        defaultOrder.insert(defaultOrder.begin(), Adwaita1{});
    }
}

return defaultOrder;
 */