Event Manager fixes/review

This commit is contained in:
rathnor 2004-05-04 14:33:38 +00:00
parent e127dabae6
commit d95fcc2dbb
6 changed files with 28 additions and 13 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day)
Changes for 0.9.10:
*04/05/04:
* Fix EventManager bug/memory leak (possibly caused crash) (Simon)
EventManager.hh/cc
*04/05/02:
* Added new nls item for windowmenu: Layer
nls/C/Windowmenu.m

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Container.cc,v 1.13 2004/01/21 13:34:40 fluxgen Exp $
// $Id: Container.cc,v 1.14 2004/05/04 14:33:37 rathnor Exp $
#include "Container.hh"
@ -37,7 +37,7 @@ Container::Container(const FbTk::FbWindow &parent):
}
Container::~Container() {
// ~FbWindow cleans event manager
}
void Container::resize(unsigned int width, unsigned int height) {

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: EventManager.cc,v 1.11 2004/04/19 22:46:46 fluxgen Exp $
// $Id: EventManager.cc,v 1.12 2004/05/04 14:33:38 rathnor Exp $
#include "EventManager.hh"
#include "FbWindow.hh"
@ -128,11 +128,19 @@ void EventManager::unregisterEventHandler(Window win) {
void EventManager::dispatch(Window win, XEvent &ev, bool parent) {
EventHandler *evhand = 0;
if (parent)
evhand = m_parent[win];
else {
if (parent) {
EventHandlerMap::iterator it = m_parent.find(win);
if (it == m_parent.end())
return;
else
evhand = it->second;
} else {
win = getEventWindow(ev);
evhand = m_eventhandlers[win];
EventHandlerMap::iterator it = m_eventhandlers.find(win);
if (it == m_eventhandlers.end())
return;
else
evhand = it->second;
}
if (evhand == 0)

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: EventManager.hh,v 1.8 2004/04/19 22:46:46 fluxgen Exp $
// $Id: EventManager.hh,v 1.9 2004/05/04 14:33:38 rathnor Exp $
#include "EventHandler.hh"
#include <map>
@ -51,12 +51,15 @@ public:
void registerEventHandler(EventHandler &ev, Window win);
void unregisterEventHandler(Window win);
private:
EventManager() { }
~EventManager();
void dispatch(Window win, XEvent &event, bool parent = false);
std::map<Window, EventHandler *> m_eventhandlers;
std::map<Window, EventHandler *> m_parent;
typedef std::map<Window, EventHandler *> EventHandlerMap;
EventHandlerMap m_eventhandlers;
EventHandlerMap m_parent;
};
} //end namespace FbTk

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: IconButton.cc,v 1.19 2004/05/02 20:46:19 fluxgen Exp $
// $Id: IconButton.cc,v 1.20 2004/05/04 14:33:37 rathnor Exp $
#include "IconButton.hh"
@ -112,7 +112,7 @@ IconButton::IconButton(const FbTk::FbWindow &parent, const FbTk::Font &font,
}
IconButton::~IconButton() {
// ~FbWindow cleans event manager
}

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: SystemTray.cc,v 1.9 2004/04/19 22:49:25 fluxgen Exp $
// $Id: SystemTray.cc,v 1.10 2004/05/04 14:33:37 rathnor Exp $
#include "SystemTray.hh"
@ -141,6 +141,7 @@ SystemTray::~SystemTray() {
// remove us, else fluxbox might delete the memory too
Fluxbox::instance()->removeAtomHandler(m_handler.get());
removeAllClients();
// ~FbWindow cleans EventManager
}
void SystemTray::move(int x, int y) {