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.
-
Untyped pointer to the underlying
GdkDevice
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
device_ptr
Default implementationTyped 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)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) 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 transformationtransform_to
ValueTransformer
to use for backwards transformationReturn 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:
Extension methodvalue: ) 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
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
DeviceSignalName
signalDeclaration
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 byuserData
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(signal:
Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
DeviceSignalName
signalDeclaration
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 byuserData
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:
Extension methodhandler: ) The
changed
signal is emitted either when theGdkDevice
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 underlyingchanged
signalDeclaration
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 methodTyped
changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var changedSignal: DeviceSignalName { get }
-
onToolChanged(flags:
Extension methodhandler: ) The
tool-changed
signal is emitted on pen/eraserGdkDevices
whenever tools enter or leave proximity.Note
This represents the underlyingtool-changed
signalDeclaration
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 methodTyped
tool-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var toolChangedSignal: DeviceSignalName { get }
-
onNotifyAssociatedDevice(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::associated-device
signalDeclaration
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 methodTyped
notify::associated-device
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyAssociatedDeviceSignal: DeviceSignalName { get }
-
onNotifyAxes(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::axes
signalDeclaration
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 methodTyped
notify::axes
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyAxesSignal: DeviceSignalName { get }
-
onNotifyDeviceManager(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::device-manager
signalDeclaration
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 methodTyped
notify::device-manager
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyDeviceManagerSignal: DeviceSignalName { get }
-
onNotifyDisplay(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::display
signalDeclaration
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 methodTyped
notify::display
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyDisplaySignal: DeviceSignalName { get }
-
onNotifyHasCursor(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::has-cursor
signalDeclaration
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 methodTyped
notify::has-cursor
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyHasCursorSignal: DeviceSignalName { get }
-
onNotifyInputMode(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::input-mode
signalDeclaration
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 methodTyped
notify::input-mode
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyInputModeSignal: DeviceSignalName { get }
-
onNotifyInputSource(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::input-source
signalDeclaration
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 methodTyped
notify::input-source
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyInputSourceSignal: DeviceSignalName { get }
-
onNotifyNAxes(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::n-axes
signalDeclaration
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 methodTyped
notify::n-axes
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyNAxesSignal: DeviceSignalName { get }
-
onNotifyName(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::name
signalDeclaration
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 methodTyped
notify::name
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyNameSignal: DeviceSignalName { get }
-
onNotifyNumTouches(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::num-touches
signalDeclaration
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 methodTyped
notify::num-touches
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyNumTouchesSignal: DeviceSignalName { get }
-
onNotifyProductId(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::product-id
signalDeclaration
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 methodTyped
notify::product-id
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyProductIdSignal: DeviceSignalName { get }
-
onNotifySeat(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::seat
signalDeclaration
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 methodTyped
notify::seat
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifySeatSignal: DeviceSignalName { get }
-
onNotifyTool(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::tool
signalDeclaration
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 methodTyped
notify::tool
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyToolSignal: DeviceSignalName { get }
-
onNotifyType(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::type
signalDeclaration
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 methodTyped
notify::type
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyTypeSignal: DeviceSignalName { get }
-
onNotifyVendorId(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::vendor-id
signalDeclaration
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 methodTyped
notify::vendor-id
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyVendorIdSignal: DeviceSignalName { get }
-
getAssociatedDevice()
Extension methodReturns the associated device to
device
, ifdevice
is of typeGDK_DEVICE_TYPE_MASTER
, it will return the paired pointer or keyboard.If
device
is of typeGDK_DEVICE_TYPE_SLAVE
, it will return the master device to whichdevice
is attached to.If
device
is of typeGDK_DEVICE_TYPE_FLOATING
,nil
will be returned, as there is no associated device.Declaration
Swift
@inlinable func getAssociatedDevice() -> DeviceRef!
-
getAxes()
Extension methodReturns the axes currently available on the device.
Declaration
Swift
@inlinable func getAxes() -> AxisFlags
-
getAxis(axes:
Extension methoduse: value: ) 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
-
getAxisValue(axes:
Extension methodaxisLabel: value: ) 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 methodReturns the device type for
device
.Declaration
Swift
@inlinable func getDeviceType() -> GdkDeviceType
-
getDisplay()
Extension methodReturns the
GdkDisplay
to whichdevice
pertains.Declaration
Swift
@inlinable func getDisplay() -> DisplayRef!
-
getHasCursor()
Extension methodDetermines 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
-
getHistory(window:
Extension methodstart: stop: events: nEvents: ) 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
-
getKey(index_:
Extension methodkeyval: modifiers: ) If
index_
has a valid keyval, this function will returntrue
and fill inkeyval
andmodifiers
with the keyval settings.Declaration
Swift
@inlinable func getKey(index_: Int, keyval: UnsafeMutablePointer<guint>!, modifiers: UnsafeMutablePointer<GdkModifierType>!) -> Bool
-
getLastEventWindow()
Extension methodGets 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 methodDetermines the mode of the device.
Declaration
Swift
@inlinable func getMode() -> GdkInputMode
-
getNAxes()
Extension methodReturns the number of axes the device currently has.
Declaration
Swift
@inlinable func getNAxes() -> Int
-
getNKeys()
Extension methodReturns the number of keys the device currently has.
Declaration
Swift
@inlinable func getNKeys() -> Int
-
getName()
Extension methodDetermines the name of the device.
Declaration
Swift
@inlinable func getName() -> String!
-
getPosition(screen:
Extension methodx: y: ) 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 typeGDK_DEVICE_TYPE_SLAVE
, unless there is an ongoing grab on them, seegdk_device_grab()
.Declaration
Swift
@inlinable func getPosition(screen: UnsafeMutablePointer<UnsafeMutablePointer<GdkScreen>?>! = nil, x: UnsafeMutablePointer<gint>! = nil, y: UnsafeMutablePointer<gint>! = nil)
-
getPositionDouble(screen:
Extension methodx: y: ) 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 typeGDK_DEVICE_TYPE_SLAVE
, unless there is an ongoing grab on them. Seegdk_device_grab()
.Declaration
Swift
@inlinable func getPositionDouble(screen: UnsafeMutablePointer<UnsafeMutablePointer<GdkScreen>?>! = nil, x: UnsafeMutablePointer<gdouble>! = nil, y: UnsafeMutablePointer<gdouble>! = nil)
-
getProductId()
Extension methodReturns 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. Seegdk_device_get_vendor_id()
for more information.Declaration
Swift
@inlinable func getProductId() -> String!
-
getSeat()
Extension methodReturns the
GdkSeat
the device belongs to.Declaration
Swift
@inlinable func getSeat() -> SeatRef!
-
getSource()
Extension methodDetermines the type of the device.
Declaration
Swift
@inlinable func getSource() -> GdkInputSource
-
getState(window:
Extension methodaxes: mask: ) 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 typeGDK_DEVICE_TYPE_SLAVE
, unless there is an ongoing grab on them. Seegdk_device_grab()
.Declaration
Swift
@inlinable func getState<WindowT>(window: WindowT, axes: UnsafeMutablePointer<gdouble>! = nil, mask: UnsafeMutablePointer<GdkModifierType>! = nil) where WindowT : WindowProtocol
-
getVendorId()
Extension methodReturns 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. composeGSettings
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!
-
getWindowAtPosition(winX:
Extension methodwinY: ) Obtains the window underneath
device
, returning the location of the device inwin_x
andwin_y
. Returnsnil
if the window tree underdevice
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, seegdk_device_grab()
.Declaration
Swift
@inlinable func getWindowAtPosition(winX: UnsafeMutablePointer<gint>! = nil, winY: UnsafeMutablePointer<gint>! = nil) -> WindowRef!
-
getWindowAtPositionDouble(winX:
Extension methodwinY: ) Obtains the window underneath
device
, returning the location of the device inwin_x
andwin_y
in double precision. Returnsnil
if the window tree underdevice
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, seegdk_device_grab()
.Declaration
Swift
@inlinable func getWindowAtPositionDouble(winX: UnsafeMutablePointer<gdouble>! = nil, winY: UnsafeMutablePointer<gdouble>! = nil) -> WindowRef!
-
grab(window:
Extension methodgrabOwnership: ownerEvents: eventMask: cursor: time_: ) 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
andwindow
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 totrue
.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
-
grab(window:
Extension methodgrabOwnership: ownerEvents: eventMask: cursor: time_: ) 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
andwindow
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 totrue
.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 methodReturns a
GList
ofGdkAtoms
, containing the labels for the axes thatdevice
currently has.Declaration
Swift
@inlinable func listAxes() -> GLib.ListRef!
-
listSlaveDevices()
Extension methodIf the device if of type
GDK_DEVICE_TYPE_MASTER
, it will return the list of slave devices attached to it, otherwise it will returnnil
Declaration
Swift
@inlinable func listSlaveDevices() -> GLib.ListRef!
-
setAxisUse(index_:
Extension methoduse: ) Specifies how an axis of a device is used.
Declaration
Swift
@inlinable func setAxisUse(index_: Int, use: GdkAxisUse)
-
setKey(index_:
Extension methodkeyval: modifiers: ) 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:
Extension methodx: y: ) Warps
device
indisplay
to the pointx
,y
on the screenscreen
, 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
-
grabInfoLibgtkOnly(display:
Extension methodgrabWindow: ownerEvents: ) 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
-
dragBeginForDevice(window:
Extension methodtargets: ) 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
-
dragBeginFromPoint(window:
Extension methodtargets: xRoot: yRoot: ) 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 methodReturns the associated device to
device
, ifdevice
is of typeGDK_DEVICE_TYPE_MASTER
, it will return the paired pointer or keyboard.If
device
is of typeGDK_DEVICE_TYPE_SLAVE
, it will return the master device to whichdevice
is attached to.If
device
is of typeGDK_DEVICE_TYPE_FLOATING
,nil
will be returned, as there is no associated device.Declaration
Swift
@inlinable var associatedDevice: DeviceRef! { get }
-
axes
Extension methodThe axes currently available for this device.
Declaration
Swift
@inlinable var axes: AxisFlags { get }
-
deviceType
Extension methodReturns the device type for
device
.Declaration
Swift
@inlinable var deviceType: GdkDeviceType { get }
-
display
Extension methodThe
GdkDisplay
theGdkDevice
pertains to.Declaration
Swift
@inlinable var display: DisplayRef! { get }
-
hasCursor
Extension methodDetermines 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 methodGets 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 methodDetermines the mode of the device.
Declaration
Swift
@inlinable var mode: GdkInputMode { get nonmutating set }
-
nAxes
Extension methodReturns the number of axes the device currently has.
Declaration
Swift
@inlinable var nAxes: Int { get }
-
nKeys
Extension methodReturns the number of keys the device currently has.
Declaration
Swift
@inlinable var nKeys: Int { get }
-
name
Extension methodThe device name.
Declaration
Swift
@inlinable var name: String! { get }
-
productId
Extension methodReturns 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. Seegdk_device_get_vendor_id()
for more information.Declaration
Swift
@inlinable var productId: String! { get }
-
seat
Extension methodGdkSeat
of this device.Declaration
Swift
@inlinable var seat: SeatRef! { get }
-
source
Extension methodDetermines the type of the device.
Declaration
Swift
@inlinable var source: GdkInputSource { get }
-
vendorId
Extension methodReturns 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. composeGSettings
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 }