EventProtocol
public protocol EventProtocol
The EventProtocol protocol exposes the methods and properties of an underlying GdkEvent 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 Event.
Alternatively, use EventRef as a lighweight, unowned reference if you already have an instance you just want to use.
GdkEvents are immutable data structures, created by GDK to
represent windowing system events.
In GTK applications the events are handled automatically by toplevel
widgets and passed on to the event controllers of appropriate widgets,
so using GdkEvent and its related API is rarely needed.
-
Untyped pointer to the underlying
GdkEventinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
event_ptrDefault implementationTyped pointer to the underlying
GdkEventinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkEventinstance.Declaration
Swift
var event_ptr: UnsafeMutablePointer<GdkEvent>! { get } -
Required Initialiser for types conforming to
EventProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
GetAngle(event2:Extension methodangle: ) Returns the relative angle from
event1toevent2.The relative angle is the angle between the X axis and the line through both events’ positions. The rotation direction for positive angles is from the positive X axis towards the positive Y axis.
This assumes that both events have X/Y information. If not, this function returns
false.Declaration
Swift
@inlinable func GetAngle<EventT>(event2: EventT, angle: UnsafeMutablePointer<CDouble>!) -> Bool where EventT : EventProtocol -
GetCenter(event2:Extension methodx: y: ) Returns the point halfway between the events’ positions.
This assumes that both events have X/Y information. If not, this function returns
false.Declaration
Swift
@inlinable func GetCenter<EventT>(event2: EventT, x: UnsafeMutablePointer<CDouble>!, y: UnsafeMutablePointer<CDouble>!) -> Bool where EventT : EventProtocol -
GetDistance(event2:Extension methoddistance: ) Returns the distance between the event locations.
This assumes that both events have X/Y information. If not, this function returns
false.Declaration
Swift
@inlinable func GetDistance<EventT>(event2: EventT, distance: UnsafeMutablePointer<CDouble>!) -> Bool where EventT : EventProtocol -
get(axes:Extension methodnAxes: ) Extracts all axis values from an event.
Declaration
Swift
@inlinable func get(axes: UnsafeMutablePointer<UnsafeMutablePointer<CDouble>?>!, nAxes: UnsafeMutablePointer<guint>!) -> Bool -
getAxis(axisUse:Extension methodvalue: ) Extract the axis value for a particular axis use from an event structure.
Declaration
Swift
@inlinable func getAxis(axisUse: GdkAxisUse, value: UnsafeMutablePointer<CDouble>!) -> Bool -
getDevice()Extension methodReturns the device of an event.
Declaration
Swift
@inlinable func getDevice() -> DeviceRef! -
getDeviceTool()Extension methodReturns a
GdkDeviceToolrepresenting the tool that caused the event.If the was not generated by a device that supports different tools (such as a tablet), this function will return
nil.Note: the
GdkDeviceToolwill be constant during the application lifetime, if settings must be stored persistently across runs, see [methodGdk.DeviceTool.get_serial].Declaration
Swift
@inlinable func getDeviceTool() -> DeviceToolRef! -
getDisplay()Extension methodRetrieves the display associated to the
event.Declaration
Swift
@inlinable func getDisplay() -> DisplayRef! -
getEventSequence()Extension methodRetuns the event sequence to which the event belongs.
Related touch events are connected in a sequence. Other events typically don’t have event sequence information.
Declaration
Swift
@inlinable func getEventSequence() -> EventSequenceRef! -
getEventType()Extension methodRetrieves the type of the event.
Declaration
Swift
@inlinable func getEventType() -> GdkEventType -
getHistory(outNCoords:Extension method) Retrieves the history of the device that
eventis for, as a list of time and coordinates.The history includes positions that are not delivered as separate events to the application because they occurred in the same frame as
event.Note that only motion and scroll events record history, and motion events do it only if one of the mouse buttons is down.
Declaration
Swift
@inlinable func getHistory(outNCoords: UnsafeMutablePointer<guint>!) -> UnsafeMutablePointer<GdkTimeCoord>! -
getModifierState()Extension methodReturns the modifier state field of an event.
Declaration
Swift
@inlinable func getModifierState() -> ModifierType -
getPointerEmulated()Extension methodReturns whether this event is an ‘emulated’ pointer event.
Emulated pointer events typically originate from a touch events.
Declaration
Swift
@inlinable func getPointerEmulated() -> Bool -
getPosition(x:Extension methody: ) Extract the event surface relative x/y coordinates from an event.
Declaration
Swift
@inlinable func getPosition(x: UnsafeMutablePointer<CDouble>!, y: UnsafeMutablePointer<CDouble>!) -> Bool -
getSeat()Extension methodReturns the seat that originated the event.
Declaration
Swift
@inlinable func getSeat() -> SeatRef! -
getSurface()Extension methodExtracts the surface associated with an event.
Declaration
Swift
@inlinable func getSurface() -> SurfaceRef! -
getTime()Extension methodReturns the timestamp of
event.Not all events have timestamps. In that case, this function returns
GDK_CURRENT_TIME.Declaration
Swift
@inlinable func getTime() -> guint32 -
ref()Extension methodIncrease the ref count of
event.Declaration
Swift
@discardableResult @inlinable func ref() -> EventRef! -
triggersContextMenu()Extension methodReturns whether a
GdkEventshould trigger a context menu, according to platform conventions.The right mouse button typically triggers context menus.
This function should always be used instead of simply checking for event->button ==
GDK_BUTTON_SECONDARY.Declaration
Swift
@inlinable func triggersContextMenu() -> Bool -
unref()Extension methodDecrease the ref count of
event.If the last reference is dropped, the structure is freed.
Declaration
Swift
@inlinable func unref() -
eventsGetAngle(event2:Extension methodangle: ) Returns the relative angle from
event1toevent2.The relative angle is the angle between the X axis and the line through both events’ positions. The rotation direction for positive angles is from the positive X axis towards the positive Y axis.
This assumes that both events have X/Y information. If not, this function returns
false.Declaration
Swift
@inlinable func eventsGetAngle<EventT>(event2: EventT, angle: UnsafeMutablePointer<CDouble>!) -> Bool where EventT : EventProtocol -
eventsGetCenter(event2:Extension methodx: y: ) Returns the point halfway between the events’ positions.
This assumes that both events have X/Y information. If not, this function returns
false.Declaration
Swift
@inlinable func eventsGetCenter<EventT>(event2: EventT, x: UnsafeMutablePointer<CDouble>!, y: UnsafeMutablePointer<CDouble>!) -> Bool where EventT : EventProtocol -
eventsGetDistance(event2:Extension methoddistance: ) Returns the distance between the event locations.
This assumes that both events have X/Y information. If not, this function returns
false.Declaration
Swift
@inlinable func eventsGetDistance<EventT>(event2: EventT, distance: UnsafeMutablePointer<CDouble>!) -> Bool where EventT : EventProtocol -
deviceExtension methodReturns the device of an event.
Declaration
Swift
@inlinable var device: DeviceRef! { get } -
deviceToolExtension methodReturns a
GdkDeviceToolrepresenting the tool that caused the event.If the was not generated by a device that supports different tools (such as a tablet), this function will return
nil.Note: the
GdkDeviceToolwill be constant during the application lifetime, if settings must be stored persistently across runs, see [methodGdk.DeviceTool.get_serial].Declaration
Swift
@inlinable var deviceTool: DeviceToolRef! { get } -
displayExtension methodRetrieves the display associated to the
event.Declaration
Swift
@inlinable var display: DisplayRef! { get } -
eventSequenceExtension methodRetuns the event sequence to which the event belongs.
Related touch events are connected in a sequence. Other events typically don’t have event sequence information.
Declaration
Swift
@inlinable var eventSequence: EventSequenceRef! { get } -
eventTypeExtension methodRetrieves the type of the event.
Declaration
Swift
@inlinable var eventType: GdkEventType { get } -
modifierStateExtension methodReturns the modifier state field of an event.
Declaration
Swift
@inlinable var modifierState: ModifierType { get } -
pointerEmulatedExtension methodReturns whether this event is an ‘emulated’ pointer event.
Emulated pointer events typically originate from a touch events.
Declaration
Swift
@inlinable var pointerEmulated: Bool { get } -
seatExtension methodReturns the seat that originated the event.
Declaration
Swift
@inlinable var seat: SeatRef! { get } -
surfaceExtension methodExtracts the surface associated with an event.
Declaration
Swift
@inlinable var surface: SurfaceRef! { get } -
timeExtension methodReturns the timestamp of
event.Not all events have timestamps. In that case, this function returns
GDK_CURRENT_TIME.Declaration
Swift
@inlinable var time: guint32 { get }
View on GitHub
Install in Dash
EventProtocol Protocol Reference