From 69fa38992b5f7ab6674a5e6c88dcc1d7f9480416 Mon Sep 17 00:00:00 2001 From: Rene Hexel Date: Sat, 30 Apr 2022 21:53:43 +1000 Subject: [PATCH 1/4] Add regression test for enum constant --- Tests/GtkTests/GtkTests.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tests/GtkTests/GtkTests.swift b/Tests/GtkTests/GtkTests.swift index ef175132..95c40204 100644 --- a/Tests/GtkTests/GtkTests.swift +++ b/Tests/GtkTests/GtkTests.swift @@ -91,6 +91,13 @@ class GtkTests: XCTestCase { XCTAssertEqual(window2.allocatedHeight, 1) } + /// test selection mode + func testSelectionMode() { + let list = ListBox() + list.selectionMode = .none + XCTAssertEqual(list.selectionMode.rawValue, 0) + } + /// text text buffers func testTextBuffer() { guard let buffer = TextBuffer() else { XCTFail() ; return } From 5e00aa2a4493c8b478ca0ea1940d9cf104d812dc Mon Sep 17 00:00:00 2001 From: Rene Hexel Date: Mon, 2 May 2022 14:39:40 +1000 Subject: [PATCH 2/4] Remove Fedora version number --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 310caf7a..b3cb0c8c 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Ubuntu 18.04 also requires you to install `libcogl-gles2-dev`. ##### Fedora -On Fedora 29, you can use the gtk that comes with the distribution. Just install with the `dnf` package manager: +On Fedora, you can use the gtk that comes with the distribution. Just install with the `dnf` package manager: sudo dnf install gtk3-devel pango-devel cairo-devel cairo-gobject-devel glib2-devel gobject-introspection-devel libxml2-devel jq From 3df1c1ffab1dc0a0ec850cb530e0ea81e3275b5f Mon Sep 17 00:00:00 2001 From: Rene Hexel Date: Sun, 23 Jul 2023 14:26:41 +1000 Subject: [PATCH 3/4] Build with typed collections. --- Gtk-3.0.sed | 8 ++++++++ Sources/Gtk/GtkTypeAliases.swift | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Gtk-3.0.sed b/Gtk-3.0.sed index 48ad363a..1b73ab25 100644 --- a/Gtk-3.0.sed +++ b/Gtk-3.0.sed @@ -193,3 +193,11 @@ s|getSearch(path: UnsafeMutablePointer|getSearch(pat s|setSearch(path: UnsafeMutablePointer|setSearch(path: UnsafeMutablePointer?>| s|rv = Gdk\(ModifierType(.*)\)|rv = Gdk.\1| s|rv = Gdk\(EventMask(.*)\)|rv = Gdk.\1| +s/var metatypeReferenceForApplication:/var metatypeReferenceForGtkApplication:/ +s/var metatypeForApplication:/var metatypeForGtkApplication:/ +s/var wrapperForApplication:/var wrapperForGtkApplication:/ +s/var metatypeReferenceForMountOperation:/var metatypeReferenceForGtkMountOperation:/ +s/var metatypeForMountOperation:/var metatypeForGtkMountOperation:/ +s/var wrapperForMountOperation:/var wrapperForGtkMountOperation:/ +s/GLib.RefSListRef/GLib.RefSListRef/ +s/free(UnsafeMutableRawPointer/systemFree(UnsafeMutableRawPointer/ diff --git a/Sources/Gtk/GtkTypeAliases.swift b/Sources/Gtk/GtkTypeAliases.swift index 45b5a011..f21f0ab5 100644 --- a/Sources/Gtk/GtkTypeAliases.swift +++ b/Sources/Gtk/GtkTypeAliases.swift @@ -1,5 +1,18 @@ import CGtk +/// Free the memory allocated for the given pointer. +/// +/// This function calles the `free()` function provided +/// by the system. +/// +/// - Note: The only reason this function exists is to avoid collisions with gtk object`free()` methods. +/// +/// - Parameter ptr: The pointer to free. +@usableFromInline +func systemFree(_ ptr: UnsafeMutableRawPointer?) { + free(ptr) +} + // Private structs not exported but needed for public pointers public typealias GtkArrowAccessiblePrivate = _GtkArrowAccessiblePrivate public typealias GtkBooleanCellAccessiblePrivate = _GtkBooleanCellAccessiblePrivate From 71e256b25cf9d522bd5852219dd673aec2a08760 Mon Sep 17 00:00:00 2001 From: Rene Hexel Date: Sat, 29 Jul 2023 17:57:40 +1000 Subject: [PATCH 4/4] Update for Swift-5.8 and glib-2.76 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b3cb0c8c..15a2b7a0 100644 --- a/README.md +++ b/README.md @@ -93,18 +93,18 @@ After that, use the (usual) Build and Test buttons to build/test this package. To build, download Swift from https://swift.org/download/ -- if you are using macOS, make sure you have the command line tools installed as well). Test that your compiler works using `swift --version`, which should give you something like $ swift --version - swift-driver version: 1.45.2 Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8) - Target: x86_64-apple-darwin20.3.0 + swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100) + Target: arm64-apple-macosx13.0 on macOS, or on Linux you should get something like: $ swift --version - Swift version 5.6.1 (swift-5.6.1-RELEASE) + Swift version 5.8.1 (swift-5.8.1-RELEASE) Target: x86_64-unknown-linux-gnu ### Gtk 3.22 or higher -The Swift wrappers have been tested with glib-2.56, 2.58, 2.60, 2.62, 2.64, 2.66, 2.68, 2.70 and 2.72, and gdk/gtk 3.22, 3.24 as well as 4.0, 4.2, 4.4, and 4.6 on the `gtk4` branch. They should work with higher versions, but YMMV. Also make sure you have `gobject-introspection` and its `.gir` files installed. +The Swift wrappers have been tested with glib-2.56, 2.58, 2.60, 2.62, 2.64, 2.66, 2.68, 2.70, 2.72, 2.74, and 2.74, and gdk/gtk 3.22, 3.24 as well as 4.0, 4.2, 4.4, and 4.6 on the `gtk4` branch. They should work with higher versions, but YMMV. Also make sure you have `gobject-introspection` and its `.gir` files installed. #### Linux