Class InputScope

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public final class InputScope
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Pins the input mode for the current thread until closed.

    This is the escape hatch for work the cursor cannot do reliably. A plugin that needs a bank sequence, a rapid offer edit or any interaction with an off-screen target opens a InputMode.PACKET scope and gets the deterministic path regardless of the user's global setting:

     try (InputScope scope = InputScope.packets())
     {
         ge.collect(0);
     }
     

    Scopes nest and restore the previous value on close, so a helper that opens its own scope cannot leak its choice back to its caller. Each thread carries its own value; a scope opened on the client thread does not affect work queued elsewhere.

    • Method Detail

      • packets

        public static InputScope packets()
        Force every interaction on this thread through the native menu pipeline.
      • humanMouse

        public static InputScope humanMouse()
        Force every interaction on this thread through the cursor.
      • current

        public static InputMode current()
        The mode pinned on this thread, or null when nothing is pinned and the configured default should decide.
      • isPinned

        public static boolean isPinned()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable