Where a VirtualDesktopManager's desktops come from: the transport to the compositor that owns them. More...
#include <PhosphorWorkspaces/IVirtualDesktopBackend.h>
Classes | |
| struct | Snapshot |
| One whole desktop list, with the current desktop and the grid's rows. More... | |
Public Types | |
| using | SnapshotCallback = std::function<void(std::optional<Snapshot> snapshot)> |
| using | AnswerCallback = std::function<void(bool answered)> |
answered is false for an error or a timeout: a stall, not a refusal. | |
Signals | |
| void | currentChanged (const QString &desktopId) |
| void | countChanged (int count) |
| The desktop count, which closes a create, a remove or a resize: every desktop signal of the change went out before it. | |
| void | desktopCreated (const QString &desktopId, int position, const QString &name) |
| void | desktopCreatedUnreadable (const QString &desktopId) |
| A desktop was created but its data could not be read. | |
| void | desktopDataChanged (const QString &desktopId, int position, const QString &name) |
A desktop was renamed or moved; position is its new one. | |
| void | desktopDataChangedUnreadable () |
| A desktop's data changed but could not be read. | |
| void | desktopRemoved (const QString &desktopId) |
| void | rowsChanged (int rows) |
| The grid's row count changed (a reshape moves no desktop). | |
Public Member Functions | |
| IVirtualDesktopBackend (QObject *parent=nullptr) | |
| ~IVirtualDesktopBackend () override=default | |
| virtual bool | connectToSource ()=0 |
| Reach the compositor's desktops. | |
| virtual bool | isReachable () const =0 |
| Whether a read can reach the desktops right now. | |
| virtual void | subscribe ()=0 |
| Start and stop emitting the change signals. | |
| virtual void | unsubscribe ()=0 |
| virtual std::optional< Snapshot > | readSnapshot ()=0 |
| Read the whole list now, blocking the caller. | |
| virtual void | readSnapshotAsync (SnapshotCallback done)=0 |
| Read the whole list without blocking. | |
| virtual void | setCurrentDesktop (const QString &desktopId)=0 |
| Switch to the desktop with this id, without waiting for the switch: it arrives as currentChanged. | |
| virtual void | createDesktop (uint position, const QString &name, AnswerCallback done)=0 |
| Create a desktop at a 0-based position. | |
| virtual void | removeDesktop (const QString &desktopId, AnswerCallback done)=0 |
Remove a desktop. done as for createDesktop. | |
| virtual void | setDesktopName (const QString &desktopId, const QString &name)=0 |
| Rename a desktop. The new name arrives as desktopDataChanged. | |
Where a VirtualDesktopManager's desktops come from: the transport to the compositor that owns them.
The manager keeps every rule about the desktops (validating a list, the list built from the change signals, renumbering, the per-screen desktops, one read in flight, retrying a failed read). A backend only reads, writes and reports what the compositor says, in the order the compositor says it.
KWin's backend talks to org.kde.KWin.VirtualDesktopManager on the session bus (PhosphorWorkspaces::Plasma). A compositor that owns its desktops in process implements this directly.
Signals go out only between subscribe() and unsubscribe(), and in the order the compositor produced the changes. A read answers with the compositor's state after every change signal emitted before the answer.
| using PhosphorWorkspaces::IVirtualDesktopBackend::AnswerCallback = std::function<void(bool answered)> |
answered is false for an error or a timeout: a stall, not a refusal.
| using PhosphorWorkspaces::IVirtualDesktopBackend::SnapshotCallback = std::function<void(std::optional<Snapshot> snapshot)> |
|
inlineexplicit |
|
overridedefault |
|
pure virtual |
Reach the compositor's desktops.
False when there are none to reach; the manager then stays unavailable. Called once.
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
signal |
The desktop count, which closes a create, a remove or a resize: every desktop signal of the change went out before it.
|
pure virtual |
Create a desktop at a 0-based position.
done runs once the compositor answered, after any desktopCreated the call caused, and never after this backend is destroyed.
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
signal |
|
signal |
|
signal |
A desktop was created but its data could not be read.
desktopId is the id when that much was readable, else empty.
|
signal |
A desktop was renamed or moved; position is its new one.
|
signal |
A desktop's data changed but could not be read.
|
signal |
|
pure virtual |
Whether a read can reach the desktops right now.
KWin's backend says no while KWin is off the bus (a restart). The manager reads nothing then, and commits a count change as reported instead of reading the list.
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
pure virtual |
Read the whole list now, blocking the caller.
nullopt when the read failed. Used only while the manager is not running (before start(), after stop()).
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
pure virtual |
Read the whole list without blocking.
done runs once, with nullopt when the read failed, and never after this backend is destroyed.
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
pure virtual |
Remove a desktop. done as for createDesktop.
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
signal |
The grid's row count changed (a reshape moves no desktop).
|
pure virtual |
Switch to the desktop with this id, without waiting for the switch: it arrives as currentChanged.
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
pure virtual |
Rename a desktop. The new name arrives as desktopDataChanged.
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
pure virtual |
Start and stop emitting the change signals.
Each is called only when the other was last, so neither needs to guard against doubling.
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.
|
pure virtual |
Implemented in PhosphorWorkspaces::KWinVirtualDesktopBackend.