2012-11-16 07:23:47 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#ifndef KWIN_VIRTUAL_DESKTOPS_H
|
|
|
|
#define KWIN_VIRTUAL_DESKTOPS_H
|
2013-04-05 07:41:25 +00:00
|
|
|
// KWin
|
|
|
|
#include <kwinglobals.h>
|
2017-04-04 16:56:10 +00:00
|
|
|
#include <kwin_export.h>
|
2012-11-16 07:23:47 +00:00
|
|
|
// Qt includes
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPoint>
|
2016-11-07 09:55:18 +00:00
|
|
|
#include <QPointer>
|
2012-11-16 07:23:47 +00:00
|
|
|
#include <QSize>
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2012-11-16 07:23:47 +00:00
|
|
|
// KDE includes
|
2014-03-17 15:24:10 +00:00
|
|
|
#include <KConfig>
|
2014-03-18 13:37:01 +00:00
|
|
|
#include <KSharedConfig>
|
2012-11-16 07:23:47 +00:00
|
|
|
|
|
|
|
class KLocalizedString;
|
|
|
|
class NETRootInfo;
|
2017-03-18 10:00:30 +00:00
|
|
|
class QAction;
|
2012-11-16 07:23:47 +00:00
|
|
|
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
namespace KWayland
|
|
|
|
{
|
|
|
|
namespace Server
|
|
|
|
{
|
|
|
|
class PlasmaVirtualDesktopManagementInterface;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-16 07:23:47 +00:00
|
|
|
namespace KWin {
|
|
|
|
|
2017-04-04 16:56:10 +00:00
|
|
|
class KWIN_EXPORT VirtualDesktop : public QObject
|
2016-11-07 09:55:18 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QByteArray id READ id CONSTANT)
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
Q_PROPERTY(uint x11DesktopNumber READ x11DesktopNumber NOTIFY x11DesktopNumberChanged)
|
2016-11-07 09:55:18 +00:00
|
|
|
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
|
|
|
|
public:
|
|
|
|
explicit VirtualDesktop(QObject *parent = nullptr);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~VirtualDesktop() override;
|
2016-11-07 09:55:18 +00:00
|
|
|
|
|
|
|
void setId(const QByteArray &id);
|
|
|
|
QByteArray id() const {
|
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setName(const QString &name);
|
|
|
|
QString name() const {
|
|
|
|
return m_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setX11DesktopNumber(uint number);
|
|
|
|
uint x11DesktopNumber() const {
|
|
|
|
return m_x11DesktopNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void nameChanged();
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void x11DesktopNumberChanged();
|
2017-04-04 16:56:10 +00:00
|
|
|
/**
|
|
|
|
* Emitted just before the desktop gets destroyed.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-04-04 16:56:10 +00:00
|
|
|
void aboutToBeDestroyed();
|
2016-11-07 09:55:18 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QByteArray m_id;
|
|
|
|
QString m_name;
|
|
|
|
int m_x11DesktopNumber = 0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* @brief Two dimensional grid containing the ID of the virtual desktop at a specific position
|
|
|
|
* in the grid.
|
|
|
|
*
|
|
|
|
* The VirtualDesktopGrid represents a visual layout of the Virtual Desktops as they are in e.g.
|
|
|
|
* a Pager. This grid is used for getting a desktop next to a given desktop in any direction by
|
|
|
|
* making use of the layout information. This allows navigation like move to desktop on left.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
class VirtualDesktopGrid
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VirtualDesktopGrid();
|
|
|
|
~VirtualDesktopGrid();
|
2016-11-10 13:02:14 +00:00
|
|
|
void update(const QSize &size, Qt::Orientation orientation, const QVector<VirtualDesktop*> &desktops);
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* @returns The coords of desktop @a id in grid units.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
QPoint gridCoords(uint id) const;
|
|
|
|
/**
|
2016-11-10 13:02:14 +00:00
|
|
|
* @returns The coords of desktop @a vd in grid units.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
QPoint gridCoords(VirtualDesktop *vd) const;
|
|
|
|
/**
|
|
|
|
* @returns The desktop at the point @a coords or 0 if no desktop exists at that
|
2012-11-16 07:23:47 +00:00
|
|
|
* point. @a coords is to be in grid units.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *at(const QPoint &coords) const;
|
2012-11-16 07:23:47 +00:00
|
|
|
int width() const;
|
|
|
|
int height() const;
|
|
|
|
const QSize &size() const;
|
|
|
|
private:
|
|
|
|
QSize m_size;
|
2016-11-10 13:02:14 +00:00
|
|
|
QVector<QVector<VirtualDesktop*>> m_grid;
|
2012-11-16 07:23:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Manages the number of available virtual desktops, the layout of those and which virtual
|
|
|
|
* desktop is the current one.
|
|
|
|
*
|
|
|
|
* This manager is responsible for Virtual Desktop handling inside KWin. It has a property for the
|
|
|
|
* count of available virtual desktops and a property for the currently active virtual desktop. All
|
|
|
|
* changes to the number of virtual desktops and the current virtual desktop need to go through this
|
|
|
|
* manager.
|
|
|
|
*
|
|
|
|
* On all changes a signal is emitted and interested parties should connect to the signal. The manager
|
|
|
|
* itself does not interact with other parts of the system. E.g. it does not hide/show windows of
|
|
|
|
* desktop changes. This is outside the scope of this manager.
|
|
|
|
*
|
|
|
|
* Internally the manager organizes the virtual desktops in a grid allowing to navigate over the
|
|
|
|
* virtual desktops. For this a set of convenient methods are available which allow to get the id
|
|
|
|
* of an adjacent desktop or to switch to an adjacent desktop. Interested parties should make use of
|
|
|
|
* these methods and not replicate the logic to switch to the next desktop.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-04-04 16:56:10 +00:00
|
|
|
class KWIN_EXPORT VirtualDesktopManager : public QObject
|
2012-11-16 07:23:47 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
/**
|
|
|
|
* The number of virtual desktops currently available.
|
|
|
|
* The ids of the virtual desktops are in the range [1, VirtualDesktopManager::maximum()].
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
Q_PROPERTY(uint count READ count WRITE setCount NOTIFY countChanged)
|
|
|
|
/**
|
|
|
|
* The id of the virtual desktop which is currently in use.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
Q_PROPERTY(uint current READ current WRITE setCurrent NOTIFY currentChanged)
|
|
|
|
/**
|
|
|
|
* Whether navigation in the desktop layout wraps around at the borders.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
Q_PROPERTY(bool navigationWrappingAround READ isNavigationWrappingAround WRITE setNavigationWrappingAround NOTIFY navigationWrappingAroundChanged)
|
|
|
|
public:
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~VirtualDesktopManager() override;
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
* @internal, for X11 case
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void setRootInfo(NETRootInfo *info);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
/**
|
|
|
|
* @internal, for Wayland case
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void setVirtualDesktopManagement(KWayland::Server::PlasmaVirtualDesktopManagementInterface *management);
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* @internal
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void setConfig(KSharedConfig::Ptr config);
|
|
|
|
/**
|
|
|
|
* @returns Total number of desktops currently in existence.
|
|
|
|
* @see setCount
|
|
|
|
* @see countChanged
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint count() const;
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
/**
|
|
|
|
* @returns the number of rows the layout has.
|
|
|
|
* @see setRows
|
|
|
|
* @see rowsChanged
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
uint rows() const;
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* @returns The ID of the current desktop.
|
|
|
|
* @see setCurrent
|
|
|
|
* @see currentChanged
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint current() const;
|
2017-04-04 16:56:10 +00:00
|
|
|
/**
|
|
|
|
* @returns The current desktop
|
|
|
|
* @see setCurrent
|
|
|
|
* @see currentChanged
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-04-04 16:56:10 +00:00
|
|
|
VirtualDesktop *currentDesktop() const;
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* Moves to the desktop through the algorithm described by Direction.
|
|
|
|
* @param wrap If @c true wraps around to the other side of the layout
|
|
|
|
* @see setCurrent
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
template <typename Direction>
|
|
|
|
void moveTo(bool wrap = false);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The name of the @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
QString name(uint desktop) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns @c true if navigation at borders of layout wraps around, @c false otherwise
|
|
|
|
* @see setNavigationWrappingAround
|
|
|
|
* @see navigationWrappingAroundChanged
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
bool isNavigationWrappingAround() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The layout aware virtual desktop grid used by this manager.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
const VirtualDesktopGrid &grid() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The ID of the desktop above desktop @a id. Wraps around to the bottom of
|
|
|
|
* the layout if @a wrap is set. If @a id is not set use the current one.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint above(uint id = 0, bool wrap = true) const;
|
2016-11-10 13:02:14 +00:00
|
|
|
/**
|
|
|
|
* @returns The desktop above desktop @a desktop. Wraps around to the bottom of
|
|
|
|
* the layout if @a wrap is set. If @a desktop is @c null use the current one.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *above(VirtualDesktop *desktop, bool wrap = true) const;
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* @returns The ID of the desktop to the right of desktop @a id. Wraps around to the
|
|
|
|
* left of the layout if @a wrap is set. If @a id is not set use the current one.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint toRight(uint id = 0, bool wrap = true) const;
|
2016-11-10 13:02:14 +00:00
|
|
|
/**
|
|
|
|
* @returns The desktop to the right of desktop @a desktop. Wraps around to the
|
|
|
|
* left of the layout if @a wrap is set. If @a desktop is @c null use the current one.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *toRight(VirtualDesktop *desktop, bool wrap = true) const;
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* @returns The ID of the desktop below desktop @a id. Wraps around to the top of the
|
|
|
|
* layout if @a wrap is set. If @a id is not set use the current one.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint below(uint id = 0, bool wrap = true) const;
|
2016-11-10 13:02:14 +00:00
|
|
|
/**
|
|
|
|
* @returns The desktop below desktop @a desktop. Wraps around to the top of the
|
|
|
|
* layout if @a wrap is set. If @a desktop is @c null use the current one.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *below(VirtualDesktop *desktop, bool wrap = true) const;
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* @returns The ID of the desktop to the left of desktop @a id. Wraps around to the
|
|
|
|
* right of the layout if @a wrap is set. If @a id is not set use the current one.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint toLeft(uint id = 0, bool wrap = true) const;
|
|
|
|
/**
|
2016-11-10 13:02:14 +00:00
|
|
|
* @returns The desktop to the left of desktop @a desktop. Wraps around to the
|
|
|
|
* right of the layout if @a wrap is set. If @a desktop is @c null use the current one.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *toLeft(VirtualDesktop *desktop, bool wrap = true) const;
|
|
|
|
/**
|
|
|
|
* @returns The desktop after the desktop @a desktop. Wraps around to the first
|
|
|
|
* desktop if @a wrap is set. If @a desktop is @c null use the current desktop.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *next(VirtualDesktop *desktop = nullptr, bool wrap = true) const;
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
2016-11-10 13:02:14 +00:00
|
|
|
* @returns The desktop in front of the desktop @a desktop. Wraps around to the
|
|
|
|
* last desktop if @a wrap is set. If @a desktop is @c null use the current desktop.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *previous(VirtualDesktop *desktop = nullptr, bool wrap = true) const;
|
2012-11-16 07:23:47 +00:00
|
|
|
|
2013-12-10 08:11:16 +00:00
|
|
|
void initShortcuts();
|
2012-11-16 07:23:47 +00:00
|
|
|
|
2016-11-10 13:02:14 +00:00
|
|
|
/**
|
|
|
|
* @returns all currently managed VirtualDesktops
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
QVector<VirtualDesktop*> desktops() const {
|
|
|
|
return m_desktops;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The VirtualDesktop for the x11 @p id, if no such VirtualDesktop @c null is returned
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *desktopForX11Id(uint id) const;
|
|
|
|
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
/**
|
|
|
|
* @returns The VirtualDesktop for the internal desktop string @p id, if no such VirtualDesktop @c null is returned
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
VirtualDesktop *desktopForId(const QByteArray &id) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new virtual desktop at the requested position.
|
|
|
|
* The difference with setCount is that setCount always adds new desktops at the end of the chain. The Id is automatically generated.
|
2019-01-17 21:12:11 +00:00
|
|
|
* @param position The position of the desktop. It should be in range [0, count].
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
* @param name The name for the new desktop, if empty the default name will be used.
|
|
|
|
* @returns the new VirtualDesktop, nullptr if we reached the maximum number of desktops
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-01-17 21:12:11 +00:00
|
|
|
VirtualDesktop *createVirtualDesktop(uint position, const QString &name = QString());
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the virtual desktop identified by id, if it exists
|
|
|
|
* difference with setCount is that is possible to remove an arbitrary desktop,
|
|
|
|
* not only the last one.
|
|
|
|
* @param id the string id of the desktop to remove
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void removeVirtualDesktop(const QByteArray &id);
|
|
|
|
|
2017-10-01 13:37:41 +00:00
|
|
|
/**
|
|
|
|
* Updates the net root info for new number of desktops
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-10-01 13:37:41 +00:00
|
|
|
void updateRootInfo();
|
|
|
|
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* @returns The maximum number of desktops that KWin supports.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
static uint maximum();
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
public Q_SLOTS:
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* Set the number of available desktops to @a count. This function overrides any previous
|
|
|
|
* grid layout.
|
|
|
|
* There needs to be at least one virtual desktop and the new value is capped at the maximum
|
|
|
|
* number of desktops. A caller of this function cannot expect that the change has been applied.
|
2019-01-12 10:31:32 +00:00
|
|
|
* It is the callers responsibility to either check the numberOfDesktops or connect to the
|
2019-01-11 13:36:17 +00:00
|
|
|
* countChanged signal.
|
2012-11-16 07:23:47 +00:00
|
|
|
*
|
2019-01-12 10:31:32 +00:00
|
|
|
* In case the @ref current desktop is on a desktop higher than the new count, the current desktop
|
2019-01-11 13:36:17 +00:00
|
|
|
* is changed to be the new desktop with highest id. In that situation the signal desktopRemoved
|
2012-11-16 07:23:47 +00:00
|
|
|
* is emitted.
|
|
|
|
* @param count The new number of desktops to use
|
|
|
|
* @see count
|
|
|
|
* @see maximum
|
|
|
|
* @see countChanged
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
* @see desktopCreated
|
|
|
|
* @see desktopRemoved
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void setCount(uint count);
|
|
|
|
/**
|
|
|
|
* Set the current desktop to @a current.
|
|
|
|
* @returns True on success, false otherwise.
|
|
|
|
* @see current
|
|
|
|
* @see currentChanged
|
|
|
|
* @see moveTo
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
bool setCurrent(uint current);
|
2016-11-10 13:02:14 +00:00
|
|
|
/**
|
|
|
|
* Set the current desktop to @a current.
|
|
|
|
* @returns True on success, false otherwise.
|
|
|
|
* @see current
|
|
|
|
* @see currentChanged
|
|
|
|
* @see moveTo
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
bool setCurrent(VirtualDesktop *current);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
/**
|
|
|
|
* Updates the layout to a new number of rows. The number of columns will be calculated accordingly
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void setRows(uint rows);
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* Called from within setCount() to ensure the desktop layout is still valid.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void updateLayout();
|
|
|
|
/**
|
2018-12-03 21:40:12 +00:00
|
|
|
* @param enabled wrapping around borders for navigation in desktop layout
|
2012-11-16 07:23:47 +00:00
|
|
|
* @see isNavigationWrappingAround
|
|
|
|
* @see navigationWrappingAroundChanged
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void setNavigationWrappingAround(bool enabled);
|
|
|
|
/**
|
|
|
|
* Loads number of desktops and names from configuration file
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void load();
|
|
|
|
/**
|
|
|
|
* Saves number of desktops and names to configuration file
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void save();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* Signal emitted whenever the number of virtual desktops changes.
|
|
|
|
* @param previousCount The number of desktops prior to the change
|
|
|
|
* @param newCount The new current number of desktops
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void countChanged(uint previousCount, uint newCount);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
* Signal when the number of rows in the layout changes
|
2019-01-11 13:36:17 +00:00
|
|
|
* @param rows number of rows
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void rowsChanged(uint rows);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A new desktop has been created
|
|
|
|
* @param desktop the new just crated desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void desktopCreated(KWin::VirtualDesktop *desktop);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A desktop has been removed and is about to be deleted
|
|
|
|
* @param desktop the desktop that has been removed.
|
|
|
|
* It's guaranteed to stil la valid pointer when the signal arrives,
|
|
|
|
* but it's about to be deleted.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void desktopRemoved(KWin::VirtualDesktop *desktop);
|
|
|
|
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* Signal emitted whenever the current desktop changes.
|
|
|
|
* @param previousDesktop The virtual desktop changed from
|
|
|
|
* @param newDesktop The virtual desktop changed to
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void currentChanged(uint previousDesktop, uint newDesktop);
|
|
|
|
/**
|
|
|
|
* Signal emitted whenever the desktop layout changes.
|
|
|
|
* @param columns The new number of columns in the layout
|
|
|
|
* @param rows The new number of rows in the layout
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void layoutChanged(int columns, int rows);
|
|
|
|
/**
|
|
|
|
* Signal emitted whenever the navigationWrappingAround property changes.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void navigationWrappingAroundChanged();
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
private Q_SLOTS:
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* Common slot for all "Switch to Desktop n" shortcuts.
|
|
|
|
* This method uses the sender() method to access some data.
|
|
|
|
* DO NOT CALL DIRECTLY! ONLY TO BE USED FROM AN ACTION!
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void slotSwitchTo();
|
|
|
|
/**
|
|
|
|
* Slot for switch to next desktop action.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void slotNext();
|
|
|
|
/**
|
|
|
|
* Slot for switch to previous desktop action.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void slotPrevious();
|
|
|
|
/**
|
|
|
|
* Slot for switch to right desktop action.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void slotRight();
|
|
|
|
/**
|
|
|
|
* Slot for switch to left desktop action.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void slotLeft();
|
|
|
|
/**
|
|
|
|
* Slot for switch to desktop above action.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void slotUp();
|
|
|
|
/**
|
|
|
|
* Slot for switch to desktop below action.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void slotDown();
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Generate a desktop layout from EWMH _NET_DESKTOP_LAYOUT property parameters.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
void setNETDesktopLayout(Qt::Orientation orientation, uint width, uint height, int startingCorner);
|
|
|
|
/**
|
|
|
|
* @returns A default name for the given @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
QString defaultName(int desktop) const;
|
|
|
|
/**
|
|
|
|
* Creates all the global keyboard shortcuts for "Switch To Desktop n" actions.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2013-12-10 08:11:16 +00:00
|
|
|
void initSwitchToShortcuts();
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* Creates an action and connects it to the @p slot in this Manager. This method is
|
|
|
|
* meant to be used for the case that an additional information needs to be stored in
|
|
|
|
* the action and the label.
|
|
|
|
* @param name The name of the action to be created
|
|
|
|
* @param label The localized name for the action to be created
|
|
|
|
* @param value An additional value added to the label and to the created action
|
|
|
|
* @param key The global shortcut for the action
|
|
|
|
* @param slot The slot to invoke when the action is triggered
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-03-18 10:00:30 +00:00
|
|
|
QAction *addAction(const QString &name, const KLocalizedString &label, uint value, const QKeySequence &key, void (VirtualDesktopManager::*slot)());
|
2012-11-16 07:23:47 +00:00
|
|
|
/**
|
|
|
|
* Creates an action and connects it to the @p slot in this Manager.
|
|
|
|
* Overloaded method for the case that no additional value needs to be passed to the action and
|
|
|
|
* no global shortcut is defined by default.
|
|
|
|
* @param name The name of the action to be created
|
|
|
|
* @param label The localized name for the action to be created
|
|
|
|
* @param slot The slot to invoke when the action is triggered
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-03-18 10:00:30 +00:00
|
|
|
QAction *addAction(const QString &name, const QString &label, void (VirtualDesktopManager::*slot)());
|
2012-11-16 07:23:47 +00:00
|
|
|
|
2016-11-07 09:55:18 +00:00
|
|
|
QVector<VirtualDesktop*> m_desktops;
|
|
|
|
QPointer<VirtualDesktop> m_current;
|
Fix changing the number of rows via the dbus protocol
Summary:
* save changes to the config files when the layout is saved
* :name() works even if netrootinfo isn't there
* as soon a rootinfo is set, connect all the desktops with name changes
Test Plan:
* tested with the kcm to add, remove and rename desktops, all of that works
* setting the number of rows still only partly works: kwin notices it but
the pager doesn't notice, a plasma restart is needed
Reviewers: #plasma, #kwin, hein, davidedmundson, graesslin
Reviewed By: #plasma, #kwin, hein, davidedmundson, graesslin
Subscribers: zzag, graesslin, davidedmundson, ngraham, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D17265
2019-01-09 09:10:28 +00:00
|
|
|
quint32 m_rows = 2;
|
2012-11-16 07:23:47 +00:00
|
|
|
bool m_navigationWrapsAround;
|
|
|
|
VirtualDesktopGrid m_grid;
|
|
|
|
// TODO: QPointer
|
|
|
|
NETRootInfo *m_rootInfo;
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
KWayland::Server::PlasmaVirtualDesktopManagementInterface *m_virtualDesktopManagement = nullptr;
|
2012-11-16 07:23:47 +00:00
|
|
|
KSharedConfig::Ptr m_config;
|
|
|
|
|
2013-04-05 07:41:25 +00:00
|
|
|
KWIN_SINGLETON_VARIABLE(VirtualDesktopManager, s_manager)
|
2012-11-16 07:23:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function object to select the desktop above in the layout.
|
|
|
|
* Note: does not switch to the desktop!
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
class DesktopAbove
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DesktopAbove() {}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the desktop above should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already topmost desktop
|
|
|
|
* @returns Id of the desktop above @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint operator() (uint desktop, bool wrap) {
|
2016-11-10 13:02:14 +00:00
|
|
|
return (*this)(VirtualDesktopManager::self()->desktopForX11Id(desktop), wrap)->x11DesktopNumber();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the desktop above should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already topmost desktop
|
|
|
|
* @returns the desktop above @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *operator() (VirtualDesktop *desktop, bool wrap) {
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->above(desktop, wrap);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function object to select the desktop below in the layout.
|
|
|
|
* Note: does not switch to the desktop!
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
class DesktopBelow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DesktopBelow() {}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the desktop below should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already lowest desktop
|
|
|
|
* @returns Id of the desktop below @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint operator() (uint desktop, bool wrap) {
|
2016-11-10 13:02:14 +00:00
|
|
|
return (*this)(VirtualDesktopManager::self()->desktopForX11Id(desktop), wrap)->x11DesktopNumber();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the desktop below should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already lowest desktop
|
|
|
|
* @returns the desktop below @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *operator() (VirtualDesktop *desktop, bool wrap) {
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->below(desktop, wrap);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function object to select the desktop to the left in the layout.
|
|
|
|
* Note: does not switch to the desktop!
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
class DesktopLeft
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DesktopLeft() {}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the desktop on the left should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already leftmost desktop
|
|
|
|
* @returns Id of the desktop left of @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint operator() (uint desktop, bool wrap) {
|
2016-11-10 13:02:14 +00:00
|
|
|
return (*this)(VirtualDesktopManager::self()->desktopForX11Id(desktop), wrap)->x11DesktopNumber();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the desktop on the left should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already leftmost desktop
|
|
|
|
* @returns the desktop left of @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *operator() (VirtualDesktop *desktop, bool wrap) {
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->toLeft(desktop, wrap);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function object to select the desktop to the right in the layout.
|
|
|
|
* Note: does not switch to the desktop!
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
class DesktopRight
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DesktopRight() {}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the desktop on the right should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already rightmost desktop
|
|
|
|
* @returns Id of the desktop right of @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint operator() (uint desktop, bool wrap) {
|
2016-11-10 13:02:14 +00:00
|
|
|
return (*this)(VirtualDesktopManager::self()->desktopForX11Id(desktop), wrap)->x11DesktopNumber();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the desktop on the right should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already rightmost desktop
|
|
|
|
* @returns the desktop right of @p desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *operator() (VirtualDesktop *desktop, bool wrap) {
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->toRight(desktop, wrap);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function object to select the next desktop in the layout.
|
|
|
|
* Note: does not switch to the desktop!
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
class DesktopNext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DesktopNext() {}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the next desktop should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already last desktop
|
|
|
|
* @returns Id of the next desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint operator() (uint desktop, bool wrap) {
|
2016-11-10 13:02:14 +00:00
|
|
|
return (*this)(VirtualDesktopManager::self()->desktopForX11Id(desktop), wrap)->x11DesktopNumber();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the next desktop should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already last desktop
|
|
|
|
* @returns the next desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *operator() (VirtualDesktop *desktop, bool wrap) {
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->next(desktop, wrap);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function object to select the previous desktop in the layout.
|
|
|
|
* Note: does not switch to the desktop!
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
class DesktopPrevious
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DesktopPrevious() {}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the previous desktop should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already first desktop
|
|
|
|
* @returns Id of the previous desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
uint operator() (uint desktop, bool wrap) {
|
2016-11-10 13:02:14 +00:00
|
|
|
return (*this)(VirtualDesktopManager::self()->desktopForX11Id(desktop), wrap)->x11DesktopNumber();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param desktop The desktop from which the previous desktop should be selected. If @c 0 the current desktop is used
|
|
|
|
* @param wrap Whether to wrap around if already first desktop
|
|
|
|
* @returns the previous desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-10 13:02:14 +00:00
|
|
|
VirtualDesktop *operator() (VirtualDesktop *desktop, bool wrap) {
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->previous(desktop, wrap);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper function to get the ID of a virtual desktop in the direction from
|
|
|
|
* the given @p desktop. If @c 0 the current desktop is used as a starting point.
|
|
|
|
* @param desktop The desktop from which the desktop in given Direction should be selected.
|
|
|
|
* @param wrap Whether desktop navigation wraps around at the borders of the layout
|
|
|
|
* @returns The next desktop in specified direction
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-16 07:23:47 +00:00
|
|
|
template <typename Direction>
|
|
|
|
uint getDesktop(int desktop = 0, bool wrap = true);
|
|
|
|
|
|
|
|
template <typename Direction>
|
|
|
|
uint getDesktop(int d, bool wrap)
|
|
|
|
{
|
|
|
|
Direction direction;
|
|
|
|
return direction(d, wrap);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
int VirtualDesktopGrid::width() const
|
|
|
|
{
|
|
|
|
return m_size.width();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
int VirtualDesktopGrid::height() const
|
|
|
|
{
|
|
|
|
return m_size.height();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
const QSize &VirtualDesktopGrid::size() const
|
|
|
|
{
|
|
|
|
return m_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
uint VirtualDesktopManager::maximum()
|
|
|
|
{
|
|
|
|
return 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
uint VirtualDesktopManager::count() const
|
|
|
|
{
|
2016-11-07 09:55:18 +00:00
|
|
|
return m_desktops.count();
|
2012-11-16 07:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
bool VirtualDesktopManager::isNavigationWrappingAround() const
|
|
|
|
{
|
|
|
|
return m_navigationWrapsAround;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
void VirtualDesktopManager::setConfig(KSharedConfig::Ptr config)
|
|
|
|
{
|
2019-10-29 22:04:15 +00:00
|
|
|
m_config = std::move(config);
|
2012-11-16 07:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
const VirtualDesktopGrid &VirtualDesktopManager::grid() const
|
|
|
|
{
|
|
|
|
return m_grid;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename Direction>
|
|
|
|
void VirtualDesktopManager::moveTo(bool wrap)
|
|
|
|
{
|
|
|
|
Direction functor;
|
2016-11-10 13:02:14 +00:00
|
|
|
setCurrent(functor(nullptr, wrap));
|
2012-11-16 07:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace KWin
|
|
|
|
#endif
|