On Tue, Mar 10, 2009 at 6:52 PM, Sam Spilsbury <smspil...@gmail.com> wrote: > Hi, > > There is currently no w->iconGeometry getter. This is required for > plugins like animation, minimize and thumbnail. > > This patch: > -> Changes the XRectangle definition to CompRect as part of the new > (unofficial) standard > -> Adds a getter for priv->iconGeometry and priv->iconGeometrySet > > The patch is attached. > > Kind Regards, > > Sam > > -- > Sam Spilsbury >
Hi, Danny requested that I make some changes. There is no longer an iconGeometrySet getter and CompRect now has an empty () method to check to see if it contains nothing. Regards, Sam -- Sam Spilsbury
From 8fd9da8e7a48b6ece45fb4ca05233eab2ea846e5 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury <s...@xps-suse.site> Date: Tue, 10 Mar 2009 19:12:43 +0900 Subject: [PATCH] Added iconGeometry getter and convert priv->iconGeometry to CompRect --- include/core/window.h | 2 ++ src/privatewindow.h | 3 +-- src/window.cpp | 30 +++++++++++++++--------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/core/window.h b/include/core/window.h index a896d56..27c7bc1 100644 --- a/include/core/window.h +++ b/include/core/window.h @@ -396,6 +396,8 @@ class CompWindow : CompIcon * getIcon (int width, int height); + CompRect iconGeometry (); + int outputDevice (); bool onCurrentDesktop (); diff --git a/src/privatewindow.h b/src/privatewindow.h index ee3224e..1e776f7 100644 --- a/src/privatewindow.h +++ b/src/privatewindow.h @@ -273,8 +273,7 @@ class PrivateWindow { std::vector<CompIcon *> icons; bool noIcons; - XRectangle iconGeometry; - bool iconGeometrySet; + CompRect iconGeometry; XWindowChanges saveWc; int saveMask; diff --git a/src/window.cpp b/src/window.cpp index 45d8c8d..b06d422 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -345,24 +345,24 @@ PrivateWindow::updateIconGeometry () 0L, 1024L, False, XA_CARDINAL, &actual, &format, &n, &left, &data); - priv->iconGeometrySet = false; - if (result == Success && data) { if (n == 4) { unsigned long *geometry = (unsigned long *) data; - priv->iconGeometry.x = geometry[0]; - priv->iconGeometry.y = geometry[1]; - priv->iconGeometry.width = geometry[2]; - priv->iconGeometry.height = geometry[3]; - - priv->iconGeometrySet = true; + priv->iconGeometry.setX (geometry[0]); + priv->iconGeometry.setY (geometry[1]); + priv->iconGeometry.setWidth (geometry[2]); + priv->iconGeometry.setHeight (geometry[3]); } + else + priv->iconGeometry.setGeometry (0, 0, 0, 0); XFree (data); } + else + priv->iconGeometry.setGeometry (0, 0, 0, 0); } Window @@ -3922,6 +3922,12 @@ CompWindow::getIcon (int width, return icon; } +CompRect +CompWindow::iconGeometry () +{ + return priv->iconGeometry; +} + void PrivateWindow::freeIcons () { @@ -4932,7 +4938,7 @@ PrivateWindow::PrivateWindow (CompWindow *window) : icons (0), noIcons (false), - iconGeometrySet (false), + iconGeometry (0, 0, 0, 0), saveMask (0), syncCounter (0), @@ -4943,12 +4949,6 @@ PrivateWindow::PrivateWindow (CompWindow *window) : closeRequests (false), lastCloseRequestTime (0) { - iconGeometry.x = 0; - iconGeometry.y = 0; - iconGeometry.width = 0; - iconGeometry.height = 0; - iconGeometrySet = FALSE; - input.left = 0; input.right = 0; input.top = 0; -- 1.5.6
From 3c69fb62ba43009b21a1a65edf37ca228c087dad Mon Sep 17 00:00:00 2001 From: Sam Spilsbury <s...@xps-suse.site> Date: Tue, 10 Mar 2009 19:54:12 +0900 Subject: [PATCH] Add 'empty' getter for CompRect --- include/core/rect.h | 1 + src/rect.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/include/core/rect.h b/include/core/rect.h index eb7475b..9b07d25 100644 --- a/include/core/rect.h +++ b/include/core/rect.h @@ -62,6 +62,7 @@ class CompRect { bool contains (const CompPoint &) const; bool operator== (const CompRect &) const; bool operator!= (const CompRect &) const; + bool empty () const; typedef std::vector<CompRect> vector; typedef std::vector<CompRect *> ptrVector; diff --git a/src/rect.cpp b/src/rect.cpp index 2e5d82c..17d678a 100644 --- a/src/rect.cpp +++ b/src/rect.cpp @@ -135,3 +135,13 @@ CompRect::operator!= (const CompRect &rect) const { return !(*this == rect); } + +bool +CompRect::empty () const +{ + return (mRegion.extents.x1 == 0 && + mRegion.extents.x2 == 0 && + mRegion.extents.y1 == 0 && + mRegion.extents.y2 == 0); +} + -- 1.5.6
_______________________________________________ compiz mailing list compiz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/compiz