diff options
author | fluxgen <fluxgen> | 2002-12-03 17:06:49 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-12-03 17:06:49 (GMT) |
commit | cc775983b62d7d6bee4ab73a09c101a40790947f (patch) | |
tree | 6de666f73ff043b735658faf8b0feea8e2a8ed9f /src | |
parent | 9233cd9db05b055f35696e0d4111915b198c11a1 (diff) | |
download | fluxbox_lack-cc775983b62d7d6bee4ab73a09c101a40790947f.zip fluxbox_lack-cc775983b62d7d6bee4ab73a09c101a40790947f.tar.bz2 |
FbWindow add and remove
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/EventManager.cc | 13 | ||||
-rw-r--r-- | src/FbTk/EventManager.hh | 6 |
2 files changed, 16 insertions, 3 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> |
27 | using namespace std; | 28 | using namespace std; |
@@ -41,7 +42,7 @@ EventManager::~EventManager() { | |||
41 | void EventManager::handleEvent(XEvent &ev) { | 42 | void 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 | ||
85 | void EventManager::add(EventHandler &ev, const FbWindow &win) { | ||
86 | registerEventHandler(ev, win.window()); | ||
87 | } | ||
88 | |||
89 | void EventManager::remove(const FbWindow &win) { | ||
90 | unregisterEventHandler(win.window()); | ||
91 | } | ||
92 | |||
84 | void EventManager::registerEventHandler(EventHandler &ev, Window win) { | 93 | void EventManager::registerEventHandler(EventHandler &ev, Window win) { |
85 | m_eventhandlers[win] = &ev; | 94 | m_eventhandlers[win] = &ev; |
86 | } | 95 | } |
diff --git a/src/FbTk/EventManager.hh b/src/FbTk/EventManager.hh index 39883b3..7d67331 100644 --- a/src/FbTk/EventManager.hh +++ b/src/FbTk/EventManager.hh | |||
@@ -19,13 +19,15 @@ | |||
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.hh,v 1.3 2002/12/02 19:36:58 fluxgen Exp $ | 22 | // $Id: EventManager.hh,v 1.4 2002/12/03 17:05:45 fluxgen Exp $ |
23 | 23 | ||
24 | #include "EventHandler.hh" | 24 | #include "EventHandler.hh" |
25 | #include <map> | 25 | #include <map> |
26 | 26 | ||
27 | namespace FbTk { | 27 | namespace FbTk { |
28 | 28 | ||
29 | class FbWindow; | ||
30 | |||
29 | /** | 31 | /** |
30 | singleton mediator for EventHandlers | 32 | singleton mediator for EventHandlers |
31 | */ | 33 | */ |
@@ -34,6 +36,8 @@ public: | |||
34 | static EventManager *instance(); | 36 | static EventManager *instance(); |
35 | 37 | ||
36 | void handleEvent(XEvent &ev); | 38 | void handleEvent(XEvent &ev); |
39 | void add(EventHandler &ev, const FbWindow &win); | ||
40 | void remove(const FbWindow &win); | ||
37 | void add(EventHandler &ev, Window win) { registerEventHandler(ev, win); } | 41 | void add(EventHandler &ev, Window win) { registerEventHandler(ev, win); } |
38 | void remove(Window win) { unregisterEventHandler(win); } | 42 | void remove(Window win) { unregisterEventHandler(win); } |
39 | void registerEventHandler(EventHandler &ev, Window win); | 43 | void registerEventHandler(EventHandler &ev, Window win); |