Klasse Display

Alle implementierten Schnittstellen:
PointerInterface

public class Display extends PropertyHolder
A representation of a workstation.

Their purpose are two-fold:

- To manage and provide information about input devices (pointers, keyboards, etc)
- To manage and provide information about output devices (monitors, projectors, etc)

Most of the input device handling has been factored out into separate
[class@Gdk.Seat] objects. Every display has a one or more seats, which
can be accessed with [method@Gdk.Display.get_default_seat] and
[method@Gdk.Display.list_seats].

Output devices are represented by [class@Gdk.Monitor] objects, which can
be accessed with [method@Gdk.Display.get_monitor_at_surface] and similar APIs.

https://docs.gtk.org/gdk4/class.Display.html

  • Felddetails

  • Konstruktordetails

  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • beep

      public void beep()
      Emits a short beep on @display
    • close

      public void close()
      Closes the connection to the windowing system for the given display.

      This cleans up associated resources.
    • createGlContext

      public GLContext createGlContext() throws AllocationError
      Creates a new `GdkGLContext` for the `GdkDisplay`.

      The context is disconnected from any particular surface or surface
      and cannot be used to draw to any surface. It can only be used to
      draw to non-surface framebuffers like textures.

      If the creation of the `GdkGLContext` failed, @error will be set.
      Before using the returned `GdkGLContext`, you will need to
      call [method@Gdk.GLContext.make_current] or [method@Gdk.GLContext.realize].
      Gibt zurück:
      the newly created `GdkGLContext`
      Löst aus:
      AllocationError
    • deviceIsGrabbed

      public boolean deviceIsGrabbed(@Nonnull Device device)
      Returns %TRUE if there is an ongoing grab on @device for @display.
      Parameter:
      device - a `GdkDevice`
      Gibt zurück:
      %TRUE if there is a grab in effect for @device.
    • flush

      public void flush()
      Flushes any requests queued for the windowing system.

      This happens automatically when the main loop blocks waiting for new events,
      but if your application is drawing without returning control to the main loop,
      you may need to call this function explicitly. A common case where this function
      needs to be called is when an application is executing drawing commands
      from a thread other than the thread where the main loop is running.

      This is most useful for X11. On windowing systems where requests are
      handled synchronously, this function will do nothing.
    • getAppLaunchContext

      public AppLaunchContext getAppLaunchContext()
      Returns a `GdkAppLaunchContext` suitable for launching
      applications on the given display.
      Gibt zurück:
      a new `GdkAppLaunchContext` for @display
    • getClipboard

      public Clipboard getClipboard()
      Gets the clipboard used for copy/paste operations.
      Gibt zurück:
      the display's clipboard
    • getDefaultSeat

      public Seat getDefaultSeat()
      Returns the default `GdkSeat` for this display.

      Note that a display may not have a seat. In this case,
      this function will return %NULL.
      Gibt zurück:
      the default seat.
    • getDmabufFormats

      public DmabufFormats getDmabufFormats()
      Returns the dma-buf formats that are supported on this display.

      GTK may use OpenGL or Vulkan to support some formats.
      Calling this function will then initialize them if they aren't yet.

      The formats returned by this function can be used for negotiating
      buffer formats with producers such as v4l, pipewire or GStreamer.

      To learn more about dma-bufs, see [class@Gdk.DmabufTextureBuilder].
      Gibt zurück:
      a `GdkDmabufFormats` object
    • getMonitorAtSurface

      public Monitor getMonitorAtSurface(@Nonnull Surface surface)
      Gets the monitor in which the largest area of @surface
      resides.
      Parameter:
      surface - a `GdkSurface`
      Gibt zurück:
      the monitor with the largest overlap with @surface
    • getMonitors

      public ListModel getMonitors()
      Gets the list of monitors associated with this display.

      Subsequent calls to this function will always return the
      same list for the same display.

      You can listen to the GListModel::items-changed signal on
      this list to monitor changes to the monitor of this display.
      Gibt zurück:
      a `GListModel` of `GdkMonitor`
    • getName

      public Str getName()
      Gets the name of the display.
      Gibt zurück:
      a string representing the display name. This string is owned by GDK and should not be modified or freed.
    • getPrimaryClipboard

      public Clipboard getPrimaryClipboard()
      Gets the clipboard used for the primary selection.

      On backends where the primary clipboard is not supported natively,
      GDK emulates this clipboard locally.
      Gibt zurück:
      the primary clipboard
    • getSetting

      public boolean getSetting(@Nonnull Str name, @Nonnull Value value)
      Retrieves a desktop-wide setting such as double-click time
      for the @display.
      Parameter:
      name - the name of the setting
      value - location to store the value of the setting
      Gibt zurück:
      %TRUE if the setting existed and a value was stored in @value, %FALSE otherwise
    • getSetting

      public boolean getSetting(String name, @Nonnull Value value)
      Retrieves a desktop-wide setting such as double-click time
      for the @display.
      Parameter:
      name - the name of the setting
      value - location to store the value of the setting
      Gibt zurück:
      %TRUE if the setting existed and a value was stored in @value, %FALSE otherwise
    • getStartupNotificationId

      @Deprecated public Str getStartupNotificationId()
      Veraltet.
      Gets the startup notification ID for a Wayland display, or %NULL
      if no ID has been defined.
      Gibt zurück:
      the startup notification ID for @display
    • isClosed

      public boolean isClosed()
      Finds out if the display has been closed.
      Gibt zurück:
      %TRUE if the display is closed.
    • isComposited

      public boolean isComposited()
      Returns whether surfaces can reasonably be expected to have
      their alpha channel drawn correctly on the screen.

      Check [method@Gdk.Display.is_rgba] for whether the display
      supports an alpha channel.

      On X11 this function returns whether a compositing manager is
      compositing on @display.

      On modern displays, this value is always %TRUE.
      Gibt zurück:
      Whether surfaces with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen.
    • isRgba

      public boolean isRgba()
      Returns whether surfaces on this @display are created with an
      alpha channel.

      Even if a %TRUE is returned, it is possible that the
      surface’s alpha channel won’t be honored when displaying the
      surface on the screen: in particular, for X an appropriate
      windowing manager and compositing manager must be running to
      provide appropriate display. Use [method@Gdk.Display.is_composited]
      to check if that is the case.

      On modern displays, this value is always %TRUE.
      Gibt zurück:
      %TRUE if surfaces are created with an alpha channel or %FALSE if the display does not support this functionality.
    • listSeats

      public List listSeats()
      Returns the list of seats known to @display.
      Gibt zurück:
      the list of seats known to the `GdkDisplay`
    • notifyStartupComplete

      @Deprecated public void notifyStartupComplete(@Nonnull Str startup_id)
      Veraltet.
      Indicates to the GUI environment that the application has
      finished loading, using a given identifier.

      GTK will call this function automatically for [GtkWindow](../gtk4/class.Window.html)
      with custom startup-notification identifier unless
      [gtk_window_set_auto_startup_notification()](../gtk4/method.Window.set_auto_startup_notification.html)
      is called to disable that feature.
      Parameter:
      startup_id - a startup-notification identifier, for which notification process should be completed
    • notifyStartupComplete

      @Deprecated public void notifyStartupComplete(String startup_id)
      Veraltet.
      Indicates to the GUI environment that the application has
      finished loading, using a given identifier.

      GTK will call this function automatically for [GtkWindow](../gtk4/class.Window.html)
      with custom startup-notification identifier unless
      [gtk_window_set_auto_startup_notification()](../gtk4/method.Window.set_auto_startup_notification.html)
      is called to disable that feature.
      Parameter:
      startup_id - a startup-notification identifier, for which notification process should be completed
    • prepareGl

      public boolean prepareGl() throws AllocationError
      Checks that OpenGL is available for @self and ensures that it is
      properly initialized.
      When this fails, an @error will be set describing the error and this
      function returns %FALSE.

      Note that even if this function succeeds, creating a `GdkGLContext`
      may still fail.

      This function is idempotent. Calling it multiple times will just
      return the same value or error.

      You never need to call this function, GDK will call it automatically
      as needed. But you can use it as a check when setting up code that
      might make use of OpenGL.
      Gibt zurück:
      %TRUE if the display supports OpenGL
      Löst aus:
      AllocationError
    • putEvent

      @Deprecated public void putEvent(@Nonnull Event event)
      Veraltet.
      Adds the given event to the event queue for @display.
      Parameter:
      event - a `GdkEvent`
    • supportsInputShapes

      public boolean supportsInputShapes()
      Returns %TRUE if the display supports input shapes.

      This means that [method@Gdk.Surface.set_input_region] can
      be used to modify the input shape of surfaces on @display.

      On modern displays, this value is always %TRUE.
      Gibt zurück:
      %TRUE if surfaces with modified input shape are supported
    • supportsShadowWidth

      public boolean supportsShadowWidth()
      Returns whether it's possible for a surface to draw outside of the window area.

      If %TRUE is returned the application decides if it wants to draw shadows.
      If %FALSE is returned, the compositor decides if it wants to draw shadows.
      Gibt zurück:
      %TRUE if surfaces can draw shadows or %FALSE if the display does not support this functionality.
    • sync

      public void sync()
      Flushes any requests queued for the windowing system and waits until all
      requests have been handled.

      This is often used for making sure that the display is synchronized
      with the current state of the program. Calling [method@Gdk.Display.sync]
      before [method@GdkX11.Display.error_trap_pop] makes sure that any errors
      generated from earlier requests are handled before the error trap is removed.

      This is most useful for X11. On windowing systems where requests are
      handled synchronously, this function will do nothing.
    • onClosed

      public SignalHandler onClosed(Display.OnClosed signal)
      Connect to signal "closed".
      See Display.OnClosed.onClosed(boolean) for signal description.
      Field SIGNAL_ON_CLOSED contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onOpened

      public SignalHandler onOpened(Display.OnOpened signal)
      Connect to signal "opened".
      See Display.OnOpened.onOpened() for signal description.
      Field SIGNAL_ON_OPENED contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onSeatAdded

      public SignalHandler onSeatAdded(Display.OnSeatAdded signal)
      Connect to signal "seat-added".
      See Display.OnSeatAdded.onSeatAdded(ch.bailu.gtk.gdk.Seat) for signal description.
      Field SIGNAL_ON_SEAT_ADDED contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onSeatRemoved

      public SignalHandler onSeatRemoved(Display.OnSeatRemoved signal)
      Connect to signal "seat-removed".
      See Display.OnSeatRemoved.onSeatRemoved(ch.bailu.gtk.gdk.Seat) for signal description.
      Field SIGNAL_ON_SEAT_REMOVED contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onSettingChanged

      public SignalHandler onSettingChanged(Display.OnSettingChanged signal)
      Connect to signal "setting-changed".
      See Display.OnSettingChanged.onSettingChanged(ch.bailu.gtk.type.Str) for signal description.
      Field SIGNAL_ON_SETTING_CHANGED contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • getDefault

      public static Display getDefault()
      Gets the default `GdkDisplay`.

      This is a convenience function for:

      gdk_display_manager_get_default_display (gdk_display_manager_get ())
      Gibt zurück:
      a `GdkDisplay`, or %NULL if there is no default display
    • open

      public static Display open(@Nullable Str display_name)
      Opens a display.

      If opening the display fails, `NULL` is returned.
      Parameter:
      display_name - the name of the display to open
      Gibt zurück:
      a `GdkDisplay`
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()