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().
-
Untyped pointer to the underlying
GdkDisplayinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
display_ptrDefault implementationTyped pointer to the underlying
GdkDisplayinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkDisplayinstance.Declaration
Swift
var display_ptr: UnsafeMutablePointer<GdkDisplay>! { get } -
Required Initialiser for types conforming to
DisplayProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
DisplaySignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DisplaySignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe 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(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
DisplaySignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DisplaySignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onClosed(flags:Extension methodhandler: ) The
closedsignal is emitted when the connection to the windowing system fordisplayis closed.Note
This represents the underlyingclosedsignalDeclaration
Swift
@discardableResult @inlinable func onClosed(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ isError: Bool) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
isErrortrueif the display was closed due to an errorhandlerThe signal handler to call Run the given callback whenever the
closedsignal is emitted -
closedSignalExtension methodTyped
closedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var closedSignal: DisplaySignalName { get } -
onMonitorAdded(flags:Extension methodhandler: ) The
monitor-addedsignal is emitted whenever a monitor is added.Note
This represents the underlyingmonitor-addedsignalDeclaration
Swift
@discardableResult @inlinable func onMonitorAdded(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ monitor: MonitorRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
monitorthe monitor that was just added
handlerThe signal handler to call Run the given callback whenever the
monitorAddedsignal is emitted -
monitorAddedSignalExtension methodTyped
monitor-addedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var monitorAddedSignal: DisplaySignalName { get } -
onMonitorRemoved(flags:Extension methodhandler: ) The
monitor-removedsignal is emitted whenever a monitor is removed.Note
This represents the underlyingmonitor-removedsignalDeclaration
Swift
@discardableResult @inlinable func onMonitorRemoved(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ monitor: MonitorRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
monitorthe monitor that was just removed
handlerThe signal handler to call Run the given callback whenever the
monitorRemovedsignal is emitted -
monitorRemovedSignalExtension methodTyped
monitor-removedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var monitorRemovedSignal: DisplaySignalName { get } -
onOpened(flags:Extension methodhandler: ) The
openedsignal is emitted when the connection to the windowing system fordisplayis opened.Note
This represents the underlyingopenedsignalDeclaration
Swift
@discardableResult @inlinable func onOpened(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
openedsignal is emitted -
openedSignalExtension methodTyped
openedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var openedSignal: DisplaySignalName { get } -
onSeatAdded(flags:Extension methodhandler: ) The
seat-addedsignal is emitted whenever a new seat is made known to the windowing system.Note
This represents the underlyingseat-addedsignalDeclaration
Swift
@discardableResult @inlinable func onSeatAdded(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ seat: SeatRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
seatthe seat that was just added
handlerThe signal handler to call Run the given callback whenever the
seatAddedsignal is emitted -
seatAddedSignalExtension methodTyped
seat-addedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var seatAddedSignal: DisplaySignalName { get } -
onSeatRemoved(flags:Extension methodhandler: ) The
seat-removedsignal is emitted whenever a seat is removed by the windowing system.Note
This represents the underlyingseat-removedsignalDeclaration
Swift
@discardableResult @inlinable func onSeatRemoved(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DisplayRef, _ seat: SeatRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
seatthe seat that was just removed
handlerThe signal handler to call Run the given callback whenever the
seatRemovedsignal is emitted -
seatRemovedSignalExtension methodTyped
seat-removedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var seatRemovedSignal: DisplaySignalName { get }
-
beep()Extension methodEmits a short beep on
displayDeclaration
Swift
@inlinable func beep() -
close()Extension methodCloses 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
trueif there is an ongoing grab ondevicefordisplay.Declaration
Swift
@inlinable func deviceIsGrabbed<DeviceT>(device: DeviceT) -> Bool where DeviceT : DeviceProtocol -
flush()Extension methodFlushes 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 methodReturns a
GdkAppLaunchContextsuitable for launching applications on the given display.Declaration
Swift
@inlinable func getAppLaunchContext() -> AppLaunchContextRef! -
getDefaultCursorSize()Extension methodReturns the default size to use for cursors on
display.Declaration
Swift
@inlinable func getDefaultCursorSize() -> Int -
getDefaultGroup()Extension methodReturns the default group leader window for all toplevel windows on
display. This window is implicitly created by GDK. Seegdk_window_set_group().Declaration
Swift
@inlinable func getDefaultGroup() -> WindowRef! -
getDefaultScreen()Extension methodGet the default
GdkScreenfordisplay.Declaration
Swift
@inlinable func getDefaultScreen() -> ScreenRef! -
getDefaultSeat()Extension methodReturns the default
GdkSeatfor this display.Declaration
Swift
@inlinable func getDefaultSeat() -> SeatRef! -
getDeviceManager()Extension methodReturns the
GdkDeviceManagerassociated todisplay.get_device_manager is deprecated: Use gdk_display_get_default_seat() and #GdkSeat operations.
Declaration
Swift
@available(*, deprecated) @inlinable func getDeviceManager() -> DeviceManagerRef! -
getEvent()Extension methodGets the next
GdkEventto be processed fordisplay, fetching events from the windowing system if necessary.Declaration
Swift
@inlinable func getEvent() -> EventRef! -
getMaximalCursorSize(width:Extension methodheight: ) 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:Extension methody: ) 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
windowresides, or a monitor close towindowif it is outside of all monitors.Declaration
Swift
@inlinable func getMonitorAt<WindowT>(window: WindowT) -> MonitorRef! where WindowT : WindowProtocol -
getNMonitors()Extension methodGets the number of monitors that belong to
display.The returned number is valid until the next emission of the
GdkDisplay::monitor-addedorGdkDisplay::monitor-removedsignal.Declaration
Swift
@inlinable func getNMonitors() -> Int -
getNScreens()Extension methodGets 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 methodGets the name of the display.
Declaration
Swift
@inlinable func getName() -> String! -
getPointer(screen:Extension methodx: y: mask: ) 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 methodGets 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! -
getWindowAtPointer(winX:Extension methodwinY: ) Obtains the window underneath the mouse pointer, returning the location of the pointer in that window in
win_x,win_yforscreen. Returnsnilif 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 methodReturns 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 methodReturns 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 methodReturns the list of seats known to
display.Declaration
Swift
@inlinable func listSeats() -> GLib.ListRef! -
notifyStartupComplete(startupId:Extension method) Indicates to the GUI environment that the application has finished loading, using a given identifier.
GTK+ will call this function automatically for
GtkWindowwith custom startup-notification identifier unlessgtk_window_set_auto_startup_notification()is called to disable that feature.Declaration
Swift
@inlinable func notifyStartupComplete(startupId: UnsafePointer<gchar>!) -
peekEvent()Extension methodGets a copy of the first
GdkEventin thedisplay’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 methodTest 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 -
requestSelectionNotification(selection:Extension method) Request
GdkEventOwnerChangeevents 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_PRESSevent). See alsogdk_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_PRESSevent). Applications should not set this, it is a global user-configured setting.Declaration
Swift
@inlinable func setDoubleClickTime(msec: Int) -
storeClipboard(clipboardWindow:Extension methodtime_: targets: nTargets: ) 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 -
supportsClipboardPersistence()Extension methodReturns 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 methodReturns
trueifgdk_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 methodReturns
trueif cursors can use an 8bit alpha channel ondisplay. Otherwise, cursors are restricted to bilevel alpha (i.e. a mask).Declaration
Swift
@inlinable func supportsCursorAlpha() -> Bool -
supportsCursorColor()Extension methodReturns
trueif multicolored cursors are supported ondisplay. Otherwise, cursors have only a forground and a background color.Declaration
Swift
@inlinable func supportsCursorColor() -> Bool -
supportsInputShapes()Extension methodReturns
trueifgdk_window_input_shape_combine_mask()can be used to modify the input shape of windows ondisplay.Declaration
Swift
@inlinable func supportsInputShapes() -> Bool -
supportsSelectionNotification()Extension methodReturns whether
GdkEventOwnerChangeevents will be sent when the owner of a selection changes.Declaration
Swift
@inlinable func supportsSelectionNotification() -> Bool -
supportsShapes()Extension methodReturns
trueifgdk_window_shape_combine_mask()can be used to create shaped windows ondisplay.Declaration
Swift
@inlinable func supportsShapes() -> Bool -
sync()Extension methodFlushes 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()beforegdk_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:Extension methodx: y: ) Warps the pointer of
displayto the pointx,yon the screenscreen, 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 methodCreates a
PangoContextfordisplay.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. Usinggtk_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! -
selectionOwnerGetForDisplay(selection:Extension method) 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! -
selectionOwnerSetForDisplay(owner:Extension methodselection: time_: sendEvent: ) Sets the
GdkWindowowneras the current owner of the selectionselection.Declaration
Swift
@inlinable func selectionOwnerSetForDisplay(owner: WindowRef? = nil, selection: GdkAtom!, time_: guint32, sendEvent: Bool) -> Bool -
selectionOwnerSetForDisplay(owner:Extension methodselection: time_: sendEvent: ) Sets the
GdkWindowowneras the current owner of the selectionselection.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 -
textPropertyToUtf8ListForDisplay(encoding:Extension methodformat: text: length: list: ) 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 -
appLaunchContextExtension methodReturns a
GdkAppLaunchContextsuitable for launching applications on the given display.Declaration
Swift
@inlinable var appLaunchContext: AppLaunchContextRef! { get } -
defaultCursorSizeExtension methodReturns the default size to use for cursors on
display.Declaration
Swift
@inlinable var defaultCursorSize: Int { get } -
defaultGroupExtension methodReturns the default group leader window for all toplevel windows on
display. This window is implicitly created by GDK. Seegdk_window_set_group().Declaration
Swift
@inlinable var defaultGroup: WindowRef! { get } -
defaultScreenExtension methodGet the default
GdkScreenfordisplay.Declaration
Swift
@inlinable var defaultScreen: ScreenRef! { get } -
defaultSeatExtension methodReturns the default
GdkSeatfor this display.Declaration
Swift
@inlinable var defaultSeat: SeatRef! { get } -
deviceManagerExtension methodReturns the
GdkDeviceManagerassociated todisplay.get_device_manager is deprecated: Use gdk_display_get_default_seat() and #GdkSeat operations.
Declaration
Swift
@inlinable var deviceManager: DeviceManagerRef! { get } -
eventExtension methodGets the next
GdkEventto be processed fordisplay, fetching events from the windowing system if necessary.Declaration
Swift
@inlinable var event: EventRef! { get } -
isClosedExtension methodFinds out if the display has been closed.
Declaration
Swift
@inlinable var isClosed: Bool { get } -
nMonitorsExtension methodGets the number of monitors that belong to
display.The returned number is valid until the next emission of the
GdkDisplay::monitor-addedorGdkDisplay::monitor-removedsignal.Declaration
Swift
@inlinable var nMonitors: Int { get } -
nScreensExtension methodGets 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 } -
nameExtension methodGets the name of the display.
Declaration
Swift
@inlinable var name: String! { get } -
primaryMonitorExtension methodGets 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 }
View on GitHub
Install in Dash
DisplayProtocol Protocol Reference