Class GestureStylus

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class GestureStylus extends GestureSingle

Recognizes tablet stylus input.

The provided signals just relay the basic information of the stylus events.

  • Constructor Details

    • GestureStylus

      public GestureStylus(MemorySegment address)
      Create a GestureStylus instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • GestureStylus

      public GestureStylus()
      Create a new GestureStylus.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the GestureStylus class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected GestureStylus asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GestureSingle
      Returns:
      the instance as if it were its parent type
    • getAxes

      public boolean getAxes(@Nullable AxisUse @Nullable [] axes, @Nullable double @Nullable [] values)

      Returns the current values for the requested axes.

      This function must be called from the handler of one of the Gtk.GestureStylus::down, Gtk.GestureStylus::motion, Gtk.GestureStylus::up or Gtk.GestureStylus::proximity signals.

      Parameters:
      axes - array of requested axes, terminated with AxisUse.IGNORE
      values - return location for the axis values
      Returns:
      true if there is a current value for the axes
    • getAxis

      public boolean getAxis(AxisUse axis, Out<Double> value)

      Returns the current value for the requested axis.

      This function must be called from the handler of one of the Gtk.GestureStylus::down, Gtk.GestureStylus::motion, Gtk.GestureStylus::up or Gtk.GestureStylus::proximity signals.

      Parameters:
      axis - requested device axis
      value - return location for the axis value
      Returns:
      true if there is a current value for the axis
    • getBacklog

      public boolean getBacklog(@Nullable Out<TimeCoord[]> backlog)

      Returns the accumulated backlog of tracking information.

      By default, GTK will limit rate of input events. On stylus input where accuracy of strokes is paramount, this function returns the accumulated coordinate/timing state before the emission of the current Gtk.GestureStylus::motion signal handler, the state given in this signal and obtainable through getAxis(AxisUse, Out) express the latest (most up-to-date) state in motion history.

      The backlog is provided in chronological order.

      Parameters:
      backlog - coordinates and times for the backlog events
      Returns:
      true if there is a backlog to unfold in the current state.
    • getDeviceTool

      public @Nullable DeviceTool getDeviceTool()

      Returns the GdkDeviceTool currently driving input through this gesture.

      This function must be called from the handler of one of the Gtk.GestureStylus::down, Gtk.GestureStylus::motion, Gtk.GestureStylus::up or Gtk.GestureStylus::proximity signals.

      Returns:
      The current stylus tool
    • getStylusOnly

      public boolean getStylusOnly()

      Checks whether the gesture is for styluses only.

      Stylus-only gestures will signal events exclusively from stylus input devices.

      Returns:
      true if the gesture is only for stylus events
      Since:
      4.10
    • setStylusOnly

      public void setStylusOnly(boolean stylusOnly)

      Sets the state of stylus-only

      If true, the gesture will exclusively handle events from stylus input devices, otherwise it'll handle events from any pointing device.

      Parameters:
      stylusOnly - whether the gesture is used exclusively for stylus events
      Since:
      4.10
    • onDown

      Emitted when the stylus touches the device.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitDown

      public void emitDown(double x, double y)
      Emits the "down" signal. See onDown(GestureStylus.DownCallback).
    • onMotion

      Emitted when the stylus moves while touching the device.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitMotion

      public void emitMotion(double x, double y)
      Emits the "motion" signal. See onMotion(GestureStylus.MotionCallback).
    • onProximity

      Emitted when the stylus is in proximity of the device.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitProximity

      public void emitProximity(double x, double y)
      Emits the "proximity" signal. See onProximity(GestureStylus.ProximityCallback).
    • onUp

      Emitted when the stylus no longer touches the device.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitUp

      public void emitUp(double x, double y)
      Emits the "up" signal. See onUp(GestureStylus.UpCallback).
    • builder

      public static GestureStylus.Builder<? extends GestureStylus.Builder> builder()
      A GestureStylus.Builder object constructs a GestureStylus with the specified properties. Use the various set...() methods to set properties, and finish construction with GestureStylus.Builder.build().
      Returns:
      the builder object