From b0569dfa7697ad19b0368c88de5764e6db0887de Mon Sep 17 00:00:00 2001
From: Joel Bosveld <Joel.Bosveld@gmail.com>
Date: Tue, 24 Mar 2009 22:16:05 +0900
Subject: [PATCH] Add focusNotify to CompWindow

---
 include/core/window.h |    8 ++++++--
 src/event.cpp         |    2 ++
 src/window.cpp        |   11 ++++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/include/core/window.h b/include/core/window.h
index 985deb7..36f5b6c 100644
--- a/include/core/window.h
+++ b/include/core/window.h
@@ -216,11 +216,13 @@ class WindowInterface : public WrapableInterface<CompWindow, WindowInterface>
 
 	virtual void stateChangeNotify (unsigned int lastState);
 
+	virtual void focusNotify (CompWindow *old);
+
 	virtual void updateFrameRegion (CompRegion &region);
 };
 
 class CompWindow :
-    public WrapableHandler<WindowInterface, 13>,
+    public WrapableHandler<WindowInterface, 14>,
     public PluginClassStorage
 {
     public:
@@ -482,8 +484,10 @@ class CompWindow :
 	WRAPABLE_HND (10, WindowInterface, void, ungrabNotify);
 	WRAPABLE_HND (11, WindowInterface, void, stateChangeNotify,
 		      unsigned int);
+	WRAPABLE_HND (12, WindowInterface, void, focusNotify,
+		      CompWindow *);
 
-	WRAPABLE_HND (12, WindowInterface, void, updateFrameRegion,
+	WRAPABLE_HND (13, WindowInterface, void, updateFrameRegion,
 		      CompRegion &);
 
 	friend class PrivateWindow;
diff --git a/src/event.cpp b/src/event.cpp
index f0e6d77..29620ed 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1612,6 +1612,8 @@ CompScreen::handleEvent (XEvent *event)
 
 		if (w->id () != priv->activeWindow)
 		{
+		    w->focusNotify (findWindow (priv->activeWindow));
+
 		    priv->activeWindow = w->id ();
 		    w->priv->activeNum = priv->activeNum++;
 
diff --git a/src/window.cpp b/src/window.cpp
index 7799aa5..8421e25 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1697,6 +1697,11 @@ void
 CompWindow::stateChangeNotify (unsigned int lastState)
     WRAPABLE_HND_FUNC (11, stateChangeNotify, lastState);
 
+void
+CompWindow::focusNotify (CompWindow *old)
+    WRAPABLE_HND_FUNC (12, focusNotify, old);
+
+
 bool
 PrivateWindow::isGroupTransient (Window clientLeader)
 {
@@ -4151,6 +4156,10 @@ WindowInterface::stateChangeNotify (unsigned int lastState)
     WRAPABLE_DEF (stateChangeNotify, lastState)
 
 void
+WindowInterface::focusNotify (CompWindow *old)
+    WRAPABLE_DEF (focusNotify, old)
+
+void
 WindowInterface::updateFrameRegion (CompRegion &region)
     WRAPABLE_DEF (updateFrameRegion, region)
 
@@ -5162,7 +5171,7 @@ CompWindow::setWindowFrameExtents (CompWindowExtents *i)
 
 void
 CompWindow::updateFrameRegion (CompRegion& region)
-    WRAPABLE_HND_FUNC (12, updateFrameRegion, region)
+    WRAPABLE_HND_FUNC (13, updateFrameRegion, region)
 
 bool
 PrivateWindow::reparent ()
-- 
1.6.0.3

