From aa28465df5ab1b8637b1ac91d317dd98379bf755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 6 Dec 2004 15:46:27 +0000 Subject: [PATCH] I think I got persuaded that having a direct access to the decorated window might be useful in very very very rare cases. svn path=/trunk/kdebase/kwin/; revision=368911 --- bridge.cpp | 5 +++++ bridge.h | 1 + kcmkwin/kwindecoration/preview.cpp | 5 +++++ kcmkwin/kwindecoration/preview.h | 1 + lib/kdecoration.cpp | 5 +++++ lib/kdecoration.h | 14 ++++++++++++++ lib/kdecoration_p.h | 1 + 7 files changed, 32 insertions(+) diff --git a/bridge.cpp b/bridge.cpp index fcd59dddb6..f93705d7c6 100644 --- a/bridge.cpp +++ b/bridge.cpp @@ -103,6 +103,11 @@ QWidget* Bridge::workspaceWidget() const return c->workspace()->desktopWidget(); } +WId Bridge::windowId() const + { + return c->window(); + } + void Bridge::titlebarDblClickOperation() { c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick()); diff --git a/bridge.h b/bridge.h index a59811ab31..49a4208839 100644 --- a/bridge.h +++ b/bridge.h @@ -50,6 +50,7 @@ class Bridge : public KDecorationBridge virtual QRect iconGeometry() const; virtual QRegion unobscuredRegion( const QRegion& r ) const; virtual QWidget* workspaceWidget() const; + virtual WId windowId() const; virtual void closeWindow(); virtual void maximize( MaximizeMode mode ); virtual void minimize(); diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index d81bb32b6b..9b63494390 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -375,6 +375,11 @@ QWidget* KDecorationPreviewBridge::workspaceWidget() const return preview; } +WId KDecorationPreviewBridge::windowId() const + { + return 0; // no decorated window + } + void KDecorationPreviewBridge::closeWindow() { } diff --git a/kcmkwin/kwindecoration/preview.h b/kcmkwin/kwindecoration/preview.h index 64f1509123..c0573a4d47 100644 --- a/kcmkwin/kwindecoration/preview.h +++ b/kcmkwin/kwindecoration/preview.h @@ -93,6 +93,7 @@ class KDecorationPreviewBridge virtual QRect iconGeometry() const; virtual QRegion unobscuredRegion( const QRegion& r ) const; virtual QWidget* workspaceWidget() const; + virtual WId windowId() const; virtual void closeWindow(); virtual void maximize( MaximizeMode mode ); virtual void minimize(); diff --git a/lib/kdecoration.cpp b/lib/kdecoration.cpp index faba138643..1b367a7d85 100644 --- a/lib/kdecoration.cpp +++ b/lib/kdecoration.cpp @@ -226,6 +226,11 @@ QWidget* KDecoration::workspaceWidget() const return bridge_->workspaceWidget(); } +WId KDecoration::windowId() const + { + return bridge_->windowId(); + } + void KDecoration::closeWindow() { bridge_->closeWindow(); diff --git a/lib/kdecoration.h b/lib/kdecoration.h index 0c44c9e9dd..88d73356f1 100644 --- a/lib/kdecoration.h +++ b/lib/kdecoration.h @@ -519,6 +519,20 @@ class KWIN_EXPORT KDecoration * allow painting the minimize animation or the transparent move bound on it. */ QWidget* workspaceWidget() const; + /** + * Returns the handle of the window that is being decorated. It is possible + * the returned value will be 0. + * IMPORTANT: This function is meant for special purposes, and it + * usually should not be used. The main purpose is finding out additional + * information about the window's state. Also note that different kinds + * of windows are decorated: Toplevel windows managed by the window manager, + * test window in the window manager decoration module, and possibly also + * other cases. + * Careless abuse of this function will usually sooner or later lead + * to problems. + * @since 3.4 + */ + WId windowId() const; /** * Convenience function that returns the width of the decoration. */ diff --git a/lib/kdecoration_p.h b/lib/kdecoration_p.h index b416b1c633..a864ca47a2 100644 --- a/lib/kdecoration_p.h +++ b/lib/kdecoration_p.h @@ -89,6 +89,7 @@ class KDecorationBridge : public KDecorationDefines virtual QRect iconGeometry() const = 0; virtual QRegion unobscuredRegion( const QRegion& r ) const = 0; virtual QWidget* workspaceWidget() const = 0; + virtual WId windowId() const = 0; virtual void closeWindow() = 0; virtual void maximize( MaximizeMode mode ) = 0; virtual void minimize() = 0;