Skip to content

Commit

Permalink
fix: task switcher alt show
Browse files Browse the repository at this point in the history
Signed-off-by: pengwenhao <[email protected]>
  • Loading branch information
pengwenhao authored and Groveer committed Oct 17, 2024
1 parent 82c8c8b commit 24d3939
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/qml/TaskSwitcher.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.deepin.dtk 1.0 as D

Item {
id: root
visible: false

required property QtObject output
readonly property OutputItem outputItem: output.outputItem
Expand Down Expand Up @@ -218,7 +219,7 @@ Item {

onCurrentIndexChanged: {
if (switchView.currentItem)
Helper.activateSurface(switchView.currentItem.surface)
switchView.currentItem.surface?.requestForceActive()

ensurePreview()
}
Expand Down Expand Up @@ -403,19 +404,38 @@ Item {

function previous() {
if (showTask(true)) {
if (switchView.count === 1) {
previewContext.visible = true
currentContext.visible = true

currentContext.loaderStatus = 0
currentContext.loaderStatus = 1
switchView.currentItem.surface?.requestForceActive()
return
}

previewContext.sourceSueface = switchView.currentItem.surface
var previousIndex = (switchView.currentIndex - 1 + switchView.count) % switchView.count
switchView.currentIndex = previousIndex
Helper.activateSurface(switchView.currentItem.surface)
switchView.currentItem.surface?.requestForceActive()
}
}

function next() {
if (showTask(true)) {
if (switchView.count === 1) {
previewContext.visible = true
currentContext.visible = true

currentContext.loaderStatus = 0
currentContext.loaderStatus = 1
Helper.activateSurface(switchView.currentItem.surface)
return
}

previewContext.sourceSueface = switchView.currentItem.surface
var nextIndex = (switchView.currentIndex + 1) % switchView.count
switchView.currentIndex = nextIndex
Helper.activateSurface(switchView.currentItem.surface)
}
}

Expand Down

0 comments on commit 24d3939

Please sign in to comment.