all repos — fluxbox @ cc775983b62d7d6bee4ab73a09c101a40790947f

custom fork of the fluxbox windowmanager

FbWindow add and remove
fluxgen fluxgen
commit

cc775983b62d7d6bee4ab73a09c101a40790947f

parent

9233cd9db05b055f35696e0d4111915b198c11a1

2 files changed, 16 insertions(+), 3 deletions(-)

jump to
M src/FbTk/EventManager.ccsrc/FbTk/EventManager.cc

@@ -19,9 +19,10 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: EventManager.cc,v 1.2 2002/12/01 13:42:14 rathnor Exp $ +// $Id: EventManager.cc,v 1.3 2002/12/03 17:06:49 fluxgen Exp $ #include "EventManager.hh" +#include "FbWindow.hh" #include <iostream> using namespace std;

@@ -41,7 +42,7 @@

void EventManager::handleEvent(XEvent &ev) { // find eventhandler for event window if (m_eventhandlers.find(ev.xany.window) == m_eventhandlers.end()) { - cerr<<"Can't find window="<<ev.xany.window<<endl; + //cerr<<"Can't find window="<<ev.xany.window<<endl; return; } EventHandler *evhand = m_eventhandlers[ev.xany.window];

@@ -79,6 +80,14 @@ default:

evhand->handleEvent(ev); break; }; +} + +void EventManager::add(EventHandler &ev, const FbWindow &win) { + registerEventHandler(ev, win.window()); +} + +void EventManager::remove(const FbWindow &win) { + unregisterEventHandler(win.window()); } void EventManager::registerEventHandler(EventHandler &ev, Window win) {
M src/FbTk/EventManager.hhsrc/FbTk/EventManager.hh

@@ -19,13 +19,15 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: EventManager.hh,v 1.3 2002/12/02 19:36:58 fluxgen Exp $ +// $Id: EventManager.hh,v 1.4 2002/12/03 17:05:45 fluxgen Exp $ #include "EventHandler.hh" #include <map> namespace FbTk { +class FbWindow; + /** singleton mediator for EventHandlers */

@@ -34,6 +36,8 @@ public:

static EventManager *instance(); void handleEvent(XEvent &ev); + void add(EventHandler &ev, const FbWindow &win); + void remove(const FbWindow &win); void add(EventHandler &ev, Window win) { registerEventHandler(ev, win); } void remove(Window win) { unregisterEventHandler(win); } void registerEventHandler(EventHandler &ev, Window win);