diff --git a/src/client/fakeinput.h b/src/client/fakeinput.h --- a/src/client/fakeinput.h +++ b/src/client/fakeinput.h @@ -38,6 +38,9 @@ /** * @short Wrapper for the org_kde_kwin_fake_input interface. * + * FakeInput allows to fake input events into the Wayland server. This is a privileged + * Wayland interface and the Wayland server is allowed to ignore all events. + * * This class provides a convenient wrapper for the org_kde_kwin_fake_input interface. * * To use this class one needs to interact with the Registry. There are two @@ -114,32 +117,91 @@ **/ EventQueue *eventQueue(); + /** + * Authenticate with the Wayland server in order to request sending fake input events. + * The Wayland server might ignore all requests without a prior authentication. + * + * The Wayland server might use the provided @p applicationName and @p reason to ask + * the user whether this request should get authenticated. + * + * There is no way for the client to figure out whether the authentication was granted + * or denied. The client should assume that it wasn't granted. + * + * @param applicationName A human readable description of the application + * @param reason A human readable explanation why this application wants to send fake requests + **/ void authenticate(const QString &applicationName, const QString &reason); + /** + * Request a relative pointer motion of @p delta pixels. + **/ void requestPointerMove(const QSizeF &delta); + /** + * Convenience overload. + * @see requestPointerButtonPress(quint32) + **/ void requestPointerButtonPress(Qt::MouseButton button); + /** + * Request a pointer button press. + * @param linuxButton The button code as defined in linux/input-event-codes.h + **/ void requestPointerButtonPress(quint32 linuxButton); + /** + * Convenience overload. + * @see requestPointerButtonRelease(quint32) + **/ void requestPointerButtonRelease(Qt::MouseButton button); + /** + * Request a pointer button release. + * @param linuxButton The button code as defined in linux/input-event-codes.h + **/ void requestPointerButtonRelease(quint32 linuxButton); + /** + * Convenience overload. + * @see requestPointerButtonClick(quint32) + **/ void requestPointerButtonClick(Qt::MouseButton button); + /** + * Requests a pointer button click, that is a press directly followed by a release. + * @param linuxButton The button code as defined in linux/input-event-codes.h + **/ void requestPointerButtonClick(quint32 linuxButton); + /** + * Request a scroll of the pointer @p axis with @p delta. + **/ void requestPointerAxis(Qt::Orientation axis, qreal delta); /** + * Request a touch down at @p pos in global coordinates. + * + * If this is the first touch down it starts a touch sequence. + * @param id The id to identify the touch point + * @param pos The global position of the touch point + * @see requestTouchMotion + * @see requestTouchUp * @since 5.23 **/ void requestTouchDown(quint32 id, const QPointF &pos); /** + * Request a move of the touch point identified by @p id to new global @p pos. + * @param id The id to identify the touch point + * @param pos The global position of the touch point + * @see requestTouchDown * @since 5.23 **/ void requestTouchMotion(quint32 id, const QPointF &pos); /** + * Requests a touch up of the touch point identified by @p id. + * @param id The id to identify the touch point * @since 5.23 **/ void requestTouchUp(quint32 id); /** + * Requests to cancel the current touch event sequence. * @since 5.23 **/ void requestTouchCancel(); /** + * Requests a touch frame. This allows to manipulate multiple touch points in one + * event and notify that the set of touch events for the current frame are finished. * @since 5.23 **/ void requestTouchFrame(); diff --git a/src/client/idle.h b/src/client/idle.h --- a/src/client/idle.h +++ b/src/client/idle.h @@ -39,6 +39,11 @@ /** * @short Wrapper for the org_kde_kwin_idle interface. * + * With the help of Idle it is possible to get notified when a Seat is not being + * used. E.g. a chat application which wants to set the user automatically to away + * if the user did not interact with the Seat for 5 minutes can create an IdleTimeout + * to get notified when the Seat has been idle for the given amount of time. + * * This class provides a convenient wrapper for the org_kde_kwin_idle interface. * * To use this class one needs to interact with the Registry. There are two @@ -115,6 +120,18 @@ **/ EventQueue *eventQueue(); + /** + * Creates a new IdleTimeout for the @p seat. If the @p seat has been idle, + * that is none of the connected input devices got used for @p msec, the + * IdleTimeout will emit the @link{IdleTimeout::idle} signal. + * + * It is not guaranteed that the signal will be emitted exactly at the given + * timeout. A Wayland server might for example have a minimum timeout which is + * larger than @p msec. + * + * @param msec The duration in milli seconds after which an idle timeout should fire + * @param seat The Seat on which the user acitivity should be monitored. + **/ IdleTimeout *getTimeout(quint32 msecs, Seat *seat, QObject *parent = nullptr); operator org_kde_kwin_idle*(); @@ -148,6 +165,10 @@ { Q_OBJECT public: + /** + * To create an IdleTimeout prefer using @link{Idle::getTimeout} which sets up the + * IdleTimeout to be fully functional. + **/ explicit IdleTimeout(QObject *parent = nullptr); virtual ~IdleTimeout(); @@ -188,10 +209,25 @@ operator org_kde_kwin_idle_timeout*(); operator org_kde_kwin_idle_timeout*() const; + /** + * Simulates user activity. If the IdleTimeout is in idle state this will trigger the + * @link{resumeFromIdle} signal. The current idle duration is reset, so the @link{idle} + * will only be emitted after a complete idle duration as requested for this IdleTimeout. + */ void simulateUserActivity(); Q_SIGNALS: + /** + * Emitted when this IdleTimeout triggered. This means the system has been idle for + * the duration specified when creating the IdleTimeout. + * @see Idle::getTimeout. + * @see resumeFromIdle + **/ void idle(); + /** + * Emitted when the system shows activity again after the idle state was reached. + * @see idle + **/ void resumeFromIdle(); private: diff --git a/src/client/plasmashell.h b/src/client/plasmashell.h --- a/src/client/plasmashell.h +++ b/src/client/plasmashell.h @@ -176,6 +176,13 @@ * * To create an instance use PlasmaShell::createSurface. * + * A PlasmaShellSurface is a privileged Surface which can add further hints to the + * Wayland server about it's position and the usage role. The Wayland server is allowed + * to ignore all requests. + * + * Even if a PlasmaShellSurface is created for a Surface a normal ShellSurface (or similar) + * needs to be created to have the Surface mapped as a window by the Wayland server. + * * @see PlasmaShell * @see Surface **/ @@ -224,26 +231,52 @@ */ static PlasmaShellSurface *get(Surface *surf); + /** + * @returns @c true if managing a org_kde_plasma_surface. + **/ bool isValid() const; operator org_kde_plasma_surface*(); operator org_kde_plasma_surface*() const; + /** + * Describes possible roles this PlasmaShellSurface can have. + * The role can be used by the Wayland server to e.g. change the stacking order accordingly. + **/ enum class Role { - Normal, - Desktop, - Panel, - OnScreenDisplay + Normal, ///< A normal Surface + Desktop, ///< The Surface represents a desktop, normally stacked below all other surfaces + Panel, ///< The Surface represents a panel (dock), normally stacked above normal surfaces + OnScreenDisplay ///< The Surface represents an on screen display, like a volume changed notification }; + /** + * Changes the requested Role to @p role. + * @see role + **/ void setRole(Role role); + /** + * @returns The requested Role, default value is @c Role::Normal. + * @see setRole + **/ Role role() const; + /** + * Requests to position this PlasmaShellSurface at @p point in global coordinates. + **/ void setPosition(const QPoint &point); + /** + * Describes how a PlasmaShellSurface with role @c Role::Panel should behave. + * @see Role + **/ enum class PanelBehavior { AlwaysVisible, AutoHide, WindowsCanCover, WindowsGoBelow }; + /** + * Sets the PanelBehavior for a PlasmaShellSurface with Role @c Role::Panel + * @see setRole + **/ void setPanelBehavior(PanelBehavior behavior); /** diff --git a/src/client/plasmawindowmanagement.h b/src/client/plasmawindowmanagement.h --- a/src/client/plasmawindowmanagement.h +++ b/src/client/plasmawindowmanagement.h @@ -41,6 +41,11 @@ /** * @short Wrapper for the org_kde_plasma_window_management interface. * + * PlasmaWindowManagement is a privileged interface. A Wayland compositor is allowed to ignore + * any requests. The PlasmaWindowManagement allows to get information about the overall windowing + * system. It allows to see which windows are currently available and thus is the base to implement + * e.g. a task manager. + * * This class provides a convenient wrapper for the org_kde_plasma_window_management interface. * It's main purpose is to create a PlasmaWindowManagementSurface. * @@ -122,13 +127,48 @@ operator org_kde_plasma_window_management*(); operator org_kde_plasma_window_management*() const; + /** + * Whether the system is currently showing the desktop. + * This means that the system focuses on the desktop and hides other windows. + * @see setShowingDesktop + * @see showDesktop + * @see hideDesktop + * @see showingDesktopChanged + **/ bool isShowingDesktop() const; + /** + * Requests to change the showing desktop state to @p show. + * @see isShowingDesktop + * @see showDesktop + * @see hideDesktop + **/ void setShowingDesktop(bool show); + /** + * Same as calling setShowingDesktop with @c true. + * @see setShowingDesktop + **/ void showDesktop(); + /** + * Same as calling setShowingDesktop with @c false. + * @see setShowingDesktop + **/ void hideDesktop(); + /** + * @returns All windows currently known to the PlasmaWindowManagement + * @see windowCreated + **/ QList windows() const; + /** + * @returns The currently active PlasmaWindow, the PlasmaWindow which + * returns @c true in @link{PlasmaWindow::isActive} or @c nullptr in case + * there is no active window. + **/ PlasmaWindow *activeWindow() const; + /** + * Factory method to create a PlasmaWindowModel. + * @returns a new created PlasmaWindowModel + **/ PlasmaWindowModel *createWindowModel(); Q_SIGNALS: @@ -140,9 +180,21 @@ * This signal is emitted right before the data is destroyed. **/ void interfaceAboutToBeDestroyed(); + /** + * The showing desktop state changed. + * @see isShowingDesktop + **/ void showingDesktopChanged(bool); + /** + * A new @p window got created. + * @see windows + **/ void windowCreated(KWayland::Client::PlasmaWindow *window); + /** + * The active window changed. + * @see activeWindow + **/ void activeWindowChanged(); /** @@ -163,6 +215,12 @@ /** * @short Wrapper for the org_kde_plasma_window interface. * + * A PlasmaWindow gets created by the PlasmaWindowManagement and announced through + * the @link{PlasmaWindowManagement::windowCreated} signal. The PlasmaWindow encapsulates + * state about a window managed by the Wayland server and allows to request state changes. + * + * The PlasmaWindow will be automatically deleted when the PlasmaWindow gets unmapped. + * * This class is a convenient wrapper for the org_kde_plasma_window interface. * The PlasmaWindow gets created by PlasmaWindowManagement. * @@ -205,54 +263,145 @@ operator org_kde_plasma_window*(); operator org_kde_plasma_window*() const; + /** + * @returns the window title. + * @see titleChanged + **/ QString title() const; + /** + * @returns the application id which should reflect the name of a desktop file. + * @see appIdChanged + **/ QString appId() const; + /** + * @returns the id of the virtual desktop this PlasmaWindow is on + * @see virtualDesktopChanged + **/ quint32 virtualDesktop() const; + /** + * @returns Whether the window is currently the active Window. + * @see activeChanged + **/ bool isActive() const; + /** + * @returns Whether the window is fullscreen + * @see fullscreenChanged + **/ bool isFullscreen() const; + /** + * @returns Whether the window is kept above other windows. + * @see keepAboveChanged + **/ bool isKeepAbove() const; + /** + * @returns Whether the window is kept below other window + * @see keepBelowChanged + **/ bool isKeepBelow() const; + /** + * @returns Whether the window is currently minimized + * @see minimizedChanged + **/ bool isMinimized() const; + /** + * @returns Whether the window is maximized. + * @see maximizedChanged + **/ bool isMaximized() const; + /** + * @returns Whether the window is shown on all desktops. + * @see virtualDesktop + * @see onAllDesktopsChanged + **/ bool isOnAllDesktops() const; + /** + * @returns Whether the window is demanding attention. + * @see demandsAttentionChanged + **/ bool isDemandingAttention() const; + /** + * @returns Whether the window can be closed. + * @see closeableChanged + **/ bool isCloseable() const; + /** + * @returns Whether the window can be maximized. + * @see maximizeableChanged + **/ bool isMaximizeable() const; + /** + * @returns Whether the window can be minimized. + * @see minimizeableChanged + **/ bool isMinimizeable() const; + /** + * @returns Whether the window can be set to fullscreen. + * @see fullscreenableChanged + **/ bool isFullscreenable() const; + /** + * @returns Whether the window should be ignored by a task bar. + * @see skipTaskbarChanged + **/ bool skipTaskbar() const; + /** + * @returns The icon of the window. + * @see iconChanged + **/ QIcon icon() const; /** + * @returns Whether the window can be set to the shaded state. + * @see isShaded + * @see shadeableChanged * @since 5.22 */ bool isShadeable() const; /** + * @returns Whether the window is shaded, that is reduced to the window decoration + * @see shadedChanged * @since 5.22 */ bool isShaded() const; /** + * @returns Whether the window can be moved. + * @see movableChanged * @since 5.22 */ bool isMovable() const; /** + * @returns Whether the window can be resized. + * @see resizableChanged * @since 5.22 */ bool isResizable() const; /** + * @returns Whether the virtual desktop can be changed. + * @see virtualDesktopChangeableChanged * @since 5.22 */ bool isVirtualDesktopChangeable() const; + /** + * Requests to activate the window. + **/ void requestActivate(); + /** + * Requests to close the window. + **/ void requestClose(); /** + * Requests to start an interactive window move operation. * @since 5.22 */ void requestMove(); /** + * Requests to start an interactive resize operation. * @since 5.22 */ void requestResize(); + /** + * Requests to send the window to virtual @p desktop. + **/ void requestVirtualDesktop(quint32 desktop); /** * Requests the window at this model row index have its minimized state toggled. @@ -291,43 +440,126 @@ quint32 internalId() const; Q_SIGNALS: + /** + * The window title changed. + * @see title + **/ void titleChanged(); + /** + * The application id changed. + * @see appId + **/ void appIdChanged(); + /** + * The virtual desktop changed. + * @see virtualDesktop + **/ void virtualDesktopChanged(); + /** + * The window became active or inactive. + * @see isActive + **/ void activeChanged(); + /** + * The fullscreen state changed. + * @see isFullscreen + **/ void fullscreenChanged(); + /** + * The keep above state changed. + * @see isKeepAbove + **/ void keepAboveChanged(); + /** + * The keep below state changed. + * @see isKeepBelow + **/ void keepBelowChanged(); + /** + * The minimized state changed. + * @see isMinimized + **/ void minimizedChanged(); + /** + * The maximized state changed. + * @see isMaximized + **/ void maximizedChanged(); + /** + * The on all desktops state changed. + * @see isOnAllDesktops + **/ void onAllDesktopsChanged(); + /** + * The demands attention state changed. + * @see isDemandingAttention + **/ void demandsAttentionChanged(); + /** + * The closeable state changed. + * @see isCloseable + **/ void closeableChanged(); + /** + * The minimizeable state changed. + * @see isMinimizeable + **/ void minimizeableChanged(); + /** + * The maximizeable state changed. + * @see isMaximizeable + **/ void maximizeableChanged(); + /** + * The fullscreenable state changed. + * @see isFullscreenable + **/ void fullscreenableChanged(); + /** + * The skip taskbar state changed. + * @see skipTaskbar + **/ void skipTaskbarChanged(); + /** + * The window icon changed. + * @see icon + **/ void iconChanged(); /** + * The shadeable state changed. + * @see isShadeable * @since 5.22 */ void shadeableChanged(); /** + * The shaded state changed. + * @see isShaded * @since 5.22 */ void shadedChanged(); /** + * The movable state changed. + * @see isMovable * @since 5.22 */ void movableChanged(); /** + * The resizable state changed. + * @see isResizable * @since 5.22 */ void resizableChanged(); /** + * The virtual desktop changeable state changed. + * @see virtualDesktopChangeable * @since 5.22 */ void virtualDesktopChangeableChanged(); + /** + * The window got unmapped and is no longer available to the Wayland server. + * This instance will be automatically deleted and one should connect to this + * signal to perform cleanup. + **/ void unmapped(); private: