diff --git a/anda/themes/k4oxygen/anda.hcl b/anda/themes/k4oxygen/anda.hcl new file mode 100644 index 0000000000..ddb498c8be --- /dev/null +++ b/anda/themes/k4oxygen/anda.hcl @@ -0,0 +1,5 @@ +project "pkg" { + rpm { + spec = "k4oxygen.spec" + } +} diff --git a/anda/themes/k4oxygen/k4oxygen.spec b/anda/themes/k4oxygen/k4oxygen.spec new file mode 100644 index 0000000000..9a7c58111e --- /dev/null +++ b/anda/themes/k4oxygen/k4oxygen.spec @@ -0,0 +1,155 @@ +%global style k4oxygen +%global dev 10110111 + +%global forgeurl https://github.com/%{dev}/%{style} +%global commit b0291eff019d4ccd498970d0c8323e49e74a2fec +%global date 20240329 +%forgemeta + +Name: %{style} +Version: 0 +Release: %autorelease +Summary: Variant of KDE4 Oxygen widget theme +License: LGPL-2.1 +URL: %{forgeurl} +Source: %{forgesource} +Patch: qt6x11_wayland.patch + +BuildRequires: cmake +BuildRequires: pkgconfig(xcb) +BuildRequires: pkgconfig(x11) + +#Qt6 +BuildRequires: cmake(Qt6Core) +BuildRequires: cmake(Qt6Widgets) +BuildRequires: cmake(Qt6Gui) +BuildRequires: cmake(Qt6DBus) +BuildRequires: qt6-qtbase-private-devel +BuildRequires: qt6-rpm-macros + +# Qt5 +BuildRequires: cmake(Qt5Core) +BuildRequires: cmake(Qt5Widgets) +BuildRequires: cmake(Qt5Gui) +BuildRequires: cmake(Qt5DBus) +BuildRequires: cmake(Qt5X11Extras) +BuildRequires: qt5-rpm-macros + +# Qt4 +BuildRequires: pkgconfig(Qt) + +Requires: %{style}-common +Requires: (%{style}-qt4 if qt) +Requires: (%{style}-qt5 if qt5-qtbase) +Requires: (%{style}-qt6 if qt6-qtbase) + +%description +K4Oxygen is a variant of KDE4 Oxygen widget theme, released from KDE +dependencies and supported for Qt4, Qt5, and Qt6. It is based on +oxygen-transparent for KDE4, but currently has some **limitations**: + +- no window decorations implementation +- no configuration utility +- translucency in Qt5 version is in experimental stage, and unchecked + completely in Qt6 version + +The theme does read Oxygen and global KDE settings similarly to how +oxygen-gtk does it. + +%files +#nothing + +#------------------------------------------------------------------------------- + +%package common +Summary: Common files for k4oxygen widget style +Enhances: %{style} + +%description common +%{summary} + +%files common +%license COPYING +%doc README.md + +#----------------------------------------------------------------------------- + +%package qt4 +Summary: Variant of KDE4 Oxygen widget theme for Qt4 +Requires: %{style}-common +Enhances: %{style} + +%description qt4 +K4Oxygen is a variant of KDE4 Oxygen widget theme, released from KDE +dependencies and supported for Qt4, Qt5, and Qt6. + +This package contains the Qt4 style. + +%files qt4 +%{_qt4_plugindir}/styles/%{style}.so + +#----------------------------------------------------------------------------- + +%package qt5 +Summary: Variant of KDE4 Oxygen widget theme for Qt5 +Requires: %{style}-common +Enhances: %{style} + +%description qt5 +K4Oxygen is a variant of KDE4 Oxygen widget theme, released from KDE +dependencies and supported for Qt4, Qt5, and Qt6. + +This package contains the Qt5 style. + +%files qt5 +%{_qt5_plugindir}/styles/%{style}.so + +#----------------------------------------------------------------------------- + +%package qt6 +Summary: Variant of KDE4 Oxygen widget theme for Qt6 +Requires: %{style}-common +Enhances: %{style} + +%description qt6 +K4Oxygen is a variant of KDE4 Oxygen widget theme, released from KDE +dependencies and supported for Qt4, Qt5, and Qt6. + +This package contains the Qt6 style. + +%files qt6 +%{_qt6_plugindir}/styles/%{style}.so + +#----------------------------------------------------------------------------- + +%prep +%forgesetup + +%build +# Build for Qt 4 +%global _vpath_builddir %{_target_platform}-qt4 +%cmake -DQT_VERSION=4 -B %{_vpath_builddir} +%cmake_build + +# Build for Qt 5 +%global _vpath_builddir %{_target_platform}-qt5 +%cmake -DQT_VERSION=5 -B %{_vpath_builddir} +%cmake_build + +# Build for Qt 6 +/usr/bin/patch -p1 -s < %{_sourcedir}/qt6x11_wayland.patch +%global _vpath_builddir %{_target_platform}-qt6 +%cmake -DQT_VERSION=6 -B %{_vpath_builddir} +%cmake_build + +%install +%cmake_install +%undefine _vpath_builddir + +%cmake_install +%undefine _vpath_builddir + +%cmake_install + +%changelog +%autochangelog diff --git a/anda/themes/k4oxygen/qt6x11_wayland.patch b/anda/themes/k4oxygen/qt6x11_wayland.patch new file mode 100644 index 0000000000..8742ac15f6 --- /dev/null +++ b/anda/themes/k4oxygen/qt6x11_wayland.patch @@ -0,0 +1,277 @@ +From 6a60f887f76c714d9a2c0f4c1a4d2ec36fd47617 Mon Sep 17 00:00:00 2001 +From: Ruslan Kabatsayev +Date: Sat, 13 May 2023 00:36:57 +0400 +Subject: [PATCH] Add support for X11-based tricks in Qt6 + +--- + CMakeLists.txt | 11 ++-------- + libs/oxygenhelper.cpp | 2 +- + style/oxygenargbhelper.cpp | 1 - + style/oxygenargbhelper.h | 5 +---- + style/oxygenblurhelper.cpp | 9 +++++++- + style/oxygenblurhelper.h | 4 +--- + style/oxygenshadowhelper.cpp | 9 ++++++-- + style/oxygenshadowhelper.h | 2 +- + style/oxygenstylehelper.h | 6 +----- + style/oxygenwindowmanager.cpp | 4 ++-- + style/oxygenx11.h | 39 +++++++++++++++++++++++++++++++++++ + 11 files changed, 63 insertions(+), 29 deletions(-) + create mode 100644 style/oxygenx11.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e65b7ea..c3cf481 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -8,17 +8,10 @@ if(NOT DEFINED QT_VERSION) + endif() + if("${QT_VERSION}" STREQUAL 6) + message("++ Compiling style for Qt 6") +- find_package(Qt6 6.0 COMPONENTS Core X11Extras QUIET) ++ find_package(Qt6 6.0 COMPONENTS Core QUIET) + find_package(Qt6 6.0 REQUIRED Core DBus Gui Widgets) + set(QT_LIBRARIES Qt6::Core Qt6::DBus Qt6::Gui Qt6::Widgets) +- if(Qt6X11Extras_FOUND) +- list(APPEND QT_LIBRARIES Qt6::X11Extras) +- set(X11_FOUND TRUE) +- else() +- if(UNIX AND NOT APPLE) +- message(WARNING "QtX11Extras package wasn't found. Shadows and smooth corners of menus and tooltips, as well as dragging by empty areas, won't be supported.") +- endif() +- endif() ++ set(X11_FOUND TRUE) # FIXME: determine it correctly here + if(NOT DEFINED PLUGIN_INSTALL_DIR) + get_target_property(libQtCorePath Qt6::Core LOCATION) + get_filename_component(libQtCoreDir "${libQtCorePath}" DIRECTORY) +diff --git a/libs/oxygenhelper.cpp b/libs/oxygenhelper.cpp +index 83caf6b..bd195f6 100644 +--- a/libs/oxygenhelper.cpp ++++ b/libs/oxygenhelper.cpp +@@ -34,7 +34,7 @@ + #include + ++#include "oxygenx11.h" + #if HAVE_X11 +-#include + #include + #include + #include "fixx11h.h" +diff --git a/style/oxygenargbhelper.cpp b/style/oxygenargbhelper.cpp +index 2379674..fd88602 100644 +--- a/style/oxygenargbhelper.cpp ++++ b/style/oxygenargbhelper.cpp +@@ -38,7 +38,6 @@ + #endif + + #if HAVE_X11 +-#include + #include + #include + #endif +diff --git a/style/oxygenargbhelper.h b/style/oxygenargbhelper.h +index 3fa3ab6..b417e38 100644 +--- a/style/oxygenargbhelper.h ++++ b/style/oxygenargbhelper.h +@@ -31,6 +31,7 @@ + ////////////////////////////////////////////////////////////////////////////// + + #include "oxygenstylehelper.h" ++#include "oxygenx11.h" + + #include + #include +@@ -38,10 +39,6 @@ + #include + #include + +-#if HAVE_X11 +-#include +-#endif +- + namespace Oxygen + { + class ArgbHelper: public QObject +diff --git a/style/oxygenblurhelper.cpp b/style/oxygenblurhelper.cpp +index b9e7f2f..c78ff35 100644 +--- a/style/oxygenblurhelper.cpp ++++ b/style/oxygenblurhelper.cpp +@@ -38,7 +38,6 @@ + #include + + #if HAVE_X11 +-#include + #include + #include + #endif +@@ -236,7 +235,11 @@ namespace Oxygen + } else { + + QVector data; ++#if QT_VERSION_CHECK(5,8,0) ++ for(const auto& rect : blurRegion) ++#else + foreach( const QRect& rect, blurRegion.rects() ) ++#endif + { data << rect.x() << rect.y() << rect.width() << rect.height(); } + + XChangeProperty( +@@ -246,7 +249,11 @@ namespace Oxygen + if( ! widget->inherits( "Konsole::MainWindow" ) ) + { + data.clear(); ++#if QT_VERSION_CHECK(5,8,0) ++ for(const auto& rect : opaqueRegion) ++#else + foreach( const QRect& rect, opaqueRegion.rects() ) ++#endif + { data << rect.x() << rect.y() << rect.width() << rect.height(); } + + XChangeProperty( +diff --git a/style/oxygenblurhelper.h b/style/oxygenblurhelper.h +index 8df097c..2670f8d 100644 +--- a/style/oxygenblurhelper.h ++++ b/style/oxygenblurhelper.h +@@ -44,9 +44,7 @@ + #include + #include + +-#if HAVE_X11 +-#include +-#endif ++#include "oxygenx11.h" + + namespace Oxygen + { +diff --git a/style/oxygenshadowhelper.cpp b/style/oxygenshadowhelper.cpp +index 3ee1cfb..33bbd77 100644 +--- a/style/oxygenshadowhelper.cpp ++++ b/style/oxygenshadowhelper.cpp +@@ -36,7 +36,6 @@ + #include + + #if HAVE_X11 +-#include + #include + #include + #include +@@ -339,7 +338,7 @@ namespace Oxygen + QImage image=source.toImage(); + xcb_put_image(xcbc,XCB_IMAGE_FORMAT_Z_PIXMAP,pixmap,gc_, + image.width(),image.height(),0,0, +- 0,32,image.byteCount(),image.constBits()); ++ 0,32,image.sizeInBytes(),image.constBits()); + + return pixmap; + #else +@@ -397,7 +396,13 @@ namespace Oxygen + // balloon tip needs special margins to deal with the arrow + int top = 0; + int bottom = 0; ++#if QT_VERSION_CHECK(6,0,0) ++ const auto margins = widget->contentsMargins(); ++ top = margins.top(); ++ bottom = margins.bottom(); ++#else + widget->getContentsMargins(NULL, &top, NULL, &bottom ); ++#endif + + // also need to decrement default size further due to extra hard coded round corner + const int size = _size - 2; +diff --git a/style/oxygenshadowhelper.h b/style/oxygenshadowhelper.h +index 580a171..508907d 100644 +--- a/style/oxygenshadowhelper.h ++++ b/style/oxygenshadowhelper.h +@@ -35,8 +35,8 @@ + + #include + ++#include "oxygenx11.h" + #if HAVE_X11 +-#include + #include + #endif + +diff --git a/style/oxygenstylehelper.h b/style/oxygenstylehelper.h +index 9e88b09..78672cb 100644 +--- a/style/oxygenstylehelper.h ++++ b/style/oxygenstylehelper.h +@@ -24,11 +24,7 @@ + + #include "oxygenhelper.h" + #include "oxygenanimationmodes.h" +- +-#if HAVE_X11 +-#include +-#include +-#endif ++#include "oxygenx11.h" + + //! helper class + /*! contains utility functions used at multiple places in oxygen style */ +diff --git a/style/oxygenwindowmanager.cpp b/style/oxygenwindowmanager.cpp +index a5e8752..28d021f 100644 +--- a/style/oxygenwindowmanager.cpp ++++ b/style/oxygenwindowmanager.cpp +@@ -60,8 +60,8 @@ + + #include "oxygenconfig.h" + ++#include "oxygenx11.h" + #if HAVE_X11 +-#include + #include "oxygennetrootinfo.h" + #endif + +@@ -620,7 +620,7 @@ namespace Oxygen + { + + #if HAVE_X11 +- XUngrabPointer(QX11Info::display(), QX11Info::appTime()); ++ XUngrabPointer(QX11Info::display(), CurrentTime); + NETRootInfo rootInfo(QX11Info::display(), NET::WMMoveResize); + rootInfo.moveResizeRequest( widget->window()->winId(), position.x(), position.y(), NET::Move); + #endif +diff --git a/style/oxygenx11.h b/style/oxygenx11.h +new file mode 100644 +index 0000000..797da0b +--- /dev/null ++++ b/style/oxygenx11.h +@@ -0,0 +1,39 @@ ++#ifndef INCLUDE_ONCE_B863251D_0A4C_4B6F_9A58_2E13272D9A5A ++#define INCLUDE_ONCE_B863251D_0A4C_4B6F_9A58_2E13272D9A5A ++ ++#include ++#include ++ ++#if HAVE_X11 ++# if QT_VERSION_CHECK(6,0,0) ++# include ++class QX11Info ++{ ++public: ++ static Display* display() ++ { ++ const auto x11app = qGuiApp->nativeInterface(); ++ if(!x11app) return nullptr; ++ return reinterpret_cast(x11app->display()); ++ } ++ static Window appRootWindow() { return DefaultRootWindow(display()); } ++}; ++# else ++# include ++# include ++# endif ++ ++// Fix stupid #defines in ++# undef Bool ++typedef int Bool; ++# undef None ++# undef CursorShape ++enum ++{ ++ None = 0, ++ CursorShape = 0, ++}; ++ ++#endif ++ ++#endif