scripting: Drop Window.desktop property
This commit is contained in:
parent
ecb58c987f
commit
017bb6d3c8
5 changed files with 13 additions and 20 deletions
|
@ -43,11 +43,11 @@ FocusScope {
|
|||
effect.swapDesktops(drag.source.desktop.x11DesktopNumber, desktop.x11DesktopNumber);
|
||||
} else {
|
||||
// dragging a KWin::Window
|
||||
if (drag.source.desktop === desktopView.desktop.x11DesktopNumber) {
|
||||
if (drag.source.desktops.length === 0 || drag.source.desktops.indexOf(desktopView.desktop) !== -1) {
|
||||
drop.action = Qt.IgnoreAction;
|
||||
return;
|
||||
}
|
||||
drag.source.desktop = desktopView.desktop.x11DesktopNumber;
|
||||
drag.source.desktops = [desktopView.desktop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ FocusScope {
|
|||
if (!desktopView.contains(desktopView.mapFromItem(null, pos.x, pos.y))) {
|
||||
return;
|
||||
}
|
||||
item.client.desktop = desktopView.desktop.x11DesktopNumber;
|
||||
item.client.desktops = [desktopView.desktop];
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
|
@ -137,10 +137,10 @@ FocusScope {
|
|||
if (eventPoint.event.button === Qt.MiddleButton) {
|
||||
window.closeWindow();
|
||||
} else if (eventPoint.event.button === Qt.RightButton) {
|
||||
if (window.desktop > -1) {
|
||||
window.desktop = -1;
|
||||
if (window.desktops.length > 0) {
|
||||
window.desktops = [];
|
||||
} else {
|
||||
window.desktop = desktopView.desktop.x11DesktopNumber;
|
||||
window.desktops = [desktopView.desktop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,11 +203,11 @@ Item {
|
|||
onDropped: drop => {
|
||||
drop.accepted = true;
|
||||
// dragging a KWin::Window
|
||||
if (drag.source.desktop === delegate.desktop.x11DesktopNumber) {
|
||||
if (drag.source.desktops.length === 0 || drag.source.desktops.indexOf(delegate.desktop) !== -1) {
|
||||
drop.action = Qt.IgnoreAction;
|
||||
return;
|
||||
}
|
||||
drag.source.desktop = delegate.desktop.x11DesktopNumber;
|
||||
drag.source.desktops = [delegate.desktop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,8 +304,8 @@ Item {
|
|||
drag.accepted = desktopModel.rowCount() < 20
|
||||
}
|
||||
onDropped: {
|
||||
desktopModel.create(desktopModel.rowCount());
|
||||
drag.source.desktop = desktopModel.rowCount() + 1;
|
||||
const desktop = desktopModel.create(desktopModel.rowCount());
|
||||
drag.source.desktops = [desktop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ VirtualDesktopModel::VirtualDesktopModel(QObject *parent)
|
|||
m_virtualDesktops = manager->desktops();
|
||||
}
|
||||
|
||||
void VirtualDesktopModel::create(uint position, const QString &name)
|
||||
VirtualDesktop *VirtualDesktopModel::create(uint position, const QString &name)
|
||||
{
|
||||
VirtualDesktopManager::self()->createVirtualDesktop(position, name);
|
||||
return VirtualDesktopManager::self()->createVirtualDesktop(position, name);
|
||||
}
|
||||
|
||||
void VirtualDesktopModel::remove(uint position)
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void create(uint position, const QString &name = QString());
|
||||
KWin::VirtualDesktop *create(uint position, const QString &name = QString());
|
||||
void remove(uint position);
|
||||
|
||||
private:
|
||||
|
|
|
@ -310,13 +310,6 @@ class KWIN_EXPORT Window : public QObject
|
|||
*/
|
||||
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
|
||||
|
||||
/**
|
||||
* The desktop this Window is on. If the Window is on all desktops the property has value -1.
|
||||
*
|
||||
* @deprecated Use the desktops property instead.
|
||||
*/
|
||||
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
|
||||
|
||||
/**
|
||||
* The virtual desktops this client is on. If it's on all desktops, the list is empty.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue