Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package QGnomePlatform for openSUSE:Factory checked in at 2022-02-24 18:21:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/QGnomePlatform (Old) and /work/SRC/openSUSE:Factory/.QGnomePlatform.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "QGnomePlatform" Thu Feb 24 18:21:00 2022 rev:9 rq:957250 version:0.8.4 Changes: -------- --- /work/SRC/openSUSE:Factory/QGnomePlatform/QGnomePlatform.changes 2021-07-28 19:20:46.627577502 +0200 +++ /work/SRC/openSUSE:Factory/.QGnomePlatform.new.1958/QGnomePlatform.changes 2022-02-24 18:24:22.126644175 +0100 @@ -1,0 +2,17 @@ +Wed Feb 23 21:08:10 UTC 2022 - Bj??rn Lie <[email protected]> + +- Update to version 0.8.4: + + Set XCURSOR_THEME env variable on Wayland + + Use C++14 to build QGnomePlatform for a KDE/Qt 5.15 change +- Changes from version 0.8.3: + + Restored QDBusTrayIcon support for Qt5 version +- Changes from version 0.8.2: + + Removed support for QDBusTrayIcon causing issue with undefined + reference as Qt doesn't export required symbols +- Changes from version 0.8.1: + + Bumped dependency on Adwaita-qt 1.4.1 and Qt 5.15.2 + + Support for Qt6 build with CMake option -DUSE_QT6=true + + Support HighContrast variants of Adwaita-qt +- Drop baselibs.conf, stop supporting 32bit libs on x86_64. + +------------------------------------------------------------------- Old: ---- QGnomePlatform-0.8.0.tar.gz baselibs.conf New: ---- QGnomePlatform-0.8.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ QGnomePlatform.spec ++++++ --- /var/tmp/diff_new_pack.qJo4lx/_old 2022-02-24 18:24:22.574644059 +0100 +++ /var/tmp/diff_new_pack.qJo4lx/_new 2022-02-24 18:24:22.582644057 +0100 @@ -1,7 +1,7 @@ # # spec file for package QGnomePlatform # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright ?? 2016 Yuriy Gorodilin <[email protected]> # Copyright ?? 2018???2019 Markus S. <[email protected]> # @@ -19,16 +19,15 @@ Name: QGnomePlatform -Version: 0.8.0 +Version: 0.8.4 Release: 0 Summary: A better Qt application inclusion in GNOME # Most code is LGPL-2.1-or-later but qgtk3dialoghelpers files forked from # Qt 5 result in this licensing scheme for the combined work: -License: LGPL-3.0-only OR GPL-2.0-or-later +License: GPL-2.0-or-later OR LGPL-3.0-only Group: System/GUI/GNOME URL: https://github.com/FedoraQt/QGnomePlatform/ Source: %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz -Source1: baselibs.conf BuildRequires: cmake BuildRequires: gcc-c++ # QGnomePlatform relies on glib's pkgconfig file to find gsettings files @@ -40,11 +39,11 @@ BuildRequires: libqt5-qtwayland-private-headers-devel BuildRequires: pkgconfig BuildRequires: cmake(Qt5ThemeSupport) -BuildRequires: pkgconfig(Qt5DBus) >= 5.12 -BuildRequires: pkgconfig(Qt5WaylandClient) >= 5.12 -BuildRequires: pkgconfig(Qt5Widgets) >= 5.12 -BuildRequires: pkgconfig(Qt5X11Extras) >= 5.12 -BuildRequires: pkgconfig(adwaita-qt) >= 1.3.0 +BuildRequires: pkgconfig(Qt5DBus) >= 5.12.2 +BuildRequires: pkgconfig(Qt5WaylandClient) >= 5.12.2 +BuildRequires: pkgconfig(Qt5Widgets) >= 5.12.2 +BuildRequires: pkgconfig(Qt5X11Extras) >= 5.12.2 +BuildRequires: pkgconfig(adwaita-qt) >= 1.4.1 BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(gtk+-x11-3.0) BuildRequires: pkgconfig(x11) ++++++ QGnomePlatform-0.8.0.tar.gz -> QGnomePlatform-0.8.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/.github/workflows/build.yml new/QGnomePlatform-0.8.4/.github/workflows/build.yml --- old/QGnomePlatform-0.8.0/.github/workflows/build.yml 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/.github/workflows/build.yml 2022-01-11 10:46:15.000000000 +0100 @@ -12,18 +12,20 @@ BUILD_TYPE: Release jobs: - build: - runs-on: ubuntu-20.04 + Linux_Qt5: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install base dependencies run: | sudo apt update - sudo apt install cmake make pkg-config libx11-dev xcb libx11-xcb-dev libgtk-3-dev - + sudo apt install cmake make pkg-config libx11-dev xcb libx11-xcb-dev libxkbcommon-dev libgtk-3-dev sassc + - name: Install Qt uses: jurplel/install-qt-action@v2 + with: + version: 5.15.2 - name: Install Adwaita-qt run: | @@ -31,13 +33,45 @@ cd adwaita-qt mkdir build cd build - cmake .. -DCMAKE_INSTALL_PREFIX=/usr - make -j5 + cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DUSE_QT6=OFF + make -j2 sudo make install - name: Build run: | mkdir build cd build - cmake .. -DCMAKE_INSTALL_PREFIX=/usr - make -j5 + cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DUSE_QT6=OFF + make -j2 + + Linux_Qt6: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install base dependencies + run: | + sudo apt update + sudo apt install cmake make pkg-config libx11-dev xcb libx11-xcb-dev libxkbcommon-dev libgtk-3-dev sassc + + - name: Install Qt + uses: jurplel/install-qt-action@v2 + with: + version: 6.2.0 + + - name: Install Adwaita-qt + run: | + git clone https://github.com/FedoraQt/adwaita-qt.git adwaita-qt + cd adwaita-qt + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DUSE_QT6=ON + make -j2 + sudo make install + + - name: Build + run: | + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DUSE_QT6=ON + make -j2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/CMakeLists.txt new/QGnomePlatform-0.8.4/CMakeLists.txt --- old/QGnomePlatform-0.8.0/CMakeLists.txt 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/CMakeLists.txt 2022-01-11 10:46:15.000000000 +0100 @@ -2,9 +2,22 @@ cmake_minimum_required(VERSION 3.0) -set(QGNOMEPLATFORM_VERSION "0.8.0") +set(QGNOMEPLATFORM_VERSION "0.8.4") + +option(USE_QT6 "Use Qt6 instead of Qt5" OFF) + +if (USE_QT6) + set(QT_MIN_VERSION "6.2.0") + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(LIBQGNOMEPLATFORM_SUFFIX "6") +else() + set(QT_MIN_VERSION "5.15.2") + set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(LIBQGNOMEPLATFORM_SUFFIX "") +endif() -set(QT_MIN_VERSION "5.12.0") set(CMAKE_AUTOMOC ON) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) @@ -12,15 +25,30 @@ include(GNUInstallDirs) include(FeatureSummary) -add_definitions(-std=c++11) - -find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core DBus Gui Widgets) -find_package(Qt5Gui ${QT_MIN_VERSION} CONFIG REQUIRED Private) +if (USE_QT6) + find_package(QT NAMES Qt6 COMPONENTS Core DBus Gui Widgets REQUIRED) +else() + find_package(QT NAMES Qt5 COMPONENTS Core DBus Gui Widgets REQUIRED) +endif() -find_package(Qt5ThemeSupport REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS + Core + DBus + Gui + Widgets +) + +find_package(Qt${QT_VERSION_MAJOR}Gui ${QT_MIN_VERSION} CONFIG REQUIRED Private) +if (NOT USE_QT6) + find_package(Qt${QT_VERSION_MAJOR}ThemeSupport REQUIRED) +endif() find_package(GSettingSchemas REQUIRED) -find_package(AdwaitaQt "1.3.0" REQUIRED) +if (USE_QT6) + find_package(AdwaitaQt6 "1.4.1" REQUIRED) +else() + find_package(AdwaitaQt "1.4.1" REQUIRED) +endif() find_package(PkgConfig REQUIRED) pkg_check_modules(GTK+3 REQUIRED IMPORTED_TARGET gtk+-3.0) @@ -30,17 +58,19 @@ if (DISABLE_DECORATION_SUPPORT) message(STATUS "Disabling Qt Wayland decoration support") else() - find_package(Qt5WaylandClient ${QT_MIN_VERSION} CONFIG REQUIRED) - set_package_properties(Qt5WaylandClient PROPERTIES + find_package(Qt${QT_VERSION_MAJOR}WaylandClient ${QT_MIN_VERSION} CONFIG REQUIRED) + set_package_properties(Qt${QT_VERSION_MAJOR}WaylandClient PROPERTIES DESCRIPTION "Qt Wayland decoration support" PURPOSE "Required for QGnomePlatform decoration plugin" TYPE REQUIRED ) # NOTE: I don't know how to do this only in case of qt_config(xkbcommon). # We would miss an include in QWaylandDisplay header file. - find_package(Qt5XkbCommonSupport ${QT_MIN_VERSION}) + if (NOT USE_QT6) + find_package(Qt${QT_VERSION_MAJOR}XkbCommonSupport ${QT_MIN_VERSION}) + endif() - if (DECORATION_SHADOWS_SUPPORT) + if (DECORATION_SHADOWS_SUPPORT OR USE_QT6) message(STATUS "Enabling Qt Wayland decoration shadows support") message(STATUS "NOTE: This support requires changes in Qt Wayland from Qt 6.2") add_definitions(-DDECORATION_SHADOWS_SUPPORT) @@ -51,13 +81,15 @@ message(STATUS "Disabling platform theme support") endif() -get_target_property(REAL_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} - IMPORTED_LOCATION) - -if (NOT QT_PLUGINS_DIR) - execute_process(COMMAND "${REAL_QMAKE_EXECUTABLE}" -query QT_INSTALL_PLUGINS - OUTPUT_VARIABLE QT_PLUGINS_DIR - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) +if (NOT USE_QT6) + get_target_property(REAL_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} + IMPORTED_LOCATION) + + if (NOT QT_PLUGINS_DIR) + execute_process(COMMAND "${REAL_QMAKE_EXECUTABLE}" -query QT_INSTALL_PLUGINS + OUTPUT_VARIABLE QT_PLUGINS_DIR + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() endif() add_subdirectory(src) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/README.md new/QGnomePlatform-0.8.4/README.md --- old/QGnomePlatform-0.8.0/README.md 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/README.md 2022-01-11 10:46:15.000000000 +0100 @@ -10,7 +10,7 @@ ``` mkdir build cd build -cmake [OPTIONS] .. +cmake [OPTIONS] [-DUSE_QT6=true] .. make && make install ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/common/CMakeLists.txt new/QGnomePlatform-0.8.4/src/common/CMakeLists.txt --- old/QGnomePlatform-0.8.0/src/common/CMakeLists.txt 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/common/CMakeLists.txt 2022-01-11 10:46:15.000000000 +0100 @@ -3,14 +3,14 @@ gnomesettings.cpp ) -add_library(qgnomeplatform SHARED ${common_SRCS}) -target_link_libraries(qgnomeplatform - Qt::Core - Qt::DBus - Qt::GuiPrivate - Qt::Widgets +add_library(qgnomeplatform${LIBQGNOMEPLATFORM_SUFFIX} SHARED ${common_SRCS}) +target_link_libraries(qgnomeplatform${LIBQGNOMEPLATFORM_SUFFIX} + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::DBus + Qt${QT_VERSION_MAJOR}::GuiPrivate + Qt${QT_VERSION_MAJOR}::Widgets ${ADWAITAQT_LIBRARIES} PkgConfig::GTK+3 ) -install(TARGETS qgnomeplatform RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS "qgnomeplatform${LIBQGNOMEPLATFORM_SUFFIX}" RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/common/gnomesettings.cpp new/QGnomePlatform-0.8.4/src/common/gnomesettings.cpp --- old/QGnomePlatform-0.8.0/src/common/gnomesettings.cpp 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/common/gnomesettings.cpp 2022-01-11 10:46:15.000000000 +0100 @@ -20,7 +20,11 @@ #include "gnomesettings.h" #include "gnomesettings_p.h" +#if QT_VERSION >= 0x060000 +#include <AdwaitaQt6/adwaitacolors.h> +#else #include <AdwaitaQt/adwaitacolors.h> +#endif // QtCore #include <QDir> @@ -102,6 +106,11 @@ return gnomeSettingsGlobal->isGtkThemeDarkVariant(); } +bool GnomeSettings::isGtkThemeHighContrastVariant() +{ + return gnomeSettingsGlobal->isGtkThemeHighContrastVariant(); +} + QString GnomeSettings::gtkTheme() { return gnomeSettingsGlobal->gtkTheme(); @@ -203,6 +212,7 @@ if (QGuiApplication::platformName() != QStringLiteral("xcb")) { cursorSizeChanged(); + cursorThemeChanged(); } loadFonts(); @@ -210,7 +220,11 @@ loadTheme(); loadTitlebar(); - m_palette = new QPalette(Adwaita::Colors::palette(m_gtkThemeDarkVariant ? Adwaita::ColorVariant::AdwaitaDark : Adwaita::ColorVariant::Adwaita)); + if (m_gtkThemeHighContrastVariant) { + m_palette = new QPalette(Adwaita::Colors::palette(m_gtkThemeDarkVariant ? Adwaita::ColorVariant::AdwaitaHighcontrastInverse : Adwaita::ColorVariant::AdwaitaHighcontrast)); + } else { + m_palette = new QPalette(Adwaita::Colors::palette(m_gtkThemeDarkVariant ? Adwaita::ColorVariant::AdwaitaDark : Adwaita::ColorVariant::Adwaita)); + } if (m_canUseFileChooserPortal) { QTimer::singleShot(0, this, [this] () { @@ -290,6 +304,11 @@ return m_gtkThemeDarkVariant; } +bool GnomeSettingsPrivate::isGtkThemeHighContrastVariant() const +{ + return m_gtkThemeHighContrastVariant; +} + QString GnomeSettingsPrivate::gtkTheme() const { return QString(m_gtkTheme); @@ -331,6 +350,10 @@ if (QGuiApplication::platformName() != QStringLiteral("xcb")) { gnomeSettings->cursorSizeChanged(); } + } else if (changedProperty == QStringLiteral("cursor-theme")) { + if (QGuiApplication::platformName() != QStringLiteral("xcb")) { + gnomeSettings->cursorThemeChanged(); + } // Org.gnome.wm.preferences } else if (changedProperty == QStringLiteral("titlebar-font")) { gnomeSettings->fontChanged(); @@ -373,6 +396,12 @@ qputenv("XCURSOR_SIZE", QString::number(cursorSize).toUtf8()); } +void GnomeSettingsPrivate::cursorThemeChanged() +{ + const QString cursorTheme = getSettingsProperty<QString>(QStringLiteral("cursor-theme")); + qputenv("XCURSOR_THEME", cursorTheme.toUtf8()); +} + void GnomeSettingsPrivate::fontChanged() { const QFont oldSysFont = *m_fonts[QPlatformTheme::SystemFont]; @@ -472,7 +501,11 @@ } else { qCDebug(QGnomePlatform) << "Theme name: " << m_gtkTheme; - if (m_gtkTheme.toLower().contains("-dark")) { + if (m_gtkTheme.toLower().startsWith("highcontrast")) { + m_gtkThemeHighContrastVariant = true; + } + + if (m_gtkTheme.toLower().contains("-dark") || m_gtkTheme.toLower().endsWith("inverse")) { m_gtkThemeDarkVariant = true; } @@ -481,7 +514,11 @@ } else { qCDebug(QGnomePlatform) << "Theme name: " << styleOverride; - if (styleOverride.toLower().contains("-dark")) { + if (styleOverride.toLower().startsWith("highcontrast")) { + m_gtkThemeHighContrastVariant = true; + } + + if (styleOverride.toLower().contains("-dark") || styleOverride.toLower().endsWith("inverse")) { m_gtkThemeDarkVariant = true; } @@ -517,6 +554,53 @@ m_hints[QPlatformTheme::StyleNames] = styleNames; } +// FIXME: duplicate +static QFont* qt_fontFromString(const QString &name) +{ + QFont *font = new QFont(QLatin1String("Sans"), 10); + + PangoFontDescription *desc = pango_font_description_from_string(name.toUtf8()); + font->setPointSizeF(static_cast<float>(pango_font_description_get_size(desc)) / PANGO_SCALE); + + QString family = QString::fromUtf8(pango_font_description_get_family(desc)); + if (!family.isEmpty()) { + font->setFamily(family); + } + + const int weight = pango_font_description_get_weight(desc); + if (weight >= PANGO_WEIGHT_HEAVY) { + font->setWeight(QFont::Black); + } else if (weight >= PANGO_WEIGHT_ULTRABOLD) { + font->setWeight(QFont::ExtraBold); + } else if (weight >= PANGO_WEIGHT_BOLD) { + font->setWeight(QFont::Bold); + } else if (weight >= PANGO_WEIGHT_SEMIBOLD) { + font->setWeight(QFont::DemiBold); + } else if (weight >= PANGO_WEIGHT_MEDIUM) { + font->setWeight(QFont::Medium); + } else if (weight >= PANGO_WEIGHT_NORMAL) { + font->setWeight(QFont::Normal); + } else if (weight >= PANGO_WEIGHT_LIGHT) { + font->setWeight(QFont::Light); + } else if (weight >= PANGO_WEIGHT_ULTRALIGHT) { + font->setWeight(QFont::ExtraLight); + } else { + font->setWeight(QFont::Thin); + } + + PangoStyle style = pango_font_description_get_style(desc); + if (style == PANGO_STYLE_ITALIC) { + font->setStyle(QFont::StyleItalic); + } else if (style == PANGO_STYLE_OBLIQUE) { + font->setStyle(QFont::StyleOblique); + } else { + font->setStyle(QFont::StyleNormal); + } + + pango_font_description_free(desc); + return font; +} + void GnomeSettingsPrivate::loadFonts() { qDeleteAll(m_fonts); @@ -529,41 +613,17 @@ if (fontName.isEmpty()) { qCWarning(QGnomePlatform) << "Couldn't get " << fontType; } else { - bool bold = false; - int fontSize; - QString name; - QRegExp re("^([^,]+)[, \t]+([0-9]+)$"); - if (re.indexIn(fontName) == 0) { - fontSize = re.cap(2).toInt(); - name = re.cap(1); - // Bold is most likely not part of the name - if (name.endsWith(QStringLiteral(" Bold"))) { - bold = true; - name = name.remove(QStringLiteral(" Bold")); - } - - QFont *font = new QFont(name, fontSize, bold ? QFont::Bold : QFont::Normal); - if (fontType == QStringLiteral("font-name")) { - m_fonts[QPlatformTheme::SystemFont] = font; - qCDebug(QGnomePlatform) << "Font name: " << name << " (size " << fontSize << ")"; - } else if (fontType == QStringLiteral("monospace-font-name")) { - m_fonts[QPlatformTheme::FixedFont] = font; - qCDebug(QGnomePlatform) << "Monospace font name: " << name << " (size " << fontSize << ")"; - } else if (fontType == QStringLiteral("titlebar-font")) { - m_fonts[QPlatformTheme::TitleBarFont] = font; - qCDebug(QGnomePlatform) << "TitleBar font name: " << name << " (size " << fontSize << ")"; - } - } else { - if (fontType == QStringLiteral("font-name")) { - m_fonts[QPlatformTheme::SystemFont] = new QFont(fontName); - qCDebug(QGnomePlatform) << "Font name: " << fontName; - } else if (fontType == QStringLiteral("monospace-font-name")) { - m_fonts[QPlatformTheme::FixedFont] = new QFont(fontName); - qCDebug(QGnomePlatform) << "Monospace font name: " << fontName; - } else if (fontType == QStringLiteral("titlebar-font")) { - m_fonts[QPlatformTheme::TitleBarFont] = new QFont(fontName); - qCDebug(QGnomePlatform) << "TitleBar font name: " << fontName; - } + qCDebug(QGnomePlatform) << "String name: " << fontName; + QFont *font = qt_fontFromString(fontName); + if (fontType == QStringLiteral("font-name")) { + m_fonts[QPlatformTheme::SystemFont] = font; + qCDebug(QGnomePlatform) << "Font name: " << font->family() << " (size " << font->pointSize() << ")"; + } else if (fontType == QStringLiteral("monospace-font-name")) { + m_fonts[QPlatformTheme::FixedFont] = font; + qCDebug(QGnomePlatform) << "Monospace font name: " << font->family() << " (size " << font->pointSize() << ")"; + } else if (fontType == QStringLiteral("titlebar-font")) { + m_fonts[QPlatformTheme::TitleBarFont] = font; + qCDebug(QGnomePlatform) << "TitleBar font name: " << font->family() << " (size " << font->pointSize() << ")"; } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/common/gnomesettings.h new/QGnomePlatform-0.8.4/src/common/gnomesettings.h --- old/QGnomePlatform-0.8.0/src/common/gnomesettings.h 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/common/gnomesettings.h 2022-01-11 10:46:15.000000000 +0100 @@ -54,6 +54,7 @@ static QVariant hint(QPlatformTheme::ThemeHint hint); static bool canUseFileChooserPortal(); static bool isGtkThemeDarkVariant(); + static bool isGtkThemeHighContrastVariant(); static QString gtkTheme(); static TitlebarButtons titlebarButtons(); static TitlebarButtonsPlacement titlebarButtonPlacement(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/common/gnomesettings_p.h new/QGnomePlatform-0.8.4/src/common/gnomesettings_p.h --- old/QGnomePlatform-0.8.0/src/common/gnomesettings_p.h 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/common/gnomesettings_p.h 2022-01-11 10:46:15.000000000 +0100 @@ -50,6 +50,7 @@ QPalette *palette() const; bool canUseFileChooserPortal() const; bool isGtkThemeDarkVariant() const; + bool isGtkThemeHighContrastVariant() const; QString gtkTheme() const; QVariant hint(QPlatformTheme::ThemeHint hint) const; TitlebarButtons titlebarButtons() const; @@ -58,6 +59,7 @@ private Q_SLOTS: void cursorBlinkTimeChanged(); void cursorSizeChanged(); + void cursorThemeChanged(); void fontChanged(); void iconsChanged(); void themeChanged(); @@ -80,6 +82,7 @@ bool m_usePortal; bool m_canUseFileChooserPortal = false; bool m_gtkThemeDarkVariant = false; + bool m_gtkThemeHighContrastVariant = false; TitlebarButtons m_titlebarButtons = TitlebarButton::CloseButton; TitlebarButtonsPlacement m_titlebarButtonPlacement = TitlebarButtonsPlacement::RightPlacement; QString m_gtkTheme = nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/decoration/CMakeLists.txt new/QGnomePlatform-0.8.4/src/decoration/CMakeLists.txt --- old/QGnomePlatform-0.8.0/src/decoration/CMakeLists.txt 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/decoration/CMakeLists.txt 2022-01-11 10:46:15.000000000 +0100 @@ -10,19 +10,24 @@ add_library(qgnomeplatformdecoration MODULE ${decoration_SRCS}) target_link_libraries(qgnomeplatformdecoration - qgnomeplatform - Qt::Gui - Qt::GuiPrivate - Qt::WaylandClientPrivate + qgnomeplatform${LIBQGNOMEPLATFORM_SUFFIX} + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::GuiPrivate + Qt${QT_VERSION_MAJOR}::WaylandClientPrivate ${ADWAITAQT_LIBRARIES} PkgConfig::GTK+3 ) -if (${Qt5XkbCommonSupport_FOUND}) -target_link_libraries(qgnomeplatformdecoration - Qt::XkbCommonSupportPrivate -) +if (NOT USE_QT6) + if (${Qt5XkbCommonSupport_FOUND}) + target_link_libraries(qgnomeplatformdecoration + Qt${QT_VERSION_MAJOR}::XkbCommonSupportPrivate + ) + endif() endif() -install(TARGETS qgnomeplatformdecoration DESTINATION ${QT_PLUGINS_DIR}//wayland-decoration-client) - +if (USE_QT6) + install(TARGETS qgnomeplatformdecoration DESTINATION ${QT6_INSTALL_PLUGINS}/wayland-decoration-client) +else() + install(TARGETS qgnomeplatformdecoration DESTINATION ${QT_PLUGINS_DIR}/wayland-decoration-client) +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/decoration/qgnomeplatformdecoration.cpp new/QGnomePlatform-0.8.4/src/decoration/qgnomeplatformdecoration.cpp --- old/QGnomePlatform-0.8.0/src/decoration/qgnomeplatformdecoration.cpp 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/decoration/qgnomeplatformdecoration.cpp 2022-01-11 10:46:15.000000000 +0100 @@ -43,9 +43,6 @@ #include "gnomesettings.h" -#include <AdwaitaQt/adwaitacolors.h> -#include <AdwaitaQt/adwaitarenderer.h> - #include <QtGui/QColor> #include <QtGui/QCursor> #include <QtGui/QLinearGradient> @@ -87,10 +84,15 @@ // Colors // TODO: move colors used for decorations to Adwaita-qt const bool darkVariant = GnomeSettings::isGtkThemeDarkVariant(); - const QPalette &palette(Adwaita::Colors::palette(darkVariant ? Adwaita::ColorVariant::AdwaitaDark : Adwaita::ColorVariant::Adwaita)); + const bool highContrastVariant = GnomeSettings::isGtkThemeHighContrastVariant(); + + m_adwaitaVariant = darkVariant ? highContrastVariant ? Adwaita::ColorVariant::AdwaitaHighcontrastInverse : Adwaita::ColorVariant::AdwaitaDark : + highContrastVariant ? Adwaita::ColorVariant::AdwaitaHighcontrast : Adwaita::ColorVariant::Adwaita; + + const QPalette &palette(Adwaita::Colors::palette(m_adwaitaVariant)); - m_foregroundColor = palette.color(QPalette::Active, QPalette::Foreground); - m_foregroundInactiveColor = palette.color(QPalette::Inactive, QPalette::Foreground); + m_foregroundColor = palette.color(QPalette::Active, QPalette::WindowText); + m_foregroundInactiveColor = palette.color(QPalette::Inactive, QPalette::WindowText); m_backgroundColorStart = darkVariant ? QColor("#262626") : QColor("#dad6d2"); // Adwaita GtkHeaderBar color m_backgroundColorEnd = darkVariant ? QColor("#2b2b2b") : QColor("#e1dedb"); // Adwaita GtkHeaderBar color m_foregroundInactiveColor = darkVariant ? QColor("#919190") : QColor("#929595"); @@ -489,58 +491,20 @@ p.restore(); } - QRectF rect; - Adwaita::StyleOptions decorationButtonStyle(&p, QRect()); - decorationButtonStyle.setColor(active ? m_foregroundColor : m_foregroundInactiveColor); // Close button - rect = closeButtonRect(); - if (m_closeButtonHovered && active) { - QRect buttonRect(static_cast<int>(rect.x()), static_cast<int>(rect.y()), BUTTON_WIDTH, BUTTON_WIDTH); - Adwaita::StyleOptions styleOptions(&p, buttonRect); - styleOptions.setMouseOver(true); - styleOptions.setSunken(m_clicking == Button::Close); - styleOptions.setColorVariant(GnomeSettings::isGtkThemeDarkVariant() ? Adwaita::ColorVariant::AdwaitaDark : Adwaita::ColorVariant::Adwaita); - styleOptions.setColor(Adwaita::Colors::buttonBackgroundColor(styleOptions)); - styleOptions.setOutlineColor(Adwaita::Colors::buttonOutlineColor(styleOptions)); - Adwaita::Renderer::renderFlatRoundedButtonFrame(styleOptions); - } - decorationButtonStyle.setRect(QRect(static_cast<int>(rect.x()) + (BUTTON_WIDTH / 4), static_cast<int>(rect.y()) + (BUTTON_WIDTH / 4), BUTTON_WIDTH / 2, BUTTON_WIDTH / 2)); - Adwaita::Renderer::renderDecorationButton(decorationButtonStyle, Adwaita::ButtonType::ButtonClose); + renderButton(&p, closeButtonRect(), Adwaita::ButtonType::ButtonClose, m_closeButtonHovered && active, m_clicking == Button::Close); + // Maximize button if (GnomeSettings::titlebarButtons().testFlag(GnomeSettings::MaximizeButton)) { - rect = maximizeButtonRect(); - if (m_maximizeButtonHovered && active) { - QRect buttonRect(static_cast<int>(rect.x()), static_cast<int>(rect.y()), BUTTON_WIDTH, BUTTON_WIDTH); - Adwaita::StyleOptions styleOptions(&p, buttonRect); - styleOptions.setMouseOver(true); - styleOptions.setSunken(m_clicking == Button::Maximize || m_clicking == Button::Restore); - styleOptions.setColorVariant(GnomeSettings::isGtkThemeDarkVariant() ? Adwaita::ColorVariant::AdwaitaDark : Adwaita::ColorVariant::Adwaita); - styleOptions.setColor(Adwaita::Colors::buttonBackgroundColor(styleOptions)); - styleOptions.setOutlineColor(Adwaita::Colors::buttonOutlineColor(styleOptions)); - Adwaita::Renderer::renderFlatRoundedButtonFrame(styleOptions); - } - decorationButtonStyle.setRect(QRect(static_cast<int>(rect.x()) + (BUTTON_WIDTH / 4), static_cast<int>(rect.y()) + (BUTTON_WIDTH / 4), BUTTON_WIDTH / 2, BUTTON_WIDTH / 2)); - const Adwaita::ButtonType buttonType = (window()->windowStates() & Qt::WindowMaximized) ? Adwaita::ButtonType::ButtonRestore : Adwaita::ButtonType::ButtonMaximize; - Adwaita::Renderer::renderDecorationButton(decorationButtonStyle, buttonType); + renderButton(&p, maximizeButtonRect(), (window()->windowStates() & Qt::WindowMaximized) ? Adwaita::ButtonType::ButtonRestore : Adwaita::ButtonType::ButtonMaximize, + m_maximizeButtonHovered && active, m_clicking == Button::Maximize || m_clicking == Button::Restore); } // Minimize button if (GnomeSettings::titlebarButtons().testFlag(GnomeSettings::MinimizeButton)) { - rect = minimizeButtonRect(); - if (m_minimizeButtonHovered && active) { - QRect buttonRect(static_cast<int>(rect.x()), static_cast<int>(rect.y()), 28, 28); - Adwaita::StyleOptions styleOptions(&p, buttonRect); - styleOptions.setMouseOver(true); - styleOptions.setSunken(m_clicking == Button::Minimize); - styleOptions.setColorVariant(GnomeSettings::isGtkThemeDarkVariant() ? Adwaita::ColorVariant::AdwaitaDark : Adwaita::ColorVariant::Adwaita); - styleOptions.setColor(Adwaita::Colors::buttonBackgroundColor(styleOptions)); - styleOptions.setOutlineColor(Adwaita::Colors::buttonOutlineColor(styleOptions)); - Adwaita::Renderer::renderFlatRoundedButtonFrame(styleOptions); - } - decorationButtonStyle.setRect(QRect(static_cast<int>(rect.x()) + (BUTTON_WIDTH / 4), static_cast<int>(rect.y()) + (BUTTON_WIDTH / 4), BUTTON_WIDTH / 2, BUTTON_WIDTH / 2)); - Adwaita::Renderer::renderDecorationButton(decorationButtonStyle, Adwaita::ButtonType::ButtonMinimize); + renderButton(&p, minimizeButtonRect(), Adwaita::ButtonType::ButtonMinimize, m_minimizeButtonHovered && active, m_clicking == Button::Minimize); } } @@ -607,12 +571,20 @@ return true; } +#if QT_VERSION >= 0x060000 +bool QGnomePlatformDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) +#else bool QGnomePlatformDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) +#endif { Q_UNUSED(inputDevice) Q_UNUSED(global) Q_UNUSED(mods) +#if QT_VERSION >= 0x060000 + bool handled = state == QEventPoint::Pressed; +#else bool handled = state == Qt::TouchPointPressed; +#endif if (handled) { if (closeButtonRect().contains(local)) { QWindowSystemInterface::handleCloseEvent(window()); @@ -768,6 +740,29 @@ #endif } + +void QGnomePlatformDecoration::renderButton(QPainter *painter, const QRectF &rect, Adwaita::ButtonType button, bool renderFrame, bool sunken) +{ + const bool active = window()->handle()->isActive(); + + Adwaita::StyleOptions decorationButtonStyle(painter, QRect()); + decorationButtonStyle.setColor(active ? m_foregroundColor : m_foregroundInactiveColor); + + if (renderFrame) { + QRect buttonRect(static_cast<int>(rect.x()), static_cast<int>(rect.y()), BUTTON_WIDTH, BUTTON_WIDTH); + Adwaita::StyleOptions styleOptions(painter, buttonRect); + styleOptions.setMouseOver(true); + styleOptions.setSunken(sunken); + styleOptions.setColorVariant(m_adwaitaVariant); + styleOptions.setColor(Adwaita::Colors::buttonBackgroundColor(styleOptions)); + styleOptions.setOutlineColor(Adwaita::Colors::buttonOutlineColor(styleOptions)); + Adwaita::Renderer::renderFlatRoundedButtonFrame(styleOptions); + } + decorationButtonStyle.setRect(QRect(static_cast<int>(rect.x()) + (BUTTON_WIDTH / 4), static_cast<int>(rect.y()) + (BUTTON_WIDTH / 4), BUTTON_WIDTH / 2, BUTTON_WIDTH / 2)); + Adwaita::Renderer::renderDecorationButton(decorationButtonStyle, button); +} + + bool QGnomePlatformDecoration::updateButtonHoverState(Button hoveredButton) { bool currentCloseButtonState = m_closeButtonHovered; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/decoration/qgnomeplatformdecoration.h new/QGnomePlatform-0.8.4/src/decoration/qgnomeplatformdecoration.h --- old/QGnomePlatform-0.8.0/src/decoration/qgnomeplatformdecoration.h 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/decoration/qgnomeplatformdecoration.h 2022-01-11 10:46:15.000000000 +0100 @@ -22,6 +22,14 @@ #include <QtWaylandClient/private/qwaylandabstractdecoration_p.h> +#if QT_VERSION >= 0x060000 +#include <AdwaitaQt6/adwaitacolors.h> +#include <AdwaitaQt6/adwaitarenderer.h> +#else +#include <AdwaitaQt/adwaitacolors.h> +#include <AdwaitaQt/adwaitarenderer.h> +#endif + #include <QtGlobal> #include <QDateTime> @@ -52,13 +60,19 @@ #endif void paint(QPaintDevice *device) override; bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) override; +#if QT_VERSION >= 0x060000 + bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) override; +#else bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) override; +#endif private: void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + void renderButton(QPainter *painter, const QRectF &rect, Adwaita::ButtonType button, bool renderFrame, bool sunken); + bool clickButton(Qt::MouseButtons b, Button btn); bool doubleClickButton(Qt::MouseButtons b, const QPointF &local, const QDateTime ¤tTime); bool updateButtonHoverState(Button hoveredButton); @@ -77,7 +91,6 @@ QColor m_foregroundInactiveColor; // Buttons - QHash<Button, QPixmap> m_buttonPixmaps; bool m_closeButtonHovered; bool m_maximizeButtonHovered; bool m_minimizeButtonHovered; @@ -92,6 +105,8 @@ // Shadows QPixmap m_shadowPixmap; + + Adwaita::ColorVariant m_adwaitaVariant; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/theme/CMakeLists.txt new/QGnomePlatform-0.8.4/src/theme/CMakeLists.txt --- old/QGnomePlatform-0.8.0/src/theme/CMakeLists.txt 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/theme/CMakeLists.txt 2022-01-11 10:46:15.000000000 +0100 @@ -12,14 +12,19 @@ add_library(qgnomeplatformtheme MODULE ${theme_SRCS}) target_link_libraries(qgnomeplatformtheme - qgnomeplatform - Qt::DBus - Qt::Gui - Qt::ThemeSupportPrivate + qgnomeplatform${LIBQGNOMEPLATFORM_SUFFIX} + Qt${QT_VERSION_MAJOR}::DBus + Qt${QT_VERSION_MAJOR}::Gui ${ADWAITAQT_LIBRARIES} PkgConfig::GTK+3 ) -install(TARGETS qgnomeplatformtheme RENAME qgnomeplatform DESTINATION ${QT_PLUGINS_DIR}/platformthemes) - +if (NOT USE_QT6) + target_link_libraries(qgnomeplatformtheme Qt5::ThemeSupportPrivate) +endif() +if (USE_QT6) + install(TARGETS qgnomeplatformtheme DESTINATION ${QT6_INSTALL_PLUGINS}/platformthemes) +else() + install(TARGETS qgnomeplatformtheme DESTINATION ${QT_PLUGINS_DIR}/platformthemes) +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/theme/qgnomeplatformtheme.cpp new/QGnomePlatform-0.8.4/src/theme/qgnomeplatformtheme.cpp --- old/QGnomePlatform-0.8.0/src/theme/qgnomeplatformtheme.cpp 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/theme/qgnomeplatformtheme.cpp 2022-01-11 10:46:15.000000000 +0100 @@ -31,9 +31,11 @@ #include <gtk-3.0/gtk/gtk.h> #define signals Q_SIGNALS -#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) +#if QT_VERSION < 0x060000 +#ifndef QT_NO_SYSTEMTRAYICON #include <private/qdbustrayicon_p.h> #endif +#endif QGnomePlatformTheme::QGnomePlatformTheme() { @@ -109,7 +111,8 @@ } } -#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) +#if QT_VERSION < 0x060000 +#ifndef QT_NO_SYSTEMTRAYICON static bool isDBusTrayAvailable() { static bool dbusTrayAvailable = false; static bool dbusTrayAvailableKnown = false; @@ -123,13 +126,16 @@ return dbusTrayAvailable; } #endif +#endif -#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) -QPlatformSystemTrayIcon * QGnomePlatformTheme::createPlatformSystemTrayIcon() const +#ifndef QT_NO_SYSTEMTRAYICON +QPlatformSystemTrayIcon* QGnomePlatformTheme::createPlatformSystemTrayIcon() const { +#if QT_VERSION < 0x060000 if (isDBusTrayAvailable()) { return new QDBusTrayIcon(); } +#endif return Q_NULLPTR; } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/theme/qgnomeplatformtheme.h new/QGnomePlatform-0.8.4/src/theme/qgnomeplatformtheme.h --- old/QGnomePlatform-0.8.0/src/theme/qgnomeplatformtheme.h 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/theme/qgnomeplatformtheme.h 2022-01-11 10:46:15.000000000 +0100 @@ -36,8 +36,8 @@ const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE; QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE; -#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) - virtual QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const; +#ifndef QT_NO_SYSTEMTRAYICON + QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE; #endif }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.8.0/src/theme/qgtk3dialoghelpers.cpp new/QGnomePlatform-0.8.4/src/theme/qgtk3dialoghelpers.cpp --- old/QGnomePlatform-0.8.0/src/theme/qgtk3dialoghelpers.cpp 2021-06-01 14:19:02.000000000 +0200 +++ new/QGnomePlatform-0.8.4/src/theme/qgtk3dialoghelpers.cpp 2022-01-11 10:46:15.000000000 +0100 @@ -616,7 +616,24 @@ font.setFamily(family); const int weight = pango_font_description_get_weight(desc); - font.setWeight(QPlatformFontDatabase::weightFromInteger(weight)); + if (weight >= PANGO_WEIGHT_HEAVY) + font.setWeight(QFont::Black); + else if (weight >= PANGO_WEIGHT_ULTRABOLD) + font.setWeight(QFont::ExtraBold); + else if (weight >= PANGO_WEIGHT_BOLD) + font.setWeight(QFont::Bold); + else if (weight >= PANGO_WEIGHT_SEMIBOLD) + font.setWeight(QFont::DemiBold); + else if (weight >= PANGO_WEIGHT_MEDIUM) + font.setWeight(QFont::Medium); + else if (weight >= PANGO_WEIGHT_NORMAL) + font.setWeight(QFont::Normal); + else if (weight >= PANGO_WEIGHT_LIGHT) + font.setWeight(QFont::Light); + else if (weight >= PANGO_WEIGHT_ULTRALIGHT) + font.setWeight(QFont::ExtraLight); + else + font.setWeight(QFont::Thin); PangoStyle style = pango_font_description_get_style(desc); if (style == PANGO_STYLE_ITALIC)
