aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/EventManager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/EventManager.cc')
-rw-r--r--src/FbTk/EventManager.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc
index 05d95c4..6d10b8d 100644
--- a/src/FbTk/EventManager.cc
+++ b/src/FbTk/EventManager.cc
@@ -19,9 +19,10 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: EventManager.cc,v 1.2 2002/12/01 13:42:14 rathnor Exp $ 22// $Id: EventManager.cc,v 1.3 2002/12/03 17:06:49 fluxgen Exp $
23 23
24#include "EventManager.hh" 24#include "EventManager.hh"
25#include "FbWindow.hh"
25 26
26#include <iostream> 27#include <iostream>
27using namespace std; 28using namespace std;
@@ -41,7 +42,7 @@ EventManager::~EventManager() {
41void EventManager::handleEvent(XEvent &ev) { 42void EventManager::handleEvent(XEvent &ev) {
42 // find eventhandler for event window 43 // find eventhandler for event window
43 if (m_eventhandlers.find(ev.xany.window) == m_eventhandlers.end()) { 44 if (m_eventhandlers.find(ev.xany.window) == m_eventhandlers.end()) {
44 cerr<<"Can't find window="<<ev.xany.window<<endl; 45 //cerr<<"Can't find window="<<ev.xany.window<<endl;
45 return; 46 return;
46 } 47 }
47 EventHandler *evhand = m_eventhandlers[ev.xany.window]; 48 EventHandler *evhand = m_eventhandlers[ev.xany.window];
@@ -81,6 +82,14 @@ void EventManager::handleEvent(XEvent &ev) {
81 }; 82 };
82} 83}
83 84
85void EventManager::add(EventHandler &ev, const FbWindow &win) {
86 registerEventHandler(ev, win.window());
87}
88
89void EventManager::remove(const FbWindow &win) {
90 unregisterEventHandler(win.window());
91}
92
84void EventManager::registerEventHandler(EventHandler &ev, Window win) { 93void EventManager::registerEventHandler(EventHandler &ev, Window win) {
85 m_eventhandlers[win] = &ev; 94 m_eventhandlers[win] = &ev;
86} 95}