Skip to content

Commit 12198f7

Browse files
committed
Trying GdkModifierType instead of UInt
1 parent f7750d7 commit 12198f7

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

Sources/Gtk/Generated/EventControllerKey.swift

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,42 @@ open class EventControllerKey: EventController {
1818
}
1919

2020
let handler1:
21-
@convention(c) (UnsafeMutableRawPointer, UInt, UInt, UInt, UnsafeMutableRawPointer) ->
22-
Void =
21+
@convention(c) (
22+
UnsafeMutableRawPointer, UInt, UInt, GdkModifierType, UnsafeMutableRawPointer
23+
) -> Void =
2324
{ _, value1, value2, value3, data in
24-
SignalBox3<UInt, UInt, UInt>.run(data, value1, value2, value3)
25+
SignalBox3<UInt, UInt, GdkModifierType>.run(data, value1, value2, value3)
2526
}
2627

2728
addSignal(name: "key-pressed", handler: gCallback(handler1)) {
28-
[weak self] (param0: UInt, param1: UInt, param2: UInt) in
29+
[weak self] (param0: UInt, param1: UInt, param2: GdkModifierType) in
2930
guard let self = self else { return }
3031
self.keyPressed?(self, param0, param1, param2)
3132
}
3233

3334
let handler2:
34-
@convention(c) (UnsafeMutableRawPointer, UInt, UInt, UInt, UnsafeMutableRawPointer) ->
35-
Void =
35+
@convention(c) (
36+
UnsafeMutableRawPointer, UInt, UInt, GdkModifierType, UnsafeMutableRawPointer
37+
) -> Void =
3638
{ _, value1, value2, value3, data in
37-
SignalBox3<UInt, UInt, UInt>.run(data, value1, value2, value3)
39+
SignalBox3<UInt, UInt, GdkModifierType>.run(data, value1, value2, value3)
3840
}
3941

4042
addSignal(name: "key-released", handler: gCallback(handler2)) {
41-
[weak self] (param0: UInt, param1: UInt, param2: UInt) in
43+
[weak self] (param0: UInt, param1: UInt, param2: GdkModifierType) in
4244
guard let self = self else { return }
4345
self.keyReleased?(self, param0, param1, param2)
4446
}
4547

4648
let handler3:
47-
@convention(c) (UnsafeMutableRawPointer, UInt, UnsafeMutableRawPointer) -> Void =
49+
@convention(c) (UnsafeMutableRawPointer, GdkModifierType, UnsafeMutableRawPointer) ->
50+
Void =
4851
{ _, value1, data in
49-
SignalBox1<UInt>.run(data, value1)
52+
SignalBox1<GdkModifierType>.run(data, value1)
5053
}
5154

52-
addSignal(name: "modifiers", handler: gCallback(handler3)) { [weak self] (param0: UInt) in
55+
addSignal(name: "modifiers", handler: gCallback(handler3)) {
56+
[weak self] (param0: GdkModifierType) in
5357
guard let self = self else { return }
5458
self.modifiers?(self, param0)
5559
}
@@ -63,11 +67,11 @@ open class EventControllerKey: EventController {
6367
public var imUpdate: ((EventControllerKey) -> Void)?
6468

6569
/// Emitted whenever a key is pressed.
66-
public var keyPressed: ((EventControllerKey, UInt, UInt, UInt) -> Void)?
70+
public var keyPressed: ((EventControllerKey, UInt, UInt, GdkModifierType) -> Void)?
6771

6872
/// Emitted whenever a key is released.
69-
public var keyReleased: ((EventControllerKey, UInt, UInt, UInt) -> Void)?
73+
public var keyReleased: ((EventControllerKey, UInt, UInt, GdkModifierType) -> Void)?
7074

7175
/// Emitted whenever the state of modifier keys and pointer buttons change.
72-
public var modifiers: ((EventControllerKey, UInt) -> Void)?
76+
public var modifiers: ((EventControllerKey, GdkModifierType) -> Void)?
7377
}

Sources/Gtk/Widgets/Window.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ open class Window: Widget {
9191

9292
public func setEscapeKeyPressedHandler(to handler: (() -> Void)?) {
9393
escapeKeyPressed = handler
94-
94+
9595
guard escapeKeyEventController == nil else { return }
96-
96+
9797
let keyEventController = EventControllerKey()
9898
keyEventController.keyPressed = { [weak self] _, keyval, _, _ in
9999
guard keyval == GDK_KEY_Escape else { return }

Sources/GtkCodeGen/GtkCodeGen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct GtkCodeGen {
6868
"Gdk.GLContext": "OpaquePointer",
6969
"Gdk.Paintable": "OpaquePointer",
7070
"Gdk.Clipboard": "OpaquePointer",
71-
"Gdk.ModifierType": "UInt",
71+
"Gdk.ModifierType": "GdkModifierType",
7272
]
7373

7474
static let interfaces: [String] = [

0 commit comments

Comments
 (0)