-
Notifications
You must be signed in to change notification settings - Fork 55
fix: 关闭弹窗时同时关闭启动器 #1397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: 关闭弹窗时同时关闭启动器 #1397
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,30 @@ import Qt.labs.platform | |
|
|
||
| Item { | ||
| property Menu activeMenu: null | ||
| property var aboutToHideConnections: ({}) // Store connections by menu object | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Using a plain JS object keyed by menu instances is unreliable because keys are coerced to strings. Because QML/JS object keys are always strings, indexing with |
||
|
|
||
| function openMenu(menu: Menu) { | ||
| if (activeMenu) { | ||
| activeMenu.close() | ||
| } | ||
|
|
||
| // Disconnect previous connection for this menu if exists | ||
| if (aboutToHideConnections[menu]) { | ||
| try { | ||
| menu.aboutToHide.disconnect(aboutToHideConnections[menu]) | ||
| } catch (e) { | ||
| // Silently ignore disconnect errors | ||
| } | ||
| } | ||
| menu.open() | ||
| menu.aboutToHide.connect(() => { activeMenu = null }) | ||
|
|
||
| // Create and store the handler for this specific menu | ||
| let handler = function() { | ||
| activeMenu = null | ||
| } | ||
| aboutToHideConnections[menu] = handler | ||
| menu.aboutToHide.connect(handler) | ||
|
|
||
| activeMenu = menu | ||
| } | ||
| function closeMenu(menu: Menu) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ Window { | |
| (Screen.width - dockLeftPart.implicitWidth - dockRightPart.implicitWidth) | ||
| property int dockRemainingSpaceForCenter: useColumnLayout ? | ||
| (Screen.height / 1.8 - dockRightPart.implicitHeight) : | ||
| (Screen.width / 1.8 - dockRightPart.implicitWidth) | ||
| (Screen.width / 1.8 - dockRightPart.implicitWidth) | ||
| property int dockPartSpacing: gridLayout.columnSpacing | ||
| // TODO | ||
| signal dockCenterPartPosChanged() | ||
|
|
@@ -42,6 +42,9 @@ Window { | |
|
|
||
| property real dockItemIconSize: dockItemMaxSize * 9 / 14 | ||
|
|
||
| // LauncherController wrapper for optional launchpad support | ||
| property var launcherControllerWrapper: null | ||
|
|
||
| // NOTE: -1 means not set its size, follow the platform size | ||
| width: Panel.position === Dock.Top || Panel.position === Dock.Bottom ? -1 : dockSize | ||
| height: Panel.position === Dock.Left || Panel.position === Dock.Right ? -1 : dockSize | ||
|
|
@@ -65,7 +68,7 @@ Window { | |
| D.DWindow.windowRadius: 0 | ||
| //TODO:由于windoweffect处理有BUG,导致动画结束后一致保持无阴影,无borderwidth状态。 无法恢复到最初的阴影和边框 | ||
| //D.DWindow.windowEffect: hideShowAnimation.running ? D.PlatformHandle.EffectNoShadow | D.PlatformHandle.EffectNoBorder : 0 | ||
|
|
||
| // 目前直接处理shadowColor(透明和默认值的切换)和borderWidth(0和1的切换),来控制阴影和边框 | ||
| // 默认阴影透明度是 60%,见: https://github.com/linuxdeepin/qt5platform-plugins/blob/master/xcb/dframewindow.h#L122 | ||
| D.DWindow.shadowColor: hideShowAnimation.running ? Qt.rgba(0, 0, 0, 0) : Qt.rgba(0, 0, 0, 0.6) | ||
|
|
@@ -119,13 +122,13 @@ Window { | |
| Connections { | ||
| target: dockTransform | ||
| enabled: Qt.platform.pluginName === "xcb" && hideShowAnimation.running | ||
|
|
||
| function onXChanged() { | ||
| if (dock.useColumnLayout) { | ||
| Panel.notifyDockPositionChanged(dockTransform.x, 0) | ||
| } | ||
| } | ||
|
|
||
| function onYChanged() { | ||
| if (!dock.useColumnLayout) { | ||
| Panel.notifyDockPositionChanged(0, dockTransform.y) | ||
|
|
@@ -136,13 +139,13 @@ Window { | |
| Connections { | ||
| target: dock | ||
| enabled: Qt.platform.pluginName !== "xcb" && hideShowAnimation.running | ||
|
|
||
| function onWidthChanged() { | ||
| if (dock.useColumnLayout) { | ||
| Panel.notifyDockPositionChanged(dock.width, 0) | ||
| } | ||
| } | ||
|
|
||
| function onHeightChanged() { | ||
| if (!dock.useColumnLayout) { | ||
| Panel.notifyDockPositionChanged(0, dock.height) | ||
|
|
@@ -458,18 +461,18 @@ Window { | |
| } | ||
| } | ||
|
|
||
| Item { | ||
| Item { | ||
| id: dockCenterPart | ||
| property var taskmanagerRootObject: { | ||
| let applet = DS.applet("org.deepin.ds.dock.taskmanager") | ||
| return applet ? applet.rootObject : null | ||
| } | ||
|
|
||
| readonly property real taskmanagerImplicitWidth: taskmanagerRootObject ? taskmanagerRootObject.implicitWidth : 0 | ||
| readonly property real taskmanagerImplicitHeight: taskmanagerRootObject ? taskmanagerRootObject.implicitHeight : 0 | ||
| readonly property real taskmanagerAppContainerWidth: taskmanagerRootObject ? taskmanagerRootObject.appContainerWidth : 0 | ||
| readonly property real taskmanagerAppContainerHeight: taskmanagerRootObject ? taskmanagerRootObject.appContainerHeight : 0 | ||
|
|
||
| implicitWidth: centerLoader.implicitWidth - taskmanagerImplicitWidth + taskmanagerAppContainerWidth | ||
| implicitHeight: centerLoader.implicitHeight - taskmanagerImplicitHeight + taskmanagerAppContainerHeight | ||
| onXChanged: dockCenterPartPosChanged() | ||
|
|
@@ -685,6 +688,10 @@ Window { | |
| DS.closeChildrenWindows(popup) | ||
| if (popup && popup.visible) | ||
| popup.close() | ||
| // Close dde-launchpad if available | ||
| if (launcherControllerWrapper) { | ||
| launcherControllerWrapper.hide() | ||
| } | ||
| } | ||
| function onDockScreenChanged() { | ||
| // Close all popups when dock moves to another screen | ||
|
|
@@ -744,5 +751,14 @@ Window { | |
| dock.itemIconSizeBase = dock.dockItemMaxSize | ||
| dock.visible = Panel.hideState !== Dock.Hide | ||
| changeDragAreaAnchor() | ||
|
|
||
| // Try to create LauncherController wrapper for optional launchpad support | ||
| try { | ||
| launcherControllerWrapper = Qt.createQmlObject( | ||
| 'import QtQuick 2.15; import org.deepin.launchpad 1.0; QtObject { function hide() { LauncherController.visible = false } }', | ||
| dock, "LauncherControllerWrapper") | ||
|
Comment on lines
+758
to
+759
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 啊?这里的目的仅仅是为了获取LauncherController以便你隐藏launchpad是么? |
||
| } catch (e) { | ||
| // Launchpad module not available, launcherControllerWrapper remains null | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onRequestClosePopup 的时候关掉启动器的话,下面那一堆仍然是需要的吗?