package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Wrappers.Display

type t = [ `display | `object_ ] Gobject.obj
val translate_key : t -> int -> Gdk_enums.modifiertype -> int -> bool * int * int * int * Gdk_enums.modifiertype

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.

val sync : t -> unit

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.

val supports_shadow_width : t -> bool

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.

val supports_input_shapes : t -> bool

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.

val put_event : t -> [ `event ] Gobject.obj -> unit

Adds the given event to the event queue for @display.

val prepare_gl : t -> (bool, GError.t) result

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.

val notify_startup_complete : t -> string -> unit

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.

val map_keyval : t -> int -> bool * [ `keymap_key ] Gobject.obj array * int

Obtains a list of keycode/group/level combinations that will generate @keyval.

Groups and levels are two kinds of keyboard mode; in general, the level determines whether the top or bottom symbol on a key is used, and the group determines whether the left or right symbol is used.

On US keyboards, the shift key changes the keyboard level, and there are no groups. A group switch key might convert a keyboard between Hebrew to English modes, for example.

`GdkEventKey` contains a %group field that indicates the active keyboard group. The level is computed from the modifier mask.

The returned array should be freed with g_free().

val map_keycode : t -> int -> bool * [ `keymap_key ] Gobject.obj array * int array * int

Returns the keyvals bound to @keycode.

The Nth `GdkKeymapKey` in @keys is bound to the Nth keyval in @keyvals.

When a keycode is pressed by the user, the keyval from this list of entries is selected by considering the effective keyboard group and level.

Free the returned arrays with g_free().

val list_seats : t -> [ `seat | `object_ ] Gobject.obj list

Returns the list of seats known to @display.

val is_rgba : t -> bool

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.

val is_composited : t -> bool

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.

val is_closed : t -> bool

Finds out if the display has been closed.

val get_startup_notification_id : t -> string option

Gets the startup notification ID for a Wayland display, or %NULL if no ID has been defined.

val get_setting : t -> string -> Gobject.Value.t -> bool

Retrieves a desktop-wide setting such as double-click time for the @display.

val get_primary_clipboard : t -> [ `clipboard | `object_ ] Gobject.obj

Gets the clipboard used for the primary selection.

On backends where the primary clipboard is not supported natively, GDK emulates this clipboard locally.

val get_name : t -> string

Gets the name of the display.

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.

val get_monitor_at_surface : t -> [ `surface | `object_ ] Gobject.obj -> [ `monitor | `object_ ] Gobject.obj option

Gets the monitor in which the largest area of @surface resides.

val get_dmabuf_formats : t -> [ `dmabuf_formats ] Gobject.obj

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.

val get_default_seat : t -> [ `seat | `object_ ] Gobject.obj option

Returns the default `GdkSeat` for this display.

Note that a display may not have a seat. In this case, this function will return %NULL.

val get_clipboard : t -> [ `clipboard | `object_ ] Gobject.obj

Gets the clipboard used for copy/paste operations.

val get_app_launch_context : t -> [ `app_launch_context | `object_ ] Gobject.obj

Returns a `GdkAppLaunchContext` suitable for launching applications on the given display.

val flush : t -> unit

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.

val device_is_grabbed : t -> [ `device | `object_ ] Gobject.obj -> bool

Returns %TRUE if there is an ongoing grab on @device for @display.

val create_gl_context : t -> ([ `gl_context | `draw_context | `object_ ] Gobject.obj, GError.t) result

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.

val close : t -> unit

Closes the connection to the windowing system for the given display.

This cleans up associated resources.

val beep : t -> unit

Emits a short beep on @display

val get_composited : t -> bool

Get property: composited

val get_input_shapes : t -> bool

Get property: input-shapes

val get_rgba : t -> bool

Get property: rgba

val get_shadow_width : t -> bool

Get property: shadow-width

val on_closed : ?after:bool -> t -> callback:(is_error:bool -> unit) -> Gobject.Signal.handler_id
val on_opened : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_seat_added : ?after:bool -> t -> callback:(seat:[ `seat | `object_ ] Gobject.obj -> unit) -> Gobject.Signal.handler_id
val on_seat_removed : ?after:bool -> t -> callback:(seat:[ `seat | `object_ ] Gobject.obj -> unit) -> Gobject.Signal.handler_id
val on_setting_changed : ?after:bool -> t -> callback:(setting:string -> unit) -> Gobject.Signal.handler_id