Boolean Methods in Libgdx InputProcessor and GestureListener

I haven’t really thought about this before because I’ve had no problems with the Libgdx InputProcessor or GestureListener, but what is the purpose of returning a boolean in, for example, the touchDown and fling methods?

public class InputHandler implements InputProcessor, GestureListener {

	@Override
	public boolean touchDown(float x, float y, int pointer, int button) {
		return false;
	}

In this case, touchDown returns false. Changing it to return true doesn’t seem to have any effect. Could someone please explain this?

It’s for when you stack processors (via a multiplexer), if a listener returns true, then the event is “consumed” and no more listeners will hear of it. This is useful when in GUIs, if you don’t want an event to propagate all the way through layered gui components, but be absorbed by the top-most one (that you clicked on or whatever).

http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/InputMultiplexer.html
Lower-level analogue: setBubbles() in http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/Event.html

The main thing to use it for imo, is when you want to listen for a touchUp/Drag events.

So if you return false, any code in your touchUp/Drag methods will simply not be run.

So it is good to return false if you don’t intend to use said methods, as it will call a whole bunch of empty methods when you move your finger on the button and release, or just release.