From 919329ab0022718a11dd7a72028d24f22bb3a7e5 Mon Sep 17 00:00:00 2001 From: yushuoqi Date: Mon, 18 Jul 2022 16:12:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=AA=97=E5=8F=A3=E5=8F=8C?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI/mainwidget.cpp | 43 +++++++++++++++++++++++--------------- UI/player/miniwidget.cpp | 4 ++++ UI/titlebar/menumodule.cpp | 20 +++++++++++++----- debian/changelog | 2 ++ 4 files changed, 47 insertions(+), 22 deletions(-) diff --git a/UI/mainwidget.cpp b/UI/mainwidget.cpp index e084c99..9193ccf 100644 --- a/UI/mainwidget.cpp +++ b/UI/mainwidget.cpp @@ -983,6 +983,11 @@ void Widget::slotShowMiniWidget() m_miniWidget->update(); }); + if (Global::isWayland) { + kdk::UkuiStyleHelper::self()->removeHeader(this); + kdk::UkuiStyleHelper::self()->removeHeader((QWidget *)m_miniWidget); + } + m_miniWidget->setWindowOpacity(0); m_miniWidget->showNormal(); m_miniWidget->activateWindow(); @@ -1005,21 +1010,27 @@ void Widget::slotClose() void Widget::slotShowMinimized() { - this->showMinimized(); - if(Minimize == true) - { - this->showMaximized(); + if (Global::isWayland) { + kdk::UkuiStyleHelper::self()->removeHeader(this); + kdk::UkuiStyleHelper::self()->removeHeader((QWidget *)m_miniWidget); } - else - { + + this->showMinimized(); + if(Minimize == true) { + this->showMaximized(); + } else { this->showNormal(); } } void Widget::slotShowMaximized() { - if(Minimize) - { + if (Global::isWayland) { + kdk::UkuiStyleHelper::self()->removeHeader(this); + kdk::UkuiStyleHelper::self()->removeHeader(m_miniWidget); + } + + if(Minimize) { showNormal(); Minimize = false; m_titleBar->maximumBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic")); @@ -1027,13 +1038,10 @@ void Widget::slotShowMaximized() m_titleBar->maximumBtn->setProperty("isWindowButton", 0x1); m_titleBar->maximumBtn->setProperty("useIconHighlightEffect", 0x2); m_titleBar->maximumBtn->setFlat(true); - } - else - { + } else { showMaximized(); Minimize = true; m_titleBar->maximumBtn->setIcon(QIcon::fromTheme("window-restore-symbolic")); -// maximumBtn->setToolTip(tr("还原")); m_titleBar->maximumBtn->setToolTip(tr("reduction")); m_titleBar->maximumBtn->setProperty("isWindowButton", 0x1); m_titleBar->maximumBtn->setProperty("useIconHighlightEffect", 0x2); @@ -1121,12 +1129,13 @@ void Widget::PlayPause() const void Widget::slotRecoverNormalWidget() { - if(Minimize == true) - { - this->showMaximized(); + if (Global::isWayland) { + kdk::UkuiStyleHelper::self()->removeHeader(this); } - else - { + + if(Minimize == true) { + this->showMaximized(); + } else { this->showNormal(); } m_miniWidget->hide(); diff --git a/UI/player/miniwidget.cpp b/UI/player/miniwidget.cpp index 00ce70f..e64f527 100644 --- a/UI/player/miniwidget.cpp +++ b/UI/player/miniwidget.cpp @@ -31,6 +31,10 @@ miniWidget::miniWidget(QWidget *parent) : QFrame(parent) setFixedSize(300,60); this->setObjectName("miniWidget"); + if (Global::isWayland) { + kdk::UkuiStyleHelper::self()->removeHeader(this); + } + m_mouseState = false; setWindowFlags(Qt::WindowStaysOnTopHint); // setWindowFlags(Qt::FramelessWindowHint|Qt::Tool|Qt::WindowStaysOnTopHint); diff --git a/UI/titlebar/menumodule.cpp b/UI/titlebar/menumodule.cpp index bcc1218..e301efb 100644 --- a/UI/titlebar/menumodule.cpp +++ b/UI/titlebar/menumodule.cpp @@ -1,6 +1,9 @@ #include "menumodule.h" #include "UI/mainwidget.h" #include "UI/base/xatom-helper.h" +#include "UIControl/global/global.h" +#include "ukuistylehelper/ukuistylehelper.h" +#include "windowmanager/windowmanager.h" #define PT_14 14 @@ -198,11 +201,18 @@ void menuModule::helpAction(){ void menuModule::initAbout(){ aboutWindow->setWindowModality(Qt::ApplicationModal); aboutWindow->setWindowFlag(Qt::Tool); - MotifWmHints hints; - hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; - hints.functions = MWM_FUNC_ALL; - hints.decorations = MWM_DECOR_BORDER; - XAtomHelper::getInstance()->setWindowMotifHint(aboutWindow->winId(), hints); + + if (Global::isWayland) { + kdk::UkuiStyleHelper::self()->removeHeader(aboutWindow); + } else { + MotifWmHints hints; + hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; + hints.functions = MWM_FUNC_ALL; + hints.decorations = MWM_DECOR_BORDER; + XAtomHelper::getInstance()->setWindowMotifHint(aboutWindow->winId(), hints); + } + + aboutWindow->setFixedSize(420,390); QVBoxLayout *mainlyt = new QVBoxLayout(); QHBoxLayout *titleLyt = initTitleBar(); diff --git a/debian/changelog b/debian/changelog index b702411..d2b512b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ kylin-music (1.1.0.47-ok6~0718) yangtze; urgency=medium * [BUG] - close-cd: #127037, 解决音乐音量控件显示位置和窗口显示问题 + * 其他: 更改窗口双标题问题 + -- yushuoqi Mon, 18 Jul 2022 11:25:08 +0800 kylin-music (1.1.0.47-ok5~0716) yangtze; urgency=medium