Class InputRouter


  • @Singleton
    public class InputRouter
    extends java.lang.Object
    Chooses which backend delivers an interaction.

    Precedence is deliberate and narrow: a thread-pinned InputScope always wins, otherwise the configured default applies. A cursor backend is only consulted when one has been registered and reports itself available, so an install with no cursor support behaves exactly as it did before.

    Fallback is opt-in. When a cursor request cannot be served and fallback is disabled, the rejection reaches the caller instead of quietly becoming a different kind of interaction.

    • Method Detail

      • setCursorBackend

        public void setCursorBackend​(InputBackend backend)
        Install the cursor backend. Kept as registration rather than injection so that openosrs-api does not depend on the canvas layer that implements it.
      • cursorBackend

        public java.util.Optional<InputBackend> cursorBackend()
      • setMouseDriver

        public void setMouseDriver​(MouseDriver driver)
      • isCursorAvailable

        public boolean isCursorAvailable()
      • selectedMode

        public InputMode selectedMode()
        Requested mode before target support or fallback is considered.
      • resolveMode

        public InputMode resolveMode​(MenuRequest request)
        The mode that would be used right now for a request of this shape.
      • prepare

        public boolean prepare​(HoverIntent intent)
      • cancelPreparation

        public void cancelPreparation()
      • anticipate

        public void anticipate​(MenuRequest request)