[added]Feature Request: Have postEventFromUser returns bool

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
kkrizka
Posts: 70
Joined: Sun Sep 30, 2007 3:10 am

[added]Feature Request: Have postEventFromUser returns bool

Post by kkrizka »

Hello,

I am using Irrlicht in conjuction with another event input system (Qt), so I have to manually pass event to irrlicht using the IrrlichtDevice::postEventFromUser and it works very well. However, I want to know whether irrlicht absorbed the event because I need to know if I should continue processing the event using Qt for menu shortcuts to work or whether I should stop it.

The patch for this is very simple, attached below, and since we are changing the return value from void to bool, this change should not break anything.

Code: Select all

Index: source/Irrlicht/CIrrDeviceStub.cpp
===================================================================
--- source/Irrlicht/CIrrDeviceStub.cpp	(revision 1485)
+++ source/Irrlicht/CIrrDeviceStub.cpp	(working copy)
@@ -171,7 +171,7 @@
 

 

 //! send the event to the right receiver

-void CIrrDeviceStub::postEventFromUser(const SEvent& event)

+bool CIrrDeviceStub::postEventFromUser(const SEvent& event)

 {

 	bool absorbed = false;

 

@@ -187,6 +187,8 @@
 

 	if (!absorbed && inputReceiver)

 		absorbed = inputReceiver->postEventFromUser(event);

+

+	return absorbed;

 }

 

 

Index: source/Irrlicht/CIrrDeviceStub.h
===================================================================
--- source/Irrlicht/CIrrDeviceStub.h	(revision 1485)
+++ source/Irrlicht/CIrrDeviceStub.h	(working copy)
@@ -83,7 +83,7 @@
 		virtual const char* getVersion() const;

 

 		//! send the event to the right receiver

-		virtual void postEventFromUser(const SEvent& event);

+		virtual bool postEventFromUser(const SEvent& event);

 

 		//! Sets a new event receiver to receive events

 		virtual void setEventReceiver(IEventReceiver* receiver);

Index: include/IrrlichtDevice.h
===================================================================
--- include/IrrlichtDevice.h	(revision 1485)
+++ include/IrrlichtDevice.h	(working copy)
@@ -194,7 +194,7 @@
 		input, you can use this to post key or mouse input events to

 		the engine. Internally, this method only delegates the events

 		further to the scene manager and the GUI environment. */

-		virtual void postEventFromUser(const SEvent& event) = 0;

+		virtual bool postEventFromUser(const SEvent& event) = 0;

 

 		//! Sets the input receiving scene manager.

 		/** If set to null, the main scene manager (returned by
Cheers,
Karol Krizka

http://www.krizka.net
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Sounds reasonable :)
kkrizka
Posts: 70
Joined: Sun Sep 30, 2007 3:10 am

Post by kkrizka »

Great! I've created a tracker item for this:
http://sourceforge.net/tracker/index.ph ... tid=540678
Cheers,
Karol Krizka

http://www.krizka.net
Post Reply