From 3a91e4dee66a7d45d55f25f1567db9d0cac8780d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Wed, 9 Nov 2011 19:51:23 +0100 Subject: [PATCH] kwin: Add a KDecorationUnstable::region() slot This slot can be reimplemented by the decoration to return the regions defined by KDecorationDefines::Region. The only region defined initially is ExtendedBorderRegion. This region specifies an invisible input region that can extend both inside and outside the decoration. The intended use case is to be able to have an active border area that's larger than the visible borders. --- libkdecorations/kdecoration.cpp | 5 +++++ libkdecorations/kdecoration.h | 36 ++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/libkdecorations/kdecoration.cpp b/libkdecorations/kdecoration.cpp index 1229f24a6e..e53f55cecc 100644 --- a/libkdecorations/kdecoration.cpp +++ b/libkdecorations/kdecoration.cpp @@ -474,6 +474,11 @@ KDecoration::WindowOperation KDecorationUnstable::buttonToWindowOperation(Qt::Mo return static_cast< KDecorationBridgeUnstable* >(bridge_)->buttonToWindowOperation(button); } +QRegion KDecorationUnstable::region(KDecorationDefines::Region) +{ + return QRegion(); +} + QString KDecorationDefines::clientGroupItemDragMimeType() { return "text/ClientGroupItem"; diff --git a/libkdecorations/kdecoration.h b/libkdecorations/kdecoration.h index 86b5ce2a26..030afa0bbb 100644 --- a/libkdecorations/kdecoration.h +++ b/libkdecorations/kdecoration.h @@ -205,10 +205,29 @@ public: enum Requirement { REQUIREMENT_DUMMY = 1000000 }; /** - * - * Returns mimeType used to drag and drop clientGroupItems - */ + * Regions that can be returned by KDecorationUnstable::region(). + */ + enum Region { + /** + * This is an invisible input region that can be used to expand the + * borders by an invisible amount, both inside and outside the + * decoration. The intended use case is to provide an active border + * area that's larger than the visible border. + * + * The mousePosition() implementation must return correct values + * for the pixels inside this region. + * + * Note that mouse events that occur within this region are not + * forwarded to the decoration. This may change in the future. + * + * @since 4.8 + */ + ExtendedBorderRegion + }; + /** + * Returns the mimeType used to drag and drop clientGroupItems + */ static QString clientGroupItemDragMimeType(); }; @@ -978,6 +997,17 @@ public: * a button press was for window tab dragging or for displaying the client menu. */ WindowOperation buttonToWindowOperation(Qt::MouseButtons button); + +public Q_SLOTS: + /** + * This slot can be reimplemented to return the regions defined + * by KDecorationDefines::Region. + * + * The default implementation always returns an empty region. + * + * @since 4.8 + */ + QRegion region(KDecorationDefines::Region r); }; inline