DeviceProtocol

public protocol DeviceProtocol : ObjectProtocol

The DeviceProtocol protocol exposes the methods and properties of an underlying GdkDevice 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 Device. Alternatively, use DeviceRef as a lighweight, unowned reference if you already have an instance you just want to use.

The GdkDevice object represents a single input device, such as a keyboard, a mouse, a touchpad, etc.

See the GdkDeviceManager documentation for more information about the various kinds of master and slave devices, and their relationships.

  • ptr

    Untyped pointer to the underlying GdkDevice instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GdkDevice instance.

    Default Implementation

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

    Declaration

    Swift

    var device_ptr: UnsafeMutablePointer<GdkDevice>! { get }
  • Required Initialiser for types conforming to DeviceProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Device Class

  • Bind a DevicePropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: DevicePropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a Device property

    Declaration

    Swift

    @inlinable
    func get(property: DevicePropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a Device property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: DevicePropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

Device signals

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

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: DeviceSignalName, 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 DeviceSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: DeviceSignalName, 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)

  • onChanged(flags:handler:) Extension method

    The changed signal is emitted either when the GdkDevice has changed the number of either axes or keys. For example In X this will normally happen when the slave device routing events through the master device changes (for example, user switches from the USB mouse to a tablet), in that case the master device will change to reflect the new slave device axes and keys.

    Note

    This represents the underlying changed signal

    Declaration

    Swift

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

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

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

  • changedSignal Extension method

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

    Declaration

    Swift

    static var changedSignal: DeviceSignalName { get }
  • The tool-changed signal is emitted on pen/eraser GdkDevices whenever tools enter or leave proximity.

    Note

    This represents the underlying tool-changed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onToolChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ tool: DeviceToolRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    tool

    The new current tool

    handler

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

  • toolChangedSignal Extension method

    Typed tool-changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var toolChangedSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::associated-device signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyAssociatedDevice(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyAssociatedDeviceSignal Extension method

    Typed notify::associated-device signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyAssociatedDeviceSignal: DeviceSignalName { get }
  • onNotifyAxes(flags:handler:) Extension method

    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::axes signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyAxes(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyAxesSignal Extension method

    Typed notify::axes signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyAxesSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::device-manager signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyDeviceManager(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyDeviceManagerSignal Extension method

    Typed notify::device-manager signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyDeviceManagerSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::display signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyDisplay(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyDisplaySignal Extension method

    Typed notify::display signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyDisplaySignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::has-cursor signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyHasCursor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyHasCursorSignal Extension method

    Typed notify::has-cursor signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyHasCursorSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::input-mode signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyInputMode(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyInputModeSignal Extension method

    Typed notify::input-mode signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyInputModeSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::input-source signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyInputSource(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyInputSourceSignal Extension method

    Typed notify::input-source signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyInputSourceSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::n-axes signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyNAxes(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyNAxesSignal Extension method

    Typed notify::n-axes signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyNAxesSignal: DeviceSignalName { get }
  • onNotifyName(flags:handler:) Extension method

    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::name signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyName(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyNameSignal Extension method

    Typed notify::name signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyNameSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::num-touches signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyNumTouches(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyNumTouchesSignal Extension method

    Typed notify::num-touches signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyNumTouchesSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::product-id signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyProductId(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyProductIdSignal Extension method

    Typed notify::product-id signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyProductIdSignal: DeviceSignalName { get }
  • onNotifySeat(flags:handler:) Extension method

    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::seat signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifySeat(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifySeatSignal Extension method

    Typed notify::seat signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifySeatSignal: DeviceSignalName { get }
  • onNotifyTool(flags:handler:) Extension method

    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::tool signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyTool(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyToolSignal Extension method

    Typed notify::tool signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyToolSignal: DeviceSignalName { get }
  • onNotifyType(flags:handler:) Extension method

    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::type signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyType(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyTypeSignal Extension method

    Typed notify::type signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyTypeSignal: DeviceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::vendor-id signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyVendorId(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DeviceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

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

  • notifyVendorIdSignal Extension method

    Typed notify::vendor-id signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyVendorIdSignal: DeviceSignalName { get }

Device Class: DeviceProtocol extension (methods and fields)

  • getAssociatedDevice() Extension method

    Returns the associated device to device, if device is of type GDK_DEVICE_TYPE_MASTER, it will return the paired pointer or keyboard.

    If device is of type GDK_DEVICE_TYPE_SLAVE, it will return the master device to which device is attached to.

    If device is of type GDK_DEVICE_TYPE_FLOATING, nil will be returned, as there is no associated device.

    Declaration

    Swift

    @inlinable
    func getAssociatedDevice() -> DeviceRef!
  • getAxes() Extension method

    Returns the axes currently available on the device.

    Declaration

    Swift

    @inlinable
    func getAxes() -> AxisFlags
  • getAxis(axes:use:value:) Extension method

    Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis use.

    Declaration

    Swift

    @inlinable
    func getAxis(axes: UnsafeMutablePointer<gdouble>!, use: GdkAxisUse, value: UnsafeMutablePointer<gdouble>!) -> Bool
  • getAxisUse(index_:) Extension method

    Returns the axis use for index_.

    Declaration

    Swift

    @inlinable
    func getAxisUse(index_: Int) -> GdkAxisUse
  • Interprets an array of double as axis values for a given device, and locates the value in the array for a given axis label, as returned by gdk_device_list_axes()

    Declaration

    Swift

    @inlinable
    func getAxisValue(axes: UnsafeMutablePointer<gdouble>!, axisLabel: GdkAtom!, value: UnsafeMutablePointer<gdouble>!) -> Bool
  • getDeviceType() Extension method

    Returns the device type for device.

    Declaration

    Swift

    @inlinable
    func getDeviceType() -> GdkDeviceType
  • getDisplay() Extension method

    Returns the GdkDisplay to which device pertains.

    Declaration

    Swift

    @inlinable
    func getDisplay() -> DisplayRef!
  • getHasCursor() Extension method

    Determines whether the pointer follows device motion. This is not meaningful for keyboard devices, which don’t have a pointer.

    Declaration

    Swift

    @inlinable
    func getHasCursor() -> Bool
  • Obtains the motion history for a pointer device; given a starting and ending timestamp, return all events in the motion history for the device in the given range of time. Some windowing systems do not support motion history, in which case, false will be returned. (This is not distinguishable from the case where motion history is supported and no events were found.)

    Note that there is also gdk_window_set_event_compression() to get more motion events delivered directly, independent of the windowing system.

    Declaration

    Swift

    @inlinable
    func getHistory<WindowT>(window: WindowT, start: guint32, stop: guint32, events: UnsafeMutablePointer<UnsafeMutablePointer<UnsafeMutablePointer<GdkTimeCoord>?>?>! = nil, nEvents: UnsafeMutablePointer<gint>! = nil) -> Bool where WindowT : WindowProtocol
  • If index_ has a valid keyval, this function will return true and fill in keyval and modifiers with the keyval settings.

    Declaration

    Swift

    @inlinable
    func getKey(index_: Int, keyval: UnsafeMutablePointer<guint>!, modifiers: UnsafeMutablePointer<GdkModifierType>!) -> Bool
  • getLastEventWindow() Extension method

    Gets information about which window the given pointer device is in, based on events that have been received so far from the display server. If another application has a pointer grab, or this application has a grab with owner_events = false, nil may be returned even if the pointer is physically over one of this application’s windows.

    Declaration

    Swift

    @inlinable
    func getLastEventWindow() -> WindowRef!
  • getMode() Extension method

    Determines the mode of the device.

    Declaration

    Swift

    @inlinable
    func getMode() -> GdkInputMode
  • getNAxes() Extension method

    Returns the number of axes the device currently has.

    Declaration

    Swift

    @inlinable
    func getNAxes() -> Int
  • getNKeys() Extension method

    Returns the number of keys the device currently has.

    Declaration

    Swift

    @inlinable
    func getNKeys() -> Int
  • getName() Extension method

    Determines the name of the device.

    Declaration

    Swift

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

    Gets the current location of device. As a slave device coordinates are those of its master pointer, This function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them, see gdk_device_grab().

    Declaration

    Swift

    @inlinable
    func getPosition(screen: UnsafeMutablePointer<UnsafeMutablePointer<GdkScreen>?>! = nil, x: UnsafeMutablePointer<gint>! = nil, y: UnsafeMutablePointer<gint>! = nil)
  • Gets the current location of device in double precision. As a slave device’s coordinates are those of its master pointer, this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See gdk_device_grab().

    Declaration

    Swift

    @inlinable
    func getPositionDouble(screen: UnsafeMutablePointer<UnsafeMutablePointer<GdkScreen>?>! = nil, x: UnsafeMutablePointer<gdouble>! = nil, y: UnsafeMutablePointer<gdouble>! = nil)
  • getProductId() Extension method

    Returns the product ID of this device, or nil if this information couldn’t be obtained. This ID is retrieved from the device, and is thus constant for it. See gdk_device_get_vendor_id() for more information.

    Declaration

    Swift

    @inlinable
    func getProductId() -> String!
  • getSeat() Extension method

    Returns the GdkSeat the device belongs to.

    Declaration

    Swift

    @inlinable
    func getSeat() -> SeatRef!
  • getSource() Extension method

    Determines the type of the device.

    Declaration

    Swift

    @inlinable
    func getSource() -> GdkInputSource
  • getState(window:axes:mask:) Extension method

    Gets the current state of a pointer device relative to window. As a slave device’s coordinates are those of its master pointer, this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them. See gdk_device_grab().

    Declaration

    Swift

    @inlinable
    func getState<WindowT>(window: WindowT, axes: UnsafeMutablePointer<gdouble>! = nil, mask: UnsafeMutablePointer<GdkModifierType>! = nil) where WindowT : WindowProtocol
  • getVendorId() Extension method

    Returns the vendor ID of this device, or nil if this information couldn’t be obtained. This ID is retrieved from the device, and is thus constant for it.

    This function, together with gdk_device_get_product_id(), can be used to eg. compose GSettings paths to store settings for this device.

    (C Language Example):

     static GSettings *
     get_device_settings (GdkDevice *device)
     {
       const gchar *vendor, *product;
       GSettings *settings;
       GdkDevice *device;
       gchar *path;
    
       vendor = gdk_device_get_vendor_id (device);
       product = gdk_device_get_product_id (device);
    
       path = g_strdup_printf ("/org/example/app/devices/%s:%s/", vendor, product);
       settings = g_settings_new_with_path (DEVICE_SCHEMA, path);
       g_free (path);
    
       return settings;
     }
    

    Declaration

    Swift

    @inlinable
    func getVendorId() -> String!
  • Obtains the window underneath device, returning the location of the device in win_x and win_y. Returns nil if the window tree under device is not known to GDK (for example, belongs to another application).

    As a slave device coordinates are those of its master pointer, This function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them, see gdk_device_grab().

    Declaration

    Swift

    @inlinable
    func getWindowAtPosition(winX: UnsafeMutablePointer<gint>! = nil, winY: UnsafeMutablePointer<gint>! = nil) -> WindowRef!
  • Obtains the window underneath device, returning the location of the device in win_x and win_y in double precision. Returns nil if the window tree under device is not known to GDK (for example, belongs to another application).

    As a slave device coordinates are those of its master pointer, This function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE, unless there is an ongoing grab on them, see gdk_device_grab().

    Declaration

    Swift

    @inlinable
    func getWindowAtPositionDouble(winX: UnsafeMutablePointer<gdouble>! = nil, winY: UnsafeMutablePointer<gdouble>! = nil) -> WindowRef!
  • Grabs the device so that all events coming from this device are passed to this application until the device is ungrabbed with gdk_device_ungrab(), or the window becomes unviewable. This overrides any previous grab on the device by this client.

    Note that device and window need to be on the same display.

    Device grabs are used for operations which need complete control over the given device events (either pointer or keyboard). For example in GTK+ this is used for Drag and Drop operations, popup menus and such.

    Note that if the event mask of an X window has selected both button press and button release events, then a button press event will cause an automatic pointer grab until the button is released. X does this automatically since most applications expect to receive button press and release events in pairs. It is equivalent to a pointer grab on the window with owner_events set to true.

    If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the GdkEventGrabBroken events that are emitted when the grab ends unvoluntarily.

    grab is deprecated: Use gdk_seat_grab() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func grab<WindowT>(window: WindowT, grabOwnership: GdkGrabOwnership, ownerEvents: Bool, eventMask: EventMask, cursor: CursorRef? = nil, time_: guint32) -> GdkGrabStatus where WindowT : WindowProtocol
  • Grabs the device so that all events coming from this device are passed to this application until the device is ungrabbed with gdk_device_ungrab(), or the window becomes unviewable. This overrides any previous grab on the device by this client.

    Note that device and window need to be on the same display.

    Device grabs are used for operations which need complete control over the given device events (either pointer or keyboard). For example in GTK+ this is used for Drag and Drop operations, popup menus and such.

    Note that if the event mask of an X window has selected both button press and button release events, then a button press event will cause an automatic pointer grab until the button is released. X does this automatically since most applications expect to receive button press and release events in pairs. It is equivalent to a pointer grab on the window with owner_events set to true.

    If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the GdkEventGrabBroken events that are emitted when the grab ends unvoluntarily.

    grab is deprecated: Use gdk_seat_grab() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func grab<CursorT, WindowT>(window: WindowT, grabOwnership: GdkGrabOwnership, ownerEvents: Bool, eventMask: EventMask, cursor: CursorT?, time_: guint32) -> GdkGrabStatus where CursorT : CursorProtocol, WindowT : WindowProtocol
  • listAxes() Extension method

    Returns a GList of GdkAtoms, containing the labels for the axes that device currently has.

    Declaration

    Swift

    @inlinable
    func listAxes() -> GLib.ListRef!
  • listSlaveDevices() Extension method

    If the device if of type GDK_DEVICE_TYPE_MASTER, it will return the list of slave devices attached to it, otherwise it will return nil

    Declaration

    Swift

    @inlinable
    func listSlaveDevices() -> GLib.ListRef!
  • setAxisUse(index_:use:) Extension method

    Specifies how an axis of a device is used.

    Declaration

    Swift

    @inlinable
    func setAxisUse(index_: Int, use: GdkAxisUse)
  • Specifies the X key event to generate when a macro button of a device is pressed.

    Declaration

    Swift

    @inlinable
    func setKey(index_: Int, keyval: Int, modifiers: ModifierType)
  • set(mode:) Extension method

    Sets a the mode of an input device. The mode controls if the device is active and whether the device’s range is mapped to the entire screen or to a single window.

    Note: This is only meaningful for floating devices, master devices (and slaves connected to these) drive the pointer cursor, which is not limited by the input mode.

    Declaration

    Swift

    @inlinable
    func set(mode: GdkInputMode) -> Bool
  • ungrab(time_:) Extension method

    Release any grab on device.

    ungrab is deprecated: Use gdk_seat_ungrab() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func ungrab(time_: guint32)
  • warp(screen:x:y:) Extension method

    Warps device in display to the point x,y on the screen screen, unless the device 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.

    Declaration

    Swift

    @inlinable
    func warp<ScreenT>(screen: ScreenT, x: Int, y: Int) where ScreenT : ScreenProtocol
  • Determines information about the current keyboard grab. This is not public API and must not be used by applications.

    grab_info_libgtk_only is deprecated: The symbol was never meant to be used outside of GTK+

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func grabInfoLibgtkOnly<DisplayT>(display: DisplayT, grabWindow: UnsafeMutablePointer<UnsafeMutablePointer<GdkWindow>?>!, ownerEvents: UnsafeMutablePointer<gboolean>!) -> Bool where DisplayT : DisplayProtocol
  • Starts a drag and creates a new drag context for it.

    This function is called by the drag source.

    Declaration

    Swift

    @inlinable
    func dragBeginForDevice<ListT, WindowT>(window: WindowT, targets: ListT) -> DragContextRef! where ListT : ListProtocol, WindowT : WindowProtocol
  • Starts a drag and creates a new drag context for it.

    This function is called by the drag source.

    Declaration

    Swift

    @inlinable
    func dragBeginFromPoint<ListT, WindowT>(window: WindowT, targets: ListT, xRoot: Int, yRoot: Int) -> DragContextRef! where ListT : ListProtocol, WindowT : WindowProtocol
  • associatedDevice Extension method

    Returns the associated device to device, if device is of type GDK_DEVICE_TYPE_MASTER, it will return the paired pointer or keyboard.

    If device is of type GDK_DEVICE_TYPE_SLAVE, it will return the master device to which device is attached to.

    If device is of type GDK_DEVICE_TYPE_FLOATING, nil will be returned, as there is no associated device.

    Declaration

    Swift

    @inlinable
    var associatedDevice: DeviceRef! { get }
  • axes Extension method

    The axes currently available for this device.

    Declaration

    Swift

    @inlinable
    var axes: AxisFlags { get }
  • deviceType Extension method

    Returns the device type for device.

    Declaration

    Swift

    @inlinable
    var deviceType: GdkDeviceType { get }
  • display Extension method

    The GdkDisplay the GdkDevice pertains to.

    Declaration

    Swift

    @inlinable
    var display: DisplayRef! { get }
  • hasCursor Extension method

    Determines whether the pointer follows device motion. This is not meaningful for keyboard devices, which don’t have a pointer.

    Declaration

    Swift

    @inlinable
    var hasCursor: Bool { get }
  • lastEventWindow Extension method

    Gets information about which window the given pointer device is in, based on events that have been received so far from the display server. If another application has a pointer grab, or this application has a grab with owner_events = false, nil may be returned even if the pointer is physically over one of this application’s windows.

    Declaration

    Swift

    @inlinable
    var lastEventWindow: WindowRef! { get }
  • mode Extension method

    Determines the mode of the device.

    Declaration

    Swift

    @inlinable
    var mode: GdkInputMode { get nonmutating set }
  • nAxes Extension method

    Returns the number of axes the device currently has.

    Declaration

    Swift

    @inlinable
    var nAxes: Int { get }
  • nKeys Extension method

    Returns the number of keys the device currently has.

    Declaration

    Swift

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

    The device name.

    Declaration

    Swift

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

    Returns the product ID of this device, or nil if this information couldn’t be obtained. This ID is retrieved from the device, and is thus constant for it. See gdk_device_get_vendor_id() for more information.

    Declaration

    Swift

    @inlinable
    var productId: String! { get }
  • seat Extension method

    GdkSeat of this device.

    Declaration

    Swift

    @inlinable
    var seat: SeatRef! { get }
  • source Extension method

    Determines the type of the device.

    Declaration

    Swift

    @inlinable
    var source: GdkInputSource { get }
  • vendorId Extension method

    Returns the vendor ID of this device, or nil if this information couldn’t be obtained. This ID is retrieved from the device, and is thus constant for it.

    This function, together with gdk_device_get_product_id(), can be used to eg. compose GSettings paths to store settings for this device.

    (C Language Example):

     static GSettings *
     get_device_settings (GdkDevice *device)
     {
       const gchar *vendor, *product;
       GSettings *settings;
       GdkDevice *device;
       gchar *path;
    
       vendor = gdk_device_get_vendor_id (device);
       product = gdk_device_get_product_id (device);
    
       path = g_strdup_printf ("/org/example/app/devices/%s:%s/", vendor, product);
       settings = g_settings_new_with_path (DEVICE_SCHEMA, path);
       g_free (path);
    
       return settings;
     }
    

    Declaration

    Swift

    @inlinable
    var vendorId: String! { get }