changeset 2:e84dccee1bb7

* add myself to authors * fix missing break in guimanager * when an event occurs over an guichan window the event is marked as consumedByGuichan, but the event is still distributed to all event listeners, those can check via event.isConsumedByGuichan...
author spq@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 01 Jul 2008 17:43:35 +0000
parents 2082bf27a3b8
children 6387bbc0c2d5
files doc/AUTHORS engine/core/eventchannel/base/ec_inputevent.h engine/core/eventchannel/eventchannel.i engine/core/eventchannel/eventmanager.cpp engine/core/eventchannel/key/ec_keyevent.h engine/core/eventchannel/mouse/ec_mouseevent.h engine/core/gui/guimanager.cpp
diffstat 7 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/doc/AUTHORS	Mon Jun 30 16:59:25 2008 +0000
+++ b/doc/AUTHORS	Tue Jul 01 17:43:35 2008 +0000
@@ -40,4 +40,4 @@
 vtchill >> manning.jesse@gmail.com
 zahlman >> karl.knechtel@utoronto.ca
 zbyte64 >> zbyte64@gmail.com
-
+spq >> spq@my-ct.de
--- a/engine/core/eventchannel/base/ec_inputevent.h	Mon Jun 30 16:59:25 2008 +0000
+++ b/engine/core/eventchannel/base/ec_inputevent.h	Tue Jul 01 17:43:35 2008 +0000
@@ -45,6 +45,7 @@
 		*/
 		InputEvent(): 
 			Event(), 
+			m_consumedbyguichan(false), 
 			m_isshiftpressed(false), 
 			m_iscontrolpressed(false), 
 			m_isaltpressed(false), 
@@ -73,6 +74,11 @@
 		 */
 		virtual bool isShiftPressed() const { return m_isshiftpressed; }
 		virtual void setShiftPressed(bool pressed) { m_isshiftpressed = pressed; }
+		
+		/** Marks events as consumed by guichan. 
+		 */
+		virtual void consumedByGuichan() { m_consumedbyguichan = true; }
+		virtual bool isConsumedByGuichan() const { return m_consumedbyguichan; }
 
 		virtual void consume() { Event::consume(); }
 		virtual bool isConsumed() const { return Event::isConsumed(); }
@@ -101,6 +107,7 @@
 
 
 	private:
+		bool m_consumedbyguichan;
 		bool m_isshiftpressed;
 		bool m_iscontrolpressed;
 		bool m_isaltpressed;
--- a/engine/core/eventchannel/eventchannel.i	Mon Jun 30 16:59:25 2008 +0000
+++ b/engine/core/eventchannel/eventchannel.i	Tue Jul 01 17:43:35 2008 +0000
@@ -66,6 +66,7 @@
 
 	class InputEvent: public Event {
 	public:
+		virtual bool isConsumedByGuichan() const;
 		virtual bool isAltPressed() const;
 		virtual bool isControlPressed() const;
 		virtual bool isMetaPressed() const;
--- a/engine/core/eventchannel/eventmanager.cpp	Mon Jun 30 16:59:25 2008 +0000
+++ b/engine/core/eventchannel/eventmanager.cpp	Tue Jul 01 17:43:35 2008 +0000
@@ -408,6 +408,7 @@
 					break;
 				case MouseEvent::ENTERED:
 					(*i)->mouseEntered(evt);
+					break;
 				case MouseEvent::EXITED:
 					(*i)->mouseExited(evt);
 					break;
--- a/engine/core/eventchannel/key/ec_keyevent.h	Mon Jun 30 16:59:25 2008 +0000
+++ b/engine/core/eventchannel/key/ec_keyevent.h	Tue Jul 01 17:43:35 2008 +0000
@@ -82,6 +82,8 @@
 
 		virtual void consume() { InputEvent::consume(); }
 		virtual bool isConsumed() const { return InputEvent::isConsumed(); }
+		virtual void consumedByGuichan() { InputEvent::consumedByGuichan(); }
+		virtual bool isConsumedByGuichan() const { return InputEvent::isConsumedByGuichan(); }
 		virtual IEventSource* getSource() { return InputEvent::getSource(); }
 		virtual void setSource(IEventSource* source) { InputEvent::setSource(source); }
 		virtual gcn::Widget* getSourceWidget() { return InputEvent::getSourceWidget(); }
--- a/engine/core/eventchannel/mouse/ec_mouseevent.h	Mon Jun 30 16:59:25 2008 +0000
+++ b/engine/core/eventchannel/mouse/ec_mouseevent.h	Tue Jul 01 17:43:35 2008 +0000
@@ -125,6 +125,8 @@
 
 		virtual void consume() { InputEvent::consume(); }
 		virtual bool isConsumed() const { return InputEvent::isConsumed(); }
+		virtual void consumedByGuichan() { InputEvent::consumedByGuichan(); }
+		virtual bool isConsumedByGuichan() const { return InputEvent::isConsumedByGuichan(); }
 		virtual IEventSource* getSource() { return InputEvent::getSource(); }
 		virtual void setSource(IEventSource* source) { InputEvent::setSource(source); }
 		virtual gcn::Widget* getSourceWidget() { return InputEvent::getSourceWidget(); }
--- a/engine/core/gui/guimanager.cpp	Mon Jun 30 16:59:25 2008 +0000
+++ b/engine/core/gui/guimanager.cpp	Tue Jul 01 17:43:35 2008 +0000
@@ -201,20 +201,20 @@
 	void GUIManager::evaluateKeyEventConsumption(KeyEvent& evt) {
 		gcn::Widget* w = m_focushandler->getFocused();
 		if (w) {
-			evt.consume();
+			evt.consumedByGuichan();
 		}
 	}
 
 	void GUIManager::evaluateMouseEventConsumption(MouseEvent& evt) {
 		gcn::Widget* w = m_gcn_topcontainer->getWidgetAt(evt.getX(), evt.getY());
 		if (w && w->isVisible()) {
-			// evt.consume();
+			evt.consumedByGuichan();
 		}
 	}
 
 	void GUIManager::mousePressed(MouseEvent& evt) {
  		evaluateMouseEventConsumption(evt);
-		if (!evt.isConsumed()) {
+		if (!evt.isConsumedByGuichan()) {
 			m_focushandler->focusNone();
 		}
 	}