From 08f8a7c59da4213170ceaf665b564b0a4fb06f92 Mon Sep 17 00:00:00 2001 From: luoqing Date: Tue, 17 Oct 2023 10:00:58 +0800 Subject: [PATCH] fix(tray):Fixed an issue where the popup was in the wrong position when the tray was at the top of the screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复托盘在屏幕顶部时,弹窗位置不对的问题 Related #17279 --- ...n-issue-where-the-popup-was-in-the-w.patch | 125 ++++++++++++++++++ kiran-control-panel.spec | 6 +- 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 0016-fix-tray-Fixed-an-issue-where-the-popup-was-in-the-w.patch diff --git a/0016-fix-tray-Fixed-an-issue-where-the-popup-was-in-the-w.patch b/0016-fix-tray-Fixed-an-issue-where-the-popup-was-in-the-w.patch new file mode 100644 index 0000000..2adf2ff --- /dev/null +++ b/0016-fix-tray-Fixed-an-issue-where-the-popup-was-in-the-w.patch @@ -0,0 +1,125 @@ +From 74f15f8c5e6bf30a990ebf71def1c29581e67c85 Mon Sep 17 00:00:00 2001 +From: luoqing +Date: Tue, 17 Oct 2023 09:33:24 +0800 +Subject: [PATCH] fix(tray):Fixed an issue where the popup was in the wrong + position when the tray was at the top of the screen +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复托盘在屏幕顶部时,弹窗位置不对的问题 + +Related #17279 +--- + .../src/system-tray/audio-system-tray.cpp | 32 +++++++++++++------ + .../audio/src/system-tray/audio-system-tray.h | 2 +- + plugins/network/src/tray/network-tray.cpp | 16 +++++++--- + 3 files changed, 35 insertions(+), 15 deletions(-) + +diff --git a/plugins/audio/src/system-tray/audio-system-tray.cpp b/plugins/audio/src/system-tray/audio-system-tray.cpp +index 0c6aca6..cc4015d 100644 +--- a/plugins/audio/src/system-tray/audio-system-tray.cpp ++++ b/plugins/audio/src/system-tray/audio-system-tray.cpp +@@ -162,7 +162,19 @@ void AudioSystemTray::setVolumeSettingPos() + int pageWidth = 300; + int pageHeight = 66; + +- m_volumenPopup->setGeometry(xTray - pageWidth / 2, yTray - pageHeight - offset, pageWidth, pageHeight); ++ int showPosY; ++ // 托盘程序在顶端 ++ if(m_yTray == 0) ++ { ++ showPosY = m_heightTray - offset; ++ } ++ else ++ { ++ //托盘程序在底部 ++ showPosY = m_yTray - pageHeight - offset; ++ } ++ ++ m_volumenPopup->setGeometry(m_xTray - pageWidth / 2, showPosY, pageWidth, pageHeight); + } + + void AudioSystemTray::handleMixedSettingClicked() +@@ -180,7 +192,7 @@ void AudioSystemTray::setMixedSettingPos() + int width = m_mixedPopup->sizeHint().width(); + + m_mixedPopup->setFixedHeight(height + offset * 2); +- m_mixedPopup->move(xTray - width / 2, yTray - height - offset); ++ m_mixedPopup->move(m_xTray - width / 2, m_yTray - height - offset); + } + + void AudioSystemTray::handleAdjustedMixedSettingPageSize() +@@ -228,15 +240,15 @@ void AudioSystemTray::getTrayGeometry() + } + } + } +- heightTray = static_cast(height); +- widthTray = static_cast(width); +- xTray = static_cast(x); +- yTray = static_cast(y); ++ m_heightTray = static_cast(height); ++ m_widthTray = static_cast(width); ++ m_xTray = static_cast(x); ++ m_yTray = static_cast(y); + KLOG_DEBUG() << "getTrayGeometry "; +- KLOG_DEBUG() << "heightTray" << heightTray; +- KLOG_DEBUG() << "widthTray" << widthTray; +- KLOG_DEBUG() << "xTray" << xTray; +- KLOG_DEBUG() << "yTray" << yTray; ++ KLOG_DEBUG() << "heightTray" << m_heightTray; ++ KLOG_DEBUG() << "widthTray" << m_widthTray; ++ KLOG_DEBUG() << "xTray" << m_xTray; ++ KLOG_DEBUG() << "yTray" << m_yTray; + } + + // XXX:频繁调用函数,需要优化 +diff --git a/plugins/audio/src/system-tray/audio-system-tray.h b/plugins/audio/src/system-tray/audio-system-tray.h +index a61284e..fd5f150 100644 +--- a/plugins/audio/src/system-tray/audio-system-tray.h ++++ b/plugins/audio/src/system-tray/audio-system-tray.h +@@ -70,7 +70,7 @@ private: + AudioInterface* m_audioInterface; + + QString m_colorTheme; +- int xTray, yTray, heightTray, widthTray; ++ int m_xTray, m_yTray, m_heightTray, m_widthTray; + + QDBusServiceWatcher *m_dbusServiceWatcher; + }; +diff --git a/plugins/network/src/tray/network-tray.cpp b/plugins/network/src/tray/network-tray.cpp +index dd5ff12..c43d8ff 100644 +--- a/plugins/network/src/tray/network-tray.cpp ++++ b/plugins/network/src/tray/network-tray.cpp +@@ -305,16 +305,24 @@ void NetworkTray::showOrHideTrayPage() + + void NetworkTray::setTrayPagePos() + { +- // KLOG_DEBUG() << "this->sizeHint():" << this->sizeHint(); +- // KLOG_DEBUG() << "this->size():" << this->size(); +- + int pageHeight = this->size().height(); + int pageWidth = this->size().width(); + + getTrayGeometry(); + // 抵消KiranRoundedTrayPopup的margin + int offset = 8; +- this->move(m_xTray - pageWidth / 2, m_yTray - pageHeight + offset); ++ int showPosY; ++ // 托盘程序在顶端 ++ if(m_yTray == 0) ++ { ++ showPosY = m_heightTray - offset; ++ } ++ else ++ { ++ //托盘程序在底部 ++ showPosY = m_yTray - pageHeight + offset; ++ } ++ this->move(m_xTray - pageWidth / 2, showPosY); + } + + void NetworkTray::getTrayGeometry() +-- +2.33.0 + diff --git a/kiran-control-panel.spec b/kiran-control-panel.spec index c46c495..a601ba8 100644 --- a/kiran-control-panel.spec +++ b/kiran-control-panel.spec @@ -1,6 +1,6 @@ Name: kiran-control-panel Version: 2.5.5 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Kiran Control Panel Summary(zh_CN): Kiran桌面控制面板 @@ -22,6 +22,7 @@ Patch0012: 0012-fix-network-tray-Improved-the-notification-logic.-Wi.patch Patch0013: 0013-fix-network-Modify-DNS-Settings-and-display-DNS-deta.patch Patch0014: 0014-fix-tray-Fixed-the-tray-menu-using-the-X11-platform-.patch Patch0015: 0015-fix-network-tray-Fixed-an-issue-where-the-size-Setti.patch +Patch0016: 0016-fix-tray-Fixed-an-issue-where-the-popup-was-in-the-w.patch BuildRequires: gcc-c++ BuildRequires: cmake >= 3.2 @@ -178,6 +179,9 @@ make %{?_smp_mflags} rm -rf %{buildroot} %changelog +* Tue Oct 17 2023 luoqing - 2.5.5-12 +- KYOS-F: Fixed an issue where the popup was in the wrong position when the tray was at the top of the screen (#17279) + * Thu Sep 21 2023 luoqing - 2.5.5-11 - KYOS-F: Fixed an issue where the size Settings of widgets that are not currently displaying pages in the stackwidget did not take effect when multiple nics were present during tray initialization(#13862) - KYOS-F: Fixed the tray menu using the X11 platform, which caused the missing voice and network icon in the lower right corner, and the network icon in the taskbar was formatted incorrectly(#13353,#11856,#14006) -- Gitee