From 00993ab5661b4bd6ace3d600b826d160b423cb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 29 Dec 2011 10:19:36 +0100 Subject: [PATCH] More properties on Toplevel and Client Mostly exporting the getters used by EffectWindow as Properties. In client some have got a notify signal. REVIEW: 103510 --- client.cpp | 4 +++ client.h | 47 +++++++++++++++++++++++++++++ toplevel.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) diff --git a/client.cpp b/client.cpp index f30b70a7b6..7f499f41f8 100644 --- a/client.cpp +++ b/client.cpp @@ -204,6 +204,8 @@ Client::Client(Workspace* ws) connect(this, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), SIGNAL(geometryChanged())); connect(this, SIGNAL(clientMaximizedStateChanged(KWin::Client*,KDecorationDefines::MaximizeMode)), SIGNAL(geometryChanged())); connect(this, SIGNAL(clientStepUserMovedResized(KWin::Client*,QRect)), SIGNAL(geometryChanged())); + connect(this, SIGNAL(clientStartUserMovedResized(KWin::Client*)), SIGNAL(moveResizedChanged())); + connect(this, SIGNAL(clientFinishUserMovedResized(KWin::Client*)), SIGNAL(moveResizedChanged())); // SELI TODO: Initialize xsizehints?? } @@ -1553,6 +1555,7 @@ void Client::setSkipSwitcher(bool set) return; skip_switcher = set; updateWindowRules(); + emit skipSwitcherChanged(); } void Client::setModal(bool m) @@ -2066,6 +2069,7 @@ void Client::getIcons() } if (isManaged() && decoration != NULL) decoration->iconChange(); + emit iconChanged(); } QPixmap Client::icon(const QSize& size) const diff --git a/client.h b/client.h index c5a19fefc2..f624ea0267 100644 --- a/client.h +++ b/client.h @@ -175,6 +175,50 @@ class Client * Property uses a QObject. If the property is needed as a Client, perform a qobject_cast. **/ Q_PROPERTY(QObject *transientFor READ transientFor NOTIFY transientChanged) + /** + * By how much the window wishes to grow/shrink at least. Usually QSize(1,1). + * MAY BE DISOBEYED BY THE WM! It's only for information, do NOT rely on it at all. + * The value is evaluated each time the getter is called. + * Because of that no changed signal is provided. + */ + Q_PROPERTY(QSize basicUnit READ basicUnit) + /** + * Whether the Client is currently being moved by the user. + * Notify signal is emitted when the Client starts or ends move/resize mode. + **/ + Q_PROPERTY(bool move READ isMove NOTIFY moveResizedChanged) + /** + * Whether the Client is currently being resized by the user. + * Notify signal is emitted when the Client starts or ends move/resize mode. + **/ + Q_PROPERTY(bool resize READ isResize NOTIFY moveResizedChanged) + /** + * The optional geometry representing the minimized Client in e.g a taskbar. + * See _NET_WM_ICON_GEOMETRY at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + * The value is evaluated each time the getter is called. + * Because of that no changed signal is provided. + **/ + Q_PROPERTY(QRect iconGeometry READ iconGeometry) + /** + * Returns whether the window is any of special windows types (desktop, dock, splash, ...), + * i.e. window types that usually don't have a window frame and the user does not use window + * management (moving, raising,...) on them. + * The value is evaluated each time the getter is called. + * Because of that no changed signal is provided. + **/ + Q_PROPERTY(bool specialWindow READ isSpecialWindow) + /** + * Whether the Client can accept keyboard focus. + * The value is evaluated each time the getter is called. + * Because of that no changed signal is provided. + **/ + Q_PROPERTY(bool wantsInput READ wantsInput) + // TODO: a QIcon with all icon sizes? + Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) + /** + * Whether the Client should be excluded from window switching effects. + **/ + Q_PROPERTY(bool skipSwitcher READ skipSwitcher WRITE setSkipSwitcher NOTIFY skipSwitcherChanged) public: Client(Workspace* ws); Window wrapperId() const; @@ -595,6 +639,9 @@ signals: void keepAboveChanged(); void keepBelowChanged(); void minimizedChanged(); + void moveResizedChanged(); + void iconChanged(); + void skipSwitcherChanged(); private: void exportMappingState(int s); // ICCCM 4.1.3.1, 4.1.4, NETWM 2.5.1 diff --git a/toplevel.h b/toplevel.h index de8501ed21..2b64c69d2b 100644 --- a/toplevel.h +++ b/toplevel.h @@ -58,6 +58,92 @@ class Toplevel Q_PROPERTY(qulonglong windowId READ window CONSTANT) Q_PROPERTY(int x READ x) Q_PROPERTY(int y READ y) + Q_PROPERTY(int desktop READ desktop) + Q_PROPERTY(QRect rect READ rect) + Q_PROPERTY(QPoint clientPos READ clientPos) + Q_PROPERTY(QSize clientSize READ clientSize) + Q_PROPERTY(QByteArray resourceName READ resourceName) + Q_PROPERTY(QByteArray resourceClass READ resourceClass) + Q_PROPERTY(QByteArray windowRole READ windowRole) + /** + * Returns whether the window is a desktop background window (the one with wallpaper). + * See _NET_WM_WINDOW_TYPE_DESKTOP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool desktopWindow READ isDesktop) + /** + * Returns whether the window is a dock (i.e. a panel). + * See _NET_WM_WINDOW_TYPE_DOCK at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool dock READ isDock) + /** + * Returns whether the window is a standalone (detached) toolbar window. + * See _NET_WM_WINDOW_TYPE_TOOLBAR at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool toolbar READ isToolbar) + /** + * Returns whether the window is a torn-off menu. + * See _NET_WM_WINDOW_TYPE_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool menu READ isMenu) + /** + * Returns whether the window is a "normal" window, i.e. an application or any other window + * for which none of the specialized window types fit. + * See _NET_WM_WINDOW_TYPE_NORMAL at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool normalWindow READ isNormalWindow) + /** + * Returns whether the window is a dialog window. + * See _NET_WM_WINDOW_TYPE_DIALOG at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool dialog READ isDialog) + /** + * Returns whether the window is a splashscreen. Note that many (especially older) applications + * do not support marking their splash windows with this type. + * See _NET_WM_WINDOW_TYPE_SPLASH at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool splash READ isSplash) + /** + * Returns whether the window is a utility window, such as a tool window. + * See _NET_WM_WINDOW_TYPE_UTILITY at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool utility READ isUtility) + /** + * Returns whether the window is a dropdown menu (i.e. a popup directly or indirectly open + * from the applications menubar). + * See _NET_WM_WINDOW_TYPE_DROPDOWN_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool dropdownMenu READ isDropdownMenu) + /** + * Returns whether the window is a popup menu (that is not a torn-off or dropdown menu). + * See _NET_WM_WINDOW_TYPE_POPUP_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool popupMenu READ isPopupMenu) + /** + * Returns whether the window is a tooltip. + * See _NET_WM_WINDOW_TYPE_TOOLTIP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool tooltip READ isTooltip) + /** + * Returns whether the window is a window with a notification. + * See _NET_WM_WINDOW_TYPE_NOTIFICATION at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool notification READ isNotification) + /** + * Returns whether the window is a combobox popup. + * See _NET_WM_WINDOW_TYPE_COMBO at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool comboBox READ isComboBox) + /** + * Returns whether the window is a Drag&Drop icon. + * See _NET_WM_WINDOW_TYPE_DND at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(bool dndIcon READ isDNDIcon) + /** + * Returns the NETWM window type + * See http://standards.freedesktop.org/wm-spec/wm-spec-latest.html . + */ + Q_PROPERTY(int windowType READ windowType) + Q_PROPERTY(QStringList activities READ activities) public: Toplevel(Workspace *ws); Window frameId() const;