Closed lschmierer closed 4 years ago
Swift doesn't support C-style unions such as GdkEvent
, so there is no corresponding Swift wrapper with more idiomatic properties at the moment. I'll have a think if there is a way to teach gir2swift
some magic to work around this ...
With SwiftGtk 3.24.17 and gir2swift 10, you can now access GdkEvent
fields directly from Swift. Also, you probably want to use onKey
or onKeyPress
instead of connectKey
, e.g.:
widget.onKeyPress { widget, event in
let key = event.keyval
let hw = event.hardwareKeycode
// ...
}
canvas.onKey(event: .keyPressEvent) { widget, event in
let key = event.keyval
let hw = event.hardwareKeycode
// ...
}
How can I access event struct fields without accessing
_ptr
?