-
-
Notifications
You must be signed in to change notification settings - Fork 58
Bring back the terminal backend to life. #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,7 @@ let package = Package( | |
.library(name: "Gtk", type: libraryType, targets: ["Gtk"]), | ||
.library(name: "Gtk3", type: libraryType, targets: ["Gtk3"]), | ||
.executable(name: "GtkExample", targets: ["GtkExample"]), | ||
// .library(name: "CursesBackend", type: libraryType, targets: ["CursesBackend"]), | ||
.library(name: "TermKitBackend", type: libraryType, targets: ["TermKitBackend"]), | ||
// .library(name: "QtBackend", type: libraryType, targets: ["QtBackend"]), | ||
// .library(name: "LVGLBackend", type: libraryType, targets: ["LVGLBackend"]), | ||
], | ||
|
@@ -110,10 +110,10 @@ let package = Package( | |
url: "https://github.com/stackotter/swift-winui", | ||
branch: "927e2c46430cfb1b6c195590b9e65a30a8fd98a2" | ||
), | ||
// .package( | ||
// url: "https://github.com/stackotter/TermKit", | ||
// revision: "163afa64f1257a0c026cc83ed8bc47a5f8fc9704" | ||
// ), | ||
.package( | ||
url: "https://github.com/migueldeicaza/TermKit", | ||
revision: "6b82436223a739af53b19045784b4bbc3f92505f" | ||
), | ||
// .package( | ||
// url: "https://github.com/PADL/LVGLSwift", | ||
// revision: "19c19a942153b50d61486faf1d0d45daf79e7be5" | ||
|
@@ -252,10 +252,10 @@ let package = Package( | |
name: "WinUIInterop", | ||
dependencies: [] | ||
), | ||
// .target( | ||
// name: "CursesBackend", | ||
// dependencies: ["SwiftCrossUI", "TermKit"] | ||
// ), | ||
.target( | ||
name: "TermKitBackend", | ||
dependencies: ["SwiftCrossUI", .product(name: "TermKit", package: "TermKit")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
), | ||
// .target( | ||
// name: "QtBackend", | ||
// dependencies: ["SwiftCrossUI", .product(name: "Qlift", package: "qlift")] | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,9 @@ public protocol AppBackend: Sendable { | |
/// The default amount of padding used when a user uses the ``View/padding(_:_:)`` | ||
/// modifier. | ||
var defaultPaddingAmount: Int { get } | ||
/// The default amount of spacing used when a user uses the ``HStack`` or ``VStack`` | ||
/// classes | ||
var defaultStackSpacingAmount: Int { get } | ||
/// Gets the layout width of a backend's scroll bars. Assumes that the width | ||
/// is the same for both vertical and horizontal scroll bars (where the width | ||
/// of a horizontal scroll bar is what pedants may call its height). If the | ||
|
@@ -693,6 +696,8 @@ public protocol AppBackend: Sendable { | |
) | ||
/// Navigates a web view to a given URL. | ||
func navigateWebView(_ webView: Widget, to url: URL) | ||
|
||
func limitScreenBounds(_ bounds: SIMD2<Int>) -> SIMD2<Int> | ||
} | ||
|
||
extension AppBackend { | ||
|
@@ -709,6 +714,7 @@ extension AppBackend { | |
} | ||
|
||
extension AppBackend { | ||
public var defaultStackSpacingAmount: Int { 10 } | ||
/// Used by placeholder implementations of backend methods. | ||
private func todo(_ function: String = #function) -> Never { | ||
print("\(type(of: self)): \(function) not implemented") | ||
|
@@ -1139,4 +1145,8 @@ extension AppBackend { | |
) { | ||
todo() | ||
} | ||
|
||
public func limitScreenBounds(_ bounds: SIMD2<Int>) -> SIMD2<Int> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like this should be reworked to |
||
return bounds | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,8 +88,8 @@ public final class WindowGroupNode<Content: View>: SceneGraphNode { | |
_ = update( | ||
newScene, | ||
proposedWindowSize: isFirstUpdate && isProgramaticallyResizable | ||
? (newScene ?? scene).defaultSize | ||
: backend.size(ofWindow: window), | ||
? backend.limitScreenBounds((newScene ?? scene).defaultSize) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indent these two hanging lines |
||
: backend.limitScreenBounds(backend.size(ofWindow: window)), | ||
backend: backend, | ||
environment: environment, | ||
windowSizeIsFinal: !isProgramaticallyResizable | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation (and for the TermKit package above and TermKitBackend product above that)