diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/qgnomeplatform')
3 files changed, 157 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/qgnomeplatform/default.nix b/nixpkgs/pkgs/development/libraries/qgnomeplatform/default.nix new file mode 100644 index 000000000000..4c75b475c17c --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/qgnomeplatform/default.nix @@ -0,0 +1,79 @@ +{ stdenv +, lib +, fetchFromGitHub +, nix-update-script +, cmake +, pkg-config +, adwaita-qt +, adwaita-qt6 +, glib +, gtk3 +, qtbase +, qtwayland +, pantheon +, substituteAll +, gsettings-desktop-schemas +, useQt6 ? false +}: + +stdenv.mkDerivation rec { + pname = "qgnomeplatform"; + version = "0.8.4"; + + src = fetchFromGitHub { + owner = "FedoraQt"; + repo = "QGnomePlatform"; + rev = version; + sha256 = "sha256-DaIBtWmce+58OOhqFG5802c3EprBAtDXhjiSPIImoOM="; + }; + + patches = [ + # Hardcode GSettings schema path to avoid crashes from missing schemas + (substituteAll { + src = ./hardcode-gsettings.patch; + gds_gsettings_path = glib.getSchemaPath gsettings-desktop-schemas; + }) + + # Backport cursor fix for Qt6 apps + # Ajusted from https://github.com/FedoraQt/QGnomePlatform/pull/138 + ./qt6-cursor-fix.patch + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + glib + gtk3 + qtbase + qtwayland + ] ++ lib.optionals (!useQt6) [ + adwaita-qt + ] ++ lib.optionals useQt6 [ + adwaita-qt6 + ]; + + # Qt setup hook complains about missing `wrapQtAppsHook` otherwise. + dontWrapQtApps = true; + + cmakeFlags = [ + "-DGLIB_SCHEMAS_DIR=${glib.getSchemaPath gsettings-desktop-schemas}" + "-DQT_PLUGINS_DIR=${placeholder "out"}/${qtbase.qtPluginPrefix}" + ] ++ lib.optionals useQt6 [ + "-DUSE_QT6=true" + ]; + + passthru = { + updateScript = nix-update-script { }; + }; + + meta = with lib; { + description = "QPlatformTheme for a better Qt application inclusion in GNOME"; + homepage = "https://github.com/FedoraQt/QGnomePlatform"; + license = licenses.lgpl21Plus; + maintainers = with maintainers; [ ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/qgnomeplatform/hardcode-gsettings.patch b/nixpkgs/pkgs/development/libraries/qgnomeplatform/hardcode-gsettings.patch new file mode 100644 index 000000000000..40f7f98f25c7 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/qgnomeplatform/hardcode-gsettings.patch @@ -0,0 +1,25 @@ +diff --git a/src/common/gnomesettings.cpp b/src/common/gnomesettings.cpp +index 717cc9b..ee255ea 100644 +--- a/src/common/gnomesettings.cpp ++++ b/src/common/gnomesettings.cpp +@@ -150,10 +150,18 @@ GnomeSettingsPrivate::GnomeSettingsPrivate(QObject *parent) + : GnomeSettings(parent) + , m_usePortal(checkUsePortalSupport()) + , m_canUseFileChooserPortal(!m_usePortal) +- , m_gnomeDesktopSettings(g_settings_new("org.gnome.desktop.wm.preferences")) +- , m_settings(g_settings_new("org.gnome.desktop.interface")) + , m_fallbackFont(new QFont(QLatin1String("Sans"), 10)) + { ++ g_autoptr(GSettingsSchemaSource) schemaSource = nullptr; ++ g_autoptr(GSettingsSchema) gnomeDesktopSchema = nullptr; ++ g_autoptr(GSettingsSchema) settingsSchema = nullptr; ++ ++ schemaSource = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", g_settings_schema_source_get_default(), true, nullptr); ++ gnomeDesktopSchema = g_settings_schema_source_lookup(schemaSource, "org.gnome.desktop.wm.preferences", false); ++ m_gnomeDesktopSettings = g_settings_new_full(gnomeDesktopSchema, nullptr, nullptr); ++ settingsSchema = g_settings_schema_source_lookup(schemaSource, "org.gnome.desktop.interface", false); ++ m_settings = g_settings_new_full(settingsSchema, nullptr, nullptr); ++ + gtk_init(nullptr, nullptr); + + // Set log handler to suppress false GtkDialog warnings diff --git a/nixpkgs/pkgs/development/libraries/qgnomeplatform/qt6-cursor-fix.patch b/nixpkgs/pkgs/development/libraries/qgnomeplatform/qt6-cursor-fix.patch new file mode 100644 index 000000000000..40438aae33ed --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/qgnomeplatform/qt6-cursor-fix.patch @@ -0,0 +1,53 @@ +diff --git a/src/common/gnomesettings.cpp b/src/common/gnomesettings.cpp +index 961f75d..d947eb2 100644 +--- a/src/common/gnomesettings.cpp ++++ b/src/common/gnomesettings.cpp +@@ -210,7 +210,7 @@ GnomeSettingsPrivate::GnomeSettingsPrivate(QObject *parent) + QStringLiteral("SettingChanged"), this, SLOT(portalSettingChanged(QString,QString,QDBusVariant))); + } + +- if (QGuiApplication::platformName() != QStringLiteral("xcb")) { ++ if (true) { + cursorSizeChanged(); + cursorThemeChanged(); + } +@@ -347,11 +347,11 @@ void GnomeSettingsPrivate::gsettingPropertyChanged(GSettings *settings, gchar *k + } else if (changedProperty == QStringLiteral("monospace-font-name")) { + gnomeSettings->fontChanged(); + } else if (changedProperty == QStringLiteral("cursor-size")) { +- if (QGuiApplication::platformName() != QStringLiteral("xcb")) { ++ if (true) { + gnomeSettings->cursorSizeChanged(); + } + } else if (changedProperty == QStringLiteral("cursor-theme")) { +- if (QGuiApplication::platformName() != QStringLiteral("xcb")) { ++ if (true) { + gnomeSettings->cursorThemeChanged(); + } + // Org.gnome.wm.preferences +@@ -393,13 +393,23 @@ void GnomeSettingsPrivate::cursorBlinkTimeChanged() + void GnomeSettingsPrivate::cursorSizeChanged() + { + int cursorSize = getSettingsProperty<int>(QStringLiteral("cursor-size")); +- qputenv("XCURSOR_SIZE", QString::number(cursorSize).toUtf8()); ++ if (QGuiApplication::platformName() != QStringLiteral("xcb")) { ++ qputenv("XCURSOR_SIZE", QString::number(cursorSize).toUtf8()); ++ } ++#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) ++ m_hints[QPlatformTheme::MouseCursorSize] = QSize(cursorSize, cursorSize); ++#endif + } + + void GnomeSettingsPrivate::cursorThemeChanged() + { + const QString cursorTheme = getSettingsProperty<QString>(QStringLiteral("cursor-theme")); +- qputenv("XCURSOR_THEME", cursorTheme.toUtf8()); ++ if (QGuiApplication::platformName() != QStringLiteral("xcb")) { ++ qputenv("XCURSOR_THEME", cursorTheme.toUtf8()); ++ } ++#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) ++ m_hints[QPlatformTheme::MouseCursorTheme] = cursorTheme; ++#endif + } + + void GnomeSettingsPrivate::fontChanged() |