aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-05-04 14:33:38 (GMT)
committerrathnor <rathnor>2004-05-04 14:33:38 (GMT)
commitd95fcc2dbba7fdf3884452bd69c352c87ae1e57b (patch)
treeb232dbadf1898049ee0fdd9cedbb00852c44d29c
parente127dabae691ee567aaedb84a2d7456c72991978 (diff)
downloadfluxbox_pavel-d95fcc2dbba7fdf3884452bd69c352c87ae1e57b.zip
fluxbox_pavel-d95fcc2dbba7fdf3884452bd69c352c87ae1e57b.tar.bz2
Event Manager fixes/review
-rw-r--r--ChangeLog3
-rw-r--r--src/Container.cc4
-rw-r--r--src/FbTk/EventManager.cc18
-rw-r--r--src/FbTk/EventManager.hh9
-rw-r--r--src/IconButton.cc4
-rw-r--r--src/SystemTray.cc3
6 files changed, 28 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index ab06eb4..17b0da1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.10: 2Changes for 0.9.10:
3*04/05/04:
4 * Fix EventManager bug/memory leak (possibly caused crash) (Simon)
5 EventManager.hh/cc
3*04/05/02: 6*04/05/02:
4 * Added new nls item for windowmenu: Layer 7 * Added new nls item for windowmenu: Layer
5 nls/C/Windowmenu.m 8 nls/C/Windowmenu.m
diff --git a/src/Container.cc b/src/Container.cc
index a53901d..5d07552 100644
--- a/src/Container.cc
+++ b/src/Container.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: Container.cc,v 1.13 2004/01/21 13:34:40 fluxgen Exp $ 23// $Id: Container.cc,v 1.14 2004/05/04 14:33:37 rathnor Exp $
24 24
25#include "Container.hh" 25#include "Container.hh"
26 26
@@ -37,7 +37,7 @@ Container::Container(const FbTk::FbWindow &parent):
37} 37}
38 38
39Container::~Container() { 39Container::~Container() {
40 40 // ~FbWindow cleans event manager
41} 41}
42 42
43void Container::resize(unsigned int width, unsigned int height) { 43void Container::resize(unsigned int width, unsigned int height) {
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc
index 9a11ab2..d4f4f4c 100644
--- a/src/FbTk/EventManager.cc
+++ b/src/FbTk/EventManager.cc
@@ -19,7 +19,7 @@
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.11 2004/04/19 22:46:46 fluxgen Exp $ 22// $Id: EventManager.cc,v 1.12 2004/05/04 14:33:38 rathnor Exp $
23 23
24#include "EventManager.hh" 24#include "EventManager.hh"
25#include "FbWindow.hh" 25#include "FbWindow.hh"
@@ -128,11 +128,19 @@ void EventManager::unregisterEventHandler(Window win) {
128 128
129void EventManager::dispatch(Window win, XEvent &ev, bool parent) { 129void EventManager::dispatch(Window win, XEvent &ev, bool parent) {
130 EventHandler *evhand = 0; 130 EventHandler *evhand = 0;
131 if (parent) 131 if (parent) {
132 evhand = m_parent[win]; 132 EventHandlerMap::iterator it = m_parent.find(win);
133 else { 133 if (it == m_parent.end())
134 return;
135 else
136 evhand = it->second;
137 } else {
134 win = getEventWindow(ev); 138 win = getEventWindow(ev);
135 evhand = m_eventhandlers[win]; 139 EventHandlerMap::iterator it = m_eventhandlers.find(win);
140 if (it == m_eventhandlers.end())
141 return;
142 else
143 evhand = it->second;
136 } 144 }
137 145
138 if (evhand == 0) 146 if (evhand == 0)
diff --git a/src/FbTk/EventManager.hh b/src/FbTk/EventManager.hh
index 049d527..6bd368c 100644
--- a/src/FbTk/EventManager.hh
+++ b/src/FbTk/EventManager.hh
@@ -19,7 +19,7 @@
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.8 2004/04/19 22:46:46 fluxgen Exp $ 22// $Id: EventManager.hh,v 1.9 2004/05/04 14:33:38 rathnor Exp $
23 23
24#include "EventHandler.hh" 24#include "EventHandler.hh"
25#include <map> 25#include <map>
@@ -51,12 +51,15 @@ public:
51 51
52 void registerEventHandler(EventHandler &ev, Window win); 52 void registerEventHandler(EventHandler &ev, Window win);
53 void unregisterEventHandler(Window win); 53 void unregisterEventHandler(Window win);
54
54private: 55private:
55 EventManager() { } 56 EventManager() { }
56 ~EventManager(); 57 ~EventManager();
57 void dispatch(Window win, XEvent &event, bool parent = false); 58 void dispatch(Window win, XEvent &event, bool parent = false);
58 std::map<Window, EventHandler *> m_eventhandlers; 59
59 std::map<Window, EventHandler *> m_parent; 60 typedef std::map<Window, EventHandler *> EventHandlerMap;
61 EventHandlerMap m_eventhandlers;
62 EventHandlerMap m_parent;
60}; 63};
61 64
62} //end namespace FbTk 65} //end namespace FbTk
diff --git a/src/IconButton.cc b/src/IconButton.cc
index c572604..6f0b0b7 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: IconButton.cc,v 1.19 2004/05/02 20:46:19 fluxgen Exp $ 23// $Id: IconButton.cc,v 1.20 2004/05/04 14:33:37 rathnor Exp $
24 24
25#include "IconButton.hh" 25#include "IconButton.hh"
26 26
@@ -112,7 +112,7 @@ IconButton::IconButton(const FbTk::FbWindow &parent, const FbTk::Font &font,
112} 112}
113 113
114IconButton::~IconButton() { 114IconButton::~IconButton() {
115 115 // ~FbWindow cleans event manager
116} 116}
117 117
118 118
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index 7214c20..5e28681 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -19,7 +19,7 @@
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: SystemTray.cc,v 1.9 2004/04/19 22:49:25 fluxgen Exp $ 22// $Id: SystemTray.cc,v 1.10 2004/05/04 14:33:37 rathnor Exp $
23 23
24#include "SystemTray.hh" 24#include "SystemTray.hh"
25 25
@@ -141,6 +141,7 @@ SystemTray::~SystemTray() {
141 // remove us, else fluxbox might delete the memory too 141 // remove us, else fluxbox might delete the memory too
142 Fluxbox::instance()->removeAtomHandler(m_handler.get()); 142 Fluxbox::instance()->removeAtomHandler(m_handler.get());
143 removeAllClients(); 143 removeAllClients();
144 // ~FbWindow cleans EventManager
144} 145}
145 146
146void SystemTray::move(int x, int y) { 147void SystemTray::move(int x, int y) {