diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9ab9ff16aa48..5656212027ae 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,6 +6,7 @@ on: - ".github/workflows/CI.yml" - "examples/**" - "gdk4/**" + - "gdk4-macos/**" - "gdk4-wayland/**" - "gdk4-win32/**" - "gdk4-x11/**" @@ -17,6 +18,7 @@ on: - ".github/workflows/CI.yml" - "examples/**" - "gdk4/**" + - "gdk4-macos/**" - "gdk4-wayland/**" - "gdk4-win32/**" - "gdk4-x11/**" @@ -166,6 +168,7 @@ jobs: - { name: "gtk4", is_macros_crate: false } - { name: "gdk4", is_macros_crate: false } - { name: "gsk4", is_macros_crate: false } + - { name: "gdk4-macos", is_macros_crate: false } - { name: "gdk4-x11", is_macros_crate: false } - { name: "gdk4-wayland", is_macros_crate: false } - { name: "gdk4-win32", is_macros_crate: false } diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f9acadcffb13..cf99c13378ed 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,6 +6,7 @@ on: paths: - ".github/workflows/docs.yml" - "gdk4/**" + - "gdk4-macos/**" - "gdk4-wayland/**" - "gdk4-win32/**" - "gdk4-x11/**" @@ -17,6 +18,7 @@ on: paths: - ".github/workflows/docs.yml" - "gdk4/**" + - "gdk4-macos/**" - "gdk4-wayland/**" - "gdk4-win32/**" - "gdk4-x11/**" @@ -83,6 +85,7 @@ jobs: -p gdk4-x11 -p gdk4-x11-sys -p gsk4 -p gsk4-sys -p gtk4 -p gtk4-sys + -p gdk4-macos -p gdk4-macos-sys -p gtk4-macros --all-features --no-deps diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 47e0b03ee6d6..24df45178677 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -6,6 +6,7 @@ on: paths: - ".github/workflows/macos.yml" - "gdk4/**" + - "gdk4-macos/**" - "gsk4/**" - "gtk4/**" - "gtk4-macros/**" @@ -13,6 +14,7 @@ on: paths: - ".github/workflows/macos.yml" - "gdk4/**" + - "gdk4-macos/**" - "gsk4/**" - "gtk4/**" - "gtk4-macros/**" @@ -52,3 +54,19 @@ jobs: # with: # command: test # args: --features v4_8,xml_validation + + - name: Build gdk4-macos + uses: actions-rs/cargo@v1 + with: + command: build + args: --features v4_8 --manifest-path ./gdk4-macos/Cargo.toml + - name: Clippy gdk4-macos + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --features v4_8 --manifest-path ./gdk4-macos/Cargo.toml + - name: Tests gdk4-macos + uses: actions-rs/cargo@v1 + with: + command: test + args: --features v4_8 --manifest-path ./gdk4-macos/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index bf0bfdb9df64..15cb5bfe4d1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -435,6 +435,30 @@ dependencies = [ "pango", ] +[[package]] +name = "gdk4-macos" +version = "0.10.0" +dependencies = [ + "gdk4", + "gdk4-macos-sys", + "gio", + "gir-format-check", + "glib", + "libc", +] + +[[package]] +name = "gdk4-macos-sys" +version = "0.10.0" +dependencies = [ + "gdk4-sys", + "glib-sys", + "libc", + "shell-words", + "system-deps", + "tempfile", +] + [[package]] name = "gdk4-sys" version = "0.10.0" diff --git a/Cargo.toml b/Cargo.toml index 5d1e01845e08..5249b5f1e0c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,8 @@ members = [ "gdk4-wayland/sys", "gdk4-win32", "gdk4-win32/sys", + "gdk4-macos", + "gdk4-macos/sys", "gsk4", "gsk4/sys", "gtk4", @@ -58,6 +60,7 @@ libc = "0.2" pango-sys = {git = "https://github.com/gtk-rs/gtk-rs-core", version = "0.21", branch = "main", features = ["v1_46"]} pango = {git = "https://github.com/gtk-rs/gtk-rs-core", version = "0.21", branch = "main", features = ["v1_46"]} gir-format-check = "^0.1" +gdk4-macos-sys = {path = "gdk4-macos/sys", version = "0.10"} gdk4-x11-sys = {path = "gdk4-x11/sys", version = "0.10"} gdk4-wayland-sys = {path = "gdk4-wayland/sys", version = "0.10"} gdk4-win32-sys = {path = "gdk4-win32/sys", version = "0.10"} diff --git a/README.md b/README.md index 1f735e22faa6..a0fdc82f6c07 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ A group of crates that aims to provide complete [GTK](https://gtk.org/) 4 bindin - [GTK](./gtk4) - [GDK](./gdk4): An intermediate layer which isolates GTK from the details of the windowing system. + - [GDK Macos](./gdk4-macos): Macos backend specific functions. - [GDK Wayland](./gdk4-wayland): Wayland backend specific functions. - [GDK Win32](./gdk4-win32): Windows backend specific functions. - [GDK X11](./gdk4-x11): X backend specific functions. diff --git a/gdk4-macos/COPYRIGHT b/gdk4-macos/COPYRIGHT new file mode 120000 index 000000000000..dc5f40a221a3 --- /dev/null +++ b/gdk4-macos/COPYRIGHT @@ -0,0 +1 @@ +../COPYRIGHT \ No newline at end of file diff --git a/gdk4-macos/Cargo.toml b/gdk4-macos/Cargo.toml new file mode 100644 index 000000000000..6c6824625630 --- /dev/null +++ b/gdk4-macos/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "gdk4-macos" +description = "Rust bindings of the GDK4 macos library" +documentation = "https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4_macos/" +keywords = ["gdk4", "gdk4-macos", "gtk-rs", "gnome", "GUI"] +readme = "README.md" +authors.workspace = true +categories.workspace = true +edition.workspace = true +homepage.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true + +[features] +v4_8 = ["gdk4-macos-sys/v4_8"] + +[dependencies] +gdk4-macos-sys.workspace = true +gdk.workspace = true +gio.workspace = true +glib.workspace = true +libc.workspace = true + +[dev-dependencies] +gir-format-check.workspace = true + +[package.metadata.docs.rs] +all-features = true +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] diff --git a/gdk4-macos/Gir.toml b/gdk4-macos/Gir.toml new file mode 100644 index 000000000000..1deea6c27fb7 --- /dev/null +++ b/gdk4-macos/Gir.toml @@ -0,0 +1,39 @@ +[options] +girs_directories = ["../gir-files"] +library = "GdkMacos" +version = "4.0" +min_cfg_version = "4.0.0" +target_path = "." +work_mode = "normal" +use_gi_docgen = true +single_version_file = true +generate_safety_asserts = true +deprecate_by_min_version = true +trust_return_value_nullability = true + +generate = [ + "GdkMacos.MacosDevice", + "GdkMacos.MacosDisplay", + "GdkMacos.MacosGLContext", + "GdkMacos.MacosKeymap", + "GdkMacos.MacosSeat", + "GdkMacos.MacosSurface", +] + +manual = [ + "Gdk.Device", + "Gdk.Display", + "Gdk.DrawContext", + "Gdk.GLContext", + "Gdk.Monitor", + "Gdk.Rectangle", + "Gdk.Seat", + "Gdk.Surface", +] + +[[object]] +name = "GdkMacos.MacosMonitor" +status = "generate" + [[object.function]] + name = "get_geometry" + ignore = true # The function does not exists \ No newline at end of file diff --git a/gdk4-macos/LICENSE b/gdk4-macos/LICENSE new file mode 120000 index 000000000000..ea5b60640b01 --- /dev/null +++ b/gdk4-macos/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/gdk4-macos/README.md b/gdk4-macos/README.md new file mode 100644 index 000000000000..ed78d169e6a1 --- /dev/null +++ b/gdk4-macos/README.md @@ -0,0 +1,58 @@ +# Rust GDK 4 Macos bindings + +The project website is [here](https://gtk-rs.org/). + +Rust bindings of GDK 4's Macos backend, +part of [gtk4-rs](https://github.com/gtk-rs/gtk4-rs/). + +GDK is an intermediate layer that isolates GTK from the details of the windowing system. +GDK Macos contains functions specific to the Macos backend. + +## Minimum supported Rust version + +Currently, the minimum supported Rust version is `1.80`. + +## Documentation + +- The Rust API [Stable](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4_macos)/[Development](https://gtk-rs.org/gtk4-rs/git/docs/gdk4_macos/) +- [The C API](https://docs.gtk.org/gdk4-macos/) +- [GTK Installation instructions](https://www.gtk.org/docs/installations/) + +## Using + +We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs), +as [demonstrated here](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/index.html#library-versions). + +If you want to track the bleeding edge, use the git dependency instead: + +```toml +[dependencies] +gdk-wayland = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4-wayland" } +``` + +Avoid mixing versioned and git crates like this: + +```toml +# This will not compile +[dependencies] +gdk-macos = {version = "0.1", package = "gdk4-macos"} +gdk-wayland = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4-wayland" } +``` + +### Features + +| Feature | Description | +| --- | ----------- | +| `v4_8` | Enable the new APIs part of GTK 4.8 | + +### See Also + +- [glib](https://crates.io/crates/glib) +- [gio](https://crates.io/crates/gio) +- [gsk4](https://crates.io/crates/gsk4) +- [gdk4](https://crates.io/crates/gdk4) +- [gtk4](https://crates.io/crates/gtk4) + +## License + +The Rust bindings of __gdk4-macos__ are available under the MIT License, please refer to it. diff --git a/gdk4-macos/src/auto/macos_device.rs b/gdk4-macos/src/auto/macos_device.rs new file mode 100644 index 000000000000..c3134ffd0f11 --- /dev/null +++ b/gdk4-macos/src/auto/macos_device.rs @@ -0,0 +1,16 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::ffi; + +glib::wrapper! { + #[doc(alias = "GdkMacosDevice")] + pub struct MacosDevice(Object) @extends gdk::Device; + + match fn { + type_ => || ffi::gdk_macos_device_get_type(), + } +} + +impl MacosDevice {} diff --git a/gdk4-macos/src/auto/macos_display.rs b/gdk4-macos/src/auto/macos_display.rs new file mode 100644 index 000000000000..14b1cc78bff9 --- /dev/null +++ b/gdk4-macos/src/auto/macos_display.rs @@ -0,0 +1,16 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::ffi; + +glib::wrapper! { + #[doc(alias = "GdkMacosDisplay")] + pub struct MacosDisplay(Object) @extends gdk::Display; + + match fn { + type_ => || ffi::gdk_macos_display_get_type(), + } +} + +impl MacosDisplay {} diff --git a/gdk4-macos/src/auto/macos_gl_context.rs b/gdk4-macos/src/auto/macos_gl_context.rs new file mode 100644 index 000000000000..02c418cde55c --- /dev/null +++ b/gdk4-macos/src/auto/macos_gl_context.rs @@ -0,0 +1,16 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::ffi; + +glib::wrapper! { + #[doc(alias = "GdkMacosGLContext")] + pub struct MacosGLContext(Object) @extends gdk::GLContext, gdk::DrawContext; + + match fn { + type_ => || ffi::gdk_macos_gl_context_get_type(), + } +} + +impl MacosGLContext {} diff --git a/gdk4-macos/src/auto/macos_keymap.rs b/gdk4-macos/src/auto/macos_keymap.rs new file mode 100644 index 000000000000..1f73318e06e1 --- /dev/null +++ b/gdk4-macos/src/auto/macos_keymap.rs @@ -0,0 +1,16 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::ffi; + +glib::wrapper! { + #[doc(alias = "GdkMacosKeymap")] + pub struct MacosKeymap(Object); + + match fn { + type_ => || ffi::gdk_macos_keymap_get_type(), + } +} + +impl MacosKeymap {} diff --git a/gdk4-macos/src/auto/macos_monitor.rs b/gdk4-macos/src/auto/macos_monitor.rs new file mode 100644 index 000000000000..f5c37a7c7199 --- /dev/null +++ b/gdk4-macos/src/auto/macos_monitor.rs @@ -0,0 +1,31 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::ffi; +use glib::{prelude::*, translate::*}; + +glib::wrapper! { + #[doc(alias = "GdkMacosMonitor")] + pub struct MacosMonitor(Object) @extends gdk::Monitor; + + match fn { + type_ => || ffi::gdk_macos_monitor_get_type(), + } +} + +impl MacosMonitor { + #[doc(alias = "gdk_macos_monitor_get_workarea")] + #[doc(alias = "get_workarea")] + pub fn workarea(monitor: &impl IsA) -> gdk::Rectangle { + assert_initialized_main_thread!(); + unsafe { + let mut geometry = gdk::Rectangle::uninitialized(); + ffi::gdk_macos_monitor_get_workarea( + monitor.as_ref().to_glib_none().0, + geometry.to_glib_none_mut().0, + ); + geometry + } + } +} diff --git a/gdk4-macos/src/auto/macos_seat.rs b/gdk4-macos/src/auto/macos_seat.rs new file mode 100644 index 000000000000..c85a1f761d92 --- /dev/null +++ b/gdk4-macos/src/auto/macos_seat.rs @@ -0,0 +1,16 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::ffi; + +glib::wrapper! { + #[doc(alias = "GdkMacosSeat")] + pub struct MacosSeat(Object) @extends gdk::Seat; + + match fn { + type_ => || ffi::gdk_macos_seat_get_type(), + } +} + +impl MacosSeat {} diff --git a/gdk4-macos/src/auto/macos_surface.rs b/gdk4-macos/src/auto/macos_surface.rs new file mode 100644 index 000000000000..8dc628bd49ec --- /dev/null +++ b/gdk4-macos/src/auto/macos_surface.rs @@ -0,0 +1,57 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::ffi; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::boxed::Box as Box_; + +glib::wrapper! { + #[doc(alias = "GdkMacosSurface")] + pub struct MacosSurface(Object) @extends gdk::Surface; + + match fn { + type_ => || ffi::gdk_macos_surface_get_type(), + } +} + +impl MacosSurface { + //#[cfg(feature = "v4_8")] + //#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))] + //#[doc(alias = "gdk_macos_surface_get_native_window")] + //#[doc(alias = "get_native_window")] + //pub fn native_window(&self) -> /*Unimplemented*/Option { + // unsafe { TODO: call ffi:gdk_macos_surface_get_native_window() } + //} + + //pub fn native(&self) -> /*Unimplemented*/Basic: Pointer { + // ObjectExt::property(self, "native") + //} + + #[doc(alias = "native")] + pub fn connect_native_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_native_trampoline( + this: *mut ffi::GdkMacosSurface, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::native\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( + notify_native_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gdk4-macos/src/auto/mod.rs b/gdk4-macos/src/auto/mod.rs new file mode 100644 index 000000000000..94440ae4e7ec --- /dev/null +++ b/gdk4-macos/src/auto/mod.rs @@ -0,0 +1,24 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +mod macos_device; +pub use self::macos_device::MacosDevice; + +mod macos_display; +pub use self::macos_display::MacosDisplay; + +mod macos_gl_context; +pub use self::macos_gl_context::MacosGLContext; + +mod macos_keymap; +pub use self::macos_keymap::MacosKeymap; + +mod macos_monitor; +pub use self::macos_monitor::MacosMonitor; + +mod macos_seat; +pub use self::macos_seat::MacosSeat; + +mod macos_surface; +pub use self::macos_surface::MacosSurface; diff --git a/gdk4-macos/src/auto/versions.txt b/gdk4-macos/src/auto/versions.txt new file mode 100644 index 000000000000..5af8e497d2f0 --- /dev/null +++ b/gdk4-macos/src/auto/versions.txt @@ -0,0 +1,2 @@ +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-macos/src/lib.rs b/gdk4-macos/src/lib.rs new file mode 100644 index 000000000000..c9ff34a3d8b2 --- /dev/null +++ b/gdk4-macos/src/lib.rs @@ -0,0 +1,18 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +#![doc = include_str!("../README.md")] +#![allow(deprecated)] +#![cfg_attr(docsrs, feature(doc_cfg))] + +pub use gdk; +pub use gdk4_macos_sys as ffi; +pub use gio; +pub use glib; +#[macro_use] +mod rt; + +mod auto; + +pub mod prelude; + +pub use auto::*; diff --git a/gdk4-macos/src/prelude.rs b/gdk4-macos/src/prelude.rs new file mode 100644 index 000000000000..8c10e121793f --- /dev/null +++ b/gdk4-macos/src/prelude.rs @@ -0,0 +1,7 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +// rustdoc-stripper-ignore-next +//! Traits intended for blanket imports. + +#[doc(hidden)] +pub use gdk::prelude::*; diff --git a/gdk4-macos/src/rt.rs b/gdk4-macos/src/rt.rs new file mode 100644 index 000000000000..917563e7bff9 --- /dev/null +++ b/gdk4-macos/src/rt.rs @@ -0,0 +1,10 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +macro_rules! assert_initialized_main_thread { + () => {}; +} + +/// No-op. +macro_rules! skip_assert_initialized { + () => {}; +} diff --git a/gdk4-macos/sys/Cargo.toml b/gdk4-macos/sys/Cargo.toml new file mode 100644 index 000000000000..64df27ded78f --- /dev/null +++ b/gdk4-macos/sys/Cargo.toml @@ -0,0 +1,64 @@ +[package] +name = "gdk4-macos-sys" +build = "build.rs" +description = "FFI bindings of GDK4 macos" +documentation = "https://gtk-rs.org/gtk4-rs/git/docs/gdk4_macos_sys/" +keywords = ["gdk4", "gdk4-macos", "ffi", "gtk-rs", "gnome"] + +[package.authors] +workspace = true + +[package.categories] +workspace = true + +[package.edition] +workspace = true + +[package.homepage] +workspace = true + +[package.license] +workspace = true + +[package.repository] +workspace = true + +[package.rust-version] +workspace = true + +[package.version] +workspace = true + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +all-features = true + +[package.metadata.system-deps.gtk4_macos] +name = "gtk4-macos" +version = "4" + +[package.metadata.system-deps.gtk4_macos.v4_8] +version = "4.8" + +[lib] +name = "gdk4_macos_sys" + +[features] +v4_8 = [] + +[dependencies] +libc = "0.2" + +[dependencies.gdk4-sys] +workspace = true + +[dependencies.glib-sys] +workspace = true + +[build-dependencies] +system-deps = "7" + +[dev-dependencies] +shell-words = "1.0.0" +tempfile = "3" diff --git a/gdk4-macos/sys/Gir.toml b/gdk4-macos/sys/Gir.toml new file mode 100644 index 000000000000..ffa3e359a2d3 --- /dev/null +++ b/gdk4-macos/sys/Gir.toml @@ -0,0 +1,22 @@ +[options] +work_mode = "sys" +library = "GdkMacos" +version = "4.0" +min_cfg_version = "4.0.0" +single_version_file = "." +girs_directories = ["../../gir-files"] + +external_libraries = [ + "GLib", +] + +[external_libraries] +gdk4 = "Gdk" + + +[[object]] +name = "GdkMacos.MacosMonitor" +status = "generate" + [[object.function]] + name = "get_geometry" + ignore = true # The function does not exists \ No newline at end of file diff --git a/gdk4-macos/sys/LICENSE b/gdk4-macos/sys/LICENSE new file mode 120000 index 000000000000..30cff7403da0 --- /dev/null +++ b/gdk4-macos/sys/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/gdk4-macos/sys/build.rs b/gdk4-macos/sys/build.rs new file mode 100644 index 000000000000..e98844f2d792 --- /dev/null +++ b/gdk4-macos/sys/build.rs @@ -0,0 +1,17 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +#[cfg(not(docsrs))] +use std::process; + +#[cfg(docsrs)] +fn main() {} // prevent linking libraries to avoid documentation failure + +#[cfg(not(docsrs))] +fn main() { + if let Err(s) = system_deps::Config::new().probe() { + println!("cargo:warning={s}"); + process::exit(1); + } +} diff --git a/gdk4-macos/sys/src/lib.rs b/gdk4-macos/sys/src/lib.rs new file mode 100644 index 000000000000..5ee3081c0460 --- /dev/null +++ b/gdk4-macos/sys/src/lib.rs @@ -0,0 +1,236 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] +#![allow( + clippy::approx_constant, + clippy::type_complexity, + clippy::unreadable_literal, + clippy::upper_case_acronyms +)] +#![cfg_attr(docsrs, feature(doc_cfg))] + +use gdk4_sys as gdk; +use glib_sys as glib; + +#[cfg(unix)] +#[allow(unused_imports)] +use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t}; +#[allow(unused_imports)] +use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE}; +#[allow(unused_imports)] +use std::ffi::{ + c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, +}; + +#[allow(unused_imports)] +use glib::{gboolean, gconstpointer, gpointer, GType}; + +// Records +#[repr(C)] +#[allow(dead_code)] +pub struct _GdkMacosDeviceClass { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GdkMacosDeviceClass = _GdkMacosDeviceClass; + +#[repr(C)] +#[allow(dead_code)] +pub struct _GdkMacosDisplayClass { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GdkMacosDisplayClass = _GdkMacosDisplayClass; + +#[repr(C)] +#[allow(dead_code)] +pub struct _GdkMacosGLContextClass { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GdkMacosGLContextClass = _GdkMacosGLContextClass; + +#[repr(C)] +#[allow(dead_code)] +pub struct _GdkMacosKeymapClass { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GdkMacosKeymapClass = _GdkMacosKeymapClass; + +#[repr(C)] +#[allow(dead_code)] +pub struct _GdkMacosMonitorClass { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GdkMacosMonitorClass = _GdkMacosMonitorClass; + +#[repr(C)] +#[allow(dead_code)] +pub struct _GdkMacosSeatClass { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GdkMacosSeatClass = _GdkMacosSeatClass; + +#[repr(C)] +#[allow(dead_code)] +pub struct _GdkMacosSurfaceClass { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GdkMacosSurfaceClass = _GdkMacosSurfaceClass; + +// Classes +#[repr(C)] +#[allow(dead_code)] +pub struct GdkMacosDevice { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for GdkMacosDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GdkMacosDevice @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct GdkMacosDisplay { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for GdkMacosDisplay { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GdkMacosDisplay @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct GdkMacosGLContext { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for GdkMacosGLContext { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GdkMacosGLContext @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct GdkMacosKeymap { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for GdkMacosKeymap { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GdkMacosKeymap @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct GdkMacosMonitor { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for GdkMacosMonitor { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GdkMacosMonitor @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct GdkMacosSeat { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for GdkMacosSeat { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GdkMacosSeat @ {self:p}")).finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct GdkMacosSurface { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for GdkMacosSurface { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GdkMacosSurface @ {self:p}")) + .finish() + } +} + +extern "C" { + + //========================================================================= + // GdkMacosDevice + //========================================================================= + pub fn gdk_macos_device_get_type() -> GType; + + //========================================================================= + // GdkMacosDisplay + //========================================================================= + pub fn gdk_macos_display_get_type() -> GType; + + //========================================================================= + // GdkMacosGLContext + //========================================================================= + pub fn gdk_macos_gl_context_get_type() -> GType; + + //========================================================================= + // GdkMacosKeymap + //========================================================================= + pub fn gdk_macos_keymap_get_type() -> GType; + + //========================================================================= + // GdkMacosMonitor + //========================================================================= + pub fn gdk_macos_monitor_get_type() -> GType; + pub fn gdk_macos_monitor_get_workarea( + monitor: *mut gdk::GdkMonitor, + geometry: *mut gdk::GdkRectangle, + ); + + //========================================================================= + // GdkMacosSeat + //========================================================================= + pub fn gdk_macos_seat_get_type() -> GType; + + //========================================================================= + // GdkMacosSurface + //========================================================================= + pub fn gdk_macos_surface_get_type() -> GType; + #[cfg(feature = "v4_8")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))] + pub fn gdk_macos_surface_get_native_window(self_: *mut GdkMacosSurface) -> gpointer; + +} diff --git a/gdk4-macos/sys/versions.txt b/gdk4-macos/sys/versions.txt new file mode 100644 index 000000000000..5af8e497d2f0 --- /dev/null +++ b/gdk4-macos/sys/versions.txt @@ -0,0 +1,2 @@ +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-macos/tests/check_gir.rs b/gdk4-macos/tests/check_gir.rs new file mode 100644 index 000000000000..2ccf5ff05bcf --- /dev/null +++ b/gdk4-macos/tests/check_gir.rs @@ -0,0 +1,8 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +#[test] +fn check_gir_file() { + let res = gir_format_check::check_gir_file("Gir.toml"); + println!("{res}"); + assert_eq!(res.nb_errors, 0); +} diff --git a/gdk4-wayland/src/auto/versions.txt b/gdk4-wayland/src/auto/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gdk4-wayland/src/auto/versions.txt +++ b/gdk4-wayland/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-wayland/sys/versions.txt b/gdk4-wayland/sys/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gdk4-wayland/sys/versions.txt +++ b/gdk4-wayland/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-win32/src/auto/versions.txt b/gdk4-win32/src/auto/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gdk4-win32/src/auto/versions.txt +++ b/gdk4-win32/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-win32/sys/versions.txt b/gdk4-win32/sys/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gdk4-win32/sys/versions.txt +++ b/gdk4-win32/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-x11/src/auto/versions.txt b/gdk4-x11/src/auto/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gdk4-x11/src/auto/versions.txt +++ b/gdk4-x11/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-x11/sys/versions.txt b/gdk4-x11/sys/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gdk4-x11/sys/versions.txt +++ b/gdk4-x11/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4/src/auto/dmabuf_texture_builder.rs b/gdk4/src/auto/dmabuf_texture_builder.rs index 4320f6eed1d8..f53242bb08b4 100644 --- a/gdk4/src/auto/dmabuf_texture_builder.rs +++ b/gdk4/src/auto/dmabuf_texture_builder.rs @@ -36,7 +36,7 @@ impl DmabufTextureBuilder { #[doc(alias = "color-state")] pub fn color_state(&self) -> Option { unsafe { - from_glib_full(ffi::gdk_dmabuf_texture_builder_get_color_state( + from_glib_none(ffi::gdk_dmabuf_texture_builder_get_color_state( self.to_glib_none().0, )) } diff --git a/gdk4/src/auto/gl_texture_builder.rs b/gdk4/src/auto/gl_texture_builder.rs index c3621efd025a..8275c471d2e7 100644 --- a/gdk4/src/auto/gl_texture_builder.rs +++ b/gdk4/src/auto/gl_texture_builder.rs @@ -40,7 +40,7 @@ impl GLTextureBuilder { #[doc(alias = "color-state")] pub fn color_state(&self) -> ColorState { unsafe { - from_glib_full(ffi::gdk_gl_texture_builder_get_color_state( + from_glib_none(ffi::gdk_gl_texture_builder_get_color_state( self.to_glib_none().0, )) } diff --git a/gdk4/src/auto/versions.txt b/gdk4/src/auto/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gdk4/src/auto/versions.txt +++ b/gdk4/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4/sys/versions.txt b/gdk4/sys/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gdk4/sys/versions.txt +++ b/gdk4/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gir b/gir index e5ad53c3ad05..1b34ebba86cb 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit e5ad53c3ad05f06c499704f2d39d2a04c4111eb4 +Subproject commit 1b34ebba86cb5c5c6b474b1693f8aeb55b88477d diff --git a/gir-files b/gir-files index 3e07ae5a14c7..c05f5cc23cb7 160000 --- a/gir-files +++ b/gir-files @@ -1 +1 @@ -Subproject commit 3e07ae5a14c7ae05333e0fcdcc5a5e668d74a710 +Subproject commit c05f5cc23cb7344ba67d9ed20e9c153b3b06e120 diff --git a/gsk4/src/auto/versions.txt b/gsk4/src/auto/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gsk4/src/auto/versions.txt +++ b/gsk4/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gsk4/sys/versions.txt b/gsk4/sys/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gsk4/sys/versions.txt +++ b/gsk4/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gtk4/src/auto/flags.rs b/gtk4/src/auto/flags.rs index ccd452fb5e03..3c7cf5d8e723 100644 --- a/gtk4/src/auto/flags.rs +++ b/gtk4/src/auto/flags.rs @@ -681,6 +681,10 @@ bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "GtkIconLookupFlags")] pub struct IconLookupFlags: u32 { + #[cfg(feature = "v4_18")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))] + #[doc(alias = "GTK_ICON_LOOKUP_NONE")] + const NONE = ffi::GTK_ICON_LOOKUP_NONE as _; #[doc(alias = "GTK_ICON_LOOKUP_FORCE_REGULAR")] const FORCE_REGULAR = ffi::GTK_ICON_LOOKUP_FORCE_REGULAR as _; #[doc(alias = "GTK_ICON_LOOKUP_FORCE_SYMBOLIC")] diff --git a/gtk4/src/auto/text_view.rs b/gtk4/src/auto/text_view.rs index 0c059efbaaa7..a5382622db98 100644 --- a/gtk4/src/auto/text_view.rs +++ b/gtk4/src/auto/text_view.rs @@ -838,6 +838,23 @@ pub trait TextViewExt: IsA + 'static { unsafe { ffi::gtk_text_view_get_top_margin(self.as_ref().to_glib_none().0) } } + #[cfg(feature = "v4_18")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))] + #[doc(alias = "gtk_text_view_get_visible_offset")] + #[doc(alias = "get_visible_offset")] + fn visible_offset(&self) -> (f64, f64) { + unsafe { + let mut x_offset = std::mem::MaybeUninit::uninit(); + let mut y_offset = std::mem::MaybeUninit::uninit(); + ffi::gtk_text_view_get_visible_offset( + self.as_ref().to_glib_none().0, + x_offset.as_mut_ptr(), + y_offset.as_mut_ptr(), + ); + (x_offset.assume_init(), y_offset.assume_init()) + } + } + #[doc(alias = "gtk_text_view_get_visible_rect")] #[doc(alias = "get_visible_rect")] fn visible_rect(&self) -> gdk::Rectangle { diff --git a/gtk4/src/auto/versions.txt b/gtk4/src/auto/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gtk4/src/auto/versions.txt +++ b/gtk4/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gtk4/sys/src/lib.rs b/gtk4/sys/src/lib.rs index c190605b743c..4eea1ae98dfb 100644 --- a/gtk4/sys/src/lib.rs +++ b/gtk4/sys/src/lib.rs @@ -1070,6 +1070,9 @@ pub const GTK_FONT_CHOOSER_LEVEL_VARIATIONS: GtkFontChooserLevel = 4; pub const GTK_FONT_CHOOSER_LEVEL_FEATURES: GtkFontChooserLevel = 8; pub type GtkIconLookupFlags = c_uint; +#[cfg(feature = "v4_18")] +#[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))] +pub const GTK_ICON_LOOKUP_NONE: GtkIconLookupFlags = 0; pub const GTK_ICON_LOOKUP_FORCE_REGULAR: GtkIconLookupFlags = 1; pub const GTK_ICON_LOOKUP_FORCE_SYMBOLIC: GtkIconLookupFlags = 2; pub const GTK_ICON_LOOKUP_PRELOAD: GtkIconLookupFlags = 4; @@ -19013,6 +19016,13 @@ extern "C" { pub fn gtk_text_view_get_rtl_context(text_view: *mut GtkTextView) -> *mut pango::PangoContext; pub fn gtk_text_view_get_tabs(text_view: *mut GtkTextView) -> *mut pango::PangoTabArray; pub fn gtk_text_view_get_top_margin(text_view: *mut GtkTextView) -> c_int; + #[cfg(feature = "v4_18")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))] + pub fn gtk_text_view_get_visible_offset( + text_view: *mut GtkTextView, + x_offset: *mut c_double, + y_offset: *mut c_double, + ); pub fn gtk_text_view_get_visible_rect( text_view: *mut GtkTextView, visible_rect: *mut gdk::GdkRectangle, diff --git a/gtk4/sys/tests/abi.rs b/gtk4/sys/tests/abi.rs index 3d114d6da0df..265a949f793b 100644 --- a/gtk4/sys/tests/abi.rs +++ b/gtk4/sys/tests/abi.rs @@ -2996,6 +2996,7 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ ("(gint) GTK_GRAPHICS_OFFLOAD_ENABLED", "0"), ("(guint) GTK_ICON_LOOKUP_FORCE_REGULAR", "1"), ("(guint) GTK_ICON_LOOKUP_FORCE_SYMBOLIC", "2"), + ("(guint) GTK_ICON_LOOKUP_NONE", "0"), ("(guint) GTK_ICON_LOOKUP_PRELOAD", "4"), ("(gint) GTK_ICON_SIZE_INHERIT", "0"), ("(gint) GTK_ICON_SIZE_LARGE", "2"), diff --git a/gtk4/sys/tests/constant.c b/gtk4/sys/tests/constant.c index 2cd2bb0496c1..5d73094b8c68 100644 --- a/gtk4/sys/tests/constant.c +++ b/gtk4/sys/tests/constant.c @@ -425,6 +425,7 @@ int main() { PRINT_CONSTANT((gint) GTK_GRAPHICS_OFFLOAD_ENABLED); PRINT_CONSTANT((guint) GTK_ICON_LOOKUP_FORCE_REGULAR); PRINT_CONSTANT((guint) GTK_ICON_LOOKUP_FORCE_SYMBOLIC); + PRINT_CONSTANT((guint) GTK_ICON_LOOKUP_NONE); PRINT_CONSTANT((guint) GTK_ICON_LOOKUP_PRELOAD); PRINT_CONSTANT((gint) GTK_ICON_SIZE_INHERIT); PRINT_CONSTANT((gint) GTK_ICON_SIZE_LARGE); diff --git a/gtk4/sys/versions.txt b/gtk4/sys/versions.txt index d9d8881f68ee..5af8e497d2f0 100644 --- a/gtk4/sys/versions.txt +++ b/gtk4/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e5ad53c3ad05) -from gir-files (https://github.com/gtk-rs/gir-files @ 3e07ae5a14c7) +Generated by gir (https://github.com/gtk-rs/gir @ 1b34ebba86cb) +from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7)