WindowsOutsideClickWatcher

class WindowsOutsideClickWatcher(windowSupplier: () -> Window?, onOutsideClick: () -> Unit, ignorePointPredicate: (x: Int, y: Int) -> Boolean? = null) : AutoCloseable

WindowsOutsideClickWatcher using a low-level mouse hook (WH_MOUSE_LL) via JNI.

Behavior:

  • Listens for global left-button down events.

  • If the click occurs outside the supplied window (and not ignored by predicate), invokes onOutsideClick().

Public signatures are preserved.

Constructors

Link copied to clipboard
constructor(windowSupplier: () -> Window?, onOutsideClick: () -> Unit, ignorePointPredicate: (x: Int, y: Int) -> Boolean? = null)

Functions

Link copied to clipboard
open override fun close()

Uninstalls the hook and signals the hook thread to exit.

Link copied to clipboard
fun start()

Start the global low-level mouse hook on a dedicated daemon thread.

Link copied to clipboard
fun stop()

Stop the hook (alias to close()).