Class MainLoop

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class MainLoop extends ProxyInstance
The GMainLoop struct is an opaque data type representing the main event loop of a GLib or GTK application.
  • Constructor Details

    • MainLoop

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

      public MainLoop(@Nullable MainContext context, boolean isRunning)
      Creates a new GLib.MainLoop structure.
      Parameters:
      context - a main context (if NULL, the global-default main context will be used).
      isRunning - set to true to indicate that the loop is running. This is not very important since calling run() will set this to true anyway.
  • Method Details

    • getType

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

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

      public MainContext getContext()
      Returns the GLib.MainContext of loop.
      Returns:
      the GLib.MainContext of this MainLoop
    • isRunning

      public boolean isRunning()
      Checks to see if the main loop is currently being run via run().
      Returns:
      true if the main loop is currently being run, false otherwise
    • quit

      public void quit()

      Stops a GLib.MainLoop from running. Any calls to run() for the loop will return.

      Note that sources that have already been dispatched when quit() is called will still be executed.

    • ref

      public MainLoop ref()
      Increases the reference count on a GLib.MainLoop object by one.
      Returns:
      this MainLoop
    • run

      public void run()

      Runs a main loop until quit() is called on the loop.

      If this is called from the thread of the loop’s GLib.MainContext, it will process events from the loop, otherwise it will simply wait.

    • unref

      public void unref()

      Decreases the reference count on a GLib.MainLoop object by one.

      If the result is zero, the loop and all associated memory are freed.