plugins/desktopchangeosd: Fix previous desktop indicator
BUG: 480630
This commit is contained in:
parent
63c1363ca1
commit
8f7f97148c
3 changed files with 26 additions and 37 deletions
|
@ -14,10 +14,11 @@ Loader {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Workspace
|
target: Workspace
|
||||||
function onCurrentDesktopChanged() {
|
function onCurrentDesktopChanged(previous) {
|
||||||
if (!mainItemLoader.item) {
|
if (!mainItemLoader.item) {
|
||||||
mainItemLoader.source = "osd.qml";
|
mainItemLoader.source = "osd.qml";
|
||||||
}
|
}
|
||||||
|
mainItemLoader.item.show(previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,34 +30,6 @@ PlasmaCore.Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
|
||||||
if (Workspace.isEffectActive("overview")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const index = Workspace.desktops.indexOf(Workspace.currentDesktop);
|
|
||||||
if (dialogItem.currentIndex === index) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dialogItem.previousIndex = dialogItem.currentIndex;
|
|
||||||
timer.stop();
|
|
||||||
dialogItem.currentIndex = index;
|
|
||||||
// screen geometry might have changed
|
|
||||||
var screen = Workspace.clientArea(KWin.FullScreenArea, Workspace.activeScreen, Workspace.currentDesktop);
|
|
||||||
dialogItem.screenWidth = screen.width;
|
|
||||||
dialogItem.screenHeight = screen.height;
|
|
||||||
if (dialogItem.showGrid) {
|
|
||||||
// non dependable properties might have changed
|
|
||||||
view.columns = Workspace.desktopGridWidth;
|
|
||||||
view.rows = Workspace.desktopGridHeight;
|
|
||||||
}
|
|
||||||
dialog.visible = true;
|
|
||||||
// position might have changed
|
|
||||||
dialog.x = screen.x + screen.width/2 - dialogItem.width/2;
|
|
||||||
dialog.y = screen.y + screen.height/2 - dialogItem.height/2;
|
|
||||||
// start the hide timer
|
|
||||||
timer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
id: dialogItem
|
id: dialogItem
|
||||||
property int screenWidth: 0
|
property int screenWidth: 0
|
||||||
property int screenHeight: 0
|
property int screenHeight: 0
|
||||||
|
@ -275,12 +247,6 @@ PlasmaCore.Dialog {
|
||||||
onTriggered: dialog.visible = false
|
onTriggered: dialog.visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: Workspace
|
|
||||||
function onCurrentDesktopChanged() {
|
|
||||||
dialogItem.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Options
|
target: Options
|
||||||
function onConfigChanged() {
|
function onConfigChanged() {
|
||||||
|
@ -291,7 +257,29 @@ PlasmaCore.Dialog {
|
||||||
view.columns = Workspace.desktopGridWidth;
|
view.columns = Workspace.desktopGridWidth;
|
||||||
view.rows = Workspace.desktopGridHeight;
|
view.rows = Workspace.desktopGridHeight;
|
||||||
dialogItem.loadConfig();
|
dialogItem.loadConfig();
|
||||||
dialogItem.show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function show(previous) {
|
||||||
|
if (Workspace.isEffectActive("overview")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialogItem.previousIndex = Workspace.desktops.indexOf(previous);
|
||||||
|
dialogItem.currentIndex = Workspace.desktops.indexOf(Workspace.currentDesktop);
|
||||||
|
// screen geometry might have changed
|
||||||
|
var screen = Workspace.clientArea(KWin.FullScreenArea, Workspace.activeScreen, Workspace.currentDesktop);
|
||||||
|
dialogItem.screenWidth = screen.width;
|
||||||
|
dialogItem.screenHeight = screen.height;
|
||||||
|
if (dialogItem.showGrid) {
|
||||||
|
// non dependable properties might have changed
|
||||||
|
view.columns = Workspace.desktopGridWidth;
|
||||||
|
view.rows = Workspace.desktopGridHeight;
|
||||||
|
}
|
||||||
|
dialog.visible = true;
|
||||||
|
// position might have changed
|
||||||
|
dialog.x = screen.x + screen.width/2 - dialogItem.width/2;
|
||||||
|
dialog.y = screen.y + screen.height/2 - dialogItem.height/2;
|
||||||
|
// start the hide timer
|
||||||
|
timer.restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* This signal is emitted when the current virtual desktop changes.
|
* This signal is emitted when the current virtual desktop changes.
|
||||||
*/
|
*/
|
||||||
void currentDesktopChanged();
|
void currentDesktopChanged(KWin::VirtualDesktop *previous);
|
||||||
/**
|
/**
|
||||||
* This signal is emitted when the cursor position changes.
|
* This signal is emitted when the cursor position changes.
|
||||||
* @see cursorPos()
|
* @see cursorPos()
|
||||||
|
|
Loading…
Reference in a new issue