Skip to content

Commit 6dd411c

Browse files
committed
Add parameter to Gtk3 and WinUI, and remove extraneous override in UIKit
Gtk3 and WinUI still only actually support .primary, but at least now they'll compile.
1 parent a99d9dd commit 6dd411c

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Sources/Gtk3Backend/Gtk3Backend.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,10 @@ public final class Gtk3Backend: AppBackend {
934934
gtk_native_dialog_show(chooser.gobjectPointer.cast())
935935
}
936936

937-
public func createTapGestureTarget(wrapping child: Widget) -> Widget {
937+
public func createTapGestureTarget(wrapping child: Widget, gesture: TapGesture) -> Widget {
938+
if gesture != .primary {
939+
fatalError("Unsupported gesture type \(gesture)")
940+
}
938941
let eventBox = Gtk3.EventBox()
939942
eventBox.setChild(to: child)
940943
eventBox.aboveChild = true
@@ -943,8 +946,12 @@ public final class Gtk3Backend: AppBackend {
943946

944947
public func updateTapGestureTarget(
945948
_ tapGestureTarget: Widget,
949+
gesture: TapGesture,
946950
action: @escaping () -> Void
947951
) {
952+
if gesture != .primary {
953+
fatalError("Unsupported gesture type \(gesture)")
954+
}
948955
tapGestureTarget.onButtonPress = { _, buttonEvent in
949956
let eventType = buttonEvent.type
950957
guard

Sources/UIKitBackend/UIKitBackend+Control.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ final class TappableWidget: ContainerWidget {
129129
}
130130
}
131131

132-
override init(child: some WidgetProtocol) {
133-
super.init(child: child)
134-
}
135-
136132
@objc
137133
func viewTouched() {
138134
onTap?()

Sources/WinUIBackend/WinUIBackend.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,10 @@ public final class WinUIBackend: AppBackend {
10141014
// ) {
10151015
// }
10161016

1017-
public func createTapGestureTarget(wrapping child: Widget) -> Widget {
1017+
public func createTapGestureTarget(wrapping child: Widget, gesture: TapGesture) -> Widget {
1018+
if gesture != .primary {
1019+
fatalError("Unsupported gesture type \(gesture)")
1020+
}
10181021
let tapGestureTarget = TapGestureTarget()
10191022
addChild(child, to: tapGestureTarget)
10201023
tapGestureTarget.child = child
@@ -1037,8 +1040,12 @@ public final class WinUIBackend: AppBackend {
10371040

10381041
public func updateTapGestureTarget(
10391042
_ tapGestureTarget: Widget,
1043+
gesture: TapGesture,
10401044
action: @escaping () -> Void
10411045
) {
1046+
if gesture != .primary {
1047+
fatalError("Unsupported gesture type \(gesture)")
1048+
}
10421049
let tapGestureTarget = tapGestureTarget as! TapGestureTarget
10431050
tapGestureTarget.clickHandler = action
10441051
tapGestureTarget.width = tapGestureTarget.child!.width

0 commit comments

Comments
 (0)