diff --git a/UI/ukui-wayland/plasma-shell-manager.cpp b/UI/ukui-wayland/plasma-shell-manager.cpp new file mode 100644 index 0000000..64e6117 --- /dev/null +++ b/UI/ukui-wayland/plasma-shell-manager.cpp @@ -0,0 +1,145 @@ +#include "plasma-shell-manager.h" + +#include + +#include +#include + +#include + +static PlasmaShellManager* global_instance = nullptr; + +PlasmaShellManager *PlasmaShellManager::getInstance() +{ + if (!global_instance) + global_instance = new PlasmaShellManager; + return global_instance; +} + +bool PlasmaShellManager::setAppWindowActive() +{ + if (!supportPlasmaWindowManagement()) + return false; + + m_appWindow->requestActivate(); + return true; +} + +bool PlasmaShellManager::setAppWindowKeepAbove(bool keep) +{ + if (!supportPlasmaWindowManagement()) + return false; + + if(keep != m_appWindow->isKeepAbove()) { + m_appWindow->requestToggleKeepAbove(); + } + return true; +} + +bool PlasmaShellManager::setMaximized(QWindow *window) +{ + if (!supportShell()) + return false; + + auto surface = KWayland::Client::Surface::fromWindow(window); + if (!surface) + return false; + + auto shellSurface = m_shell->createSurface(surface, window); + if (!shellSurface) + return false; + + shellSurface->setMaximized(); + return true; +} + +bool PlasmaShellManager::setRole(QWindow *window, KWayland::Client::PlasmaShellSurface::Role role) +{ + if (!supportPlasmaShell()) + return false; + + auto surface = KWayland::Client::Surface::fromWindow(window); + if (!surface) + return false; + + auto plasmaShellSurface = m_plasmaShell->createSurface(surface, window); + if (!plasmaShellSurface) + return false; + + plasmaShellSurface->setRole(role); + return true; +} + +bool PlasmaShellManager::setPos(QWindow *window, const QPoint &pos) +{ + if (!supportPlasmaShell()) + return false; + + auto surface = KWayland::Client::Surface::fromWindow(window); + if (!surface) + return false; + + auto plasmaShellSurface = m_plasmaShell->createSurface(surface, window); + if (!plasmaShellSurface) + return false; + + plasmaShellSurface->setPosition(pos); + return true; +} + +bool PlasmaShellManager::supportPlasmaShell() +{ + return m_plasmaShell; +} + +bool PlasmaShellManager::supportShell() +{ + return m_shell; +} + +bool PlasmaShellManager::supportPlasmaWindowManagement() +{ + return m_windowManager && m_appWindow; +} + +PlasmaShellManager::PlasmaShellManager(QObject *parent) : QObject(parent) +{ + auto connection = KWayland::Client::ConnectionThread::fromApplication(qApp); + auto registry = new KWayland::Client::Registry(this); + registry->create(connection->display()); + + connect(registry, &KWayland::Client::Registry::plasmaShellAnnounced, this, [=](){ + const auto interface = registry->interface(KWayland::Client::Registry::Interface::PlasmaShell); + if (interface.name != 0) { + m_plasmaShell = registry->createPlasmaShell(interface.name, interface.version, this); + } + }); + + connect(registry, &KWayland::Client::Registry::plasmaWindowManagementAnnounced, this, [=](){ + const auto interface = registry->interface(KWayland::Client::Registry::Interface::PlasmaWindowManagement); + if (interface.name != 0) { + m_windowManager = registry->createPlasmaWindowManagement(interface.name, interface.version, this); + } + if(m_windowManager) { + connect(m_windowManager, &KWayland::Client::PlasmaWindowManagement::windowCreated, + [this](KWayland::Client::PlasmaWindow *window) { + if(window->appId() == QApplication::applicationName()){ + if(isFirstCreate) { + isFirstCreate = false; + m_appWindow = window; + } + } + }); + } + }); + + connect(registry, &KWayland::Client::Registry::shellAnnounced, this, [=](){ + const auto interface = registry->interface(KWayland::Client::Registry::Interface::Shell); + if (interface.name != 0) { + m_shell = registry->createShell(interface.name, interface.version, this); + } + }); + + registry->setup(); + connection->roundtrip(); +} diff --git a/UI/ukui-wayland/plasma-shell-manager.h b/UI/ukui-wayland/plasma-shell-manager.h new file mode 100644 index 0000000..1edc439 --- /dev/null +++ b/UI/ukui-wayland/plasma-shell-manager.h @@ -0,0 +1,36 @@ +#ifndef PLASMASHELLMANAGER_H +#define PLASMASHELLMANAGER_H + +#include +#include +#include +#include +#include + +class PlasmaShellManager : public QObject +{ + Q_OBJECT +public: + static PlasmaShellManager *getInstance(); + + bool setAppWindowActive(); + bool setAppWindowKeepAbove(bool keep); + bool setMaximized(QWindow *window); + bool setRole(QWindow *window, KWayland::Client::PlasmaShellSurface::Role role); + bool setPos(QWindow *window, const QPoint &pos); + bool supportPlasmaShell(); + bool supportShell(); + bool supportPlasmaWindowManagement(); + +private: + explicit PlasmaShellManager(QObject *parent = nullptr); + + KWayland::Client::PlasmaShell *m_plasmaShell = nullptr; + KWayland::Client::Shell *m_shell = nullptr; + KWayland::Client::PlasmaWindowManagement *m_windowManager = nullptr; + KWayland::Client::PlasmaWindow *m_appWindow = nullptr; + + bool isFirstCreate = true; +}; + +#endif // PLASMASHELLMANAGER_H diff --git a/UI/ukui-wayland/ukui-decoration-client.h b/UI/ukui-wayland/ukui-decoration-client.h new file mode 100644 index 0000000..12c131f --- /dev/null +++ b/UI/ukui-wayland/ukui-decoration-client.h @@ -0,0 +1,164 @@ +/* Generated by wayland-scanner 1.18.0 */ + +#ifndef CUSTOM_CLIENT_PROTOCOL_H +#define CUSTOM_CLIENT_PROTOCOL_H + +#include +#include +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_custom The custom protocol + * @section page_ifaces_custom Interfaces + * - @subpage page_iface_ukui_decoration - UKUI Wayland extension + * @section page_copyright_custom Copyright + *
+ *
+ * Copyright (C) 2015 The Qt Company Ltd.
+ * Contact: http://www.qt.io/licensing/
+ *
+ * This file is part of the examples of the Qt Wayland module
+ *
+ * $QT_BEGIN_LICENSE:BSD$
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * "Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of The Qt Company Ltd nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+ *
+ * $QT_END_LICENSE$
+ * 
+ */ +struct ukui_decoration; +struct wl_surface; + +/** + * @page page_iface_ukui_decoration ukui_decoration + * @section page_iface_ukui_decoration_desc Description + * + * This example shows how to add extra functionality to Wayland + * through an extension. This is the global object of the extension. + * @section page_iface_ukui_decoration_api API + * See @ref iface_ukui_decoration. + */ +/** + * @defgroup iface_ukui_decoration The ukui_decoration interface + * + * This example shows how to add extra functionality to Wayland + * through an extension. This is the global object of the extension. + */ +extern const struct wl_interface ukui_decoration_interface; + +#define UKUI_DECORATION_MOVE_SURFACE 0 +#define UKUI_DECORATION_SET_UKUI_DECORATION_MODE 1 +#define UKUI_DECORATION_SET_UNITY_BORDER_RADIUS 2 + + +/** + * @ingroup iface_ukui_decoration + */ +#define UKUI_DECORATION_MOVE_SURFACE_SINCE_VERSION 1 +/** + * @ingroup iface_ukui_decoration + */ +#define UKUI_DECORATION_SET_UKUI_DECORATION_MODE_SINCE_VERSION 1 +/** + * @ingroup iface_ukui_decoration + */ +#define UKUI_DECORATION_SET_UNITY_BORDER_RADIUS_SINCE_VERSION 1 + +/** @ingroup iface_ukui_decoration */ +static inline void +ukui_decoration_set_user_data(struct ukui_decoration *ukui_decoration, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) ukui_decoration, user_data); +} + +/** @ingroup iface_ukui_decoration */ +static inline void * +ukui_decoration_get_user_data(struct ukui_decoration *ukui_decoration) +{ + return wl_proxy_get_user_data((struct wl_proxy *) ukui_decoration); +} + +static inline uint32_t +ukui_decoration_get_version(struct ukui_decoration *ukui_decoration) +{ + return wl_proxy_get_version((struct wl_proxy *) ukui_decoration); +} + +/** @ingroup iface_ukui_decoration */ +static inline void +ukui_decoration_destroy(struct ukui_decoration *ukui_decoration) +{ + wl_proxy_destroy((struct wl_proxy *) ukui_decoration); +} + +/** + * @ingroup iface_ukui_decoration + * + * Inform the compositor that the client has a new surface that is + * covered by the extension. + */ +static inline void +ukui_decoration_move_surface(struct ukui_decoration *ukui_decoration, struct wl_surface *surface) +{ + wl_proxy_marshal((struct wl_proxy *) ukui_decoration, + UKUI_DECORATION_MOVE_SURFACE, surface); +} + +/** + * @ingroup iface_ukui_decoration + * + * The compositor should perform a move animation on the surface. + */ +static inline void +ukui_decoration_set_ukui_decoration_mode(struct ukui_decoration *ukui_decoration, struct wl_surface *surface, uint32_t mode) +{ + wl_proxy_marshal((struct wl_proxy *) ukui_decoration, + UKUI_DECORATION_SET_UKUI_DECORATION_MODE, surface, mode); +} + +/** + * @ingroup iface_ukui_decoration + * + * The compositor should perform a move animation on the surface. + */ +static inline void +ukui_decoration_set_unity_border_radius(struct ukui_decoration *ukui_decoration, struct wl_surface *surface, uint32_t topleft, uint32_t topright, uint32_t bottomleft, uint32_t bottomright) +{ + wl_proxy_marshal((struct wl_proxy *) ukui_decoration, + UKUI_DECORATION_SET_UNITY_BORDER_RADIUS, surface, topleft, topright, bottomleft, bottomright); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/UI/ukui-wayland/ukui-decoration-core.c b/UI/ukui-wayland/ukui-decoration-core.c new file mode 100644 index 0000000..f96bde4 --- /dev/null +++ b/UI/ukui-wayland/ukui-decoration-core.c @@ -0,0 +1,79 @@ +/* Generated by wayland-scanner 1.18.0 */ + +/* + * Copyright (C) 2015 The Qt Company Ltd. + * Contact: http://www.qt.io/licensing/ + * + * This file is part of the examples of the Qt Wayland module + * + * $QT_BEGIN_LICENSE:BSD$ + * You may use this file under the terms of the BSD license as follows: + * + * "Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of The Qt Company Ltd nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + * + * $QT_END_LICENSE$ + */ + +#include +#include +#include "wayland-util.h" + +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ +#endif + +#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) +#define WL_PRIVATE __attribute__ ((visibility("hidden"))) +#else +#define WL_PRIVATE +#endif + +extern const struct wl_interface wl_surface_interface; + +static const struct wl_interface *custom_types[] = { + &wl_surface_interface, + &wl_surface_interface, + NULL, + &wl_surface_interface, + NULL, + NULL, + NULL, + NULL, +}; + +static const struct wl_message ukui_decoration_requests[] = { + { "move_surface", "o", custom_types + 0 }, + { "set_ukui_decoration_mode", "ou", custom_types + 1 }, + { "set_unity_border_radius", "ouuuu", custom_types + 3 }, +}; + +WL_PRIVATE const struct wl_interface ukui_decoration_interface = { + "ukui_decoration", 1, + 3, ukui_decoration_requests, + 0, NULL, +}; + diff --git a/UI/ukui-wayland/ukui-decoration-manager.cpp b/UI/ukui-wayland/ukui-decoration-manager.cpp new file mode 100644 index 0000000..64aee9e --- /dev/null +++ b/UI/ukui-wayland/ukui-decoration-manager.cpp @@ -0,0 +1,101 @@ +#include "ukui-decoration-manager.h" + +#include "ukui-decoration-client.h" + +#include +#include +#include + +static UKUIDecorationManager *global_instance = nullptr; + +static wl_display *display = nullptr; +static ukui_decoration *ukui_decoration_manager = nullptr; + +static void handle_global(void *data, struct wl_registry *registry, + uint32_t name, const char *interface, uint32_t version) { + if (strcmp(interface, ukui_decoration_interface.name) == 0) { + ukui_decoration_manager = (ukui_decoration *) wl_registry_bind(registry, name, &ukui_decoration_interface, version); + } +} + +static void handle_global_remove(void *data, struct wl_registry *registry, + uint32_t name) { + // Who cares +} + +static const struct wl_registry_listener registry_listener = { + .global = handle_global, + .global_remove = handle_global_remove, +}; + +UKUIDecorationManager *UKUIDecorationManager::getInstance() +{ + if (!global_instance) + global_instance = new UKUIDecorationManager; + return global_instance; +} + +bool UKUIDecorationManager::supportUKUIDecoration() +{ + return ukui_decoration_manager; +} + +bool UKUIDecorationManager::moveWindow(QWindow *windowHandle) +{ + if (!supportUKUIDecoration()) + return false; + + auto nativeInterface = qApp->platformNativeInterface(); + wl_surface *surface = reinterpret_cast(nativeInterface->nativeResourceForWindow(QByteArrayLiteral("surface"), windowHandle)); + if (!surface) + return false; + + ukui_decoration_move_surface(ukui_decoration_manager, surface); + wl_surface_commit(surface); + wl_display_roundtrip(display); + return true; +} + +bool UKUIDecorationManager::removeHeaderBar(QWindow *windowHandle) +{ + if (!supportUKUIDecoration()) + return false; + + auto nativeInterface = qApp->platformNativeInterface(); + wl_surface *surface = reinterpret_cast(nativeInterface->nativeResourceForWindow(QByteArrayLiteral("surface"), windowHandle)); + if (!surface) + return false; + + ukui_decoration_set_ukui_decoration_mode(ukui_decoration_manager, surface, 1); + wl_surface_commit(surface); + wl_display_roundtrip(display); + return true; +} + +bool UKUIDecorationManager::setCornerRadius(QWindow *windowHandle, int topleft, int topright, int bottomleft, int bottomright) +{ + if (!supportUKUIDecoration()) + return false; + + auto nativeInterface = qApp->platformNativeInterface(); + wl_surface *surface = reinterpret_cast(nativeInterface->nativeResourceForWindow(QByteArrayLiteral("surface"), windowHandle)); + if (!surface) + return false; + + ukui_decoration_set_unity_border_radius(ukui_decoration_manager, surface, topleft, topright, bottomleft, bottomright); + wl_surface_commit(surface); + wl_display_roundtrip(display); + return true; +} + +UKUIDecorationManager::UKUIDecorationManager() +{ + auto connectionThread = KWayland::Client::ConnectionThread::fromApplication(qApp); + display = connectionThread->display(); + + struct wl_registry *registry = wl_display_get_registry(display); + + // get ukui_decoration_manager + wl_registry_add_listener(registry, ®istry_listener, nullptr); + wl_display_roundtrip(display); +} diff --git a/UI/ukui-wayland/ukui-decoration-manager.h b/UI/ukui-wayland/ukui-decoration-manager.h new file mode 100644 index 0000000..4c97d5b --- /dev/null +++ b/UI/ukui-wayland/ukui-decoration-manager.h @@ -0,0 +1,20 @@ +#ifndef UKUIDECORATIONMANAGER_H +#define UKUIDECORATIONMANAGER_H + +#include + +class UKUIDecorationManager +{ +public: + static UKUIDecorationManager *getInstance(); + bool supportUKUIDecoration(); + + bool moveWindow(QWindow *windowHandle); + bool removeHeaderBar(QWindow *windowHandle); + bool setCornerRadius(QWindow *windowHandle, int topleft, int topright, int bottomleft, int bottomright); + +private: + UKUIDecorationManager(); +}; + +#endif // UKUIDECORATIONMANAGER_H diff --git a/UI/ukui-wayland/ukui-raise.c b/UI/ukui-wayland/ukui-raise.c new file mode 100644 index 0000000..7ec34d3 --- /dev/null +++ b/UI/ukui-wayland/ukui-raise.c @@ -0,0 +1,30 @@ +#include +#include +#include "wayland-util.h" + +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ +#endif + +#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) +#define WL_PRIVATE __attribute__ ((visibility("hidden"))) +#else +#define WL_PRIVATE +#endif + +extern const struct wl_interface wl_surface_interface; +static const struct wl_interface *custom_types[] = { + &wl_surface_interface, + NULL, +}; + static const struct wl_message ukui_raise_requests[] = { + { "set_top", "o", custom_types + 0 } + }; + + WL_PRIVATE const struct wl_interface ukui_raise_interface = { + "ukui_raise", 1, + 1, ukui_raise_requests, + 0, NULL, + }; + + diff --git a/UI/ukui-wayland/waylanddialog.cpp b/UI/ukui-wayland/waylanddialog.cpp new file mode 100644 index 0000000..8155c2e --- /dev/null +++ b/UI/ukui-wayland/waylanddialog.cpp @@ -0,0 +1,20 @@ +#include "waylanddialog.h" +#include "ui_waylanddialog.h" + +WaylandDialog::WaylandDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::WaylandDialog) +{ + ui->setupUi(this); + setFixedSize(400, 170); +} + +WaylandDialog::~WaylandDialog() +{ + delete ui; +} + +void WaylandDialog::setText(QString text) +{ + ui->textBrowser->setText(text); +} diff --git a/UI/ukui-wayland/waylanddialog.h b/UI/ukui-wayland/waylanddialog.h new file mode 100644 index 0000000..5a2aa69 --- /dev/null +++ b/UI/ukui-wayland/waylanddialog.h @@ -0,0 +1,26 @@ +#ifndef WAYLANDDIALOG_H +#define WAYLANDDIALOG_H + +#include +#include "ukui-decoration-client.h" +#include "ukui-decoration-manager.h" + +namespace Ui { +class WaylandDialog; +} + +class WaylandDialog : public QDialog +{ + Q_OBJECT + +public: + explicit WaylandDialog(QWidget *parent = nullptr); + ~WaylandDialog(); + + void setText(QString text); + +private: + Ui::WaylandDialog *ui; +}; + +#endif // WAYLANDDIALOG_H diff --git a/UI/ukui-wayland/waylanddialog.ui b/UI/ukui-wayland/waylanddialog.ui new file mode 100644 index 0000000..bafe038 --- /dev/null +++ b/UI/ukui-wayland/waylanddialog.ui @@ -0,0 +1,83 @@ + + + WaylandDialog + + + + 0 + 0 + 400 + 210 + + + + Dialog + + + + 20 + + + 40 + + + 20 + + + 20 + + + + + background-color: rgba(255, 255, 255, 0); + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + WaylandDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + WaylandDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/debian/control b/debian/control index 92008c3..0955f1d 100644 --- a/debian/control +++ b/debian/control @@ -13,6 +13,10 @@ Build-Depends: cmake, libpeony-dev, libqt5svg5-dev, libqt5x11extras5-dev, + libxi-dev, + xorg-dev, + libkf5wayland-dev, + libwayland-dev, libsqlite3-dev, libtag1-dev, libukui-log4qt-dev, diff --git a/kylin-music.pro b/kylin-music.pro index 2024d16..cf3e5a0 100644 --- a/kylin-music.pro +++ b/kylin-music.pro @@ -1,4 +1,4 @@ -QT += core gui sql widgets dbus x11extras KWindowSystem network svg +QT += core gui sql widgets dbus x11extras KWindowSystem network svg KWaylandClient gui-private #greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -57,7 +57,7 @@ INSTALLS += \ CONFIG += link_pkgconfig -PKGCONFIG += gsettings-qt taglib gio-unix-2.0 kysdk-qtwidgets +PKGCONFIG += gsettings-qt taglib gio-unix-2.0 kysdk-qtwidgets wayland-client # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. @@ -104,6 +104,11 @@ SOURCES += \ UI/tableview/tableviewdelegate.cpp \ UI/titlebar/menumodule.cpp \ UI/titlebar/titlebar.cpp \ + UI/ukui-wayland/plasma-shell-manager.cpp \ + UI/ukui-wayland/ukui-decoration-core.c \ + UI/ukui-wayland/ukui-decoration-manager.cpp \ + UI/ukui-wayland/ukui-raise.c \ + UI/ukui-wayland/waylanddialog.cpp \ UIControl/base/daemonipcdbus.cpp \ UIControl/base/musicDataBase.cpp \ UIControl/base/musicfileinformation.cpp \ @@ -143,6 +148,10 @@ HEADERS += \ UI/tableview/tableviewdelegate.h \ UI/titlebar/menumodule.h \ UI/titlebar/titlebar.h \ + UI/ukui-wayland/plasma-shell-manager.h \ + UI/ukui-wayland/ukui-decoration-client.h \ + UI/ukui-wayland/ukui-decoration-manager.h \ + UI/ukui-wayland/waylanddialog.h \ UIControl/base/daemonipcdbus.h \ UIControl/base/musicDataBase.h \ UIControl/base/musicfileinformation.h \ @@ -167,3 +176,6 @@ DISTFILES += \ translations/generate_translations_pm.sh \ translations/kylin-music_bo_CN.ts \ translations/kylin-music_zh_CN.ts + +FORMS += \ + UI/ukui-wayland/waylanddialog.ui diff --git a/main.cpp b/main.cpp index d95724e..a490df2 100644 --- a/main.cpp +++ b/main.cpp @@ -78,10 +78,12 @@ int main(int argc, char *argv[]) initUkuiLog4qt("kylin-music"); qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); -// //高清屏幕自适应 -// QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -// QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); - // 适配4K屏 + + + if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { + qputenv("QT_QPA_PLATFORM", "wayland"); + } else { + // 适配4K屏,高清屏幕自适应 #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); @@ -90,6 +92,7 @@ int main(int argc, char *argv[]) #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); #endif + } // qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); // //高清屏幕自适应 // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); diff --git a/translations/kylin-music_bo_CN.qm b/translations/kylin-music_bo_CN.qm index 6b659bb..4f80061 100644 Binary files a/translations/kylin-music_bo_CN.qm and b/translations/kylin-music_bo_CN.qm differ diff --git a/translations/kylin-music_zh_CN.qm b/translations/kylin-music_zh_CN.qm index 3709f46..0cc4de7 100644 Binary files a/translations/kylin-music_zh_CN.qm and b/translations/kylin-music_zh_CN.qm differ