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 [classGdk.Seat] objects. Every display has a one or more seats, which can be accessed with [methodGdk.Display.get_default_seat] and [methodGdk.Display.list_seats].
Output devices are represented by [classGdk.Monitor] objects, which can be accessed with [methodGdk.Display.get_monitor_at_surface] and similar APIs.
procedure Beep (Self : not null access Gdk_Display_Record)
Emits a short beep on Display
type Cb_Gdk_Display_Boolean_Void is not null access procedure
(Self : access Gdk_Display_Record'Class;
Is_Error : Boolean);
type Cb_Gdk_Display_Gdk_Seat_Void is not null access procedure
(Self : access Gdk_Display_Record'Class;
Seat : not null access Gdk.Seat.Gdk_Seat_Record'Class);
type Cb_Gdk_Display_UTF8_String_Void is not null access procedure
(Self : access Gdk_Display_Record'Class;
Setting : UTF8_String);
type Cb_Gdk_Display_Void is not null access procedure (Self : access Gdk_Display_Record'Class);
type Cb_GObject_Boolean_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Is_Error : Boolean);
type Cb_GObject_Gdk_Seat_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Seat : not null access Gdk.Seat.Gdk_Seat_Record'Class);
type Cb_GObject_UTF8_String_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Setting : UTF8_String);
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
procedure Close (Self : not null access Gdk_Display_Record)
Closes the connection to the windowing system for the given display. This cleans up associated resources.
Composited_Property : constant Glib.Properties.Property_Boolean;
True if the display properly composites the alpha channel.
function Convert (R : Gdk.Gdk_Display) return System.Address
function Convert (R : System.Address) return Gdk.Gdk_Display
function Create_Gl_Context
(Self : not null access Gdk_Display_Record;
Error : out Glib.Error.GError) return Gdk.GLContext.Gdk_GLContext
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 [methodGdk.GLContext.make_current] or [methodGdk.GLContext.realize]. Since: gtk+ 4.6
the return location for a recoverable error
the newly created GdkGLContext. Has transfer-ownership='full'.
function Device_Is_Grabbed
(Self : not null access Gdk_Display_Record;
Device : not null access Gdk.Device.Gdk_Device_Record'Class)
return Boolean
Returns True if there is an ongoing grab on Device for Display.
a GdkDevice
True if there is a grab in effect for Device.
package Display_List is new Generic_List (Gdk.Gdk_Display);
Dmabuf_Formats_Property : constant Glib.Properties.Property_Boxed;
Type: Dmabuf_Formats The dma-buf formats that are supported on this display
procedure Flush (Self : not null access Gdk_Display_Record)
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.
subtype Gdk_Display is Gdk.Gdk_Display;
type Gdk_Display_Record is new GObject_Record with null record;
function Get_App_Launch_Context
(Self : not null access Gdk_Display_Record)
return Gdk.App_Launch_Context.Gdk_App_Launch_Context
Returns a GdkAppLaunchContext suitable for launching applications on the given display.
a new GdkAppLaunchContext for Display. Has transfer-ownership='full'.
function Get_Clipboard
(Self : not null access Gdk_Display_Record)
return Gdk.Clipboard.Gdk_Clipboard
Gets the clipboard used for copy/paste operations.
the display's clipboard. Has transfer-ownership='none'.
function Get_Default return Gdk.Gdk_Display
Gets the default GdkDisplay. This is a convenience function for: gdk_display_manager_get_default_display (gdk_display_manager_get ())
a GdkDisplay, or null if there is no default display. Has transfer-ownership='none'.
function Get_Default_Seat
(Self : not null access Gdk_Display_Record) return Gdk.Gdk_Seat
Returns the default GdkSeat for this display. Note that a display may not have a seat. In this case, this function will return null.
the default seat. Has transfer-ownership='none'.
function Get_Dmabuf_Formats
(Self : not null access Gdk_Display_Record)
return Gdk.Dmabuf_Formats.Gdk_Dmabuf_Formats
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 [classGdk.DmabufTextureBuilder]. This function is threadsafe. It can be called from any thread. Since: gtk+ 4.14
a GdkDmabufFormats object. Has transfer-ownership='none'.
function Get_Monitor_At_Surface
(Self : not null access Gdk_Display_Record;
Surface : not null access Gdk.Surface.Gdk_Surface_Record'Class)
return Gdk.Monitor.Gdk_Monitor
Gets the monitor in which the largest area of Surface resides.
a GdkSurface
the monitor with the largest overlap with Surface. Has transfer-ownership='none'.
function Get_Monitors
(Self : not null access Gdk_Display_Record)
return Glib.List_Model.Glist_Model
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.
a GListModel of GdkMonitor
function Get_Name
(Self : not null access Gdk_Display_Record) return UTF8_String
Gets the name of the display.
a string representing the display name. This string is owned by GDK and should not be modified or freed.
function Get_Primary_Clipboard
(Self : not null access Gdk_Display_Record)
return Gdk.Clipboard.Gdk_Clipboard
Gets the clipboard used for the primary selection. On backends where the primary clipboard is not supported natively, GDK emulates this clipboard locally.
the primary clipboard. Has transfer-ownership='none'.
function Get_Setting
(Self : not null access Gdk_Display_Record;
Name : UTF8_String;
Value : in out Glib.Values.GValue) return Boolean
Retrieves a desktop-wide setting such as double-click time for the Display.
the name of the setting
location to store the value of the setting
True if the setting existed and a value was stored in Value, False otherwise
function Get_Startup_Notification_Id
(Self : not null access Gdk_Display_Record) return UTF8_String
Gets the startup notification ID for a Wayland display, or null if no ID has been defined. Deprecated since 4.10, 1
the startup notification ID for Display
function Get_Type return Glib.GType
Input_Shapes_Property : constant Glib.Properties.Property_Boolean;
True if the display supports input shapes.
function Is_Closed
(Self : not null access Gdk_Display_Record) return Boolean
Finds out if the display has been closed.
True if the display is closed.
function Is_Composited
(Self : not null access Gdk_Display_Record) return Boolean
Returns whether surfaces can reasonably be expected to have their alpha channel drawn correctly on the screen. Check [methodGdk.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.
Whether surfaces with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen.
function Is_Rgba
(Self : not null access Gdk_Display_Record) return Boolean
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 [methodGdk.Display.is_composited] to check if that is the case. On modern displays, this value is always True.
True if surfaces are created with an alpha channel or False if the display does not support this functionality.
function List_Seats
(Self : not null access Gdk_Display_Record)
return Gdk.Seat.Seat_List.Glist
Returns the list of seats known to Display.
the list of seats known to the GdkDisplay
procedure Notify_Startup_Complete
(Self : not null access Gdk_Display_Record;
Startup_Id : UTF8_String)
Indicates to the GUI environment that the application has finished loading, using a given identifier. GTK will call this function automatically for GtkWindow with custom startup-notification identifier unless gtk_window_set_auto_startup_notification is called to disable that feature. Deprecated since 4.10, 1
a startup-notification identifier, for which notification process should be completed
procedure On_Closed
(Self : not null access Gdk_Display_Record;
Call : Cb_Gdk_Display_Boolean_Void;
After : Boolean := False)
Emitted when the connection to the windowing system for Display is closed.
procedure On_Closed
(Self : not null access Gdk_Display_Record;
Call : Cb_GObject_Boolean_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the connection to the windowing system for Display is closed.
procedure On_Opened
(Self : not null access Gdk_Display_Record;
Call : Cb_Gdk_Display_Void;
After : Boolean := False)
Emitted when the connection to the windowing system for Display is opened.
procedure On_Opened
(Self : not null access Gdk_Display_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the connection to the windowing system for Display is opened.
procedure On_Seat_Added
(Self : not null access Gdk_Display_Record;
Call : Cb_Gdk_Display_Gdk_Seat_Void;
After : Boolean := False)
Emitted whenever a new seat is made known to the windowing system.
procedure On_Seat_Added
(Self : not null access Gdk_Display_Record;
Call : Cb_GObject_Gdk_Seat_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted whenever a new seat is made known to the windowing system.
procedure On_Seat_Removed
(Self : not null access Gdk_Display_Record;
Call : Cb_Gdk_Display_Gdk_Seat_Void;
After : Boolean := False)
Emitted whenever a seat is removed by the windowing system.
procedure On_Seat_Removed
(Self : not null access Gdk_Display_Record;
Call : Cb_GObject_Gdk_Seat_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted whenever a seat is removed by the windowing system.
procedure On_Setting_Changed
(Self : not null access Gdk_Display_Record;
Call : Cb_Gdk_Display_UTF8_String_Void;
After : Boolean := False)
Emitted whenever a setting changes its value.
procedure On_Setting_Changed
(Self : not null access Gdk_Display_Record;
Call : Cb_GObject_UTF8_String_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted whenever a setting changes its value.
function Open (Display_Name : UTF8_String := "") return Gdk.Gdk_Display
Opens a display. If opening the display fails, NULL is returned.
the name of the display to open
a GdkDisplay. Has transfer-ownership='none'.
function Prepare_Gl
(Self : not null access Gdk_Display_Record;
Error : out Glib.Error.GError) return Boolean
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. Since: gtk+ 4.4
the return location for a recoverable error
True if the display supports OpenGL
Rgba_Property : constant Glib.Properties.Property_Boolean;
True if the display supports an alpha channel.
Shadow_Width_Property : constant Glib.Properties.Property_Boolean;
True if the display supports extensible frames.
Signal_Closed : constant Glib.Signal_Name := "closed";
Emitted when the connection to the windowing system for Display is closed.
Signal_Opened : constant Glib.Signal_Name := "opened";
Emitted when the connection to the windowing system for Display is opened.
Signal_Seat_Added : constant Glib.Signal_Name := "seat-added";
Emitted whenever a new seat is made known to the windowing system.
Signal_Seat_Removed : constant Glib.Signal_Name := "seat-removed";
Emitted whenever a seat is removed by the windowing system.
Signal_Setting_Changed : constant Glib.Signal_Name := "setting-changed";
Emitted whenever a setting changes its value.
function Supports_Input_Shapes
(Self : not null access Gdk_Display_Record) return Boolean
Returns True if the display supports input shapes. This means that [methodGdk.Surface.set_input_region] can be used to modify the input shape of surfaces on Display. On modern displays, this value is always True.
True if surfaces with modified input shape are supported
function Supports_Shadow_Width
(Self : not null access Gdk_Display_Record) return Boolean
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. Since: gtk+ 4.14
True if surfaces can draw shadows or False if the display does not support this functionality.
procedure Sync (Self : not null access Gdk_Display_Record)
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 [methodGdk.Display.sync] before [methodGdkx11.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.
function Translate_Key
(Self : not null access Gdk_Display_Record;
Keycode : Guint;
State : Gdk.Enums.Gdk_Modifier_Type;
Group : Glib.Gint;
Keyval : access Guint := null;
Effective_Group : access Glib.Gint := null;
Level : access Glib.Gint := null;
Consumed : access Gdk.Enums.Gdk_Modifier_Type := null)
return Boolean
Translates the contents of a GdkEventKey into a keyval, effective group, and level. Modifiers that affected the translation and are thus unavailable for application use are returned in Consumed_Modifiers. The Effective_Group is the group that was actually used for the translation; some keys such as Enter are not affected by the active keyboard group. The Level is derived from State. Consumed_Modifiers gives modifiers that should be masked out from State when comparing this key press to a keyboard shortcut. For instance, on a US keyboard, the plus symbol is shifted, so when comparing a key press to a <Control>plus accelerator <Shift> should be masked out. This function should rarely be needed, since GdkEventKey already contains the translated keyval. It is exported for the benefit of virtualized test environments.
a keycode
a modifier state
active keyboard group
return location for keyval
return location for effective group
return location for level
return location for modifiers that were used to determine the group or level
True if there was a keyval bound to keycode/state/group.