DisplayProtocol

public protocol DisplayProtocol : ObjectProtocol

The DisplayProtocol protocol exposes the methods and properties of an underlying GdkDisplay instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see Display. Alternatively, use DisplayRef as a lighweight, unowned reference if you already have an instance you just want to use.

GdkDisplay objects purpose are two fold:

  • To manage and provide information about input devices (pointers and keyboards)

  • To manage and provide information about the available GdkScreens

GdkDisplay objects are the GDK representation of an X Display, which can be described as a workstation consisting of a keyboard, a pointing device (such as a mouse) and one or more screens. It is used to open and keep track of various GdkScreen objects currently instantiated by the application. It is also used to access the keyboard(s) and mouse pointer(s) of the display.

Most of the input device handling has been factored out into the separate GdkDeviceManager object. Every display has a device manager, which you can obtain using gdk_display_get_device_manager().

  • ptr

    Untyped pointer to the underlying GdkDisplay instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • display_ptr Default implementation

    Typed pointer to the underlying GdkDisplay instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GdkDisplay instance.

    Declaration

    Swift

    var display_ptr: UnsafeMutablePointer<GdkDisplay>! { get }
  • Required Initialiser for types conforming to DisplayProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Display signals

  • Connect a Swift signal handler to the given, typed DisplaySignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: DisplaySignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed DisplaySignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: DisplaySignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • onClosed(flags:handler:) Extension method

    The closed signal is emitted when the connection to the windowing system for display is closed.

    Note

    This represents the underlying closed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onClosed(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ isError: Bool) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    isError

    true if the display was closed due to an error

    handler

    The signal handler to call Run the given callback whenever the closed signal is emitted

  • closedSignal Extension method

    Typed closed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var closedSignal: DisplaySignalName { get }
  • The monitor-added signal is emitted whenever a monitor is added.

    Note

    This represents the underlying monitor-added signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onMonitorAdded(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ monitor: MonitorRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    monitor

    the monitor that was just added

    handler

    The signal handler to call Run the given callback whenever the monitorAdded signal is emitted

  • monitorAddedSignal Extension method

    Typed monitor-added signal for using the connect(signal:) methods

    Declaration

    Swift

    static var monitorAddedSignal: DisplaySignalName { get }
  • The monitor-removed signal is emitted whenever a monitor is removed.

    Note

    This represents the underlying monitor-removed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onMonitorRemoved(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ monitor: MonitorRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    monitor

    the monitor that was just removed

    handler

    The signal handler to call Run the given callback whenever the monitorRemoved signal is emitted

  • monitorRemovedSignal Extension method

    Typed monitor-removed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var monitorRemovedSignal: DisplaySignalName { get }
  • onOpened(flags:handler:) Extension method

    The opened signal is emitted when the connection to the windowing system for display is opened.

    Note

    This represents the underlying opened signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onOpened(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the opened signal is emitted

  • openedSignal Extension method

    Typed opened signal for using the connect(signal:) methods

    Declaration

    Swift

    static var openedSignal: DisplaySignalName { get }
  • onSeatAdded(flags:handler:) Extension method

    The seat-added signal is emitted whenever a new seat is made known to the windowing system.

    Note

    This represents the underlying seat-added signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onSeatAdded(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ seat: SeatRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    seat

    the seat that was just added

    handler

    The signal handler to call Run the given callback whenever the seatAdded signal is emitted

  • seatAddedSignal Extension method

    Typed seat-added signal for using the connect(signal:) methods

    Declaration

    Swift

    static var seatAddedSignal: DisplaySignalName { get }
  • The seat-removed signal is emitted whenever a seat is removed by the windowing system.

    Note

    This represents the underlying seat-removed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onSeatRemoved(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ seat: SeatRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    seat

    the seat that was just removed

    handler

    The signal handler to call Run the given callback whenever the seatRemoved signal is emitted

  • seatRemovedSignal Extension method

    Typed seat-removed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var seatRemovedSignal: DisplaySignalName { get }

Display Class: DisplayProtocol extension (methods and fields)

  • beep() Extension method

    Emits a short beep on display

    Declaration

    Swift

    @inlinable
    func beep()
  • close() Extension method

    Closes the connection to the windowing system for the given display, and cleans up associated resources.

    Declaration

    Swift

    @inlinable
    func close()
  • deviceIsGrabbed(device:) Extension method

    Returns true if there is an ongoing grab on device for display.

    Declaration

    Swift

    @inlinable
    func deviceIsGrabbed<DeviceT>(device: DeviceT) -> Bool where DeviceT : DeviceProtocol
  • flush() Extension method

    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.

    Declaration

    Swift

    @inlinable
    func flush()
  • getAppLaunchContext() Extension method

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

    Declaration

    Swift

    @inlinable
    func getAppLaunchContext() -> AppLaunchContextRef!
  • getDefaultCursorSize() Extension method

    Returns the default size to use for cursors on display.

    Declaration

    Swift

    @inlinable
    func getDefaultCursorSize() -> Int
  • getDefaultGroup() Extension method

    Returns the default group leader window for all toplevel windows on display. This window is implicitly created by GDK. See gdk_window_set_group().

    Declaration

    Swift

    @inlinable
    func getDefaultGroup() -> WindowRef!
  • getDefaultScreen() Extension method

    Get the default GdkScreen for display.

    Declaration

    Swift

    @inlinable
    func getDefaultScreen() -> ScreenRef!
  • getDefaultSeat() Extension method

    Returns the default GdkSeat for this display.

    Declaration

    Swift

    @inlinable
    func getDefaultSeat() -> SeatRef!
  • getDeviceManager() Extension method

    Returns the GdkDeviceManager associated to display.

    get_device_manager is deprecated: Use gdk_display_get_default_seat() and #GdkSeat operations.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getDeviceManager() -> DeviceManagerRef!
  • getEvent() Extension method

    Gets the next GdkEvent to be processed for display, fetching events from the windowing system if necessary.

    Declaration

    Swift

    @inlinable
    func getEvent() -> EventRef!
  • Gets the maximal size to use for cursors on display.

    Declaration

    Swift

    @inlinable
    func getMaximalCursorSize(width: UnsafeMutablePointer<guint>!, height: UnsafeMutablePointer<guint>!)
  • getMonitor(monitorNum:) Extension method

    Gets a monitor associated with this display.

    Declaration

    Swift

    @inlinable
    func getMonitor(monitorNum: Int) -> MonitorRef!
  • getMonitorAtPoint(x:y:) Extension method

    Gets the monitor in which the point (x, y) is located, or a nearby monitor if the point is not in any monitor.

    Declaration

    Swift

    @inlinable
    func getMonitorAtPoint(x: Int, y: Int) -> MonitorRef!
  • getMonitorAt(window:) Extension method

    Gets the monitor in which the largest area of window resides, or a monitor close to window if it is outside of all monitors.

    Declaration

    Swift

    @inlinable
    func getMonitorAt<WindowT>(window: WindowT) -> MonitorRef! where WindowT : WindowProtocol
  • getNMonitors() Extension method

    Gets the number of monitors that belong to display.

    The returned number is valid until the next emission of the GdkDisplay::monitor-added or GdkDisplay::monitor-removed signal.

    Declaration

    Swift

    @inlinable
    func getNMonitors() -> Int
  • getNScreens() Extension method

    Gets the number of screen managed by the display.

    get_n_screens is deprecated: The number of screens is always 1.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getNScreens() -> Int
  • getName() Extension method

    Gets the name of the display.

    Declaration

    Swift

    @inlinable
    func getName() -> String!
  • getPointer(screen:x:y:mask:) Extension method

    Gets the current location of the pointer and the current modifier mask for a given display.

    get_pointer is deprecated: Use gdk_device_get_position() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getPointer(screen: UnsafeMutablePointer<UnsafeMutablePointer<GdkScreen>?>! = nil, x: UnsafeMutablePointer<gint>! = nil, y: UnsafeMutablePointer<gint>! = nil, mask: UnsafeMutablePointer<GdkModifierType>! = nil)
  • getPrimaryMonitor() Extension method

    Gets the primary monitor for the display.

    The primary monitor is considered the monitor where the “main desktop” lives. While normal application windows typically allow the window manager to place the windows, specialized desktop applications such as panels should place themselves on the primary monitor.

    Declaration

    Swift

    @inlinable
    func getPrimaryMonitor() -> MonitorRef!
  • getScreen(screenNum:) Extension method

    Returns a screen object for one of the screens of the display.

    get_screen is deprecated: There is only one screen; use gdk_display_get_default_screen() to get it.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getScreen(screenNum: Int) -> ScreenRef!
  • Obtains the window underneath the mouse pointer, returning the location of the pointer in that window in win_x, win_y for screen. Returns nil if the window under the mouse pointer is not known to GDK (for example, belongs to another application).

    get_window_at_pointer is deprecated: Use gdk_device_get_window_at_position() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getWindowAtPointer(winX: UnsafeMutablePointer<gint>! = nil, winY: UnsafeMutablePointer<gint>! = nil) -> WindowRef!
  • hasPending() Extension method

    Returns whether the display has events that are waiting to be processed.

    Declaration

    Swift

    @inlinable
    func hasPending() -> Bool
  • keyboardUngrab(time_:) Extension method

    Release any keyboard grab

    keyboard_ungrab is deprecated: Use gdk_device_ungrab(), together with gdk_device_grab() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func keyboardUngrab(time_: guint32)
  • listDevices() Extension method

    Returns the list of available input devices attached to display. The list is statically allocated and should not be freed.

    list_devices is deprecated: Use gdk_device_manager_list_devices() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func listDevices() -> GLib.ListRef!
  • listSeats() Extension method

    Returns the list of seats known to display.

    Declaration

    Swift

    @inlinable
    func listSeats() -> GLib.ListRef!
  • 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.

    Declaration

    Swift

    @inlinable
    func notifyStartupComplete(startupId: UnsafePointer<gchar>!)
  • peekEvent() Extension method

    Gets a copy of the first GdkEvent in the display’s event queue, without removing the event from the queue. (Note that this function will not get more events from the windowing system. It only checks the events that have already been moved to the GDK event queue.)

    Declaration

    Swift

    @inlinable
    func peekEvent() -> EventRef!
  • pointerIsGrabbed() Extension method

    Test if the pointer is grabbed.

    pointer_is_grabbed is deprecated: Use gdk_display_device_is_grabbed() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func pointerIsGrabbed() -> Bool
  • pointerUngrab(time_:) Extension method

    Release any pointer grab.

    pointer_ungrab is deprecated: Use gdk_device_ungrab(), together with gdk_device_grab() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func pointerUngrab(time_: guint32)
  • put(event:) Extension method

    Appends a copy of the given event onto the front of the event queue for display.

    Declaration

    Swift

    @inlinable
    func put<EventT>(event: EventT) where EventT : EventProtocol
  • Request GdkEventOwnerChange events for ownership changes of the selection named by the given atom.

    Declaration

    Swift

    @inlinable
    func requestSelectionNotification(selection: GdkAtom!) -> Bool
  • setDoubleClick(distance:) Extension method

    Sets the double click distance (two clicks within this distance count as a double click and result in a GDK_2BUTTON_PRESS event). See also gdk_display_set_double_click_time(). Applications should not set this, it is a global user-configured setting.

    Declaration

    Swift

    @inlinable
    func setDoubleClick(distance: Int)
  • setDoubleClickTime(msec:) Extension method

    Sets the double click time (two clicks within this time interval count as a double click and result in a GDK_2BUTTON_PRESS event). Applications should not set this, it is a global user-configured setting.

    Declaration

    Swift

    @inlinable
    func setDoubleClickTime(msec: Int)
  • Issues a request to the clipboard manager to store the clipboard data. On X11, this is a special program that works according to the FreeDesktop Clipboard Specification.

    Declaration

    Swift

    @inlinable
    func storeClipboard<WindowT>(clipboardWindow: WindowT, time_: guint32, targets: UnsafePointer<GdkAtom?>! = nil, nTargets: Int) where WindowT : WindowProtocol
  • Returns whether the speicifed display supports clipboard persistance; i.e. if it’s possible to store the clipboard data after an application has quit. On X11 this checks if a clipboard daemon is running.

    Declaration

    Swift

    @inlinable
    func supportsClipboardPersistence() -> Bool
  • supportsComposite() Extension method

    Returns true if gdk_window_set_composited() can be used to redirect drawing on the window using compositing.

    Currently this only works on X11 with XComposite and XDamage extensions available.

    supports_composite is deprecated: Compositing is an outdated technology that only ever worked on X11.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func supportsComposite() -> Bool
  • supportsCursorAlpha() Extension method

    Returns true if cursors can use an 8bit alpha channel on display. Otherwise, cursors are restricted to bilevel alpha (i.e. a mask).

    Declaration

    Swift

    @inlinable
    func supportsCursorAlpha() -> Bool
  • supportsCursorColor() Extension method

    Returns true if multicolored cursors are supported on display. Otherwise, cursors have only a forground and a background color.

    Declaration

    Swift

    @inlinable
    func supportsCursorColor() -> Bool
  • supportsInputShapes() Extension method

    Returns true if gdk_window_input_shape_combine_mask() can be used to modify the input shape of windows on display.

    Declaration

    Swift

    @inlinable
    func supportsInputShapes() -> Bool
  • Returns whether GdkEventOwnerChange events will be sent when the owner of a selection changes.

    Declaration

    Swift

    @inlinable
    func supportsSelectionNotification() -> Bool
  • supportsShapes() Extension method

    Returns true if gdk_window_shape_combine_mask() can be used to create shaped windows on display.

    Declaration

    Swift

    @inlinable
    func supportsShapes() -> Bool
  • sync() Extension method

    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 gdk_display_sync() before gdk_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.

    Declaration

    Swift

    @inlinable
    func sync()
  • warpPointer(screen:x:y:) Extension method

    Warps the pointer of display to the point x,y on the screen screen, unless the pointer is confined to a window by a grab, in which case it will be moved as far as allowed by the grab. Warping the pointer creates events as if the user had moved the mouse instantaneously to the destination.

    Note that the pointer should normally be under the control of the user. This function was added to cover some rare use cases like keyboard navigation support for the color picker in the GtkColorSelectionDialog.

    warp_pointer is deprecated: Use gdk_device_warp() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func warpPointer<ScreenT>(screen: ScreenT, x: Int, y: Int) where ScreenT : ScreenProtocol
  • pangoContextGetForDisplay() Extension method

    Creates a PangoContext for display.

    The context must be freed when you’re finished with it.

    When using GTK+, normally you should use gtk_widget_get_pango_context() instead of this function, to get the appropriate context for the widget you intend to render text onto.

    The newly created context will have the default font options (see cairo_font_options_t) for the display; if these options change it will not be updated. Using gtk_widget_get_pango_context() is more convenient if you want to keep a context around and track changes to the font rendering settings.

    Declaration

    Swift

    @inlinable
    func pangoContextGetForDisplay() -> Pango.ContextRef!
  • Determine the owner of the given selection.

    Note that the return value may be owned by a different process if a foreign window was previously created for that window, but a new foreign window will never be created by this call.

    Declaration

    Swift

    @inlinable
    func selectionOwnerGetForDisplay(selection: GdkAtom!) -> WindowRef!
  • Sets the GdkWindow owner as the current owner of the selection selection.

    Declaration

    Swift

    @inlinable
    func selectionOwnerSetForDisplay(owner: WindowRef? = nil, selection: GdkAtom!, time_: guint32, sendEvent: Bool) -> Bool
  • Sets the GdkWindow owner as the current owner of the selection selection.

    Declaration

    Swift

    @inlinable
    func selectionOwnerSetForDisplay<WindowT>(owner: WindowT?, selection: GdkAtom!, time_: guint32, sendEvent: Bool) -> Bool where WindowT : WindowProtocol
  • Send a response to SelectionRequest event.

    Declaration

    Swift

    @inlinable
    func selectionSendNotifyForDisplay<WindowT>(requestor: WindowT, selection: GdkAtom!, target: GdkAtom!, property: GdkAtom!, time_: guint32) where WindowT : WindowProtocol
  • Converts a text property in the given encoding to a list of UTF-8 strings.

    Declaration

    Swift

    @inlinable
    func textPropertyToUtf8ListForDisplay(encoding: GdkAtom!, format: Int, text: UnsafePointer<guchar>!, length: Int, list: UnsafeMutablePointer<UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>?>!) -> Int
  • appLaunchContext Extension method

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

    Declaration

    Swift

    @inlinable
    var appLaunchContext: AppLaunchContextRef! { get }
  • defaultCursorSize Extension method

    Returns the default size to use for cursors on display.

    Declaration

    Swift

    @inlinable
    var defaultCursorSize: Int { get }
  • defaultGroup Extension method

    Returns the default group leader window for all toplevel windows on display. This window is implicitly created by GDK. See gdk_window_set_group().

    Declaration

    Swift

    @inlinable
    var defaultGroup: WindowRef! { get }
  • defaultScreen Extension method

    Get the default GdkScreen for display.

    Declaration

    Swift

    @inlinable
    var defaultScreen: ScreenRef! { get }
  • defaultSeat Extension method

    Returns the default GdkSeat for this display.

    Declaration

    Swift

    @inlinable
    var defaultSeat: SeatRef! { get }
  • deviceManager Extension method

    Returns the GdkDeviceManager associated to display.

    get_device_manager is deprecated: Use gdk_display_get_default_seat() and #GdkSeat operations.

    Declaration

    Swift

    @inlinable
    var deviceManager: DeviceManagerRef! { get }
  • event Extension method

    Gets the next GdkEvent to be processed for display, fetching events from the windowing system if necessary.

    Declaration

    Swift

    @inlinable
    var event: EventRef! { get }
  • isClosed Extension method

    Finds out if the display has been closed.

    Declaration

    Swift

    @inlinable
    var isClosed: Bool { get }
  • nMonitors Extension method

    Gets the number of monitors that belong to display.

    The returned number is valid until the next emission of the GdkDisplay::monitor-added or GdkDisplay::monitor-removed signal.

    Declaration

    Swift

    @inlinable
    var nMonitors: Int { get }
  • nScreens Extension method

    Gets the number of screen managed by the display.

    get_n_screens is deprecated: The number of screens is always 1.

    Declaration

    Swift

    @inlinable
    var nScreens: Int { get }
  • name Extension method

    Gets the name of the display.

    Declaration

    Swift

    @inlinable
    var name: String! { get }
  • primaryMonitor Extension method

    Gets the primary monitor for the display.

    The primary monitor is considered the monitor where the “main desktop” lives. While normal application windows typically allow the window manager to place the windows, specialized desktop applications such as panels should place themselves on the primary monitor.

    Declaration

    Swift

    @inlinable
    var primaryMonitor: MonitorRef! { get }