Commit b0d6eab4 authored by Eike Hein's avatar Eike Hein

Adjust Task Manager to libtaskmanager API changes for Wayland virtual desktop support

Summary:
Depends on D13745.

This code is largely untested and subject to change.

Reviewers: mart, davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D13746
parent 2ea223d5
......@@ -137,7 +137,7 @@ PlasmaComponents.ContextMenu {
// Add Media Player control actions
var sourceName = mpris2Source.sourceNameForLauncherUrl(launcherUrl, get(atm.AppPid));
if (sourceName && !(get(atm.LegacyWinIdList) != undefined && get(atm.LegacyWinIdList).length > 1)) {
if (sourceName && !(get(atm.WinIdList) != undefined && get(atm.WinIdList).length > 1)) {
var playerData = mpris2Source.data[sourceName]
if (playerData.CanControl) {
......@@ -261,7 +261,7 @@ PlasmaComponents.ContextMenu {
visible: virtualDesktopInfo.numberOfDesktops > 1
&& (visualParent && get(atm.IsLauncher) !== true
&& get(atm.IsStartup) !== true
&& get(atm.IsVirtualDesktopChangeable) === true)
&& get(atm.IsVirtualDesktopsChangeable) === true)
enabled: visible
......@@ -270,8 +270,9 @@ PlasmaComponents.ContextMenu {
Connections {
target: virtualDesktopInfo
onNumberOfDesktopsChanged: virtualDesktopsMenu.refresh()
onDesktopNamesChanged: virtualDesktopsMenu.refresh()
onNumberOfDesktopsChanged: Qt.callLater(virtualDesktopsMenu.refresh)
onDesktopIdsChanged: Qt.callLater(virtualDesktopsMenu.refresh)
onDesktopNamesChanged: Qt.callLater(virtualDesktopsMenu.refresh)
}
PlasmaComponents.ContextMenu {
......@@ -289,10 +290,10 @@ PlasmaComponents.ContextMenu {
var menuItem = menu.newMenuItem(virtualDesktopsMenu);
menuItem.text = i18n("Move &To Current Desktop");
menuItem.enabled = Qt.binding(function() {
return menu.visualParent && menu.get(atm.VirtualDesktop) != virtualDesktopInfo.currentDesktop;
return menu.visualParent && menu.get(atm.VirtualDesktops).indexOf(virtualDesktopInfo.currentDesktop) == -1;
});
menuItem.clicked.connect(function() {
tasksModel.requestVirtualDesktop(menu.modelIndex, virtualDesktopInfo.currentDesktop);
tasksModel.requestVirtualDesktops(menu.modelIndex, [virtualDesktopInfo.currentDesktop]);
});
menuItem = menu.newMenuItem(virtualDesktopsMenu);
......@@ -302,7 +303,7 @@ PlasmaComponents.ContextMenu {
return menu.visualParent && menu.get(atm.IsOnAllVirtualDesktops) === true;
});
menuItem.clicked.connect(function() {
tasksModel.requestVirtualDesktop(menu.modelIndex, 0);
tasksModel.requestVirtualDesktops(menu.modelIndex, []);
});
backend.setActionGroup(menuItem.action);
......@@ -313,10 +314,10 @@ PlasmaComponents.ContextMenu {
menuItem.text = i18nc("1 = number of desktop, 2 = desktop name", "&%1 %2", i + 1, virtualDesktopInfo.desktopNames[i]);
menuItem.checkable = true;
menuItem.checked = Qt.binding((function(i) {
return function() { return menu.visualParent && menu.get(atm.VirtualDesktop) == (i + 1) };
return function() { return menu.visualParent && menu.get(atm.VirtualDesktops).indexOf(virtualDesktopInfo.desktopIds[i]) > -1 };
})(i));
menuItem.clicked.connect((function(i) {
return function() { return tasksModel.requestVirtualDesktop(menu.modelIndex, i + 1); };
return function() { return tasksModel.requestVirtualDesktops(menu.modelIndex, [virtualDesktopInfo.desktopIds[i]]); };
})(i));
backend.setActionGroup(menuItem.action);
}
......@@ -326,7 +327,7 @@ PlasmaComponents.ContextMenu {
menuItem = menu.newMenuItem(virtualDesktopsMenu);
menuItem.text = i18n("&New Desktop");
menuItem.clicked.connect(function() {
tasksModel.requestVirtualDesktop(menu.modelIndex, virtualDesktopInfo.numberOfDesktops + 1)
tasksModel.requestNewVirtualDesktop(menu.modelIndex);
});
}
......
......@@ -80,6 +80,13 @@ Item {
var above = target.childAt(event.x, event.y);
if (!above) {
hoveredItem = null;
activationTimer.stop();
return;
}
// If we're mixing launcher tasks with other tasks and are moving
// a (small) launcher task across a non-launcher task, don't allow
// the latter to be the move target twice in a row for a while, as
......@@ -91,8 +98,8 @@ Item {
// the movement direction has reversed, etablishing user intent to
// move back.
if (!plasmoid.configuration.separateLaunchers && tasks.dragSource != null
&& tasks.dragSource.m.IsLauncher === true && above != null
&& above.m.IsLauncher !== true && above == ignoredItem) {
&& tasks.dragSource.m.IsLauncher === true && above.m.IsLauncher !== true
&& above == ignoredItem) {
return;
} else {
ignoredItem = null;
......@@ -117,12 +124,9 @@ Item {
ignoredItem = above;
ignoreItemTimer.restart();
}
} else if (!tasks.dragSource && above && hoveredItem != above) {
} else if (!tasks.dragSource && hoveredItem != above) {
hoveredItem = above;
activationTimer.restart();
} else if (!above) {
hoveredItem = null;
activationTimer.stop();
}
}
......
......@@ -125,7 +125,7 @@ MouseArea {
}
if (model.IsWindow === true) {
tasks.windowsHovered(model.LegacyWinIdList, containsMouse);
tasks.windowsHovered(model.WinIdList, containsMouse);
}
}
......@@ -343,7 +343,7 @@ MouseArea {
return model.AppPid;
});
toolTipDelegate.windows = Qt.binding(function() {
return model.LegacyWinIdList;
return model.WinIdList;
});
toolTipDelegate.isGroup = Qt.binding(function() {
return model.IsGroupParent == true;
......
......@@ -99,7 +99,7 @@ function activateTask(index, model, modifiers, task) {
} else if (model.IsGroupParent === true) {
if ((iconsOnly || modifiers == Qt.ControlModifier) && backend.canPresentWindows()) {
task.toolTipAreaItem.hideToolTip();
tasks.presentWindows(model.LegacyWinIdList);
tasks.presentWindows(model.WinIdList);
} else if (groupDialog.visible) {
groupDialog.visible = false;
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment