├── .gitignore ├── README.md ├── cogl ├── src │ ├── lib.rs │ └── auto │ │ ├── mod.rs │ │ └── flags.rs ├── Gir.toml └── Cargo.toml ├── gdesktop_enums ├── src │ ├── lib.rs │ └── auto │ │ ├── mod.rs │ │ └── enums.rs ├── Gir.toml └── Cargo.toml ├── meta-sys ├── tests │ └── manual.h ├── build.rs └── Cargo.toml ├── xlib-sys ├── tests │ ├── manual.h │ ├── constant.c │ ├── layout.c │ └── abi.rs ├── build.rs ├── Cargo.toml └── src │ └── lib.rs ├── gdesktop_enums-sys ├── tests │ ├── manual.h │ ├── layout.c │ └── constant.c ├── build.rs └── Cargo.toml ├── cogl-sys ├── tests │ ├── manual.h │ └── layout.c ├── build.rs └── Cargo.toml ├── clutter-sys ├── tests │ └── manual.h ├── build.rs └── Cargo.toml ├── json-sys ├── tests │ ├── manual.h │ ├── layout.c │ └── constant.c ├── build.rs └── Cargo.toml ├── meta ├── src │ ├── subclass │ │ └── mod.rs │ ├── lib.rs │ ├── auto │ │ ├── window_group.rs │ │ ├── background_group.rs │ │ ├── stage.rs │ │ ├── key_binding.rs │ │ ├── background_actor.rs │ │ ├── mod.rs │ │ ├── rectangle.rs │ │ ├── background.rs │ │ ├── selection.rs │ │ ├── selection_source.rs │ │ ├── plugin.rs │ │ ├── window_actor.rs │ │ ├── backend.rs │ │ ├── compositor.rs │ │ └── monitor_manager.rs │ ├── rectangle.rs │ └── display.rs ├── Cargo.toml └── Gir.toml ├── xlib-sys.toml ├── clutter ├── src │ ├── lib.rs │ ├── color.rs │ ├── auto │ │ ├── action.rs │ │ ├── constraint.rs │ │ ├── scriptable.rs │ │ ├── effect.rs │ │ ├── clone.rs │ │ ├── input_focus.rs │ │ ├── animatable.rs │ │ ├── image.rs │ │ ├── actor_meta.rs │ │ ├── content.rs │ │ ├── backend.rs │ │ └── mod.rs │ └── key_event.rs ├── Cargo.toml └── Gir.toml ├── gdesktop_enums-sys.toml ├── json-sys.toml ├── cogl-sys.toml ├── .gitmodules ├── clutter-sys.toml ├── Cargo.toml ├── meta-sys.toml ├── mutter-gir-files ├── GDesktopEnums-3.0.patch ├── xlib-2.0.patch ├── Clutter-8.patch ├── Meta-8.patch └── xlib-2.0.gir ├── gdesktop_enums-sys.patch ├── clutter-sys.patch ├── meta-sys.patch └── generate.sh /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mutter-rs 2 | Rust wrappers for Mutter and related projects 3 | -------------------------------------------------------------------------------- /cogl/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub use ffi; 2 | 3 | pub use auto::*; 4 | pub use auto::traits::*; 5 | mod auto; 6 | -------------------------------------------------------------------------------- /gdesktop_enums/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub use ffi; 2 | 3 | pub use auto::*; 4 | pub use auto::traits::*; 5 | mod auto; 6 | -------------------------------------------------------------------------------- /meta-sys/tests/manual.h: -------------------------------------------------------------------------------- 1 | // Feel free to edit this file, it won't be regenerated by gir generator unless removed. 2 | 3 | -------------------------------------------------------------------------------- /xlib-sys/tests/manual.h: -------------------------------------------------------------------------------- 1 | // Feel free to edit this file, it won't be regenerated by gir generator unless removed. 2 | 3 | -------------------------------------------------------------------------------- /gdesktop_enums-sys/tests/manual.h: -------------------------------------------------------------------------------- 1 | // Feel free to edit this file, it won't be regenerated by gir generator unless removed. 2 | 3 | -------------------------------------------------------------------------------- /cogl-sys/tests/manual.h: -------------------------------------------------------------------------------- 1 | // Feel free to edit this file, it won't be regenerated by gir generator unless removed. 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /clutter-sys/tests/manual.h: -------------------------------------------------------------------------------- 1 | // Feel free to edit this file, it won't be regenerated by gir generator unless removed. 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /json-sys/tests/manual.h: -------------------------------------------------------------------------------- 1 | // Feel free to edit this file, it won't be regenerated by gir generator unless removed. 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /meta/src/subclass/mod.rs: -------------------------------------------------------------------------------- 1 | mod plugin; 2 | 3 | pub mod prelude { 4 | pub use super::plugin::PluginImpl; 5 | pub use glib::subclass::prelude::*; 6 | } 7 | -------------------------------------------------------------------------------- /xlib-sys.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "xlib" 3 | version = "2.0" 4 | external_libraries = [ 5 | "GLib" 6 | ] 7 | target_path = "xlib-sys" 8 | work_mode = "sys" 9 | -------------------------------------------------------------------------------- /clutter/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub use ffi; 2 | 3 | pub use auto::*; 4 | pub use auto::traits::*; 5 | mod auto; 6 | 7 | mod color; 8 | 9 | pub use key_event::*; 10 | mod key_event; 11 | -------------------------------------------------------------------------------- /gdesktop_enums-sys.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "GDesktopEnums" 3 | version = "3.0" 4 | external_libraries = [ 5 | "GLib", 6 | ] 7 | target_path = "gdesktop_enums-sys" 8 | work_mode = "sys" 9 | -------------------------------------------------------------------------------- /json-sys.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "Json" 3 | version = "1.0" 4 | external_libraries = [ 5 | "Gio", 6 | "GLib", 7 | "GObject", 8 | ] 9 | target_path = "json-sys" 10 | work_mode = "sys" 11 | -------------------------------------------------------------------------------- /gdesktop_enums/Gir.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "GDesktopEnums" 3 | version = "3.0" 4 | target_path = "." 5 | work_mode = "normal" 6 | 7 | generate = [ 8 | "GDesktopEnums.BackgroundStyle", 9 | ] 10 | -------------------------------------------------------------------------------- /cogl-sys.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "Cogl" 3 | version = "8" 4 | external_libraries = [ 5 | "cairo", 6 | "GLib", 7 | "GObject", 8 | "Graphene", 9 | ] 10 | target_path = "cogl-sys" 11 | work_mode = "sys" 12 | -------------------------------------------------------------------------------- /meta/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub use ffi; 2 | 3 | pub use auto::*; 4 | pub use auto::traits::*; 5 | pub use auto::functions::*; 6 | mod auto; 7 | 8 | mod display; 9 | 10 | mod rectangle; 11 | 12 | pub mod subclass; 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "gir"] 2 | path = gir 3 | url = https://github.com/pop-os/gir.git 4 | branch = master 5 | [submodule "gir-files"] 6 | path = gir-files 7 | url = https://github.com/gtk-rs/gir-files.git 8 | branch = master 9 | -------------------------------------------------------------------------------- /clutter-sys.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "Clutter" 3 | version = "8" 4 | external_libraries = [ 5 | "Atk", 6 | "cairo", 7 | "Cogl", 8 | "Gio", 9 | "GLib", 10 | "GObject", 11 | "Graphene", 12 | "Json", 13 | "Pango", 14 | ] 15 | target_path = "clutter-sys" 16 | work_mode = "sys" 17 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "clutter", 4 | "clutter-sys", 5 | "cogl", 6 | "cogl-sys", 7 | "gdesktop_enums", 8 | "gdesktop_enums-sys", 9 | "json-sys", 10 | "meta", 11 | "meta-sys", 12 | "xlib-sys", 13 | ] 14 | exclude = [ 15 | "gir", 16 | ] 17 | -------------------------------------------------------------------------------- /cogl/Gir.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "Cogl" 3 | version = "8" 4 | target_path = "." 5 | work_mode = "normal" 6 | 7 | generate = [ 8 | "Cogl.PixelFormat", 9 | "Cogl.Texture", 10 | ] 11 | 12 | [[object]] 13 | name = "Cogl.*" 14 | status = "generate" 15 | [[object.constant]] 16 | pattern = "*" 17 | ignore = true 18 | -------------------------------------------------------------------------------- /meta-sys.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "Meta" 3 | version = "8" 4 | external_libraries = [ 5 | "cairo", 6 | "Clutter", 7 | "Cogl", 8 | "GDesktopEnums", 9 | "GLib", 10 | "Gio", 11 | "GObject", 12 | "Graphene", 13 | "Gtk", 14 | "Pango", 15 | "xlib", 16 | ] 17 | target_path = "meta-sys" 18 | work_mode = "sys" 19 | -------------------------------------------------------------------------------- /gdesktop_enums/src/auto/mod.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | mod enums; 7 | pub use self::enums::BackgroundStyle; 8 | 9 | #[doc(hidden)] 10 | pub mod traits { 11 | } 12 | -------------------------------------------------------------------------------- /gdesktop_enums/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "gdesktop_enums" 3 | version = "0.0.1" 4 | edition = "2018" 5 | 6 | [lib] 7 | name = "gdesktop_enums" 8 | 9 | [dependencies] 10 | bitflags = "1.3.2" 11 | ffi = { package = "gdesktop_enums-sys", path = "../gdesktop_enums-sys" } 12 | glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } 13 | libc = "0.2.100" 14 | -------------------------------------------------------------------------------- /clutter/src/color.rs: -------------------------------------------------------------------------------- 1 | use ffi::ClutterColor; 2 | use glib::translate::{ 3 | FromGlibPtrNone, 4 | Uninitialized, 5 | }; 6 | 7 | use crate::Color; 8 | 9 | impl Uninitialized for Color { 10 | unsafe fn uninitialized() -> Self { 11 | //TODO: is this implementation correct? 12 | let color = ClutterColor { 13 | red: 0, 14 | green: 0, 15 | blue: 0, 16 | alpha: 0, 17 | }; 18 | Self::from_glib_none(&color as *const ClutterColor) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /cogl/src/auto/mod.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | mod texture; 7 | pub use self::texture::{Texture, NONE_TEXTURE}; 8 | 9 | mod flags; 10 | #[cfg(any(feature = "v0_8", feature = "dox"))] 11 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_8")))] 12 | pub use self::flags::PixelFormat; 13 | 14 | pub mod functions; 15 | 16 | #[doc(hidden)] 17 | pub mod traits { 18 | pub use super::texture::TextureExt; 19 | } 20 | -------------------------------------------------------------------------------- /clutter-sys/build.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #[cfg(not(feature = "dox"))] 7 | use std::process; 8 | 9 | #[cfg(feature = "dox")] 10 | fn main() {} // prevent linking libraries to avoid documentation failure 11 | 12 | #[cfg(not(feature = "dox"))] 13 | fn main() { 14 | if let Err(s) = system_deps::Config::new().probe() { 15 | println!("cargo:warning={}", s); 16 | process::exit(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cogl-sys/build.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #[cfg(not(feature = "dox"))] 7 | use std::process; 8 | 9 | #[cfg(feature = "dox")] 10 | fn main() {} // prevent linking libraries to avoid documentation failure 11 | 12 | #[cfg(not(feature = "dox"))] 13 | fn main() { 14 | if let Err(s) = system_deps::Config::new().probe() { 15 | println!("cargo:warning={}", s); 16 | process::exit(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /json-sys/build.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #[cfg(not(feature = "dox"))] 7 | use std::process; 8 | 9 | #[cfg(feature = "dox")] 10 | fn main() {} // prevent linking libraries to avoid documentation failure 11 | 12 | #[cfg(not(feature = "dox"))] 13 | fn main() { 14 | if let Err(s) = system_deps::Config::new().probe() { 15 | println!("cargo:warning={}", s); 16 | process::exit(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /meta-sys/build.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #[cfg(not(feature = "dox"))] 7 | use std::process; 8 | 9 | #[cfg(feature = "dox")] 10 | fn main() {} // prevent linking libraries to avoid documentation failure 11 | 12 | #[cfg(not(feature = "dox"))] 13 | fn main() { 14 | if let Err(s) = system_deps::Config::new().probe() { 15 | println!("cargo:warning={}", s); 16 | process::exit(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xlib-sys/build.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #[cfg(not(feature = "dox"))] 7 | use std::process; 8 | 9 | #[cfg(feature = "dox")] 10 | fn main() {} // prevent linking libraries to avoid documentation failure 11 | 12 | #[cfg(not(feature = "dox"))] 13 | fn main() { 14 | if let Err(s) = system_deps::Config::new().probe() { 15 | println!("cargo:warning={}", s); 16 | process::exit(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /meta/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "meta" 3 | version = "0.0.1" 4 | edition = "2018" 5 | 6 | [lib] 7 | name = "meta" 8 | 9 | [dependencies] 10 | bitflags = "1.3.2" 11 | cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core" } 12 | clutter = { path = "../clutter" } 13 | ffi = { package = "meta-sys", path = "../meta-sys" } 14 | gdesktop_enums = { path = "../gdesktop_enums" } 15 | glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } 16 | gio = { git = "https://github.com/gtk-rs/gtk-rs-core" } 17 | libc = "0.2.100" 18 | pango = { git = "https://github.com/gtk-rs/gtk-rs-core" } 19 | -------------------------------------------------------------------------------- /gdesktop_enums-sys/build.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #[cfg(not(feature = "dox"))] 7 | use std::process; 8 | 9 | #[cfg(feature = "dox")] 10 | fn main() {} // prevent linking libraries to avoid documentation failure 11 | 12 | #[cfg(not(feature = "dox"))] 13 | fn main() { 14 | if let Err(s) = system_deps::Config::new().probe() { 15 | println!("cargo:warning={}", s); 16 | process::exit(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xlib-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xlib-sys" 3 | version = "0.0.1" 4 | links = "\"X11\"" 5 | edition = "2018" 6 | build = "build.rs" 7 | [package.metadata.system-deps.x11] 8 | name = "x11" 9 | version = "0.0" 10 | [package.metadata.docs.rs] 11 | features = ["dox"] 12 | 13 | [lib] 14 | name = "xlib_sys" 15 | 16 | [dependencies] 17 | libc = "0.2" 18 | 19 | [dependencies.glib-sys] 20 | git = "https://github.com/gtk-rs/gtk-rs-core" 21 | 22 | [build-dependencies] 23 | system-deps = "3" 24 | 25 | [dev-dependencies] 26 | shell-words = "1.0.0" 27 | tempfile = "3" 28 | 29 | [features] 30 | dox = [] 31 | -------------------------------------------------------------------------------- /mutter-gir-files/GDesktopEnums-3.0.patch: -------------------------------------------------------------------------------- 1 | --- /usr/share/gir-1.0/GDesktopEnums-3.0.gir 2021-06-10 16:18:47.000000000 -0600 2 | +++ mutter-gir-files/GDesktopEnums-3.0.gir 2021-08-20 11:26:40.727012789 -0600 3 | @@ -6,6 +6,8 @@ 4 | xmlns="http://www.gtk.org/introspection/core/1.0" 5 | xmlns:c="http://www.gtk.org/introspection/c/1.0" 6 | xmlns:glib="http://www.gtk.org/introspection/glib/1.0"> 7 | + 8 | + 9 | 7 | + 8 | + 9 | 13 | 14 | -------------------------------------------------------------------------------- /gdesktop_enums-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "gdesktop_enums-sys" 3 | version = "0.0.1" 4 | links = "\"\"" 5 | edition = "2018" 6 | build = "build.rs" 7 | [package.metadata.system-deps.gsettings_desktop_schemas] 8 | name = "gsettings-desktop-schemas" 9 | version = "0.0" 10 | [package.metadata.docs.rs] 11 | features = ["dox"] 12 | 13 | [lib] 14 | name = "gdesktop_enums_sys" 15 | 16 | [dependencies] 17 | libc = "0.2" 18 | 19 | [dependencies.glib-sys] 20 | git = "https://github.com/gtk-rs/gtk-rs-core" 21 | 22 | [build-dependencies] 23 | system-deps = "3" 24 | 25 | [dev-dependencies] 26 | shell-words = "1.0.0" 27 | tempfile = "3" 28 | 29 | [features] 30 | dox = [] 31 | -------------------------------------------------------------------------------- /gdesktop_enums-sys.patch: -------------------------------------------------------------------------------- 1 | --- gdesktop_enums-sys/Cargo.toml.orig 2021-08-20 11:31:53.048499821 -0600 2 | +++ gdesktop_enums-sys/Cargo.toml 2021-08-20 11:32:00.988531835 -0600 3 | @@ -1,5 +1,5 @@ 4 | [package] 5 | -name = "gdesktop-enums-sys" 6 | +name = "gdesktop_enums-sys" 7 | version = "0.0.1" 8 | links = "\"\"" 9 | edition = "2018" 10 | --- gdesktop_enums-sys/src/lib.rs.orig 2021-08-20 11:28:45.383666628 -0600 11 | +++ gdesktop_enums-sys/src/lib.rs 2021-08-20 11:28:55.067713678 -0600 12 | @@ -187,7 +187,6 @@ 13 | pub const G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH: GDesktopVisualBellType = 0; 14 | pub const G_DESKTOP_VISUAL_BELL_FRAME_FLASH: GDesktopVisualBellType = 1; 15 | 16 | -#[link(name = "")] 17 | extern "C" { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /clutter/src/auto/action.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::ActorMeta; 7 | use std::fmt; 8 | 9 | glib::wrapper! { 10 | #[doc(alias = "ClutterAction")] 11 | pub struct Action(Object) @extends ActorMeta; 12 | 13 | match fn { 14 | type_ => || ffi::clutter_action_get_type(), 15 | } 16 | } 17 | 18 | impl Action {} 19 | 20 | pub const NONE_ACTION: Option<&Action> = None; 21 | 22 | impl fmt::Display for Action { 23 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 24 | f.write_str("Action") 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /meta/src/auto/window_group.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use std::fmt; 7 | 8 | glib::wrapper! { 9 | #[doc(alias = "MetaWindowGroup")] 10 | pub struct WindowGroup(Object) @extends clutter::Actor, @implements clutter::Animatable, clutter::Container, clutter::Scriptable; 11 | 12 | match fn { 13 | type_ => || ffi::meta_window_group_get_type(), 14 | } 15 | } 16 | 17 | impl WindowGroup {} 18 | 19 | impl fmt::Display for WindowGroup { 20 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 21 | f.write_str("WindowGroup") 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /cogl/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cogl" 3 | version = "0.0.1" 4 | edition = "2018" 5 | 6 | [lib] 7 | name = "cogl" 8 | 9 | [dependencies] 10 | bitflags = "1.3.2" 11 | ffi = { package = "cogl-sys", path = "../cogl-sys" } 12 | glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } 13 | libc = "0.2.100" 14 | 15 | [features] 16 | # Force all features on by default 17 | default = ["v2_0"] 18 | v0_8 = ["ffi/v0_8"] 19 | v0_10 = ["ffi/v0_10", "v0_8"] 20 | v1_0 = ["ffi/v1_0", "v0_10"] 21 | v1_2 = ["ffi/v1_2", "v1_0"] 22 | v1_4 = ["ffi/v1_4", "v1_2"] 23 | v1_6 = ["ffi/v1_6", "v1_4"] 24 | v1_8 = ["ffi/v1_8", "v1_6"] 25 | v1_10 = ["ffi/v1_10", "v1_8"] 26 | v1_14 = ["ffi/v1_14", "v1_10"] 27 | v1_16 = ["ffi/v1_16", "v1_14"] 28 | v1_18 = ["ffi/v1_18", "v1_16"] 29 | v1_20 = ["ffi/v1_20", "v1_18"] 30 | v2_0 = ["ffi/v2_0", "v1_20"] 31 | -------------------------------------------------------------------------------- /clutter-sys.patch: -------------------------------------------------------------------------------- 1 | --- clutter-sys/Cargo.toml.orig 2021-08-20 11:11:26.873860272 -0600 2 | +++ clutter-sys/Cargo.toml 2021-08-20 11:11:33.981862505 -0600 3 | @@ -74,13 +74,13 @@ 4 | libc = "0.2" 5 | 6 | [dependencies.atk-sys] 7 | -git = "https://github.com/gtk-rs/gtk-rs-core" 8 | +git = "https://github.com/gtk-rs/gtk3-rs" 9 | 10 | [dependencies.cairo-sys-rs] 11 | git = "https://github.com/gtk-rs/gtk-rs-core" 12 | 13 | [dependencies.cogl-sys] 14 | -git = "https://github.com/gtk-rs/gtk-rs-core" 15 | +path = "../cogl-sys" 16 | 17 | [dependencies.glib-sys] 18 | git = "https://github.com/gtk-rs/gtk-rs-core" 19 | @@ -92,7 +92,7 @@ 20 | git = "https://github.com/gtk-rs/gtk-rs-core" 21 | 22 | [dependencies.json-sys] 23 | -git = "https://github.com/gtk-rs/gtk-rs-core" 24 | +path = "../json-sys" 25 | 26 | [dependencies.pango-sys] 27 | git = "https://github.com/gtk-rs/gtk-rs-core" 28 | -------------------------------------------------------------------------------- /meta/src/rectangle.rs: -------------------------------------------------------------------------------- 1 | use ffi::MetaRectangle; 2 | use glib::translate::{ 3 | FromGlibPtrNone, 4 | Uninitialized, 5 | ToGlibPtr, 6 | }; 7 | 8 | use crate::Rectangle; 9 | 10 | impl Rectangle { 11 | pub fn x(&self) -> libc::c_int { 12 | unsafe { (*self.to_glib_none().0).x } 13 | } 14 | 15 | pub fn y(&self) -> libc::c_int { 16 | unsafe { (*self.to_glib_none().0).y } 17 | } 18 | 19 | pub fn width(&self) -> libc::c_int { 20 | unsafe { (*self.to_glib_none().0).width } 21 | } 22 | 23 | pub fn height(&self) -> libc::c_int { 24 | unsafe { (*self.to_glib_none().0).height } 25 | } 26 | } 27 | 28 | impl Uninitialized for Rectangle { 29 | unsafe fn uninitialized() -> Self { 30 | //TODO: is this implementation correct? 31 | let rect = MetaRectangle { 32 | x: 0, 33 | y: 0, 34 | width: 0, 35 | height: 0, 36 | }; 37 | Self::from_glib_none(&rect as *const MetaRectangle) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /meta-sys.patch: -------------------------------------------------------------------------------- 1 | --- meta-sys/Cargo.toml.orig 2021-08-20 12:19:24.115805806 -0600 2 | +++ meta-sys/Cargo.toml 2021-08-20 12:19:41.439844322 -0600 3 | @@ -20,13 +20,13 @@ 4 | git = "https://github.com/gtk-rs/gtk-rs-core" 5 | 6 | [dependencies.clutter-sys] 7 | -git = "https://github.com/gtk-rs/gtk-rs-core" 8 | +path = "../clutter-sys" 9 | 10 | [dependencies.cogl-sys] 11 | -git = "https://github.com/gtk-rs/gtk-rs-core" 12 | +path = "../cogl-sys" 13 | 14 | [dependencies.gdesktop_enums-sys] 15 | -git = "https://github.com/gtk-rs/gtk-rs-core" 16 | +path = "../gdesktop_enums-sys" 17 | 18 | [dependencies.glib-sys] 19 | git = "https://github.com/gtk-rs/gtk-rs-core" 20 | @@ -41,13 +41,13 @@ 21 | git = "https://github.com/gtk-rs/gtk-rs-core" 22 | 23 | [dependencies.gtk-sys] 24 | -git = "https://github.com/gtk-rs/gtk-rs-core" 25 | +git = "https://github.com/gtk-rs/gtk3-rs" 26 | 27 | [dependencies.pango-sys] 28 | git = "https://github.com/gtk-rs/gtk-rs-core" 29 | 30 | [dependencies.xlib-sys] 31 | -git = "https://github.com/gtk-rs/gtk-rs-core" 32 | +path = "../xlib-sys" 33 | 34 | [build-dependencies] 35 | system-deps = "3" 36 | -------------------------------------------------------------------------------- /clutter/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "clutter" 3 | version = "0.0.1" 4 | edition = "2018" 5 | 6 | [lib] 7 | name = "clutter" 8 | 9 | [dependencies] 10 | bitflags = "1.3.2" 11 | cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core" } 12 | cogl = { path = "../cogl" } 13 | ffi = { package = "clutter-sys", path = "../clutter-sys" } 14 | glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } 15 | libc = "0.2.100" 16 | pango = { git = "https://github.com/gtk-rs/gtk-rs-core" } 17 | 18 | [features] 19 | # Force all features on by default 20 | default = ["v1_28"] 21 | v0_2 = ["ffi/v0_2"] 22 | v0_4 = ["ffi/v0_4", "v0_2"] 23 | v0_6 = ["ffi/v0_6", "v0_4"] 24 | v0_8 = ["ffi/v0_8", "v0_6"] 25 | v1_0 = ["ffi/v1_0", "v0_8"] 26 | v1_2 = ["ffi/v1_2", "v1_0"] 27 | v1_4 = ["ffi/v1_4", "v1_2"] 28 | v1_6 = ["ffi/v1_6", "v1_4"] 29 | v1_8 = ["ffi/v1_8", "v1_6"] 30 | v1_10 = ["ffi/v1_10", "v1_8"] 31 | v1_12 = ["ffi/v1_12", "v1_10"] 32 | v1_14 = ["ffi/v1_14", "v1_12"] 33 | v1_16 = ["ffi/v1_16", "v1_14"] 34 | v1_18 = ["ffi/v1_18", "v1_16"] 35 | v1_20 = ["ffi/v1_20", "v1_18"] 36 | v1_22 = ["ffi/v1_22", "v1_20"] 37 | v1_24 = ["ffi/v1_24", "v1_22"] 38 | v1_26 = ["ffi/v1_26", "v1_24"] 39 | v1_28 = ["ffi/v1_28", "v1_26"] 40 | -------------------------------------------------------------------------------- /xlib-sys/tests/constant.c: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #include "manual.h" 7 | #include 8 | 9 | #define PRINT_CONSTANT(CONSTANT_NAME) \ 10 | printf("%s;", #CONSTANT_NAME); \ 11 | printf(_Generic((CONSTANT_NAME), \ 12 | char *: "%s", \ 13 | const char *: "%s", \ 14 | char: "%c", \ 15 | signed char: "%hhd", \ 16 | unsigned char: "%hhu", \ 17 | short int: "%hd", \ 18 | unsigned short int: "%hu", \ 19 | int: "%d", \ 20 | unsigned int: "%u", \ 21 | long: "%ld", \ 22 | unsigned long: "%lu", \ 23 | long long: "%lld", \ 24 | unsigned long long: "%llu", \ 25 | float: "%f", \ 26 | double: "%f", \ 27 | long double: "%ld"), \ 28 | CONSTANT_NAME); \ 29 | printf("\n"); 30 | 31 | int main() { 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /xlib-sys/tests/layout.c: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #include "manual.h" 7 | #include 8 | #include 9 | 10 | int main() { 11 | printf("%s;%zu;%zu\n", "Atom", sizeof(Atom), alignof(Atom)); 12 | printf("%s;%zu;%zu\n", "Colormap", sizeof(Colormap), alignof(Colormap)); 13 | printf("%s;%zu;%zu\n", "Cursor", sizeof(Cursor), alignof(Cursor)); 14 | printf("%s;%zu;%zu\n", "Drawable", sizeof(Drawable), alignof(Drawable)); 15 | printf("%s;%zu;%zu\n", "GC", sizeof(GC), alignof(GC)); 16 | printf("%s;%zu;%zu\n", "KeyCode", sizeof(KeyCode), alignof(KeyCode)); 17 | printf("%s;%zu;%zu\n", "KeySym", sizeof(KeySym), alignof(KeySym)); 18 | printf("%s;%zu;%zu\n", "Picture", sizeof(Picture), alignof(Picture)); 19 | printf("%s;%zu;%zu\n", "Pixmap", sizeof(Pixmap), alignof(Pixmap)); 20 | printf("%s;%zu;%zu\n", "Time", sizeof(Time), alignof(Time)); 21 | printf("%s;%zu;%zu\n", "VisualID", sizeof(VisualID), alignof(VisualID)); 22 | printf("%s;%zu;%zu\n", "Window", sizeof(Window), alignof(Window)); 23 | printf("%s;%zu;%zu\n", "XID", sizeof(XID), alignof(XID)); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /meta/src/auto/background_group.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use glib::object::Cast; 7 | use glib::translate::*; 8 | use std::fmt; 9 | 10 | glib::wrapper! { 11 | #[doc(alias = "MetaBackgroundGroup")] 12 | pub struct BackgroundGroup(Object) @extends clutter::Actor, @implements clutter::Animatable, clutter::Container, clutter::Scriptable; 13 | 14 | match fn { 15 | type_ => || ffi::meta_background_group_get_type(), 16 | } 17 | } 18 | 19 | impl BackgroundGroup { 20 | #[doc(alias = "meta_background_group_new")] 21 | pub fn new() -> BackgroundGroup { 22 | unsafe { 23 | clutter::Actor::from_glib_none(ffi::meta_background_group_new()).unsafe_cast() 24 | } 25 | } 26 | } 27 | 28 | impl Default for BackgroundGroup { 29 | fn default() -> Self { 30 | Self::new() 31 | } 32 | } 33 | 34 | pub const NONE_BACKGROUND_GROUP: Option<&BackgroundGroup> = None; 35 | 36 | impl fmt::Display for BackgroundGroup { 37 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 38 | f.write_str("BackgroundGroup") 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /meta-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "meta-sys" 3 | version = "0.0.1" 4 | links = "\"mutter-8\"" 5 | edition = "2018" 6 | build = "build.rs" 7 | [package.metadata.system-deps.libmutter_8] 8 | name = "libmutter-8" 9 | version = "0.0" 10 | [package.metadata.docs.rs] 11 | features = ["dox"] 12 | 13 | [lib] 14 | name = "meta_sys" 15 | 16 | [dependencies] 17 | libc = "0.2" 18 | 19 | [dependencies.cairo-sys-rs] 20 | git = "https://github.com/gtk-rs/gtk-rs-core" 21 | 22 | [dependencies.clutter-sys] 23 | path = "../clutter-sys" 24 | 25 | [dependencies.cogl-sys] 26 | path = "../cogl-sys" 27 | 28 | [dependencies.gdesktop_enums-sys] 29 | path = "../gdesktop_enums-sys" 30 | 31 | [dependencies.glib-sys] 32 | git = "https://github.com/gtk-rs/gtk-rs-core" 33 | 34 | [dependencies.gio-sys] 35 | git = "https://github.com/gtk-rs/gtk-rs-core" 36 | 37 | [dependencies.gobject-sys] 38 | git = "https://github.com/gtk-rs/gtk-rs-core" 39 | 40 | [dependencies.graphene-sys] 41 | git = "https://github.com/gtk-rs/gtk-rs-core" 42 | 43 | [dependencies.gtk-sys] 44 | git = "https://github.com/gtk-rs/gtk3-rs" 45 | 46 | [dependencies.pango-sys] 47 | git = "https://github.com/gtk-rs/gtk-rs-core" 48 | 49 | [dependencies.xlib-sys] 50 | path = "../xlib-sys" 51 | 52 | [build-dependencies] 53 | system-deps = "3" 54 | 55 | [dev-dependencies] 56 | shell-words = "1.0.0" 57 | tempfile = "3" 58 | 59 | [features] 60 | dox = [] 61 | -------------------------------------------------------------------------------- /clutter/src/key_event.rs: -------------------------------------------------------------------------------- 1 | use glib::translate::{ 2 | Borrowed, 3 | FromGlib, 4 | FromGlibPtrBorrow, 5 | FromGlibPtrNone, 6 | }; 7 | use libc::c_uint; 8 | 9 | use crate::{ 10 | Actor, 11 | EventFlags, 12 | EventType, 13 | InputDevice, 14 | ModifierType, 15 | Stage, 16 | ffi::ClutterKeyEvent, 17 | }; 18 | 19 | /// Key event 20 | pub struct KeyEvent { 21 | pub type_: EventType, 22 | pub time: u32, 23 | pub flags: EventFlags, 24 | pub stage: Stage, 25 | pub source: Actor, 26 | pub modifier_state: ModifierType, 27 | pub keyval: c_uint, 28 | pub hardware_keycode: u16, 29 | pub unicode_value: u32, 30 | pub evdev_code: u32, 31 | pub device: InputDevice, 32 | } 33 | 34 | impl FromGlibPtrBorrow<*mut ClutterKeyEvent> for KeyEvent { 35 | unsafe fn from_glib_borrow(ptr: *mut ClutterKeyEvent) -> Borrowed { 36 | let glib = *ptr; 37 | Borrowed::new(KeyEvent { 38 | type_: EventType::from_glib(glib.type_), 39 | time: glib.time, 40 | flags: EventFlags::from_glib(glib.flags), 41 | stage: Stage::from_glib_none(glib.stage), 42 | source: Actor::from_glib_none(glib.source), 43 | modifier_state: ModifierType::from_glib(glib.modifier_state), 44 | keyval: glib.keyval, 45 | hardware_keycode: glib.hardware_keycode, 46 | unicode_value: glib.unicode_value, 47 | evdev_code: glib.evdev_code, 48 | device: InputDevice::from_glib_none(glib.device), 49 | }) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /json-sys/tests/layout.c: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #include "manual.h" 7 | #include 8 | #include 9 | 10 | int main() { 11 | printf("%s;%zu;%zu\n", "JsonBuilder", sizeof(JsonBuilder), alignof(JsonBuilder)); 12 | printf("%s;%zu;%zu\n", "JsonBuilderClass", sizeof(JsonBuilderClass), alignof(JsonBuilderClass)); 13 | printf("%s;%zu;%zu\n", "JsonGenerator", sizeof(JsonGenerator), alignof(JsonGenerator)); 14 | printf("%s;%zu;%zu\n", "JsonGeneratorClass", sizeof(JsonGeneratorClass), alignof(JsonGeneratorClass)); 15 | printf("%s;%zu;%zu\n", "JsonNodeType", sizeof(JsonNodeType), alignof(JsonNodeType)); 16 | printf("%s;%zu;%zu\n", "JsonObjectIter", sizeof(JsonObjectIter), alignof(JsonObjectIter)); 17 | printf("%s;%zu;%zu\n", "JsonParser", sizeof(JsonParser), alignof(JsonParser)); 18 | printf("%s;%zu;%zu\n", "JsonParserClass", sizeof(JsonParserClass), alignof(JsonParserClass)); 19 | printf("%s;%zu;%zu\n", "JsonParserError", sizeof(JsonParserError), alignof(JsonParserError)); 20 | printf("%s;%zu;%zu\n", "JsonPathError", sizeof(JsonPathError), alignof(JsonPathError)); 21 | printf("%s;%zu;%zu\n", "JsonReader", sizeof(JsonReader), alignof(JsonReader)); 22 | printf("%s;%zu;%zu\n", "JsonReaderClass", sizeof(JsonReaderClass), alignof(JsonReaderClass)); 23 | printf("%s;%zu;%zu\n", "JsonReaderError", sizeof(JsonReaderError), alignof(JsonReaderError)); 24 | printf("%s;%zu;%zu\n", "JsonSerializableIface", sizeof(JsonSerializableIface), alignof(JsonSerializableIface)); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /json-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "json-sys" 3 | version = "0.0.1" 4 | links = "\"json-glib-1.0\"" 5 | edition = "2018" 6 | build = "build.rs" 7 | [package.metadata.system-deps.json_glib_1_0] 8 | name = "json-glib-1.0" 9 | version = "0.0" 10 | 11 | [package.metadata.system-deps.json_glib_1_0.v0_4] 12 | version = "0.4" 13 | 14 | [package.metadata.system-deps.json_glib_1_0.v0_6] 15 | version = "0.6" 16 | 17 | [package.metadata.system-deps.json_glib_1_0.v0_8] 18 | version = "0.8" 19 | 20 | [package.metadata.system-deps.json_glib_1_0.v0_10] 21 | version = "0.10" 22 | 23 | [package.metadata.system-deps.json_glib_1_0.v0_12] 24 | version = "0.12" 25 | 26 | [package.metadata.system-deps.json_glib_1_0.v0_14] 27 | version = "0.14" 28 | 29 | [package.metadata.system-deps.json_glib_1_0.v0_16] 30 | version = "0.16" 31 | 32 | [package.metadata.system-deps.json_glib_1_0.v1_2] 33 | version = "1.2" 34 | 35 | [package.metadata.system-deps.json_glib_1_0.v1_4] 36 | version = "1.4" 37 | 38 | [package.metadata.system-deps.json_glib_1_0.v1_6] 39 | version = "1.6" 40 | [package.metadata.docs.rs] 41 | features = ["dox"] 42 | 43 | [lib] 44 | name = "json_sys" 45 | 46 | [dependencies] 47 | libc = "0.2" 48 | 49 | [dependencies.gio-sys] 50 | git = "https://github.com/gtk-rs/gtk-rs-core" 51 | 52 | [dependencies.glib-sys] 53 | git = "https://github.com/gtk-rs/gtk-rs-core" 54 | 55 | [dependencies.gobject-sys] 56 | git = "https://github.com/gtk-rs/gtk-rs-core" 57 | 58 | [build-dependencies] 59 | system-deps = "3" 60 | 61 | [dev-dependencies] 62 | shell-words = "1.0.0" 63 | tempfile = "3" 64 | 65 | [features] 66 | v0_4 = [] 67 | v0_6 = ["v0_4"] 68 | v0_8 = ["v0_6"] 69 | v0_10 = ["v0_8"] 70 | v0_12 = ["v0_10"] 71 | v0_14 = ["v0_12"] 72 | v0_16 = ["v0_14"] 73 | v1_2 = ["v0_16"] 74 | v1_4 = ["v1_2"] 75 | v1_6 = ["v1_4"] 76 | dox = [] 77 | -------------------------------------------------------------------------------- /meta/src/auto/stage.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Display; 7 | use glib::object::ObjectType as ObjectType_; 8 | use glib::signal::connect_raw; 9 | use glib::signal::SignalHandlerId; 10 | use glib::translate::*; 11 | use std::boxed::Box as Box_; 12 | use std::fmt; 13 | use std::mem::transmute; 14 | 15 | glib::wrapper! { 16 | #[doc(alias = "MetaStage")] 17 | pub struct Stage(Object) @extends clutter::Stage, clutter::Actor, @implements clutter::Animatable, clutter::Container, clutter::Scriptable; 18 | 19 | match fn { 20 | type_ => || ffi::meta_stage_get_type(), 21 | } 22 | } 23 | 24 | impl Stage { 25 | #[doc(alias = "meta_stage_is_focused")] 26 | pub fn is_focused(display: &Display) -> bool { 27 | unsafe { 28 | from_glib(ffi::meta_stage_is_focused(display.to_glib_none().0)) 29 | } 30 | } 31 | 32 | #[doc(alias = "actors-painted")] 33 | pub fn connect_actors_painted(&self, f: F) -> SignalHandlerId { 34 | unsafe extern "C" fn actors_painted_trampoline(this: *mut ffi::MetaStage, f: glib::ffi::gpointer) { 35 | let f: &F = &*(f as *const F); 36 | f(&from_glib_borrow(this)) 37 | } 38 | unsafe { 39 | let f: Box_ = Box_::new(f); 40 | connect_raw(self.as_ptr() as *mut _, b"actors-painted\0".as_ptr() as *const _, 41 | Some(transmute::<_, unsafe extern "C" fn()>(actors_painted_trampoline:: as *const ())), Box_::into_raw(f)) 42 | } 43 | } 44 | } 45 | 46 | impl fmt::Display for Stage { 47 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 48 | f.write_str("Stage") 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /mutter-gir-files/Clutter-8.patch: -------------------------------------------------------------------------------- 1 | --- /usr/lib/x86_64-linux-gnu/mutter-8/Clutter-8.gir 2021-08-09 09:59:52.000000000 -0600 2 | +++ mutter-gir-files/Clutter-8.gir 2021-08-20 15:45:31.711844483 -0600 3 | @@ -49161,36 +49161,6 @@ 4 | 5 | 6 | 7 | - 11 | - Adds a region described by a Cogl primitive to the @node. 14 | - 15 | -This function acquires a reference on @primitive, so it is safe 16 | -to call cogl_object_unref() when it returns. 17 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - a #ClutterPaintNode 27 | - 28 | - 29 | - 30 | - a Cogl primitive 33 | - 34 | - 35 | - 36 | - 37 | 40 | -------------------------------------------------------------------------------- /meta/src/auto/key_binding.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use glib::translate::*; 7 | 8 | glib::wrapper! { 9 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 10 | pub struct KeyBinding(Boxed); 11 | 12 | match fn { 13 | copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::meta_key_binding_get_type(), ptr as *mut _) as *mut ffi::MetaKeyBinding, 14 | free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::meta_key_binding_get_type(), ptr as *mut _), 15 | type_ => || ffi::meta_key_binding_get_type(), 16 | } 17 | } 18 | 19 | impl KeyBinding { 20 | #[doc(alias = "meta_key_binding_get_mask")] 21 | #[doc(alias = "get_mask")] 22 | pub fn mask(&self) -> u32 { 23 | unsafe { 24 | ffi::meta_key_binding_get_mask(mut_override(self.to_glib_none().0)) 25 | } 26 | } 27 | 28 | //#[doc(alias = "meta_key_binding_get_modifiers")] 29 | //#[doc(alias = "get_modifiers")] 30 | //pub fn modifiers(&self) -> /*Ignored*/VirtualModifier { 31 | // unsafe { TODO: call ffi:meta_key_binding_get_modifiers() } 32 | //} 33 | 34 | #[doc(alias = "meta_key_binding_get_name")] 35 | #[doc(alias = "get_name")] 36 | pub fn name(&self) -> Option { 37 | unsafe { 38 | from_glib_none(ffi::meta_key_binding_get_name(mut_override(self.to_glib_none().0))) 39 | } 40 | } 41 | 42 | #[doc(alias = "meta_key_binding_is_builtin")] 43 | pub fn is_builtin(&self) -> bool { 44 | unsafe { 45 | from_glib(ffi::meta_key_binding_is_builtin(mut_override(self.to_glib_none().0))) 46 | } 47 | } 48 | 49 | #[doc(alias = "meta_key_binding_is_reversed")] 50 | pub fn is_reversed(&self) -> bool { 51 | unsafe { 52 | from_glib(ffi::meta_key_binding_is_reversed(mut_override(self.to_glib_none().0))) 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /cogl-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cogl-sys" 3 | version = "0.0.1" 4 | links = "\"mutter-cogl-8\"" 5 | edition = "2018" 6 | build = "build.rs" 7 | [package.metadata.system-deps.mutter_cogl_8] 8 | name = "mutter-cogl-8" 9 | version = "0.0" 10 | 11 | [package.metadata.system-deps.mutter_cogl_8.v0_8] 12 | version = "0.8" 13 | 14 | [package.metadata.system-deps.mutter_cogl_8.v0_10] 15 | version = "0.10" 16 | 17 | [package.metadata.system-deps.mutter_cogl_8.v1_0] 18 | version = "1.0" 19 | 20 | [package.metadata.system-deps.mutter_cogl_8.v1_2] 21 | version = "1.2" 22 | 23 | [package.metadata.system-deps.mutter_cogl_8.v1_4] 24 | version = "1.4" 25 | 26 | [package.metadata.system-deps.mutter_cogl_8.v1_6] 27 | version = "1.6" 28 | 29 | [package.metadata.system-deps.mutter_cogl_8.v1_8] 30 | version = "1.8" 31 | 32 | [package.metadata.system-deps.mutter_cogl_8.v1_10] 33 | version = "1.10" 34 | 35 | [package.metadata.system-deps.mutter_cogl_8.v1_14] 36 | version = "1.14" 37 | 38 | [package.metadata.system-deps.mutter_cogl_8.v1_16] 39 | version = "1.16" 40 | 41 | [package.metadata.system-deps.mutter_cogl_8.v1_18] 42 | version = "1.18" 43 | 44 | [package.metadata.system-deps.mutter_cogl_8.v1_20] 45 | version = "1.20" 46 | 47 | [package.metadata.system-deps.mutter_cogl_8.v2_0] 48 | version = "2.0" 49 | [package.metadata.docs.rs] 50 | features = ["dox"] 51 | 52 | [lib] 53 | name = "cogl_sys" 54 | 55 | [dependencies] 56 | libc = "0.2" 57 | 58 | [dependencies.cairo-sys-rs] 59 | git = "https://github.com/gtk-rs/gtk-rs-core" 60 | 61 | [dependencies.glib-sys] 62 | git = "https://github.com/gtk-rs/gtk-rs-core" 63 | 64 | [dependencies.gobject-sys] 65 | git = "https://github.com/gtk-rs/gtk-rs-core" 66 | 67 | [dependencies.graphene-sys] 68 | git = "https://github.com/gtk-rs/gtk-rs-core" 69 | 70 | [build-dependencies] 71 | system-deps = "3" 72 | 73 | [dev-dependencies] 74 | shell-words = "1.0.0" 75 | tempfile = "3" 76 | 77 | [features] 78 | v0_8 = [] 79 | v0_10 = ["v0_8"] 80 | v1_0 = ["v0_10"] 81 | v1_2 = ["v1_0"] 82 | v1_4 = ["v1_2"] 83 | v1_6 = ["v1_4"] 84 | v1_8 = ["v1_6"] 85 | v1_10 = ["v1_8"] 86 | v1_14 = ["v1_10"] 87 | v1_16 = ["v1_14"] 88 | v1_18 = ["v1_16"] 89 | v1_20 = ["v1_18"] 90 | v2_0 = ["v1_20"] 91 | dox = [] 92 | -------------------------------------------------------------------------------- /clutter/src/auto/constraint.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Actor; 7 | use crate::ActorMeta; 8 | use crate::Orientation; 9 | use glib::object::IsA; 10 | use glib::translate::*; 11 | use std::fmt; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "ClutterConstraint")] 15 | pub struct Constraint(Object) @extends ActorMeta; 16 | 17 | match fn { 18 | type_ => || ffi::clutter_constraint_get_type(), 19 | } 20 | } 21 | 22 | pub const NONE_CONSTRAINT: Option<&Constraint> = None; 23 | 24 | /// Trait containing all [`struct@Constraint`] methods. 25 | /// 26 | /// # Implementors 27 | /// 28 | /// [`AlignConstraint`][struct@crate::AlignConstraint], [`Constraint`][struct@crate::Constraint] 29 | pub trait ConstraintExt: 'static { 30 | /// Asks the `self` to update the size request of a [`Actor`][crate::Actor]. 31 | /// ## `actor` 32 | /// a [`Actor`][crate::Actor] 33 | /// ## `direction` 34 | /// a [`Orientation`][crate::Orientation] 35 | /// ## `for_size` 36 | /// the size in the opposite direction 37 | /// ## `minimum_size` 38 | /// the minimum size to modify 39 | /// ## `natural_size` 40 | /// the natural size to modify 41 | #[doc(alias = "clutter_constraint_update_preferred_size")] 42 | fn update_preferred_size>(&self, actor: &P, direction: Orientation, for_size: f32, minimum_size: &mut f32, natural_size: &mut f32); 43 | } 44 | 45 | impl> ConstraintExt for O { 46 | fn update_preferred_size>(&self, actor: &P, direction: Orientation, for_size: f32, minimum_size: &mut f32, natural_size: &mut f32) { 47 | unsafe { 48 | ffi::clutter_constraint_update_preferred_size(self.as_ref().to_glib_none().0, actor.as_ref().to_glib_none().0, direction.into_glib(), for_size, minimum_size, natural_size); 49 | } 50 | } 51 | } 52 | 53 | impl fmt::Display for Constraint { 54 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 55 | f.write_str("Constraint") 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /clutter/Gir.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "Clutter" 3 | version = "8" 4 | target_path = "." 5 | work_mode = "normal" 6 | 7 | generate = [ 8 | "Clutter.Action", 9 | "Clutter.Actor", 10 | "Clutter.ActorAlign", 11 | "Clutter.ActorFlags", 12 | "Clutter.ActorMeta", 13 | "Clutter.AlignAxis", 14 | "Clutter.AlignConstraint", 15 | "Clutter.Animatable", 16 | "Clutter.AnimationMode", 17 | "Clutter.Backend", 18 | "Clutter.Canvas", 19 | "Clutter.Clone", 20 | "Clutter.Constraint", 21 | "Clutter.Container", 22 | "Clutter.Content", 23 | "Clutter.ContentGravity", 24 | "Clutter.Effect", 25 | "Clutter.EventFlags", 26 | "Clutter.EventType", 27 | "Clutter.Image", 28 | "Clutter.InputDevice", 29 | "Clutter.InputFocus", 30 | "Clutter.InputMethod", 31 | "Clutter.ModifierType", 32 | "Clutter.Orientation", 33 | "Clutter.RequestMode", 34 | "Clutter.ScalingFilter", 35 | "Clutter.Scriptable", 36 | "Clutter.StaticColor", 37 | "Clutter.Text", 38 | "Clutter.TextDirection", 39 | ] 40 | 41 | manual = [ 42 | "cairo.Context", 43 | "cairo.FontOptions", 44 | "cairo.RectangleInt", 45 | "Clutter.KeyEvent", 46 | "Cogl.PixelFormat", 47 | "Cogl.Texture", 48 | "GLib.Bytes", 49 | "GLib.DestroyNotify", 50 | "GLib.Error", 51 | "GLib.SourceFunc", 52 | "Pango.Alignment", 53 | "Pango.AttrList", 54 | "Pango.Context", 55 | "Pango.EllipsizeMode", 56 | "Pango.FontDescription", 57 | "Pango.FontMap", 58 | "Pango.Layout", 59 | "Pango.WrapMode", 60 | ] 61 | 62 | [[object]] 63 | name = "Clutter.*" 64 | status = "generate" 65 | [[object.constant]] 66 | pattern = "*" 67 | ignore = true 68 | [[object.function]] 69 | name = "cairo_clear" 70 | ignore = true 71 | [[object.function]] 72 | name = "cairo_set_source_color" 73 | ignore = true 74 | 75 | [[object]] 76 | name = "Clutter.Color" 77 | status = "generate" 78 | [[object.function]] 79 | name = "equal" 80 | ignore = true 81 | [[object.function]] 82 | name = "hash" 83 | ignore = true 84 | 85 | [[object]] 86 | name = "Clutter.Stage" 87 | status = "generate" 88 | [[object.function]] 89 | name = "capture_into" 90 | ignore = true 91 | [[object.function]] 92 | name = "read_pixels" 93 | ignore = true 94 | 95 | [[object]] 96 | name = "Clutter.TextBuffer" 97 | status = "generate" 98 | [[object.function]] 99 | name = "new_with_text" 100 | ignore = true 101 | -------------------------------------------------------------------------------- /meta/src/auto/background_actor.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Display; 7 | use glib::object::Cast; 8 | use glib::object::ObjectType as ObjectType_; 9 | use glib::translate::*; 10 | use glib::StaticType; 11 | use std::fmt; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "MetaBackgroundActor")] 15 | pub struct BackgroundActor(Object) @extends clutter::Actor, @implements clutter::Animatable, clutter::Container, clutter::Scriptable; 16 | 17 | match fn { 18 | type_ => || ffi::meta_background_actor_get_type(), 19 | } 20 | } 21 | 22 | impl BackgroundActor { 23 | /// Creates a new actor to draw the background for the given monitor. 24 | /// ## `monitor` 25 | /// Index of the monitor for which to draw the background 26 | /// 27 | /// # Returns 28 | /// 29 | /// the newly created background actor 30 | #[doc(alias = "meta_background_actor_new")] 31 | pub fn new(display: &Display, monitor: i32) -> BackgroundActor { 32 | unsafe { 33 | clutter::Actor::from_glib_none(ffi::meta_background_actor_new(display.to_glib_none().0, monitor)).unsafe_cast() 34 | } 35 | } 36 | 37 | #[doc(alias = "meta-display")] 38 | pub fn meta_display(&self) -> Option { 39 | unsafe { 40 | let mut value = glib::Value::from_type(::static_type()); 41 | glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"meta-display\0".as_ptr() as *const _, value.to_glib_none_mut().0); 42 | value.get().expect("Return Value for property `meta-display` getter") 43 | } 44 | } 45 | 46 | pub fn monitor(&self) -> i32 { 47 | unsafe { 48 | let mut value = glib::Value::from_type(::static_type()); 49 | glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"monitor\0".as_ptr() as *const _, value.to_glib_none_mut().0); 50 | value.get().expect("Return Value for property `monitor` getter") 51 | } 52 | } 53 | } 54 | 55 | impl fmt::Display for BackgroundActor { 56 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 57 | f.write_str("BackgroundActor") 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /meta/Gir.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | library = "Meta" 3 | version = "8" 4 | target_path = "." 5 | work_mode = "normal" 6 | 7 | generate = [ 8 | "Meta.Backend", 9 | "Meta.Background", 10 | "Meta.BackgroundActor", 11 | "Meta.BackgroundContent", 12 | "Meta.BackgroundGroup", 13 | "Meta.Compositor", 14 | "Meta.Cursor", 15 | "Meta.Direction", 16 | "Meta.DisplayCorner", 17 | "Meta.DisplayDirection", 18 | "Meta.ExitCode", 19 | "Meta.FrameType", 20 | "Meta.GrabOp", 21 | "Meta.KeyBindingFlags", 22 | "Meta.MaximizeFlags", 23 | "Meta.ModalOptions", 24 | "Meta.MonitorManager", 25 | "Meta.MotionDirection", 26 | "Meta.PadActionType", 27 | "Meta.Plugin", 28 | "Meta.Rectangle", 29 | "Meta.Stage", 30 | "Meta.Selection", 31 | "Meta.SelectionSource", 32 | "Meta.SelectionType", 33 | "Meta.StackLayer", 34 | "Meta.TabList", 35 | "Meta.WindowClientType", 36 | "Meta.WindowGroup", 37 | "Meta.WindowType", 38 | "Meta.Workspace", 39 | "Meta.WorkspaceManager", 40 | ] 41 | 42 | manual = [ 43 | "cairo.RectangleInt", 44 | "cairo.Region", 45 | "cairo.Surface", 46 | "Clutter.Actor", 47 | "Clutter.Animatable", 48 | "Clutter.Color", 49 | "Clutter.Container", 50 | "Clutter.Content", 51 | "Clutter.InputDevice", 52 | "Clutter.KeyEvent", 53 | "Clutter.ModifierType", 54 | "Clutter.Scriptable", 55 | "Clutter.Stage", 56 | "GDesktopEnums.BackgroundStyle", 57 | "GLib.Error", 58 | "GLib.Pid", 59 | "Gio.Cancellable", 60 | "Gio.File", 61 | "Gio.InputStream", 62 | "Gio.OutputStream", 63 | "Gio.Settings", 64 | "Gio.Task", 65 | "GObject.Object", 66 | "Pango.FontDescription", 67 | ] 68 | 69 | [[object]] 70 | name = "Meta.*" 71 | status = "generate" 72 | [[object.constant]] 73 | pattern = "*" 74 | ignore = true 75 | [[object.function]] 76 | name = "rect" 77 | ignore = true 78 | 79 | [[object]] 80 | name = "Meta.Display" 81 | status = "generate" 82 | [[object.function]] 83 | name = "add_keybinding" 84 | ignore = true 85 | [[object.function]] 86 | name = "sort_windows_by_stacking" 87 | ignore = true 88 | 89 | [[object]] 90 | name = "Meta.KeyBinding" 91 | status = "generate" 92 | ref_mode = "ref-immut" 93 | 94 | [[object]] 95 | name = "Meta.Window" 96 | status = "generate" 97 | [[object.function]] 98 | name = "set_icon_geometry" 99 | ignore = true 100 | 101 | [[object]] 102 | name = "Meta.WindowActor" 103 | status = "generate" 104 | [[object.function]] 105 | name = "get_image" 106 | ignore = true 107 | -------------------------------------------------------------------------------- /meta/src/auto/mod.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | mod backend; 7 | pub use self::backend::{Backend}; 8 | 9 | mod background; 10 | pub use self::background::{Background}; 11 | 12 | mod background_actor; 13 | pub use self::background_actor::{BackgroundActor}; 14 | 15 | mod background_content; 16 | pub use self::background_content::{BackgroundContent}; 17 | 18 | mod background_group; 19 | pub use self::background_group::{BackgroundGroup, NONE_BACKGROUND_GROUP}; 20 | 21 | mod compositor; 22 | pub use self::compositor::{Compositor}; 23 | 24 | mod display; 25 | pub use self::display::{Display}; 26 | 27 | mod monitor_manager; 28 | pub use self::monitor_manager::{MonitorManager}; 29 | 30 | mod plugin; 31 | pub use self::plugin::{Plugin, NONE_PLUGIN}; 32 | 33 | mod selection; 34 | pub use self::selection::{Selection}; 35 | 36 | mod selection_source; 37 | pub use self::selection_source::{SelectionSource, NONE_SELECTION_SOURCE}; 38 | 39 | mod stage; 40 | pub use self::stage::{Stage}; 41 | 42 | mod window; 43 | pub use self::window::{Window}; 44 | 45 | mod window_actor; 46 | pub use self::window_actor::{WindowActor}; 47 | 48 | mod window_group; 49 | pub use self::window_group::{WindowGroup}; 50 | 51 | mod workspace; 52 | pub use self::workspace::{Workspace}; 53 | 54 | mod workspace_manager; 55 | pub use self::workspace_manager::{WorkspaceManager}; 56 | 57 | mod key_binding; 58 | pub use self::key_binding::KeyBinding; 59 | 60 | mod rectangle; 61 | pub use self::rectangle::Rectangle; 62 | 63 | mod enums; 64 | pub use self::enums::Cursor; 65 | pub use self::enums::DisplayCorner; 66 | pub use self::enums::DisplayDirection; 67 | pub use self::enums::ExitCode; 68 | pub use self::enums::FrameType; 69 | pub use self::enums::GrabOp; 70 | pub use self::enums::MotionDirection; 71 | pub use self::enums::PadActionType; 72 | pub use self::enums::SelectionType; 73 | pub use self::enums::StackLayer; 74 | pub use self::enums::TabList; 75 | pub use self::enums::WindowClientType; 76 | pub use self::enums::WindowType; 77 | 78 | mod flags; 79 | pub use self::flags::Direction; 80 | pub use self::flags::KeyBindingFlags; 81 | pub use self::flags::MaximizeFlags; 82 | pub use self::flags::ModalOptions; 83 | 84 | pub mod functions; 85 | 86 | #[doc(hidden)] 87 | pub mod traits { 88 | pub use super::plugin::PluginExt; 89 | pub use super::selection_source::SelectionSourceExt; 90 | } 91 | -------------------------------------------------------------------------------- /json-sys/tests/constant.c: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #include "manual.h" 7 | #include 8 | 9 | #define PRINT_CONSTANT(CONSTANT_NAME) \ 10 | printf("%s;", #CONSTANT_NAME); \ 11 | printf(_Generic((CONSTANT_NAME), \ 12 | char *: "%s", \ 13 | const char *: "%s", \ 14 | char: "%c", \ 15 | signed char: "%hhd", \ 16 | unsigned char: "%hhu", \ 17 | short int: "%hd", \ 18 | unsigned short int: "%hu", \ 19 | int: "%d", \ 20 | unsigned int: "%u", \ 21 | long: "%ld", \ 22 | unsigned long: "%lu", \ 23 | long long: "%lld", \ 24 | unsigned long long: "%llu", \ 25 | float: "%f", \ 26 | double: "%f", \ 27 | long double: "%ld"), \ 28 | CONSTANT_NAME); \ 29 | printf("\n"); 30 | 31 | int main() { 32 | PRINT_CONSTANT(JSON_MAJOR_VERSION); 33 | PRINT_CONSTANT(JSON_MICRO_VERSION); 34 | PRINT_CONSTANT(JSON_MINOR_VERSION); 35 | PRINT_CONSTANT((gint) JSON_NODE_ARRAY); 36 | PRINT_CONSTANT((gint) JSON_NODE_NULL); 37 | PRINT_CONSTANT((gint) JSON_NODE_OBJECT); 38 | PRINT_CONSTANT((gint) JSON_NODE_VALUE); 39 | PRINT_CONSTANT((gint) JSON_PARSER_ERROR_EMPTY_MEMBER_NAME); 40 | PRINT_CONSTANT((gint) JSON_PARSER_ERROR_INVALID_BAREWORD); 41 | PRINT_CONSTANT((gint) JSON_PARSER_ERROR_INVALID_DATA); 42 | PRINT_CONSTANT((gint) JSON_PARSER_ERROR_MISSING_COLON); 43 | PRINT_CONSTANT((gint) JSON_PARSER_ERROR_MISSING_COMMA); 44 | PRINT_CONSTANT((gint) JSON_PARSER_ERROR_PARSE); 45 | PRINT_CONSTANT((gint) JSON_PARSER_ERROR_TRAILING_COMMA); 46 | PRINT_CONSTANT((gint) JSON_PARSER_ERROR_UNKNOWN); 47 | PRINT_CONSTANT((gint) JSON_PATH_ERROR_INVALID_QUERY); 48 | PRINT_CONSTANT((gint) JSON_READER_ERROR_INVALID_INDEX); 49 | PRINT_CONSTANT((gint) JSON_READER_ERROR_INVALID_MEMBER); 50 | PRINT_CONSTANT((gint) JSON_READER_ERROR_INVALID_NODE); 51 | PRINT_CONSTANT((gint) JSON_READER_ERROR_INVALID_TYPE); 52 | PRINT_CONSTANT((gint) JSON_READER_ERROR_NO_ARRAY); 53 | PRINT_CONSTANT((gint) JSON_READER_ERROR_NO_OBJECT); 54 | PRINT_CONSTANT((gint) JSON_READER_ERROR_NO_VALUE); 55 | PRINT_CONSTANT(JSON_VERSION_S); 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | pushd mutter-gir-files 6 | rm -fv *.gir 7 | cp -v /usr/share/gir-1.0/GDesktopEnums-3.0.gir . && patch -p1 < GDesktopEnums-3.0.patch 8 | cp -v /usr/share/gir-1.0/Json-1.0.gir . 9 | cp -v /usr/share/gir-1.0/xlib-2.0.gir . && patch -p1 < xlib-2.0.patch 10 | cp -v /usr/lib/x86_64-linux-gnu/mutter-8/Cogl-8.gir . && patch -p1 < Cogl-8.patch 11 | cp -v /usr/lib/x86_64-linux-gnu/mutter-8/CoglPango-8.gir . 12 | cp -v /usr/lib/x86_64-linux-gnu/mutter-8/Clutter-8.gir . && patch -p1 < Clutter-8.patch 13 | cp -v /usr/lib/x86_64-linux-gnu/mutter-8/Meta-8.gir . && patch -p1 < Meta-8.patch 14 | popd 15 | 16 | # Packages to generate, listed in dependency order 17 | sys_pkgs=( 18 | xlib-sys 19 | cogl-sys 20 | json-sys 21 | clutter-sys 22 | gdesktop_enums-sys 23 | meta-sys 24 | ) 25 | 26 | for pkg in "${sys_pkgs[@]}" 27 | do 28 | # Uncomment to rebuild all automatically generated files 29 | #rm -rfv "${pkg}" 30 | if [ ! -d "${pkg}" ] 31 | then 32 | cargo run --release --manifest-path gir/Cargo.toml -- \ 33 | --config "${pkg}.toml" \ 34 | --girs-directories mutter-gir-files \ 35 | --girs-directories gir-files 36 | if [ -f "${pkg}.patch" ] 37 | then 38 | pushd "${pkg}" 39 | patch -p1 < "../${pkg}.patch" 40 | popd 41 | fi 42 | fi 43 | cargo build --release --manifest-path "${pkg}/Cargo.toml" --all-features 44 | done 45 | 46 | rust_pkgs=( 47 | cogl 48 | clutter 49 | gdesktop_enums 50 | meta 51 | ) 52 | 53 | for pkg in "${rust_pkgs[@]}" 54 | do 55 | rm -rfv "${pkg}/comments.md" "${pkg}/src/auto" 56 | cargo run --release --manifest-path gir/Cargo.toml -- \ 57 | --config "${pkg}/Gir.toml" \ 58 | --girs-directories mutter-gir-files \ 59 | --girs-directories gir-files 60 | cargo run --release --manifest-path gir/Cargo.toml -- \ 61 | --config "${pkg}/Gir.toml" \ 62 | --girs-directories mutter-gir-files \ 63 | --girs-directories gir-files \ 64 | --mode doc \ 65 | --doc-target-path "comments.md" 66 | rustdoc-stripper --regenerate --comment-file "${pkg}/comments.md" --dir "${pkg}/src" --ignore-doc-commented 67 | if [ "${pkg}" != "gdesktop_enums" ] 68 | then 69 | cargo run --release --manifest-path gir/Cargo.toml -- \ 70 | --config "${pkg}/Gir.toml" \ 71 | --girs-directories mutter-gir-files \ 72 | --girs-directories gir-files \ 73 | --mode not_bound 74 | fi 75 | cargo build --release --manifest-path "${pkg}/Cargo.toml" --all-features 76 | done 77 | -------------------------------------------------------------------------------- /mutter-gir-files/Meta-8.patch: -------------------------------------------------------------------------------- 1 | --- /usr/lib/x86_64-linux-gnu/mutter-8/Meta-8.gir 2021-08-09 09:59:52.000000000 -0600 2 | +++ mutter-gir-files/Meta-8.gir 2021-08-20 12:21:58.176148060 -0600 3 | @@ -15,6 +15,7 @@ 4 | 5 | 6 | 7 | + 8 | the #MetaGpu 15 | - 16 | + 17 | 18 | 19 | 20 | @@ -4745,7 +4746,7 @@ 21 | a X event 24 | - 25 | + 26 | 27 | 28 | 29 | @@ -6177,7 +6178,7 @@ 30 | a #ClutterKeyEvent 33 | - 34 | + 35 | 36 | 37 | 40 | 41 | 42 | - 44 | - 45 | - 46 | - 47 | - 48 | - 49 | - 50 | - 51 | - 52 | - 53 | - 54 | - 55 | - 56 | - 57 | 59 | 60 | -------------------------------------------------------------------------------- /mutter-gir-files/xlib-2.0.gir: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /gdesktop_enums/src/auto/enums.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use glib::translate::*; 7 | use std::fmt; 8 | 9 | #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] 10 | #[derive(Clone, Copy)] 11 | #[non_exhaustive] 12 | #[doc(alias = "GDesktopBackgroundStyle")] 13 | pub enum BackgroundStyle { 14 | #[doc(alias = "G_DESKTOP_BACKGROUND_STYLE_NONE")] 15 | None, 16 | #[doc(alias = "G_DESKTOP_BACKGROUND_STYLE_WALLPAPER")] 17 | Wallpaper, 18 | #[doc(alias = "G_DESKTOP_BACKGROUND_STYLE_CENTERED")] 19 | Centered, 20 | #[doc(alias = "G_DESKTOP_BACKGROUND_STYLE_SCALED")] 21 | Scaled, 22 | #[doc(alias = "G_DESKTOP_BACKGROUND_STYLE_STRETCHED")] 23 | Stretched, 24 | #[doc(alias = "G_DESKTOP_BACKGROUND_STYLE_ZOOM")] 25 | Zoom, 26 | #[doc(alias = "G_DESKTOP_BACKGROUND_STYLE_SPANNED")] 27 | Spanned, 28 | #[doc(hidden)] 29 | __Unknown(i32), 30 | } 31 | 32 | impl fmt::Display for BackgroundStyle { 33 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 34 | write!(f, "BackgroundStyle::{}", match *self { 35 | Self::None => "None", 36 | Self::Wallpaper => "Wallpaper", 37 | Self::Centered => "Centered", 38 | Self::Scaled => "Scaled", 39 | Self::Stretched => "Stretched", 40 | Self::Zoom => "Zoom", 41 | Self::Spanned => "Spanned", 42 | _ => "Unknown", 43 | }) 44 | } 45 | } 46 | 47 | #[doc(hidden)] 48 | impl IntoGlib for BackgroundStyle { 49 | type GlibType = ffi::GDesktopBackgroundStyle; 50 | 51 | fn into_glib(self) -> ffi::GDesktopBackgroundStyle { 52 | match self { 53 | Self::None => ffi::G_DESKTOP_BACKGROUND_STYLE_NONE, 54 | Self::Wallpaper => ffi::G_DESKTOP_BACKGROUND_STYLE_WALLPAPER, 55 | Self::Centered => ffi::G_DESKTOP_BACKGROUND_STYLE_CENTERED, 56 | Self::Scaled => ffi::G_DESKTOP_BACKGROUND_STYLE_SCALED, 57 | Self::Stretched => ffi::G_DESKTOP_BACKGROUND_STYLE_STRETCHED, 58 | Self::Zoom => ffi::G_DESKTOP_BACKGROUND_STYLE_ZOOM, 59 | Self::Spanned => ffi::G_DESKTOP_BACKGROUND_STYLE_SPANNED, 60 | Self::__Unknown(value) => value, 61 | } 62 | } 63 | } 64 | 65 | #[doc(hidden)] 66 | impl FromGlib for BackgroundStyle { 67 | unsafe fn from_glib(value: ffi::GDesktopBackgroundStyle) -> Self { 68 | match value { 69 | ffi::G_DESKTOP_BACKGROUND_STYLE_NONE => Self::None, 70 | ffi::G_DESKTOP_BACKGROUND_STYLE_WALLPAPER => Self::Wallpaper, 71 | ffi::G_DESKTOP_BACKGROUND_STYLE_CENTERED => Self::Centered, 72 | ffi::G_DESKTOP_BACKGROUND_STYLE_SCALED => Self::Scaled, 73 | ffi::G_DESKTOP_BACKGROUND_STYLE_STRETCHED => Self::Stretched, 74 | ffi::G_DESKTOP_BACKGROUND_STYLE_ZOOM => Self::Zoom, 75 | ffi::G_DESKTOP_BACKGROUND_STYLE_SPANNED => Self::Spanned, 76 | value => Self::__Unknown(value), 77 | } 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /meta/src/display.rs: -------------------------------------------------------------------------------- 1 | use glib::{ 2 | object::IsA, 3 | translate::*, 4 | }; 5 | use std::boxed::Box as Box_; 6 | 7 | use crate::{ 8 | Display, 9 | KeyBinding, 10 | KeyBindingFlags, 11 | Window, 12 | }; 13 | 14 | impl Display { 15 | /// Add a keybinding at runtime. The key `name` in `schema` needs to be of 16 | /// type `G_VARIANT_TYPE_STRING_ARRAY`, with each string describing a 17 | /// keybinding in the form of "<Control>a" or "<Shift><Alt>F1". The parser 18 | /// is fairly liberal and allows lower or upper case, and also abbreviations 19 | /// such as "<Ctl>" and "<Ctrl>". If the key is set to the empty list or a 20 | /// list with a single element of either "" or "disabled", the keybinding is 21 | /// disabled. 22 | /// 23 | /// Use [`remove_keybinding()`][Self::remove_keybinding()] to remove the binding. 24 | /// ## `name` 25 | /// the binding's name 26 | /// ## `settings` 27 | /// the [`gio::Settings`][crate::gio::Settings] object where `name` is stored 28 | /// ## `flags` 29 | /// flags to specify binding details 30 | /// ## `handler` 31 | /// function to run when the keybinding is invoked 32 | /// ## `free_data` 33 | /// function to free `user_data` 34 | /// 35 | /// # Returns 36 | /// 37 | /// the corresponding keybinding action if the keybinding was 38 | /// added successfully, otherwise `META_KEYBINDING_ACTION_NONE` 39 | #[doc(alias = "meta_display_add_keybinding")] 40 | pub fn add_keybinding, Q: Fn(&Display, Option<&Window>, Option<&clutter::KeyEvent>, &KeyBinding) + 'static>(&self, name: &str, settings: &P, flags: KeyBindingFlags, handler: Q) -> u32 { 41 | let handler_data: Box_ = Box_::new(handler); 42 | unsafe extern "C" fn handler_func, Q: Fn(&Display, Option<&Window>, Option<&clutter::KeyEvent>, &KeyBinding) + 'static>(display: *mut ffi::MetaDisplay, window: *mut ffi::MetaWindow, event: *mut clutter::ffi::ClutterKeyEvent, binding: *mut ffi::MetaKeyBinding, user_data: glib::ffi::gpointer) { 43 | let display = from_glib_borrow(display); 44 | let window: Borrowed> = from_glib_borrow(window); 45 | let event: Borrowed> = from_glib_borrow(event); 46 | let binding = from_glib_borrow(binding); 47 | let callback: &Q = &*(user_data as *mut _); 48 | (*callback)(&display, window.as_ref().as_ref(), event.as_ref().as_ref(), &binding); 49 | } 50 | let handler = Some(handler_func:: as _); 51 | unsafe extern "C" fn free_data_func, Q: Fn(&Display, Option<&Window>, Option<&clutter::KeyEvent>, &KeyBinding) + 'static>(data: glib::ffi::gpointer) { 52 | let _callback: Box_ = Box_::from_raw(data as *mut _); 53 | } 54 | let destroy_call6 = Some(free_data_func:: as _); 55 | let super_callback0: Box_ = handler_data; 56 | unsafe { 57 | ffi::meta_display_add_keybinding(self.to_glib_none().0, name.to_glib_none().0, settings.as_ref().to_glib_none().0, flags.into_glib(), handler, Box_::into_raw(super_callback0) as *mut _, destroy_call6) 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /clutter/src/auto/scriptable.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use glib::object::IsA; 7 | use glib::translate::*; 8 | use std::fmt; 9 | 10 | glib::wrapper! { 11 | #[doc(alias = "ClutterScriptable")] 12 | pub struct Scriptable(Interface); 13 | 14 | match fn { 15 | type_ => || ffi::clutter_scriptable_get_type(), 16 | } 17 | } 18 | 19 | pub const NONE_SCRIPTABLE: Option<&Scriptable> = None; 20 | 21 | /// Trait containing all [`struct@Scriptable`] methods. 22 | /// 23 | /// # Implementors 24 | /// 25 | /// [`Actor`][struct@crate::Actor], [`Clone`][struct@crate::Clone], [`Scriptable`][struct@crate::Scriptable], [`Stage`][struct@crate::Stage], [`Text`][struct@crate::Text] 26 | pub trait ScriptableExt: 'static { 27 | /// Retrieves the id of `self` set using [`set_id()`][Self::set_id()]. 28 | /// 29 | /// # Returns 30 | /// 31 | /// the id of the object. The returned string is owned by 32 | /// the scriptable object and should never be modified of freed 33 | #[doc(alias = "clutter_scriptable_get_id")] 34 | #[doc(alias = "get_id")] 35 | fn id(&self) -> Option; 36 | 37 | //#[doc(alias = "clutter_scriptable_parse_custom_node")] 38 | //fn parse_custom_node(&self, script: /*Ignored*/&Script, value: /*Ignored*/&mut glib::Value, name: &str, node: /*Ignored*/&json::Node) -> bool; 39 | 40 | //#[doc(alias = "clutter_scriptable_set_custom_property")] 41 | //fn set_custom_property(&self, script: /*Ignored*/&Script, name: &str, value: /*Ignored*/&glib::Value); 42 | 43 | /// Sets `id_` as the unique Clutter script it for this instance of 44 | /// `ClutterScriptableIface`. 45 | /// 46 | /// This name can be used by user interface designer applications to 47 | /// define a unique name for an object constructable using the UI 48 | /// definition language parsed by `ClutterScript`. 49 | /// ## `id_` 50 | /// the `ClutterScript` id of the object 51 | #[doc(alias = "clutter_scriptable_set_id")] 52 | fn set_id(&self, id_: &str); 53 | } 54 | 55 | impl> ScriptableExt for O { 56 | fn id(&self) -> Option { 57 | unsafe { 58 | from_glib_none(ffi::clutter_scriptable_get_id(self.as_ref().to_glib_none().0)) 59 | } 60 | } 61 | 62 | //fn parse_custom_node(&self, script: /*Ignored*/&Script, value: /*Ignored*/&mut glib::Value, name: &str, node: /*Ignored*/&json::Node) -> bool { 63 | // unsafe { TODO: call ffi:clutter_scriptable_parse_custom_node() } 64 | //} 65 | 66 | //fn set_custom_property(&self, script: /*Ignored*/&Script, name: &str, value: /*Ignored*/&glib::Value) { 67 | // unsafe { TODO: call ffi:clutter_scriptable_set_custom_property() } 68 | //} 69 | 70 | fn set_id(&self, id_: &str) { 71 | unsafe { 72 | ffi::clutter_scriptable_set_id(self.as_ref().to_glib_none().0, id_.to_glib_none().0); 73 | } 74 | } 75 | } 76 | 77 | impl fmt::Display for Scriptable { 78 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 79 | f.write_str("Scriptable") 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /clutter-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "clutter-sys" 3 | version = "0.0.1" 4 | links = "\"mutter-clutter-8\"" 5 | edition = "2018" 6 | build = "build.rs" 7 | [package.metadata.system-deps.mutter_clutter_8] 8 | name = "mutter-clutter-8" 9 | version = "0.0" 10 | 11 | [package.metadata.system-deps.mutter_clutter_8.v0_2] 12 | version = "0.2" 13 | 14 | [package.metadata.system-deps.mutter_clutter_8.v0_4] 15 | version = "0.4" 16 | 17 | [package.metadata.system-deps.mutter_clutter_8.v0_6] 18 | version = "0.6" 19 | 20 | [package.metadata.system-deps.mutter_clutter_8.v0_8] 21 | version = "0.8" 22 | 23 | [package.metadata.system-deps.mutter_clutter_8.v1_0] 24 | version = "1.0" 25 | 26 | [package.metadata.system-deps.mutter_clutter_8.v1_2] 27 | version = "1.2" 28 | 29 | [package.metadata.system-deps.mutter_clutter_8.v1_4] 30 | version = "1.4" 31 | 32 | [package.metadata.system-deps.mutter_clutter_8.v1_6] 33 | version = "1.6" 34 | 35 | [package.metadata.system-deps.mutter_clutter_8.v1_8] 36 | version = "1.8" 37 | 38 | [package.metadata.system-deps.mutter_clutter_8.v1_10] 39 | version = "1.10" 40 | 41 | [package.metadata.system-deps.mutter_clutter_8.v1_12] 42 | version = "1.12" 43 | 44 | [package.metadata.system-deps.mutter_clutter_8.v1_14] 45 | version = "1.14" 46 | 47 | [package.metadata.system-deps.mutter_clutter_8.v1_16] 48 | version = "1.16" 49 | 50 | [package.metadata.system-deps.mutter_clutter_8.v1_18] 51 | version = "1.18" 52 | 53 | [package.metadata.system-deps.mutter_clutter_8.v1_20] 54 | version = "1.20" 55 | 56 | [package.metadata.system-deps.mutter_clutter_8.v1_22] 57 | version = "1.22" 58 | 59 | [package.metadata.system-deps.mutter_clutter_8.v1_24] 60 | version = "1.24" 61 | 62 | [package.metadata.system-deps.mutter_clutter_8.v1_26] 63 | version = "1.26" 64 | 65 | [package.metadata.system-deps.mutter_clutter_8.v1_28] 66 | version = "1.28" 67 | [package.metadata.docs.rs] 68 | features = ["dox"] 69 | 70 | [lib] 71 | name = "clutter_sys" 72 | 73 | [dependencies] 74 | libc = "0.2" 75 | 76 | [dependencies.atk-sys] 77 | git = "https://github.com/gtk-rs/gtk3-rs" 78 | 79 | [dependencies.cairo-sys-rs] 80 | git = "https://github.com/gtk-rs/gtk-rs-core" 81 | 82 | [dependencies.cogl-sys] 83 | path = "../cogl-sys" 84 | 85 | [dependencies.gio-sys] 86 | git = "https://github.com/gtk-rs/gtk-rs-core" 87 | 88 | [dependencies.glib-sys] 89 | git = "https://github.com/gtk-rs/gtk-rs-core" 90 | 91 | [dependencies.gobject-sys] 92 | git = "https://github.com/gtk-rs/gtk-rs-core" 93 | 94 | [dependencies.graphene-sys] 95 | git = "https://github.com/gtk-rs/gtk-rs-core" 96 | 97 | [dependencies.json-sys] 98 | path = "../json-sys" 99 | 100 | [dependencies.pango-sys] 101 | git = "https://github.com/gtk-rs/gtk-rs-core" 102 | 103 | [build-dependencies] 104 | system-deps = "3" 105 | 106 | [dev-dependencies] 107 | shell-words = "1.0.0" 108 | tempfile = "3" 109 | 110 | [features] 111 | v0_2 = [] 112 | v0_4 = ["v0_2"] 113 | v0_6 = ["v0_4"] 114 | v0_8 = ["v0_6"] 115 | v1_0 = ["v0_8"] 116 | v1_2 = ["v1_0"] 117 | v1_4 = ["v1_2"] 118 | v1_6 = ["v1_4"] 119 | v1_8 = ["v1_6"] 120 | v1_10 = ["v1_8"] 121 | v1_12 = ["v1_10"] 122 | v1_14 = ["v1_12"] 123 | v1_16 = ["v1_14"] 124 | v1_18 = ["v1_16"] 125 | v1_20 = ["v1_18"] 126 | v1_22 = ["v1_20"] 127 | v1_24 = ["v1_22"] 128 | v1_26 = ["v1_24"] 129 | v1_28 = ["v1_26"] 130 | dox = [] 131 | -------------------------------------------------------------------------------- /clutter/src/auto/effect.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::ActorMeta; 7 | use glib::object::IsA; 8 | use glib::translate::*; 9 | use std::fmt; 10 | 11 | glib::wrapper! { 12 | #[doc(alias = "ClutterEffect")] 13 | pub struct Effect(Object) @extends ActorMeta; 14 | 15 | match fn { 16 | type_ => || ffi::clutter_effect_get_type(), 17 | } 18 | } 19 | 20 | pub const NONE_EFFECT: Option<&Effect> = None; 21 | 22 | /// Trait containing all [`struct@Effect`] methods. 23 | /// 24 | /// # Implementors 25 | /// 26 | /// [`Effect`][struct@crate::Effect] 27 | pub trait EffectExt: 'static { 28 | /// Queues a repaint of the effect. The effect can detect when the ‘paint’ 29 | /// method is called as a result of this function because it will not 30 | /// have the `CLUTTER_EFFECT_PAINT_ACTOR_DIRTY` flag set. In that case the 31 | /// effect is free to assume that the actor has not changed its 32 | /// appearance since the last time it was painted so it doesn't need to 33 | /// call `clutter_actor_continue_paint()` if it can draw a cached 34 | /// image. This is mostly intended for effects that are using a 35 | /// `CoglOffscreen` to redirect the actor (such as 36 | /// `ClutterOffscreenEffect`). In that case the effect can save a bit of 37 | /// rendering time by painting the cached texture without causing the 38 | /// entire actor to be painted. 39 | /// 40 | /// This function can be used by effects that have their own animatable 41 | /// parameters. For example, an effect which adds a varying degree of a 42 | /// red tint to an actor by redirecting it through a CoglOffscreen 43 | /// might have a property to specify the level of tint. When this value 44 | /// changes, the underlying actor doesn't need to be redrawn so the 45 | /// effect can call [`queue_repaint()`][Self::queue_repaint()] to make sure the 46 | /// effect is repainted. 47 | /// 48 | /// Note however that modifying the position of the parent of an actor 49 | /// may change the appearance of the actor because its transformation 50 | /// matrix would change. In this case a redraw wouldn't be queued on 51 | /// the actor itself so the `CLUTTER_EFFECT_PAINT_ACTOR_DIRTY` would still 52 | /// not be set. The effect can detect this case by keeping track of the 53 | /// last modelview matrix that was used to render the actor and 54 | /// verifying that it remains the same in the next paint. 55 | /// 56 | /// Any other effects that are layered on top of the passed in effect 57 | /// will still be passed the `CLUTTER_EFFECT_PAINT_ACTOR_DIRTY` flag. If 58 | /// anything queues a redraw on the actor without specifying an effect 59 | /// or with an effect that is lower in the chain of effects than this 60 | /// one then that will override this call. In that case this effect 61 | /// will instead be called with the `CLUTTER_EFFECT_PAINT_ACTOR_DIRTY` 62 | /// flag set. 63 | #[doc(alias = "clutter_effect_queue_repaint")] 64 | fn queue_repaint(&self); 65 | } 66 | 67 | impl> EffectExt for O { 68 | fn queue_repaint(&self) { 69 | unsafe { 70 | ffi::clutter_effect_queue_repaint(self.as_ref().to_glib_none().0); 71 | } 72 | } 73 | } 74 | 75 | impl fmt::Display for Effect { 76 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 77 | f.write_str("Effect") 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /clutter/src/auto/clone.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Actor; 7 | use crate::Animatable; 8 | use crate::Container; 9 | use crate::Scriptable; 10 | use glib::object::Cast; 11 | use glib::object::IsA; 12 | use glib::signal::connect_raw; 13 | use glib::signal::SignalHandlerId; 14 | use glib::translate::*; 15 | use std::boxed::Box as Box_; 16 | use std::fmt; 17 | use std::mem::transmute; 18 | 19 | glib::wrapper! { 20 | #[doc(alias = "ClutterClone")] 21 | pub struct Clone(Object) @extends Actor, @implements Animatable, Container, Scriptable; 22 | 23 | match fn { 24 | type_ => || ffi::clutter_clone_get_type(), 25 | } 26 | } 27 | 28 | impl Clone { 29 | /// Creates a new [`Actor`][crate::Actor] which clones `source`/ 30 | /// ## `source` 31 | /// a [`Actor`][crate::Actor], or [`None`] 32 | /// 33 | /// # Returns 34 | /// 35 | /// the newly created [`Clone`][crate::Clone] 36 | #[doc(alias = "clutter_clone_new")] 37 | pub fn new>(source: &P) -> Clone { 38 | unsafe { 39 | Actor::from_glib_none(ffi::clutter_clone_new(source.as_ref().to_glib_none().0)).unsafe_cast() 40 | } 41 | } 42 | } 43 | 44 | pub const NONE_CLONE: Option<&Clone> = None; 45 | 46 | /// Trait containing all [`struct@Clone`] methods. 47 | /// 48 | /// # Implementors 49 | /// 50 | /// [`Clone`][struct@crate::Clone] 51 | pub trait CloneExt: 'static { 52 | /// Retrieves the source [`Actor`][crate::Actor] being cloned by `self`. 53 | /// 54 | /// # Returns 55 | /// 56 | /// the actor source for the clone 57 | #[doc(alias = "clutter_clone_get_source")] 58 | #[doc(alias = "get_source")] 59 | fn source(&self) -> Option; 60 | 61 | /// Sets `source` as the source actor to be cloned by `self`. 62 | /// ## `source` 63 | /// a [`Actor`][crate::Actor], or [`None`] 64 | #[doc(alias = "clutter_clone_set_source")] 65 | fn set_source>(&self, source: Option<&P>); 66 | 67 | #[cfg(any(feature = "v1_0", feature = "dox"))] 68 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_0")))] 69 | #[doc(alias = "source")] 70 | fn connect_source_notify(&self, f: F) -> SignalHandlerId; 71 | } 72 | 73 | impl> CloneExt for O { 74 | fn source(&self) -> Option { 75 | unsafe { 76 | from_glib_none(ffi::clutter_clone_get_source(self.as_ref().to_glib_none().0)) 77 | } 78 | } 79 | 80 | fn set_source>(&self, source: Option<&P>) { 81 | unsafe { 82 | ffi::clutter_clone_set_source(self.as_ref().to_glib_none().0, source.map(|p| p.as_ref()).to_glib_none().0); 83 | } 84 | } 85 | 86 | #[cfg(any(feature = "v1_0", feature = "dox"))] 87 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_0")))] 88 | fn connect_source_notify(&self, f: F) -> SignalHandlerId { 89 | unsafe extern "C" fn notify_source_trampoline, F: Fn(&P) + 'static>(this: *mut ffi::ClutterClone, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { 90 | let f: &F = &*(f as *const F); 91 | f(Clone::from_glib_borrow(this).unsafe_cast_ref()) 92 | } 93 | unsafe { 94 | let f: Box_ = Box_::new(f); 95 | connect_raw(self.as_ptr() as *mut _, b"notify::source\0".as_ptr() as *const _, 96 | Some(transmute::<_, unsafe extern "C" fn()>(notify_source_trampoline:: as *const ())), Box_::into_raw(f)) 97 | } 98 | } 99 | } 100 | 101 | impl fmt::Display for Clone { 102 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 103 | f.write_str("Clone") 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /clutter/src/auto/input_focus.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use glib::object::IsA; 7 | use glib::translate::*; 8 | use std::fmt; 9 | 10 | glib::wrapper! { 11 | #[doc(alias = "ClutterInputFocus")] 12 | pub struct InputFocus(Object); 13 | 14 | match fn { 15 | type_ => || ffi::clutter_input_focus_get_type(), 16 | } 17 | } 18 | 19 | pub const NONE_INPUT_FOCUS: Option<&InputFocus> = None; 20 | 21 | /// Trait containing all [`struct@InputFocus`] methods. 22 | /// 23 | /// # Implementors 24 | /// 25 | /// [`InputFocus`][struct@crate::InputFocus] 26 | pub trait InputFocusExt: 'static { 27 | //#[doc(alias = "clutter_input_focus_filter_event")] 28 | //fn filter_event(&self, event: /*Ignored*/&Event) -> bool; 29 | 30 | #[doc(alias = "clutter_input_focus_is_focused")] 31 | fn is_focused(&self) -> bool; 32 | 33 | #[doc(alias = "clutter_input_focus_reset")] 34 | fn reset(&self); 35 | 36 | #[doc(alias = "clutter_input_focus_set_can_show_preedit")] 37 | fn set_can_show_preedit(&self, can_show_preedit: bool); 38 | 39 | //#[doc(alias = "clutter_input_focus_set_content_hints")] 40 | //fn set_content_hints(&self, hint: /*Ignored*/InputContentHintFlags); 41 | 42 | //#[doc(alias = "clutter_input_focus_set_content_purpose")] 43 | //fn set_content_purpose(&self, purpose: /*Ignored*/InputContentPurpose); 44 | 45 | //#[doc(alias = "clutter_input_focus_set_cursor_location")] 46 | //fn set_cursor_location(&self, rect: /*Ignored*/&graphene::Rect); 47 | 48 | //#[doc(alias = "clutter_input_focus_set_input_panel_state")] 49 | //fn set_input_panel_state(&self, state: /*Ignored*/InputPanelState); 50 | 51 | #[doc(alias = "clutter_input_focus_set_surrounding")] 52 | fn set_surrounding(&self, text: &str, cursor: u32, anchor: u32); 53 | } 54 | 55 | impl> InputFocusExt for O { 56 | //fn filter_event(&self, event: /*Ignored*/&Event) -> bool { 57 | // unsafe { TODO: call ffi:clutter_input_focus_filter_event() } 58 | //} 59 | 60 | fn is_focused(&self) -> bool { 61 | unsafe { 62 | from_glib(ffi::clutter_input_focus_is_focused(self.as_ref().to_glib_none().0)) 63 | } 64 | } 65 | 66 | fn reset(&self) { 67 | unsafe { 68 | ffi::clutter_input_focus_reset(self.as_ref().to_glib_none().0); 69 | } 70 | } 71 | 72 | fn set_can_show_preedit(&self, can_show_preedit: bool) { 73 | unsafe { 74 | ffi::clutter_input_focus_set_can_show_preedit(self.as_ref().to_glib_none().0, can_show_preedit.into_glib()); 75 | } 76 | } 77 | 78 | //fn set_content_hints(&self, hint: /*Ignored*/InputContentHintFlags) { 79 | // unsafe { TODO: call ffi:clutter_input_focus_set_content_hints() } 80 | //} 81 | 82 | //fn set_content_purpose(&self, purpose: /*Ignored*/InputContentPurpose) { 83 | // unsafe { TODO: call ffi:clutter_input_focus_set_content_purpose() } 84 | //} 85 | 86 | //fn set_cursor_location(&self, rect: /*Ignored*/&graphene::Rect) { 87 | // unsafe { TODO: call ffi:clutter_input_focus_set_cursor_location() } 88 | //} 89 | 90 | //fn set_input_panel_state(&self, state: /*Ignored*/InputPanelState) { 91 | // unsafe { TODO: call ffi:clutter_input_focus_set_input_panel_state() } 92 | //} 93 | 94 | fn set_surrounding(&self, text: &str, cursor: u32, anchor: u32) { 95 | unsafe { 96 | ffi::clutter_input_focus_set_surrounding(self.as_ref().to_glib_none().0, text.to_glib_none().0, cursor, anchor); 97 | } 98 | } 99 | } 100 | 101 | impl fmt::Display for InputFocus { 102 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 103 | f.write_str("InputFocus") 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /clutter/src/auto/animatable.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Actor; 7 | use glib::object::IsA; 8 | use glib::translate::*; 9 | use std::fmt; 10 | 11 | glib::wrapper! { 12 | #[doc(alias = "ClutterAnimatable")] 13 | pub struct Animatable(Interface); 14 | 15 | match fn { 16 | type_ => || ffi::clutter_animatable_get_type(), 17 | } 18 | } 19 | 20 | pub const NONE_ANIMATABLE: Option<&Animatable> = None; 21 | 22 | /// Trait containing all [`struct@Animatable`] methods. 23 | /// 24 | /// # Implementors 25 | /// 26 | /// [`Actor`][struct@crate::Actor], [`Animatable`][struct@crate::Animatable], [`Clone`][struct@crate::Clone], [`Stage`][struct@crate::Stage], [`Text`][struct@crate::Text] 27 | pub trait AnimatableExt: 'static { 28 | //#[cfg(any(feature = "v1_4", feature = "dox"))] 29 | //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 30 | //#[doc(alias = "clutter_animatable_find_property")] 31 | //fn find_property(&self, property_name: &str) -> /*Ignored*/Option; 32 | 33 | /// Get animated actor. 34 | /// 35 | /// # Returns 36 | /// 37 | /// a [`Actor`][crate::Actor] 38 | #[doc(alias = "clutter_animatable_get_actor")] 39 | #[doc(alias = "get_actor")] 40 | fn actor(&self) -> Option; 41 | 42 | //#[cfg(any(feature = "v1_4", feature = "dox"))] 43 | //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 44 | //#[doc(alias = "clutter_animatable_get_initial_state")] 45 | //#[doc(alias = "get_initial_state")] 46 | //fn initial_state(&self, property_name: &str, value: /*Ignored*/&mut glib::Value); 47 | 48 | //#[cfg(any(feature = "v1_8", feature = "dox"))] 49 | //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_8")))] 50 | //#[doc(alias = "clutter_animatable_interpolate_value")] 51 | //fn interpolate_value(&self, property_name: &str, interval: /*Ignored*/&Interval, progress: f64, value: /*Ignored*/glib::Value) -> bool; 52 | 53 | //#[cfg(any(feature = "v1_4", feature = "dox"))] 54 | //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 55 | //#[doc(alias = "clutter_animatable_set_final_state")] 56 | //fn set_final_state(&self, property_name: &str, value: /*Ignored*/&glib::Value); 57 | } 58 | 59 | impl> AnimatableExt for O { 60 | //#[cfg(any(feature = "v1_4", feature = "dox"))] 61 | //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 62 | //fn find_property(&self, property_name: &str) -> /*Ignored*/Option { 63 | // unsafe { TODO: call ffi:clutter_animatable_find_property() } 64 | //} 65 | 66 | fn actor(&self) -> Option { 67 | unsafe { 68 | from_glib_none(ffi::clutter_animatable_get_actor(self.as_ref().to_glib_none().0)) 69 | } 70 | } 71 | 72 | //#[cfg(any(feature = "v1_4", feature = "dox"))] 73 | //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 74 | //fn initial_state(&self, property_name: &str, value: /*Ignored*/&mut glib::Value) { 75 | // unsafe { TODO: call ffi:clutter_animatable_get_initial_state() } 76 | //} 77 | 78 | //#[cfg(any(feature = "v1_8", feature = "dox"))] 79 | //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_8")))] 80 | //fn interpolate_value(&self, property_name: &str, interval: /*Ignored*/&Interval, progress: f64, value: /*Ignored*/glib::Value) -> bool { 81 | // unsafe { TODO: call ffi:clutter_animatable_interpolate_value() } 82 | //} 83 | 84 | //#[cfg(any(feature = "v1_4", feature = "dox"))] 85 | //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 86 | //fn set_final_state(&self, property_name: &str, value: /*Ignored*/&glib::Value) { 87 | // unsafe { TODO: call ffi:clutter_animatable_set_final_state() } 88 | //} 89 | } 90 | 91 | impl fmt::Display for Animatable { 92 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 93 | f.write_str("Animatable") 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /meta/src/auto/rectangle.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use glib::translate::*; 7 | 8 | glib::wrapper! { 9 | #[derive(Debug, PartialOrd, Ord, Hash)] 10 | pub struct Rectangle(Boxed); 11 | 12 | match fn { 13 | copy => |ptr| ffi::meta_rectangle_copy(ptr), 14 | free => |ptr| ffi::meta_rectangle_free(ptr), 15 | type_ => || ffi::meta_rectangle_get_type(), 16 | } 17 | } 18 | 19 | impl Rectangle { 20 | #[doc(alias = "meta_rectangle_area")] 21 | pub fn area(&self) -> i32 { 22 | unsafe { 23 | ffi::meta_rectangle_area(self.to_glib_none().0) 24 | } 25 | } 26 | 27 | #[doc(alias = "meta_rectangle_contains_rect")] 28 | pub fn contains_rect(&self, inner_rect: &Rectangle) -> bool { 29 | unsafe { 30 | from_glib(ffi::meta_rectangle_contains_rect(self.to_glib_none().0, inner_rect.to_glib_none().0)) 31 | } 32 | } 33 | 34 | #[doc(alias = "meta_rectangle_could_fit_rect")] 35 | pub fn could_fit_rect(&self, inner_rect: &Rectangle) -> bool { 36 | unsafe { 37 | from_glib(ffi::meta_rectangle_could_fit_rect(self.to_glib_none().0, inner_rect.to_glib_none().0)) 38 | } 39 | } 40 | 41 | #[doc(alias = "meta_rectangle_equal")] 42 | fn equal(&self, src2: &Rectangle) -> bool { 43 | unsafe { 44 | from_glib(ffi::meta_rectangle_equal(self.to_glib_none().0, src2.to_glib_none().0)) 45 | } 46 | } 47 | 48 | #[doc(alias = "meta_rectangle_horiz_overlap")] 49 | pub fn horiz_overlap(&self, rect2: &Rectangle) -> bool { 50 | unsafe { 51 | from_glib(ffi::meta_rectangle_horiz_overlap(self.to_glib_none().0, rect2.to_glib_none().0)) 52 | } 53 | } 54 | 55 | /// ## `src2` 56 | /// another [`Rectangle`][crate::Rectangle] 57 | /// 58 | /// # Returns 59 | /// 60 | /// TRUE is some intersection exists and is not degenerate, FALSE 61 | /// otherwise. 62 | /// 63 | /// ## `dest` 64 | /// an empty [`Rectangle`][crate::Rectangle], to be filled 65 | /// with the coordinates of the intersection. 66 | #[doc(alias = "meta_rectangle_intersect")] 67 | pub fn intersect(&self, src2: &Rectangle) -> Option { 68 | unsafe { 69 | let mut dest = Rectangle::uninitialized(); 70 | let ret = from_glib(ffi::meta_rectangle_intersect(self.to_glib_none().0, src2.to_glib_none().0, dest.to_glib_none_mut().0)); 71 | if ret { Some(dest) } else { None } 72 | } 73 | } 74 | 75 | #[doc(alias = "meta_rectangle_overlap")] 76 | pub fn overlap(&self, rect2: &Rectangle) -> bool { 77 | unsafe { 78 | from_glib(ffi::meta_rectangle_overlap(self.to_glib_none().0, rect2.to_glib_none().0)) 79 | } 80 | } 81 | 82 | /// ## `rect2` 83 | /// another [`Rectangle`][crate::Rectangle] 84 | /// 85 | /// # Returns 86 | /// 87 | /// 88 | /// ## `dest` 89 | /// an empty [`Rectangle`][crate::Rectangle], to be filled 90 | /// with the coordinates of the bounding box. 91 | #[doc(alias = "meta_rectangle_union")] 92 | pub fn union(&self, rect2: &Rectangle) -> Rectangle { 93 | unsafe { 94 | let mut dest = Rectangle::uninitialized(); 95 | ffi::meta_rectangle_union(self.to_glib_none().0, rect2.to_glib_none().0, dest.to_glib_none_mut().0); 96 | dest 97 | } 98 | } 99 | 100 | #[doc(alias = "meta_rectangle_vert_overlap")] 101 | pub fn vert_overlap(&self, rect2: &Rectangle) -> bool { 102 | unsafe { 103 | from_glib(ffi::meta_rectangle_vert_overlap(self.to_glib_none().0, rect2.to_glib_none().0)) 104 | } 105 | } 106 | } 107 | 108 | impl PartialEq for Rectangle { 109 | #[inline] 110 | fn eq(&self, other: &Self) -> bool { 111 | self.equal(other) 112 | } 113 | } 114 | 115 | impl Eq for Rectangle {} 116 | -------------------------------------------------------------------------------- /gdesktop_enums-sys/tests/layout.c: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #include "manual.h" 7 | #include 8 | #include 9 | 10 | int main() { 11 | printf("%s;%zu;%zu\n", "GDesktopBackgroundShading", sizeof(GDesktopBackgroundShading), alignof(GDesktopBackgroundShading)); 12 | printf("%s;%zu;%zu\n", "GDesktopBackgroundStyle", sizeof(GDesktopBackgroundStyle), alignof(GDesktopBackgroundStyle)); 13 | printf("%s;%zu;%zu\n", "GDesktopClockFormat", sizeof(GDesktopClockFormat), alignof(GDesktopClockFormat)); 14 | printf("%s;%zu;%zu\n", "GDesktopDeviceSendEvents", sizeof(GDesktopDeviceSendEvents), alignof(GDesktopDeviceSendEvents)); 15 | printf("%s;%zu;%zu\n", "GDesktopFocusMode", sizeof(GDesktopFocusMode), alignof(GDesktopFocusMode)); 16 | printf("%s;%zu;%zu\n", "GDesktopFocusNewWindows", sizeof(GDesktopFocusNewWindows), alignof(GDesktopFocusNewWindows)); 17 | printf("%s;%zu;%zu\n", "GDesktopFontAntialiasingMode", sizeof(GDesktopFontAntialiasingMode), alignof(GDesktopFontAntialiasingMode)); 18 | printf("%s;%zu;%zu\n", "GDesktopFontHinting", sizeof(GDesktopFontHinting), alignof(GDesktopFontHinting)); 19 | printf("%s;%zu;%zu\n", "GDesktopFontRgbaOrder", sizeof(GDesktopFontRgbaOrder), alignof(GDesktopFontRgbaOrder)); 20 | printf("%s;%zu;%zu\n", "GDesktopLocationAccuracyLevel", sizeof(GDesktopLocationAccuracyLevel), alignof(GDesktopLocationAccuracyLevel)); 21 | printf("%s;%zu;%zu\n", "GDesktopMagnifierCaretTrackingMode", sizeof(GDesktopMagnifierCaretTrackingMode), alignof(GDesktopMagnifierCaretTrackingMode)); 22 | printf("%s;%zu;%zu\n", "GDesktopMagnifierFocusTrackingMode", sizeof(GDesktopMagnifierFocusTrackingMode), alignof(GDesktopMagnifierFocusTrackingMode)); 23 | printf("%s;%zu;%zu\n", "GDesktopMagnifierMouseTrackingMode", sizeof(GDesktopMagnifierMouseTrackingMode), alignof(GDesktopMagnifierMouseTrackingMode)); 24 | printf("%s;%zu;%zu\n", "GDesktopMagnifierScreenPosition", sizeof(GDesktopMagnifierScreenPosition), alignof(GDesktopMagnifierScreenPosition)); 25 | printf("%s;%zu;%zu\n", "GDesktopMouseDwellDirection", sizeof(GDesktopMouseDwellDirection), alignof(GDesktopMouseDwellDirection)); 26 | printf("%s;%zu;%zu\n", "GDesktopMouseDwellMode", sizeof(GDesktopMouseDwellMode), alignof(GDesktopMouseDwellMode)); 27 | printf("%s;%zu;%zu\n", "GDesktopPadButtonAction", sizeof(GDesktopPadButtonAction), alignof(GDesktopPadButtonAction)); 28 | printf("%s;%zu;%zu\n", "GDesktopPointerAccelProfile", sizeof(GDesktopPointerAccelProfile), alignof(GDesktopPointerAccelProfile)); 29 | printf("%s;%zu;%zu\n", "GDesktopProxyMode", sizeof(GDesktopProxyMode), alignof(GDesktopProxyMode)); 30 | printf("%s;%zu;%zu\n", "GDesktopScreensaverMode", sizeof(GDesktopScreensaverMode), alignof(GDesktopScreensaverMode)); 31 | printf("%s;%zu;%zu\n", "GDesktopStylusButtonAction", sizeof(GDesktopStylusButtonAction), alignof(GDesktopStylusButtonAction)); 32 | printf("%s;%zu;%zu\n", "GDesktopTabletMapping", sizeof(GDesktopTabletMapping), alignof(GDesktopTabletMapping)); 33 | printf("%s;%zu;%zu\n", "GDesktopTitlebarAction", sizeof(GDesktopTitlebarAction), alignof(GDesktopTitlebarAction)); 34 | printf("%s;%zu;%zu\n", "GDesktopToolbarIconSize", sizeof(GDesktopToolbarIconSize), alignof(GDesktopToolbarIconSize)); 35 | printf("%s;%zu;%zu\n", "GDesktopToolbarStyle", sizeof(GDesktopToolbarStyle), alignof(GDesktopToolbarStyle)); 36 | printf("%s;%zu;%zu\n", "GDesktopTouchpadClickMethod", sizeof(GDesktopTouchpadClickMethod), alignof(GDesktopTouchpadClickMethod)); 37 | printf("%s;%zu;%zu\n", "GDesktopTouchpadHandedness", sizeof(GDesktopTouchpadHandedness), alignof(GDesktopTouchpadHandedness)); 38 | printf("%s;%zu;%zu\n", "GDesktopTouchpadTapButtonMap", sizeof(GDesktopTouchpadTapButtonMap), alignof(GDesktopTouchpadTapButtonMap)); 39 | printf("%s;%zu;%zu\n", "GDesktopUsbProtection", sizeof(GDesktopUsbProtection), alignof(GDesktopUsbProtection)); 40 | printf("%s;%zu;%zu\n", "GDesktopVisualBellType", sizeof(GDesktopVisualBellType), alignof(GDesktopVisualBellType)); 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /meta/src/auto/background.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Display; 7 | use glib::object::IsA; 8 | use glib::object::ObjectType as ObjectType_; 9 | use glib::signal::connect_raw; 10 | use glib::signal::SignalHandlerId; 11 | use glib::translate::*; 12 | use glib::StaticType; 13 | use std::boxed::Box as Box_; 14 | use std::fmt; 15 | use std::mem::transmute; 16 | 17 | glib::wrapper! { 18 | #[doc(alias = "MetaBackground")] 19 | pub struct Background(Object); 20 | 21 | match fn { 22 | type_ => || ffi::meta_background_get_type(), 23 | } 24 | } 25 | 26 | impl Background { 27 | #[doc(alias = "meta_background_new")] 28 | pub fn new(display: &Display) -> Background { 29 | unsafe { 30 | from_glib_full(ffi::meta_background_new(display.to_glib_none().0)) 31 | } 32 | } 33 | 34 | #[doc(alias = "meta_background_set_blend")] 35 | pub fn set_blend, Q: IsA>(&self, file1: &P, file2: &Q, blend_factor: f64, style: gdesktop_enums::BackgroundStyle) { 36 | unsafe { 37 | ffi::meta_background_set_blend(self.to_glib_none().0, file1.as_ref().to_glib_none().0, file2.as_ref().to_glib_none().0, blend_factor, style.into_glib()); 38 | } 39 | } 40 | 41 | #[doc(alias = "meta_background_set_color")] 42 | pub fn set_color(&self, color: &mut clutter::Color) { 43 | unsafe { 44 | ffi::meta_background_set_color(self.to_glib_none().0, color.to_glib_none_mut().0); 45 | } 46 | } 47 | 48 | /// Set the background to `file` 49 | /// ## `file` 50 | /// a [`gio::File`][crate::gio::File] representing the background file 51 | /// ## `style` 52 | /// the background style to apply 53 | #[doc(alias = "meta_background_set_file")] 54 | pub fn set_file>(&self, file: Option<&P>, style: gdesktop_enums::BackgroundStyle) { 55 | unsafe { 56 | ffi::meta_background_set_file(self.to_glib_none().0, file.map(|p| p.as_ref()).to_glib_none().0, style.into_glib()); 57 | } 58 | } 59 | 60 | //#[doc(alias = "meta_background_set_gradient")] 61 | //pub fn set_gradient(&self, shading_direction: /*Ignored*/gdesktop_enums::BackgroundShading, color: &mut clutter::Color, second_color: &mut clutter::Color) { 62 | // unsafe { TODO: call ffi:meta_background_set_gradient() } 63 | //} 64 | 65 | #[doc(alias = "meta-display")] 66 | pub fn meta_display(&self) -> Option { 67 | unsafe { 68 | let mut value = glib::Value::from_type(::static_type()); 69 | glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"meta-display\0".as_ptr() as *const _, value.to_glib_none_mut().0); 70 | value.get().expect("Return Value for property `meta-display` getter") 71 | } 72 | } 73 | 74 | #[doc(alias = "meta_background_refresh_all")] 75 | pub fn refresh_all() { 76 | unsafe { 77 | ffi::meta_background_refresh_all(); 78 | } 79 | } 80 | 81 | #[doc(alias = "changed")] 82 | pub fn connect_changed(&self, f: F) -> SignalHandlerId { 83 | unsafe extern "C" fn changed_trampoline(this: *mut ffi::MetaBackground, f: glib::ffi::gpointer) { 84 | let f: &F = &*(f as *const F); 85 | f(&from_glib_borrow(this)) 86 | } 87 | unsafe { 88 | let f: Box_ = Box_::new(f); 89 | connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, 90 | Some(transmute::<_, unsafe extern "C" fn()>(changed_trampoline:: as *const ())), Box_::into_raw(f)) 91 | } 92 | } 93 | } 94 | 95 | impl fmt::Display for Background { 96 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 97 | f.write_str("Background") 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /xlib-sys/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] 7 | #![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal, clippy::upper_case_acronyms)] 8 | #![cfg_attr(feature = "dox", feature(doc_cfg))] 9 | 10 | use glib_sys as glib; 11 | 12 | #[allow(unused_imports)] 13 | use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double, 14 | c_short, c_ushort, c_long, c_ulong, 15 | c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE}; 16 | 17 | #[allow(unused_imports)] 18 | use glib::{gboolean, gconstpointer, gpointer, GType}; 19 | 20 | // Aliases 21 | pub type Atom = c_ulong; 22 | pub type Colormap = c_ulong; 23 | pub type Cursor = c_ulong; 24 | pub type Drawable = c_ulong; 25 | pub type GC = gpointer; 26 | pub type KeyCode = u8; 27 | pub type KeySym = c_ulong; 28 | pub type Picture = c_ulong; 29 | pub type Pixmap = c_ulong; 30 | pub type Time = c_ulong; 31 | pub type VisualID = c_ulong; 32 | pub type Window = c_ulong; 33 | pub type XID = c_ulong; 34 | 35 | // Unions 36 | #[repr(C)] 37 | pub struct XEvent(c_void); 38 | 39 | impl ::std::fmt::Debug for XEvent { 40 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 41 | f.debug_struct(&format!("XEvent @ {:p}", self)) 42 | .finish() 43 | } 44 | } 45 | 46 | // Records 47 | #[repr(C)] 48 | pub struct Display(c_void); 49 | 50 | impl ::std::fmt::Debug for Display { 51 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 52 | f.debug_struct(&format!("Display @ {:p}", self)) 53 | .finish() 54 | } 55 | } 56 | 57 | #[repr(C)] 58 | pub struct Screen(c_void); 59 | 60 | impl ::std::fmt::Debug for Screen { 61 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 62 | f.debug_struct(&format!("Screen @ {:p}", self)) 63 | .finish() 64 | } 65 | } 66 | 67 | #[repr(C)] 68 | pub struct Visual(c_void); 69 | 70 | impl ::std::fmt::Debug for Visual { 71 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 72 | f.debug_struct(&format!("Visual @ {:p}", self)) 73 | .finish() 74 | } 75 | } 76 | 77 | #[repr(C)] 78 | pub struct XConfigureEvent(c_void); 79 | 80 | impl ::std::fmt::Debug for XConfigureEvent { 81 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 82 | f.debug_struct(&format!("XConfigureEvent @ {:p}", self)) 83 | .finish() 84 | } 85 | } 86 | 87 | #[repr(C)] 88 | pub struct XFontStruct(c_void); 89 | 90 | impl ::std::fmt::Debug for XFontStruct { 91 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 92 | f.debug_struct(&format!("XFontStruct @ {:p}", self)) 93 | .finish() 94 | } 95 | } 96 | 97 | #[repr(C)] 98 | pub struct XImage(c_void); 99 | 100 | impl ::std::fmt::Debug for XImage { 101 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 102 | f.debug_struct(&format!("XImage @ {:p}", self)) 103 | .finish() 104 | } 105 | } 106 | 107 | #[repr(C)] 108 | pub struct XTrapezoid(c_void); 109 | 110 | impl ::std::fmt::Debug for XTrapezoid { 111 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 112 | f.debug_struct(&format!("XTrapezoid @ {:p}", self)) 113 | .finish() 114 | } 115 | } 116 | 117 | #[repr(C)] 118 | pub struct XVisualInfo(c_void); 119 | 120 | impl ::std::fmt::Debug for XVisualInfo { 121 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 122 | f.debug_struct(&format!("XVisualInfo @ {:p}", self)) 123 | .finish() 124 | } 125 | } 126 | 127 | #[repr(C)] 128 | pub struct XWindowAttributes(c_void); 129 | 130 | impl ::std::fmt::Debug for XWindowAttributes { 131 | fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 132 | f.debug_struct(&format!("XWindowAttributes @ {:p}", self)) 133 | .finish() 134 | } 135 | } 136 | 137 | #[link(name = "X11")] 138 | extern "C" { 139 | 140 | //========================================================================= 141 | // Other functions 142 | //========================================================================= 143 | pub fn XOpenDisplay(); 144 | 145 | } 146 | -------------------------------------------------------------------------------- /clutter/src/auto/image.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Content; 7 | use glib::object::IsA; 8 | use glib::translate::*; 9 | use std::fmt; 10 | #[cfg(any(feature = "v1_12", feature = "dox"))] 11 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))] 12 | use std::ptr; 13 | 14 | glib::wrapper! { 15 | #[doc(alias = "ClutterImage")] 16 | pub struct Image(Object) @implements Content; 17 | 18 | match fn { 19 | type_ => || ffi::clutter_image_get_type(), 20 | } 21 | } 22 | 23 | impl Image { 24 | /// Creates a new [`Image`][crate::Image] instance. 25 | /// 26 | /// # Returns 27 | /// 28 | /// the newly created [`Image`][crate::Image] instance. 29 | /// Use `g_object_unref()` when done. 30 | #[doc(alias = "clutter_image_new")] 31 | pub fn new() -> Option { 32 | unsafe { 33 | from_glib_full(ffi::clutter_image_new()) 34 | } 35 | } 36 | } 37 | 38 | pub const NONE_IMAGE: Option<&Image> = None; 39 | 40 | /// Trait containing all [`struct@Image`] methods. 41 | /// 42 | /// # Implementors 43 | /// 44 | /// [`Image`][struct@crate::Image] 45 | pub trait ImageExt: 'static { 46 | /// Retrieves a pointer to the Cogl texture used by `self`. 47 | /// 48 | /// If you change the contents of the returned Cogl texture you will need 49 | /// to manually invalidate the `self` with [`ContentExt::invalidate()`][crate::prelude::ContentExt::invalidate()] 50 | /// in order to update the actors using `self` as their content. 51 | /// 52 | /// # Returns 53 | /// 54 | /// a pointer to the Cogl texture, or [`None`] 55 | #[doc(alias = "clutter_image_get_texture")] 56 | #[doc(alias = "get_texture")] 57 | fn texture(&self) -> Option; 58 | 59 | //#[doc(alias = "clutter_image_set_area")] 60 | //fn set_area(&self, data: &[u8], pixel_format: cogl::PixelFormat, rect: &cairo::RectangleInt, row_stride: u32) -> Result<(), glib::Error>; 61 | 62 | /// Sets the image data stored inside a [`glib::Bytes`][crate::glib::Bytes] to be displayed by `self`. 63 | /// 64 | /// If the image data was successfully loaded, the `self` will be invalidated. 65 | /// 66 | /// In case of error, the `error` value will be set, and this function will 67 | /// return [`false`]. 68 | /// 69 | /// The image data contained inside the [`glib::Bytes`][crate::glib::Bytes] is copied in texture memory, 70 | /// and no additional reference is acquired on the `data`. 71 | /// ## `data` 72 | /// the image data, as a [`glib::Bytes`][crate::glib::Bytes] 73 | /// ## `pixel_format` 74 | /// the Cogl pixel format of the image data 75 | /// ## `width` 76 | /// the width of the image data 77 | /// ## `height` 78 | /// the height of the image data 79 | /// ## `row_stride` 80 | /// the length of each row inside `data` 81 | /// 82 | /// # Returns 83 | /// 84 | /// [`true`] if the image data was successfully loaded, 85 | /// and [`false`] otherwise. 86 | #[cfg(any(feature = "v1_12", feature = "dox"))] 87 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))] 88 | #[doc(alias = "clutter_image_set_bytes")] 89 | fn set_bytes(&self, data: &glib::Bytes, pixel_format: cogl::PixelFormat, width: u32, height: u32, row_stride: u32) -> Result<(), glib::Error>; 90 | 91 | //#[doc(alias = "clutter_image_set_data")] 92 | //fn set_data(&self, data: &[u8], pixel_format: cogl::PixelFormat, width: u32, height: u32, row_stride: u32) -> Result<(), glib::Error>; 93 | } 94 | 95 | impl> ImageExt for O { 96 | fn texture(&self) -> Option { 97 | unsafe { 98 | from_glib_none(ffi::clutter_image_get_texture(self.as_ref().to_glib_none().0)) 99 | } 100 | } 101 | 102 | //fn set_area(&self, data: &[u8], pixel_format: cogl::PixelFormat, rect: &cairo::RectangleInt, row_stride: u32) -> Result<(), glib::Error> { 103 | // unsafe { TODO: call ffi:clutter_image_set_area() } 104 | //} 105 | 106 | #[cfg(any(feature = "v1_12", feature = "dox"))] 107 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))] 108 | fn set_bytes(&self, data: &glib::Bytes, pixel_format: cogl::PixelFormat, width: u32, height: u32, row_stride: u32) -> Result<(), glib::Error> { 109 | unsafe { 110 | let mut error = ptr::null_mut(); 111 | let _ = ffi::clutter_image_set_bytes(self.as_ref().to_glib_none().0, data.to_glib_none().0, pixel_format.into_glib(), width, height, row_stride, &mut error); 112 | if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } 113 | } 114 | } 115 | 116 | //fn set_data(&self, data: &[u8], pixel_format: cogl::PixelFormat, width: u32, height: u32, row_stride: u32) -> Result<(), glib::Error> { 117 | // unsafe { TODO: call ffi:clutter_image_set_data() } 118 | //} 119 | } 120 | 121 | impl fmt::Display for Image { 122 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 123 | f.write_str("Image") 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /cogl-sys/tests/layout.c: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #include "manual.h" 7 | #include 8 | #include 9 | 10 | int main() { 11 | printf("%s;%zu;%zu\n", "CoglAngle", sizeof(CoglAngle), alignof(CoglAngle)); 12 | printf("%s;%zu;%zu\n", "CoglAttributeType", sizeof(CoglAttributeType), alignof(CoglAttributeType)); 13 | printf("%s;%zu;%zu\n", "CoglBitmapError", sizeof(CoglBitmapError), alignof(CoglBitmapError)); 14 | printf("%s;%zu;%zu\n", "CoglBlendStringError", sizeof(CoglBlendStringError), alignof(CoglBlendStringError)); 15 | printf("%s;%zu;%zu\n", "CoglBufferBit", sizeof(CoglBufferBit), alignof(CoglBufferBit)); 16 | printf("%s;%zu;%zu\n", "CoglBufferTarget", sizeof(CoglBufferTarget), alignof(CoglBufferTarget)); 17 | printf("%s;%zu;%zu\n", "CoglColor", sizeof(CoglColor), alignof(CoglColor)); 18 | printf("%s;%zu;%zu\n", "CoglDebugObjectTypeInfo", sizeof(CoglDebugObjectTypeInfo), alignof(CoglDebugObjectTypeInfo)); 19 | printf("%s;%zu;%zu\n", "CoglDepthTestFunction", sizeof(CoglDepthTestFunction), alignof(CoglDepthTestFunction)); 20 | printf("%s;%zu;%zu\n", "CoglEglImageFlags", sizeof(CoglEglImageFlags), alignof(CoglEglImageFlags)); 21 | printf("%s;%zu;%zu\n", "CoglFeatureID", sizeof(CoglFeatureID), alignof(CoglFeatureID)); 22 | printf("%s;%zu;%zu\n", "CoglFilterReturn", sizeof(CoglFilterReturn), alignof(CoglFilterReturn)); 23 | printf("%s;%zu;%zu\n", "CoglFrameEvent", sizeof(CoglFrameEvent), alignof(CoglFrameEvent)); 24 | printf("%s;%zu;%zu\n", "CoglFramebuffer", sizeof(CoglFramebuffer), alignof(CoglFramebuffer)); 25 | printf("%s;%zu;%zu\n", "CoglFramebufferClass", sizeof(CoglFramebufferClass), alignof(CoglFramebufferClass)); 26 | printf("%s;%zu;%zu\n", "CoglFramebufferError", sizeof(CoglFramebufferError), alignof(CoglFramebufferError)); 27 | printf("%s;%zu;%zu\n", "CoglGraphicsResetStatus", sizeof(CoglGraphicsResetStatus), alignof(CoglGraphicsResetStatus)); 28 | printf("%s;%zu;%zu\n", "CoglHandle", sizeof(CoglHandle), alignof(CoglHandle)); 29 | printf("%s;%zu;%zu\n", "CoglIndicesType", sizeof(CoglIndicesType), alignof(CoglIndicesType)); 30 | printf("%s;%zu;%zu\n", "CoglMaterialAlphaFunc", sizeof(CoglMaterialAlphaFunc), alignof(CoglMaterialAlphaFunc)); 31 | printf("%s;%zu;%zu\n", "CoglMaterialFilter", sizeof(CoglMaterialFilter), alignof(CoglMaterialFilter)); 32 | printf("%s;%zu;%zu\n", "CoglMaterialWrapMode", sizeof(CoglMaterialWrapMode), alignof(CoglMaterialWrapMode)); 33 | printf("%s;%zu;%zu\n", "CoglOffscreenClass", sizeof(CoglOffscreenClass), alignof(CoglOffscreenClass)); 34 | printf("%s;%zu;%zu\n", "CoglOnscreen", sizeof(CoglOnscreen), alignof(CoglOnscreen)); 35 | printf("%s;%zu;%zu\n", "CoglOnscreenClass", sizeof(CoglOnscreenClass), alignof(CoglOnscreenClass)); 36 | printf("%s;%zu;%zu\n", "CoglOnscreenDirtyInfo", sizeof(CoglOnscreenDirtyInfo), alignof(CoglOnscreenDirtyInfo)); 37 | printf("%s;%zu;%zu\n", "CoglPipelineAlphaFunc", sizeof(CoglPipelineAlphaFunc), alignof(CoglPipelineAlphaFunc)); 38 | printf("%s;%zu;%zu\n", "CoglPipelineCullFaceMode", sizeof(CoglPipelineCullFaceMode), alignof(CoglPipelineCullFaceMode)); 39 | printf("%s;%zu;%zu\n", "CoglPipelineFilter", sizeof(CoglPipelineFilter), alignof(CoglPipelineFilter)); 40 | printf("%s;%zu;%zu\n", "CoglPipelineKey", sizeof(CoglPipelineKey), alignof(CoglPipelineKey)); 41 | printf("%s;%zu;%zu\n", "CoglPipelineWrapMode", sizeof(CoglPipelineWrapMode), alignof(CoglPipelineWrapMode)); 42 | printf("%s;%zu;%zu\n", "CoglPixelFormat", sizeof(CoglPixelFormat), alignof(CoglPixelFormat)); 43 | printf("%s;%zu;%zu\n", "CoglReadPixelsFlags", sizeof(CoglReadPixelsFlags), alignof(CoglReadPixelsFlags)); 44 | printf("%s;%zu;%zu\n", "CoglRendererError", sizeof(CoglRendererError), alignof(CoglRendererError)); 45 | printf("%s;%zu;%zu\n", "CoglScanoutError", sizeof(CoglScanoutError), alignof(CoglScanoutError)); 46 | printf("%s;%zu;%zu\n", "CoglShaderType", sizeof(CoglShaderType), alignof(CoglShaderType)); 47 | printf("%s;%zu;%zu\n", "CoglStereoMode", sizeof(CoglStereoMode), alignof(CoglStereoMode)); 48 | printf("%s;%zu;%zu\n", "CoglSystemError", sizeof(CoglSystemError), alignof(CoglSystemError)); 49 | printf("%s;%zu;%zu\n", "CoglTextureComponents", sizeof(CoglTextureComponents), alignof(CoglTextureComponents)); 50 | printf("%s;%zu;%zu\n", "CoglTextureError", sizeof(CoglTextureError), alignof(CoglTextureError)); 51 | printf("%s;%zu;%zu\n", "CoglTextureFlags", sizeof(CoglTextureFlags), alignof(CoglTextureFlags)); 52 | printf("%s;%zu;%zu\n", "CoglTextureVertex", sizeof(CoglTextureVertex), alignof(CoglTextureVertex)); 53 | printf("%s;%zu;%zu\n", "CoglTraceHead", sizeof(CoglTraceHead), alignof(CoglTraceHead)); 54 | printf("%s;%zu;%zu\n", "CoglUserDataDestroyCallback", sizeof(CoglUserDataDestroyCallback), alignof(CoglUserDataDestroyCallback)); 55 | printf("%s;%zu;%zu\n", "CoglUserDataKey", sizeof(CoglUserDataKey), alignof(CoglUserDataKey)); 56 | printf("%s;%zu;%zu\n", "CoglVerticesMode", sizeof(CoglVerticesMode), alignof(CoglVerticesMode)); 57 | printf("%s;%zu;%zu\n", "CoglWinding", sizeof(CoglWinding), alignof(CoglWinding)); 58 | printf("%s;%zu;%zu\n", "CoglWinsysFeature", sizeof(CoglWinsysFeature), alignof(CoglWinsysFeature)); 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /meta/src/auto/selection.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Display; 7 | use crate::SelectionSource; 8 | use crate::SelectionType; 9 | use glib::object::IsA; 10 | use glib::object::ObjectType as ObjectType_; 11 | use glib::signal::connect_raw; 12 | use glib::signal::SignalHandlerId; 13 | use glib::translate::*; 14 | use std::boxed::Box as Box_; 15 | use std::fmt; 16 | use std::mem::transmute; 17 | use std::pin::Pin; 18 | use std::ptr; 19 | 20 | glib::wrapper! { 21 | #[doc(alias = "MetaSelection")] 22 | pub struct Selection(Object); 23 | 24 | match fn { 25 | type_ => || ffi::meta_selection_get_type(), 26 | } 27 | } 28 | 29 | impl Selection { 30 | #[doc(alias = "meta_selection_new")] 31 | pub fn new(display: &Display) -> Selection { 32 | unsafe { 33 | from_glib_full(ffi::meta_selection_new(display.to_glib_none().0)) 34 | } 35 | } 36 | 37 | /// Returns the list of supported mimetypes for the given selection type. 38 | /// ## `selection_type` 39 | /// Selection to query 40 | /// 41 | /// # Returns 42 | /// 43 | /// The supported mimetypes 44 | #[doc(alias = "meta_selection_get_mimetypes")] 45 | #[doc(alias = "get_mimetypes")] 46 | pub fn mimetypes(&self, selection_type: SelectionType) -> Vec { 47 | unsafe { 48 | FromGlibPtrContainer::from_glib_full(ffi::meta_selection_get_mimetypes(self.to_glib_none().0, selection_type.into_glib())) 49 | } 50 | } 51 | 52 | /// Sets `owner` as the owner of the selection given by `selection_type`, 53 | /// unsets any previous owner there was. 54 | /// ## `selection_type` 55 | /// Selection type 56 | /// ## `owner` 57 | /// New selection owner 58 | #[doc(alias = "meta_selection_set_owner")] 59 | pub fn set_owner>(&self, selection_type: SelectionType, owner: &P) { 60 | unsafe { 61 | ffi::meta_selection_set_owner(self.to_glib_none().0, selection_type.into_glib(), owner.as_ref().to_glib_none().0); 62 | } 63 | } 64 | 65 | /// Requests a transfer of `mimetype` on the selection given by 66 | /// `selection_type`. 67 | /// ## `selection_type` 68 | /// Selection type 69 | /// ## `mimetype` 70 | /// Mimetype to transfer 71 | /// ## `size` 72 | /// Maximum size to transfer, -1 for unlimited 73 | /// ## `output` 74 | /// Output stream to write contents to 75 | /// ## `cancellable` 76 | /// Cancellable 77 | /// ## `callback` 78 | /// User callback 79 | #[doc(alias = "meta_selection_transfer_async")] 80 | pub fn transfer_async, Q: IsA, R: FnOnce(Result<(), glib::Error>) + Send + 'static>(&self, selection_type: SelectionType, mimetype: &str, size: isize, output: &P, cancellable: Option<&Q>, callback: R) { 81 | let user_data: Box_ = Box_::new(callback); 82 | unsafe extern "C" fn transfer_async_trampoline) + Send + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) { 83 | let mut error = ptr::null_mut(); 84 | let _ = ffi::meta_selection_transfer_finish(_source_object as *mut _, res, &mut error); 85 | let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; 86 | let callback: Box_ = Box_::from_raw(user_data as *mut _); 87 | callback(result); 88 | } 89 | let callback = transfer_async_trampoline::; 90 | unsafe { 91 | ffi::meta_selection_transfer_async(self.to_glib_none().0, selection_type.into_glib(), mimetype.to_glib_none().0, size, output.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _); 92 | } 93 | } 94 | 95 | 96 | pub fn transfer_async_future + Clone + 'static>(&self, selection_type: SelectionType, mimetype: &str, size: isize, output: &P) -> Pin> + 'static>> { 97 | 98 | let mimetype = String::from(mimetype); 99 | let output = output.clone(); 100 | Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { 101 | obj.transfer_async( 102 | selection_type, 103 | &mimetype, 104 | size, 105 | &output, 106 | Some(cancellable), 107 | move |res| { 108 | send.resolve(res); 109 | }, 110 | ); 111 | })) 112 | } 113 | 114 | /// Unsets `owner` as the owner the selection given by `selection_type`. If 115 | /// `owner` does not own the selection, nothing is done. 116 | /// ## `selection_type` 117 | /// Selection type 118 | /// ## `owner` 119 | /// Owner to unset 120 | #[doc(alias = "meta_selection_unset_owner")] 121 | pub fn unset_owner>(&self, selection_type: SelectionType, owner: &P) { 122 | unsafe { 123 | ffi::meta_selection_unset_owner(self.to_glib_none().0, selection_type.into_glib(), owner.as_ref().to_glib_none().0); 124 | } 125 | } 126 | 127 | #[doc(alias = "owner-changed")] 128 | pub fn connect_owner_changed(&self, f: F) -> SignalHandlerId { 129 | unsafe extern "C" fn owner_changed_trampoline(this: *mut ffi::MetaSelection, object: libc::c_uint, p0: *mut ffi::MetaSelectionSource, f: glib::ffi::gpointer) { 130 | let f: &F = &*(f as *const F); 131 | f(&from_glib_borrow(this), object, &from_glib_borrow(p0)) 132 | } 133 | unsafe { 134 | let f: Box_ = Box_::new(f); 135 | connect_raw(self.as_ptr() as *mut _, b"owner-changed\0".as_ptr() as *const _, 136 | Some(transmute::<_, unsafe extern "C" fn()>(owner_changed_trampoline:: as *const ())), Box_::into_raw(f)) 137 | } 138 | } 139 | } 140 | 141 | impl fmt::Display for Selection { 142 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 143 | f.write_str("Selection") 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /meta/src/auto/selection_source.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use glib::object::Cast; 7 | use glib::object::IsA; 8 | use glib::object::ObjectExt; 9 | use glib::signal::connect_raw; 10 | use glib::signal::SignalHandlerId; 11 | use glib::translate::*; 12 | use std::boxed::Box as Box_; 13 | use std::fmt; 14 | use std::mem::transmute; 15 | use std::pin::Pin; 16 | use std::ptr; 17 | 18 | glib::wrapper! { 19 | #[doc(alias = "MetaSelectionSource")] 20 | pub struct SelectionSource(Object); 21 | 22 | match fn { 23 | type_ => || ffi::meta_selection_source_get_type(), 24 | } 25 | } 26 | 27 | pub const NONE_SELECTION_SOURCE: Option<&SelectionSource> = None; 28 | 29 | /// Trait containing all [`struct@SelectionSource`] methods. 30 | /// 31 | /// # Implementors 32 | /// 33 | /// [`SelectionSource`][struct@crate::SelectionSource] 34 | pub trait SelectionSourceExt: 'static { 35 | /// Returns the list of supported mimetypes. 36 | /// 37 | /// # Returns 38 | /// 39 | /// The supported mimetypes 40 | #[doc(alias = "meta_selection_source_get_mimetypes")] 41 | #[doc(alias = "get_mimetypes")] 42 | fn mimetypes(&self) -> Vec; 43 | 44 | /// Returns [`true`] if the source is active on a selection. 45 | /// 46 | /// # Returns 47 | /// 48 | /// [`true`] if the source owns a selection. 49 | #[doc(alias = "meta_selection_source_is_active")] 50 | fn is_active(&self) -> bool; 51 | 52 | #[doc(alias = "meta_selection_source_read_async")] 53 | fn read_async, Q: FnOnce(Result) + Send + 'static>(&self, mimetype: &str, cancellable: Option<&P>, callback: Q); 54 | 55 | 56 | fn read_async_future(&self, mimetype: &str) -> Pin> + 'static>>; 57 | 58 | #[doc(alias = "activated")] 59 | fn connect_activated(&self, f: F) -> SignalHandlerId; 60 | 61 | fn emit_activated(&self); 62 | 63 | #[doc(alias = "deactivated")] 64 | fn connect_deactivated(&self, f: F) -> SignalHandlerId; 65 | 66 | fn emit_deactivated(&self); 67 | } 68 | 69 | impl> SelectionSourceExt for O { 70 | fn mimetypes(&self) -> Vec { 71 | unsafe { 72 | FromGlibPtrContainer::from_glib_full(ffi::meta_selection_source_get_mimetypes(self.as_ref().to_glib_none().0)) 73 | } 74 | } 75 | 76 | fn is_active(&self) -> bool { 77 | unsafe { 78 | from_glib(ffi::meta_selection_source_is_active(self.as_ref().to_glib_none().0)) 79 | } 80 | } 81 | 82 | fn read_async, Q: FnOnce(Result) + Send + 'static>(&self, mimetype: &str, cancellable: Option<&P>, callback: Q) { 83 | let user_data: Box_ = Box_::new(callback); 84 | unsafe extern "C" fn read_async_trampoline) + Send + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) { 85 | let mut error = ptr::null_mut(); 86 | let ret = ffi::meta_selection_source_read_finish(_source_object as *mut _, res, &mut error); 87 | let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; 88 | let callback: Box_ = Box_::from_raw(user_data as *mut _); 89 | callback(result); 90 | } 91 | let callback = read_async_trampoline::; 92 | unsafe { 93 | ffi::meta_selection_source_read_async(self.as_ref().to_glib_none().0, mimetype.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _); 94 | } 95 | } 96 | 97 | 98 | fn read_async_future(&self, mimetype: &str) -> Pin> + 'static>> { 99 | 100 | let mimetype = String::from(mimetype); 101 | Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { 102 | obj.read_async( 103 | &mimetype, 104 | Some(cancellable), 105 | move |res| { 106 | send.resolve(res); 107 | }, 108 | ); 109 | })) 110 | } 111 | 112 | fn connect_activated(&self, f: F) -> SignalHandlerId { 113 | unsafe extern "C" fn activated_trampoline, F: Fn(&P) + 'static>(this: *mut ffi::MetaSelectionSource, f: glib::ffi::gpointer) { 114 | let f: &F = &*(f as *const F); 115 | f(SelectionSource::from_glib_borrow(this).unsafe_cast_ref()) 116 | } 117 | unsafe { 118 | let f: Box_ = Box_::new(f); 119 | connect_raw(self.as_ptr() as *mut _, b"activated\0".as_ptr() as *const _, 120 | Some(transmute::<_, unsafe extern "C" fn()>(activated_trampoline:: as *const ())), Box_::into_raw(f)) 121 | } 122 | } 123 | 124 | fn emit_activated(&self) { 125 | let _ = unsafe { glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject).emit_by_name("activated", &[]).unwrap() }; 126 | } 127 | 128 | fn connect_deactivated(&self, f: F) -> SignalHandlerId { 129 | unsafe extern "C" fn deactivated_trampoline, F: Fn(&P) + 'static>(this: *mut ffi::MetaSelectionSource, f: glib::ffi::gpointer) { 130 | let f: &F = &*(f as *const F); 131 | f(SelectionSource::from_glib_borrow(this).unsafe_cast_ref()) 132 | } 133 | unsafe { 134 | let f: Box_ = Box_::new(f); 135 | connect_raw(self.as_ptr() as *mut _, b"deactivated\0".as_ptr() as *const _, 136 | Some(transmute::<_, unsafe extern "C" fn()>(deactivated_trampoline:: as *const ())), Box_::into_raw(f)) 137 | } 138 | } 139 | 140 | fn emit_deactivated(&self) { 141 | let _ = unsafe { glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject).emit_by_name("deactivated", &[]).unwrap() }; 142 | } 143 | } 144 | 145 | impl fmt::Display for SelectionSource { 146 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 147 | f.write_str("SelectionSource") 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /meta/src/auto/plugin.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Display; 7 | use crate::ModalOptions; 8 | use crate::WindowActor; 9 | use glib::object::IsA; 10 | use glib::translate::*; 11 | use std::fmt; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "MetaPlugin")] 15 | pub struct Plugin(Object); 16 | 17 | match fn { 18 | type_ => || ffi::meta_plugin_get_type(), 19 | } 20 | } 21 | 22 | impl Plugin { 23 | #[doc(alias = "meta_plugin_manager_set_plugin_type")] 24 | pub fn manager_set_plugin_type(gtype: glib::types::Type) { 25 | unsafe { 26 | ffi::meta_plugin_manager_set_plugin_type(gtype.into_glib()); 27 | } 28 | } 29 | } 30 | 31 | pub const NONE_PLUGIN: Option<&Plugin> = None; 32 | 33 | /// Trait containing all [`struct@Plugin`] methods. 34 | /// 35 | /// # Implementors 36 | /// 37 | /// [`Plugin`][struct@crate::Plugin] 38 | pub trait PluginExt: 'static { 39 | /// This function is used to grab the keyboard and mouse for the exclusive 40 | /// use of the plugin. Correct operation requires that both the keyboard 41 | /// and mouse are grabbed, or thing will break. (In particular, other 42 | /// passive X grabs in Meta can trigger but not be handled by the normal 43 | /// keybinding handling code.) However, the plugin can establish the keyboard 44 | /// and/or mouse grabs ahead of time and pass in the 45 | /// [`ModalOptions::POINTER_ALREADY_GRABBED`][crate::ModalOptions::POINTER_ALREADY_GRABBED] and/or [`ModalOptions::KEYBOARD_ALREADY_GRABBED`][crate::ModalOptions::KEYBOARD_ALREADY_GRABBED] 46 | /// options. This facility is provided for two reasons: first to allow using 47 | /// this function to establish modality after a passive grab, and second to 48 | /// allow using obscure features of XGrabPointer() and XGrabKeyboard() without 49 | /// having to add them to this API. 50 | /// ## `options` 51 | /// flags that modify the behavior of the modal grab 52 | /// ## `timestamp` 53 | /// the timestamp used for establishing grabs 54 | /// 55 | /// # Returns 56 | /// 57 | /// whether we successfully grabbed the keyboard and 58 | /// mouse and made the plugin modal. 59 | #[doc(alias = "meta_plugin_begin_modal")] 60 | fn begin_modal(&self, options: ModalOptions, timestamp: u32) -> bool; 61 | 62 | #[doc(alias = "meta_plugin_complete_display_change")] 63 | fn complete_display_change(&self, ok: bool); 64 | 65 | #[doc(alias = "meta_plugin_destroy_completed")] 66 | fn destroy_completed(&self, actor: &WindowActor); 67 | 68 | /// Ends the modal operation begun with [`begin_modal()`][Self::begin_modal()]. This 69 | /// ungrabs both the mouse and keyboard even when 70 | /// [`ModalOptions::POINTER_ALREADY_GRABBED`][crate::ModalOptions::POINTER_ALREADY_GRABBED] or 71 | /// [`ModalOptions::KEYBOARD_ALREADY_GRABBED`][crate::ModalOptions::KEYBOARD_ALREADY_GRABBED] were provided as options 72 | /// when beginnning the modal operation. 73 | /// ## `timestamp` 74 | /// the time used for releasing grabs 75 | #[doc(alias = "meta_plugin_end_modal")] 76 | fn end_modal(&self, timestamp: u32); 77 | 78 | /// Gets the [`Display`][crate::Display] corresponding to a plugin. 79 | /// 80 | /// # Returns 81 | /// 82 | /// the [`Display`][crate::Display] for the plugin 83 | #[doc(alias = "meta_plugin_get_display")] 84 | #[doc(alias = "get_display")] 85 | fn display(&self) -> Option; 86 | 87 | //#[doc(alias = "meta_plugin_get_info")] 88 | //#[doc(alias = "get_info")] 89 | //fn info(&self) -> /*Ignored*/Option; 90 | 91 | #[doc(alias = "meta_plugin_map_completed")] 92 | fn map_completed(&self, actor: &WindowActor); 93 | 94 | #[doc(alias = "meta_plugin_minimize_completed")] 95 | fn minimize_completed(&self, actor: &WindowActor); 96 | 97 | #[doc(alias = "meta_plugin_size_change_completed")] 98 | fn size_change_completed(&self, actor: &WindowActor); 99 | 100 | #[doc(alias = "meta_plugin_switch_workspace_completed")] 101 | fn switch_workspace_completed(&self); 102 | 103 | #[doc(alias = "meta_plugin_unminimize_completed")] 104 | fn unminimize_completed(&self, actor: &WindowActor); 105 | } 106 | 107 | impl> PluginExt for O { 108 | fn begin_modal(&self, options: ModalOptions, timestamp: u32) -> bool { 109 | unsafe { 110 | from_glib(ffi::meta_plugin_begin_modal(self.as_ref().to_glib_none().0, options.into_glib(), timestamp)) 111 | } 112 | } 113 | 114 | fn complete_display_change(&self, ok: bool) { 115 | unsafe { 116 | ffi::meta_plugin_complete_display_change(self.as_ref().to_glib_none().0, ok.into_glib()); 117 | } 118 | } 119 | 120 | fn destroy_completed(&self, actor: &WindowActor) { 121 | unsafe { 122 | ffi::meta_plugin_destroy_completed(self.as_ref().to_glib_none().0, actor.to_glib_none().0); 123 | } 124 | } 125 | 126 | fn end_modal(&self, timestamp: u32) { 127 | unsafe { 128 | ffi::meta_plugin_end_modal(self.as_ref().to_glib_none().0, timestamp); 129 | } 130 | } 131 | 132 | fn display(&self) -> Option { 133 | unsafe { 134 | from_glib_none(ffi::meta_plugin_get_display(self.as_ref().to_glib_none().0)) 135 | } 136 | } 137 | 138 | //fn info(&self) -> /*Ignored*/Option { 139 | // unsafe { TODO: call ffi:meta_plugin_get_info() } 140 | //} 141 | 142 | fn map_completed(&self, actor: &WindowActor) { 143 | unsafe { 144 | ffi::meta_plugin_map_completed(self.as_ref().to_glib_none().0, actor.to_glib_none().0); 145 | } 146 | } 147 | 148 | fn minimize_completed(&self, actor: &WindowActor) { 149 | unsafe { 150 | ffi::meta_plugin_minimize_completed(self.as_ref().to_glib_none().0, actor.to_glib_none().0); 151 | } 152 | } 153 | 154 | fn size_change_completed(&self, actor: &WindowActor) { 155 | unsafe { 156 | ffi::meta_plugin_size_change_completed(self.as_ref().to_glib_none().0, actor.to_glib_none().0); 157 | } 158 | } 159 | 160 | fn switch_workspace_completed(&self) { 161 | unsafe { 162 | ffi::meta_plugin_switch_workspace_completed(self.as_ref().to_glib_none().0); 163 | } 164 | } 165 | 166 | fn unminimize_completed(&self, actor: &WindowActor) { 167 | unsafe { 168 | ffi::meta_plugin_unminimize_completed(self.as_ref().to_glib_none().0, actor.to_glib_none().0); 169 | } 170 | } 171 | } 172 | 173 | impl fmt::Display for Plugin { 174 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 175 | f.write_str("Plugin") 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /cogl/src/auto/flags.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #[cfg(any(feature = "v0_8", feature = "dox"))] 7 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_8")))] 8 | use bitflags::bitflags; 9 | #[cfg(any(feature = "v0_8", feature = "dox"))] 10 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_8")))] 11 | use glib::translate::*; 12 | #[cfg(any(feature = "v0_8", feature = "dox"))] 13 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_8")))] 14 | use std::fmt; 15 | 16 | #[cfg(any(feature = "v0_8", feature = "dox"))] 17 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_8")))] 18 | bitflags! { 19 | #[doc(alias = "CoglPixelFormat")] 20 | pub struct PixelFormat: u32 { 21 | #[doc(alias = "COGL_PIXEL_FORMAT_ANY")] 22 | const ANY = ffi::COGL_PIXEL_FORMAT_ANY as u32; 23 | #[doc(alias = "COGL_PIXEL_FORMAT_A_8")] 24 | const A_8 = ffi::COGL_PIXEL_FORMAT_A_8 as u32; 25 | #[doc(alias = "COGL_PIXEL_FORMAT_RGB_565")] 26 | const RGB_565 = ffi::COGL_PIXEL_FORMAT_RGB_565 as u32; 27 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_4444")] 28 | const RGBA_4444 = ffi::COGL_PIXEL_FORMAT_RGBA_4444 as u32; 29 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_5551")] 30 | const RGBA_5551 = ffi::COGL_PIXEL_FORMAT_RGBA_5551 as u32; 31 | #[doc(alias = "COGL_PIXEL_FORMAT_YUV")] 32 | const YUV = ffi::COGL_PIXEL_FORMAT_YUV as u32; 33 | #[doc(alias = "COGL_PIXEL_FORMAT_G_8")] 34 | const G_8 = ffi::COGL_PIXEL_FORMAT_G_8 as u32; 35 | #[doc(alias = "COGL_PIXEL_FORMAT_RG_88")] 36 | const RG_88 = ffi::COGL_PIXEL_FORMAT_RG_88 as u32; 37 | #[doc(alias = "COGL_PIXEL_FORMAT_RGB_888")] 38 | const RGB_888 = ffi::COGL_PIXEL_FORMAT_RGB_888 as u32; 39 | #[doc(alias = "COGL_PIXEL_FORMAT_BGR_888")] 40 | const BGR_888 = ffi::COGL_PIXEL_FORMAT_BGR_888 as u32; 41 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_8888")] 42 | const RGBA_8888 = ffi::COGL_PIXEL_FORMAT_RGBA_8888 as u32; 43 | #[doc(alias = "COGL_PIXEL_FORMAT_BGRA_8888")] 44 | const BGRA_8888 = ffi::COGL_PIXEL_FORMAT_BGRA_8888 as u32; 45 | #[doc(alias = "COGL_PIXEL_FORMAT_ARGB_8888")] 46 | const ARGB_8888 = ffi::COGL_PIXEL_FORMAT_ARGB_8888 as u32; 47 | #[doc(alias = "COGL_PIXEL_FORMAT_ABGR_8888")] 48 | const ABGR_8888 = ffi::COGL_PIXEL_FORMAT_ABGR_8888 as u32; 49 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_1010102")] 50 | const RGBA_1010102 = ffi::COGL_PIXEL_FORMAT_RGBA_1010102 as u32; 51 | #[doc(alias = "COGL_PIXEL_FORMAT_BGRA_1010102")] 52 | const BGRA_1010102 = ffi::COGL_PIXEL_FORMAT_BGRA_1010102 as u32; 53 | #[doc(alias = "COGL_PIXEL_FORMAT_ARGB_2101010")] 54 | const ARGB_2101010 = ffi::COGL_PIXEL_FORMAT_ARGB_2101010 as u32; 55 | #[doc(alias = "COGL_PIXEL_FORMAT_ABGR_2101010")] 56 | const ABGR_2101010 = ffi::COGL_PIXEL_FORMAT_ABGR_2101010 as u32; 57 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_FP_16161616")] 58 | const RGBA_FP_16161616 = ffi::COGL_PIXEL_FORMAT_RGBA_FP_16161616 as u32; 59 | #[doc(alias = "COGL_PIXEL_FORMAT_BGRA_FP_16161616")] 60 | const BGRA_FP_16161616 = ffi::COGL_PIXEL_FORMAT_BGRA_FP_16161616 as u32; 61 | #[doc(alias = "COGL_PIXEL_FORMAT_ARGB_FP_16161616")] 62 | const ARGB_FP_16161616 = ffi::COGL_PIXEL_FORMAT_ARGB_FP_16161616 as u32; 63 | #[doc(alias = "COGL_PIXEL_FORMAT_ABGR_FP_16161616")] 64 | const ABGR_FP_16161616 = ffi::COGL_PIXEL_FORMAT_ABGR_FP_16161616 as u32; 65 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_8888_PRE")] 66 | const RGBA_8888_PRE = ffi::COGL_PIXEL_FORMAT_RGBA_8888_PRE as u32; 67 | #[doc(alias = "COGL_PIXEL_FORMAT_BGRA_8888_PRE")] 68 | const BGRA_8888_PRE = ffi::COGL_PIXEL_FORMAT_BGRA_8888_PRE as u32; 69 | #[doc(alias = "COGL_PIXEL_FORMAT_ARGB_8888_PRE")] 70 | const ARGB_8888_PRE = ffi::COGL_PIXEL_FORMAT_ARGB_8888_PRE as u32; 71 | #[doc(alias = "COGL_PIXEL_FORMAT_ABGR_8888_PRE")] 72 | const ABGR_8888_PRE = ffi::COGL_PIXEL_FORMAT_ABGR_8888_PRE as u32; 73 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_4444_PRE")] 74 | const RGBA_4444_PRE = ffi::COGL_PIXEL_FORMAT_RGBA_4444_PRE as u32; 75 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_5551_PRE")] 76 | const RGBA_5551_PRE = ffi::COGL_PIXEL_FORMAT_RGBA_5551_PRE as u32; 77 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_1010102_PRE")] 78 | const RGBA_1010102_PRE = ffi::COGL_PIXEL_FORMAT_RGBA_1010102_PRE as u32; 79 | #[doc(alias = "COGL_PIXEL_FORMAT_BGRA_1010102_PRE")] 80 | const BGRA_1010102_PRE = ffi::COGL_PIXEL_FORMAT_BGRA_1010102_PRE as u32; 81 | #[doc(alias = "COGL_PIXEL_FORMAT_ARGB_2101010_PRE")] 82 | const ARGB_2101010_PRE = ffi::COGL_PIXEL_FORMAT_ARGB_2101010_PRE as u32; 83 | #[doc(alias = "COGL_PIXEL_FORMAT_ABGR_2101010_PRE")] 84 | const ABGR_2101010_PRE = ffi::COGL_PIXEL_FORMAT_ABGR_2101010_PRE as u32; 85 | #[doc(alias = "COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE")] 86 | const RGBA_FP_16161616_PRE = ffi::COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE as u32; 87 | #[doc(alias = "COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE")] 88 | const BGRA_FP_16161616_PRE = ffi::COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE as u32; 89 | #[doc(alias = "COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE")] 90 | const ARGB_FP_16161616_PRE = ffi::COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE as u32; 91 | #[doc(alias = "COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE")] 92 | const ABGR_FP_16161616_PRE = ffi::COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE as u32; 93 | #[doc(alias = "COGL_PIXEL_FORMAT_DEPTH_16")] 94 | const DEPTH_16 = ffi::COGL_PIXEL_FORMAT_DEPTH_16 as u32; 95 | #[doc(alias = "COGL_PIXEL_FORMAT_DEPTH_32")] 96 | const DEPTH_32 = ffi::COGL_PIXEL_FORMAT_DEPTH_32 as u32; 97 | #[doc(alias = "COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8")] 98 | const DEPTH_24_STENCIL_8 = ffi::COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 as u32; 99 | } 100 | } 101 | 102 | #[cfg(any(feature = "v0_8", feature = "dox"))] 103 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_8")))] 104 | impl fmt::Display for PixelFormat { 105 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 106 | ::fmt(self, f) 107 | } 108 | } 109 | 110 | #[cfg(any(feature = "v0_8", feature = "dox"))] 111 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_8")))] 112 | #[doc(hidden)] 113 | impl IntoGlib for PixelFormat { 114 | type GlibType = ffi::CoglPixelFormat; 115 | 116 | fn into_glib(self) -> ffi::CoglPixelFormat { 117 | self.bits() 118 | } 119 | } 120 | 121 | #[cfg(any(feature = "v0_8", feature = "dox"))] 122 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_8")))] 123 | #[doc(hidden)] 124 | impl FromGlib for PixelFormat { 125 | unsafe fn from_glib(value: ffi::CoglPixelFormat) -> Self { 126 | Self::from_bits_truncate(value) 127 | } 128 | } 129 | 130 | -------------------------------------------------------------------------------- /meta/src/auto/window_actor.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Window; 7 | use glib::object::ObjectType as ObjectType_; 8 | use glib::signal::connect_raw; 9 | use glib::signal::SignalHandlerId; 10 | use glib::translate::*; 11 | use std::boxed::Box as Box_; 12 | use std::fmt; 13 | use std::mem::transmute; 14 | 15 | glib::wrapper! { 16 | #[doc(alias = "MetaWindowActor")] 17 | pub struct WindowActor(Object) @extends clutter::Actor, @implements clutter::Animatable, clutter::Container, clutter::Scriptable; 18 | 19 | match fn { 20 | type_ => || ffi::meta_window_actor_get_type(), 21 | } 22 | } 23 | 24 | impl WindowActor { 25 | /// Freezes the [`WindowActor`][crate::WindowActor], which inhibits updates and geometry 26 | /// changes of the window. This property is refcounted, so make sure 27 | /// to call [`thaw()`][Self::thaw()] the exact same amount of times 28 | /// as this function to allow updates again. 29 | #[doc(alias = "meta_window_actor_freeze")] 30 | pub fn freeze(&self) { 31 | unsafe { 32 | ffi::meta_window_actor_freeze(self.to_glib_none().0); 33 | } 34 | } 35 | 36 | /// Gets the [`Window`][crate::Window] object that the the [`WindowActor`][crate::WindowActor] is displaying 37 | /// 38 | /// # Returns 39 | /// 40 | /// the displayed [`Window`][crate::Window] 41 | #[doc(alias = "meta_window_actor_get_meta_window")] 42 | #[doc(alias = "get_meta_window")] 43 | pub fn meta_window(&self) -> Option { 44 | unsafe { 45 | from_glib_none(ffi::meta_window_actor_get_meta_window(self.to_glib_none().0)) 46 | } 47 | } 48 | 49 | //#[doc(alias = "meta_window_actor_get_texture")] 50 | //#[doc(alias = "get_texture")] 51 | //pub fn texture(&self) -> /*Ignored*/Option { 52 | // unsafe { TODO: call ffi:meta_window_actor_get_texture() } 53 | //} 54 | 55 | /// Gets whether the X window that the actor was displaying has been destroyed 56 | /// 57 | /// # Returns 58 | /// 59 | /// [`true`] when the window is destroyed, otherwise [`false`] 60 | #[doc(alias = "meta_window_actor_is_destroyed")] 61 | pub fn is_destroyed(&self) -> bool { 62 | unsafe { 63 | from_glib(ffi::meta_window_actor_is_destroyed(self.to_glib_none().0)) 64 | } 65 | } 66 | 67 | #[doc(alias = "meta_window_actor_sync_visibility")] 68 | pub fn sync_visibility(&self) { 69 | unsafe { 70 | ffi::meta_window_actor_sync_visibility(self.to_glib_none().0); 71 | } 72 | } 73 | 74 | /// Thaws/unfreezes the [`WindowActor`][crate::WindowActor] to allow updates and geometry 75 | /// changes after a window was frozen using [`freeze()`][Self::freeze()]. 76 | #[doc(alias = "meta_window_actor_thaw")] 77 | pub fn thaw(&self) { 78 | unsafe { 79 | ffi::meta_window_actor_thaw(self.to_glib_none().0); 80 | } 81 | } 82 | 83 | /// Notify that one or more of the surfaces of the window have been damaged. 84 | #[doc(alias = "damaged")] 85 | pub fn connect_damaged(&self, f: F) -> SignalHandlerId { 86 | unsafe extern "C" fn damaged_trampoline(this: *mut ffi::MetaWindowActor, f: glib::ffi::gpointer) { 87 | let f: &F = &*(f as *const F); 88 | f(&from_glib_borrow(this)) 89 | } 90 | unsafe { 91 | let f: Box_ = Box_::new(f); 92 | connect_raw(self.as_ptr() as *mut _, b"damaged\0".as_ptr() as *const _, 93 | Some(transmute::<_, unsafe extern "C" fn()>(damaged_trampoline:: as *const ())), Box_::into_raw(f)) 94 | } 95 | } 96 | 97 | /// The ::effects-completed signal will be emitted once all pending compositor 98 | /// effects are completed. 99 | #[doc(alias = "effects-completed")] 100 | pub fn connect_effects_completed(&self, f: F) -> SignalHandlerId { 101 | unsafe extern "C" fn effects_completed_trampoline(this: *mut ffi::MetaWindowActor, f: glib::ffi::gpointer) { 102 | let f: &F = &*(f as *const F); 103 | f(&from_glib_borrow(this)) 104 | } 105 | unsafe { 106 | let f: Box_ = Box_::new(f); 107 | connect_raw(self.as_ptr() as *mut _, b"effects-completed\0".as_ptr() as *const _, 108 | Some(transmute::<_, unsafe extern "C" fn()>(effects_completed_trampoline:: as *const ())), Box_::into_raw(f)) 109 | } 110 | } 111 | 112 | /// The ::first-frame signal will be emitted the first time a frame 113 | /// of window contents has been drawn by the application and Mutter 114 | /// has had the chance to drawn that frame to the screen. If the 115 | /// window starts off initially hidden, obscured, or on on a 116 | /// different workspace, the ::first-frame signal will be emitted 117 | /// even though the user doesn't see the contents. 118 | /// 119 | /// MetaDisplay::window-created is a good place to connect to this 120 | /// signal - at that point, the MetaWindowActor for the window 121 | /// exists, but the window has reliably not yet been drawn. 122 | /// Connecting to an existing window that has already been drawn to 123 | /// the screen is not useful. 124 | #[doc(alias = "first-frame")] 125 | pub fn connect_first_frame(&self, f: F) -> SignalHandlerId { 126 | unsafe extern "C" fn first_frame_trampoline(this: *mut ffi::MetaWindowActor, f: glib::ffi::gpointer) { 127 | let f: &F = &*(f as *const F); 128 | f(&from_glib_borrow(this)) 129 | } 130 | unsafe { 131 | let f: Box_ = Box_::new(f); 132 | connect_raw(self.as_ptr() as *mut _, b"first-frame\0".as_ptr() as *const _, 133 | Some(transmute::<_, unsafe extern "C" fn()>(first_frame_trampoline:: as *const ())), Box_::into_raw(f)) 134 | } 135 | } 136 | 137 | #[doc(alias = "thawed")] 138 | pub fn connect_thawed(&self, f: F) -> SignalHandlerId { 139 | unsafe extern "C" fn thawed_trampoline(this: *mut ffi::MetaWindowActor, f: glib::ffi::gpointer) { 140 | let f: &F = &*(f as *const F); 141 | f(&from_glib_borrow(this)) 142 | } 143 | unsafe { 144 | let f: Box_ = Box_::new(f); 145 | connect_raw(self.as_ptr() as *mut _, b"thawed\0".as_ptr() as *const _, 146 | Some(transmute::<_, unsafe extern "C" fn()>(thawed_trampoline:: as *const ())), Box_::into_raw(f)) 147 | } 148 | } 149 | } 150 | 151 | impl fmt::Display for WindowActor { 152 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 153 | f.write_str("WindowActor") 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /clutter/src/auto/actor_meta.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Actor; 7 | use glib::object::Cast; 8 | use glib::object::IsA; 9 | use glib::signal::connect_raw; 10 | use glib::signal::SignalHandlerId; 11 | use glib::translate::*; 12 | use std::boxed::Box as Box_; 13 | use std::fmt; 14 | use std::mem::transmute; 15 | 16 | glib::wrapper! { 17 | #[doc(alias = "ClutterActorMeta")] 18 | pub struct ActorMeta(Object); 19 | 20 | match fn { 21 | type_ => || ffi::clutter_actor_meta_get_type(), 22 | } 23 | } 24 | 25 | pub const NONE_ACTOR_META: Option<&ActorMeta> = None; 26 | 27 | /// Trait containing all [`struct@ActorMeta`] methods. 28 | /// 29 | /// # Implementors 30 | /// 31 | /// [`Action`][struct@crate::Action], [`ActorMeta`][struct@crate::ActorMeta], [`Constraint`][struct@crate::Constraint], [`Effect`][struct@crate::Effect] 32 | pub trait ActorMetaExt: 'static { 33 | /// Retrieves a pointer to the [`Actor`][crate::Actor] that owns `self` 34 | /// 35 | /// # Returns 36 | /// 37 | /// a pointer to a [`Actor`][crate::Actor] or [`None`] 38 | #[doc(alias = "clutter_actor_meta_get_actor")] 39 | #[doc(alias = "get_actor")] 40 | fn actor(&self) -> Option; 41 | 42 | /// Retrieves whether `self` is enabled 43 | /// 44 | /// # Returns 45 | /// 46 | /// [`true`] if the [`ActorMeta`][crate::ActorMeta] instance is enabled 47 | #[doc(alias = "clutter_actor_meta_get_enabled")] 48 | #[doc(alias = "get_enabled")] 49 | fn is_enabled(&self) -> bool; 50 | 51 | /// Retrieves the name set using [`set_name()`][Self::set_name()] 52 | /// 53 | /// # Returns 54 | /// 55 | /// the name of the [`ActorMeta`][crate::ActorMeta] 56 | /// instance, or [`None`] if none was set. The returned string is owned 57 | /// by the [`ActorMeta`][crate::ActorMeta] instance and it should not be modified 58 | /// or freed 59 | #[doc(alias = "clutter_actor_meta_get_name")] 60 | #[doc(alias = "get_name")] 61 | fn name(&self) -> Option; 62 | 63 | /// Sets whether `self` should be enabled or not 64 | /// ## `is_enabled` 65 | /// whether `self` is enabled 66 | #[doc(alias = "clutter_actor_meta_set_enabled")] 67 | fn set_enabled(&self, is_enabled: bool); 68 | 69 | /// Sets the name of `self` 70 | /// 71 | /// The name can be used to identify the [`ActorMeta`][crate::ActorMeta] instance 72 | /// ## `name` 73 | /// the name of `self` 74 | #[doc(alias = "clutter_actor_meta_set_name")] 75 | fn set_name(&self, name: &str); 76 | 77 | #[cfg(any(feature = "v1_4", feature = "dox"))] 78 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 79 | #[doc(alias = "actor")] 80 | fn connect_actor_notify(&self, f: F) -> SignalHandlerId; 81 | 82 | #[cfg(any(feature = "v1_4", feature = "dox"))] 83 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 84 | #[doc(alias = "enabled")] 85 | fn connect_enabled_notify(&self, f: F) -> SignalHandlerId; 86 | 87 | #[cfg(any(feature = "v1_4", feature = "dox"))] 88 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 89 | #[doc(alias = "name")] 90 | fn connect_name_notify(&self, f: F) -> SignalHandlerId; 91 | } 92 | 93 | impl> ActorMetaExt for O { 94 | fn actor(&self) -> Option { 95 | unsafe { 96 | from_glib_none(ffi::clutter_actor_meta_get_actor(self.as_ref().to_glib_none().0)) 97 | } 98 | } 99 | 100 | fn is_enabled(&self) -> bool { 101 | unsafe { 102 | from_glib(ffi::clutter_actor_meta_get_enabled(self.as_ref().to_glib_none().0)) 103 | } 104 | } 105 | 106 | fn name(&self) -> Option { 107 | unsafe { 108 | from_glib_none(ffi::clutter_actor_meta_get_name(self.as_ref().to_glib_none().0)) 109 | } 110 | } 111 | 112 | fn set_enabled(&self, is_enabled: bool) { 113 | unsafe { 114 | ffi::clutter_actor_meta_set_enabled(self.as_ref().to_glib_none().0, is_enabled.into_glib()); 115 | } 116 | } 117 | 118 | fn set_name(&self, name: &str) { 119 | unsafe { 120 | ffi::clutter_actor_meta_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0); 121 | } 122 | } 123 | 124 | #[cfg(any(feature = "v1_4", feature = "dox"))] 125 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 126 | fn connect_actor_notify(&self, f: F) -> SignalHandlerId { 127 | unsafe extern "C" fn notify_actor_trampoline, F: Fn(&P) + 'static>(this: *mut ffi::ClutterActorMeta, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { 128 | let f: &F = &*(f as *const F); 129 | f(ActorMeta::from_glib_borrow(this).unsafe_cast_ref()) 130 | } 131 | unsafe { 132 | let f: Box_ = Box_::new(f); 133 | connect_raw(self.as_ptr() as *mut _, b"notify::actor\0".as_ptr() as *const _, 134 | Some(transmute::<_, unsafe extern "C" fn()>(notify_actor_trampoline:: as *const ())), Box_::into_raw(f)) 135 | } 136 | } 137 | 138 | #[cfg(any(feature = "v1_4", feature = "dox"))] 139 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 140 | fn connect_enabled_notify(&self, f: F) -> SignalHandlerId { 141 | unsafe extern "C" fn notify_enabled_trampoline, F: Fn(&P) + 'static>(this: *mut ffi::ClutterActorMeta, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { 142 | let f: &F = &*(f as *const F); 143 | f(ActorMeta::from_glib_borrow(this).unsafe_cast_ref()) 144 | } 145 | unsafe { 146 | let f: Box_ = Box_::new(f); 147 | connect_raw(self.as_ptr() as *mut _, b"notify::enabled\0".as_ptr() as *const _, 148 | Some(transmute::<_, unsafe extern "C" fn()>(notify_enabled_trampoline:: as *const ())), Box_::into_raw(f)) 149 | } 150 | } 151 | 152 | #[cfg(any(feature = "v1_4", feature = "dox"))] 153 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_4")))] 154 | fn connect_name_notify(&self, f: F) -> SignalHandlerId { 155 | unsafe extern "C" fn notify_name_trampoline, F: Fn(&P) + 'static>(this: *mut ffi::ClutterActorMeta, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { 156 | let f: &F = &*(f as *const F); 157 | f(ActorMeta::from_glib_borrow(this).unsafe_cast_ref()) 158 | } 159 | unsafe { 160 | let f: Box_ = Box_::new(f); 161 | connect_raw(self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _, 162 | Some(transmute::<_, unsafe extern "C" fn()>(notify_name_trampoline:: as *const ())), Box_::into_raw(f)) 163 | } 164 | } 165 | } 166 | 167 | impl fmt::Display for ActorMeta { 168 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 169 | f.write_str("ActorMeta") 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /meta/src/auto/backend.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use glib::object::ObjectType as ObjectType_; 7 | use glib::signal::connect_raw; 8 | use glib::signal::SignalHandlerId; 9 | use glib::translate::*; 10 | use std::boxed::Box as Box_; 11 | use std::fmt; 12 | use std::mem::transmute; 13 | 14 | glib::wrapper! { 15 | #[doc(alias = "MetaBackend")] 16 | pub struct Backend(Object); 17 | 18 | match fn { 19 | type_ => || ffi::meta_backend_get_type(), 20 | } 21 | } 22 | 23 | impl Backend { 24 | //#[doc(alias = "meta_backend_get_dnd")] 25 | //#[doc(alias = "get_dnd")] 26 | //pub fn dnd(&self) -> /*Ignored*/Option { 27 | // unsafe { TODO: call ffi:meta_backend_get_dnd() } 28 | //} 29 | 30 | //#[doc(alias = "meta_backend_get_remote_access_controller")] 31 | //#[doc(alias = "get_remote_access_controller")] 32 | //pub fn remote_access_controller(&self) -> /*Ignored*/Option { 33 | // unsafe { TODO: call ffi:meta_backend_get_remote_access_controller() } 34 | //} 35 | 36 | //#[doc(alias = "meta_backend_get_settings")] 37 | //#[doc(alias = "get_settings")] 38 | //pub fn settings(&self) -> /*Ignored*/Option { 39 | // unsafe { TODO: call ffi:meta_backend_get_settings() } 40 | //} 41 | 42 | /// Gets the global [`clutter::Stage`][crate::clutter::Stage] that's managed by this backend. 43 | /// 44 | /// # Returns 45 | /// 46 | /// the [`clutter::Stage`][crate::clutter::Stage] 47 | #[doc(alias = "meta_backend_get_stage")] 48 | #[doc(alias = "get_stage")] 49 | pub fn stage(&self) -> Option { 50 | unsafe { 51 | from_glib_none(ffi::meta_backend_get_stage(self.to_glib_none().0)) 52 | } 53 | } 54 | 55 | /// 56 | /// # Returns 57 | /// 58 | /// [`true`] if the rendering is hardware accelerated, otherwise 59 | /// [`false`]. 60 | #[doc(alias = "meta_backend_is_rendering_hardware_accelerated")] 61 | pub fn is_rendering_hardware_accelerated(&self) -> bool { 62 | unsafe { 63 | from_glib(ffi::meta_backend_is_rendering_hardware_accelerated(self.to_glib_none().0)) 64 | } 65 | } 66 | 67 | #[doc(alias = "meta_backend_lock_layout_group")] 68 | pub fn lock_layout_group(&self, idx: u32) { 69 | unsafe { 70 | ffi::meta_backend_lock_layout_group(self.to_glib_none().0, idx); 71 | } 72 | } 73 | 74 | #[doc(alias = "meta_backend_set_keymap")] 75 | pub fn set_keymap(&self, layouts: &str, variants: &str, options: &str) { 76 | unsafe { 77 | ffi::meta_backend_set_keymap(self.to_glib_none().0, layouts.to_glib_none().0, variants.to_glib_none().0, options.to_glib_none().0); 78 | } 79 | } 80 | 81 | #[doc(alias = "meta_backend_set_numlock")] 82 | pub fn set_numlock(&self, numlock_state: bool) { 83 | unsafe { 84 | ffi::meta_backend_set_numlock(self.to_glib_none().0, numlock_state.into_glib()); 85 | } 86 | } 87 | 88 | //#[doc(alias = "gpu-added")] 89 | //pub fn connect_gpu_added(&self, f: F) -> SignalHandlerId { 90 | // Unimplemented gpu: *.Pointer 91 | //} 92 | 93 | #[doc(alias = "keymap-changed")] 94 | pub fn connect_keymap_changed(&self, f: F) -> SignalHandlerId { 95 | unsafe extern "C" fn keymap_changed_trampoline(this: *mut ffi::MetaBackend, f: glib::ffi::gpointer) { 96 | let f: &F = &*(f as *const F); 97 | f(&from_glib_borrow(this)) 98 | } 99 | unsafe { 100 | let f: Box_ = Box_::new(f); 101 | connect_raw(self.as_ptr() as *mut _, b"keymap-changed\0".as_ptr() as *const _, 102 | Some(transmute::<_, unsafe extern "C" fn()>(keymap_changed_trampoline:: as *const ())), Box_::into_raw(f)) 103 | } 104 | } 105 | 106 | #[doc(alias = "keymap-layout-group-changed")] 107 | pub fn connect_keymap_layout_group_changed(&self, f: F) -> SignalHandlerId { 108 | unsafe extern "C" fn keymap_layout_group_changed_trampoline(this: *mut ffi::MetaBackend, object: libc::c_uint, f: glib::ffi::gpointer) { 109 | let f: &F = &*(f as *const F); 110 | f(&from_glib_borrow(this), object) 111 | } 112 | unsafe { 113 | let f: Box_ = Box_::new(f); 114 | connect_raw(self.as_ptr() as *mut _, b"keymap-layout-group-changed\0".as_ptr() as *const _, 115 | Some(transmute::<_, unsafe extern "C" fn()>(keymap_layout_group_changed_trampoline:: as *const ())), Box_::into_raw(f)) 116 | } 117 | } 118 | 119 | #[doc(alias = "last-device-changed")] 120 | pub fn connect_last_device_changed(&self, f: F) -> SignalHandlerId { 121 | unsafe extern "C" fn last_device_changed_trampoline(this: *mut ffi::MetaBackend, object: *mut clutter::ffi::ClutterInputDevice, f: glib::ffi::gpointer) { 122 | let f: &F = &*(f as *const F); 123 | f(&from_glib_borrow(this), &from_glib_borrow(object)) 124 | } 125 | unsafe { 126 | let f: Box_ = Box_::new(f); 127 | connect_raw(self.as_ptr() as *mut _, b"last-device-changed\0".as_ptr() as *const _, 128 | Some(transmute::<_, unsafe extern "C" fn()>(last_device_changed_trampoline:: as *const ())), Box_::into_raw(f)) 129 | } 130 | } 131 | 132 | #[doc(alias = "lid-is-closed-changed")] 133 | pub fn connect_lid_is_closed_changed(&self, f: F) -> SignalHandlerId { 134 | unsafe extern "C" fn lid_is_closed_changed_trampoline(this: *mut ffi::MetaBackend, object: glib::ffi::gboolean, f: glib::ffi::gpointer) { 135 | let f: &F = &*(f as *const F); 136 | f(&from_glib_borrow(this), from_glib(object)) 137 | } 138 | unsafe { 139 | let f: Box_ = Box_::new(f); 140 | connect_raw(self.as_ptr() as *mut _, b"lid-is-closed-changed\0".as_ptr() as *const _, 141 | Some(transmute::<_, unsafe extern "C" fn()>(lid_is_closed_changed_trampoline:: as *const ())), Box_::into_raw(f)) 142 | } 143 | } 144 | 145 | #[doc(alias = "prepare-shutdown")] 146 | pub fn connect_prepare_shutdown(&self, f: F) -> SignalHandlerId { 147 | unsafe extern "C" fn prepare_shutdown_trampoline(this: *mut ffi::MetaBackend, f: glib::ffi::gpointer) { 148 | let f: &F = &*(f as *const F); 149 | f(&from_glib_borrow(this)) 150 | } 151 | unsafe { 152 | let f: Box_ = Box_::new(f); 153 | connect_raw(self.as_ptr() as *mut _, b"prepare-shutdown\0".as_ptr() as *const _, 154 | Some(transmute::<_, unsafe extern "C" fn()>(prepare_shutdown_trampoline:: as *const ())), Box_::into_raw(f)) 155 | } 156 | } 157 | } 158 | 159 | impl fmt::Display for Backend { 160 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 161 | f.write_str("Backend") 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /meta/src/auto/compositor.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Backend; 7 | use crate::Display; 8 | use crate::KeyBinding; 9 | use crate::MotionDirection; 10 | use crate::Rectangle; 11 | use crate::Window; 12 | use crate::Workspace; 13 | use glib::object::ObjectType as ObjectType_; 14 | use glib::translate::*; 15 | use glib::StaticType; 16 | use std::fmt; 17 | 18 | glib::wrapper! { 19 | #[doc(alias = "MetaCompositor")] 20 | pub struct Compositor(Object); 21 | 22 | match fn { 23 | type_ => || ffi::meta_compositor_get_type(), 24 | } 25 | } 26 | 27 | impl Compositor { 28 | #[doc(alias = "meta_compositor_add_window")] 29 | pub fn add_window(&self, window: &Window) { 30 | unsafe { 31 | ffi::meta_compositor_add_window(self.to_glib_none().0, window.to_glib_none().0); 32 | } 33 | } 34 | 35 | #[doc(alias = "meta_compositor_destroy")] 36 | pub fn destroy(&self) { 37 | unsafe { 38 | ffi::meta_compositor_destroy(self.to_glib_none().0); 39 | } 40 | } 41 | 42 | #[doc(alias = "meta_compositor_filter_keybinding")] 43 | pub fn filter_keybinding(&self, binding: &KeyBinding) -> bool { 44 | unsafe { 45 | from_glib(ffi::meta_compositor_filter_keybinding(self.to_glib_none().0, mut_override(binding.to_glib_none().0))) 46 | } 47 | } 48 | 49 | #[doc(alias = "meta_compositor_flash_display")] 50 | pub fn flash_display(&self, display: &Display) { 51 | unsafe { 52 | ffi::meta_compositor_flash_display(self.to_glib_none().0, display.to_glib_none().0); 53 | } 54 | } 55 | 56 | #[doc(alias = "meta_compositor_hide_tile_preview")] 57 | pub fn hide_tile_preview(&self) { 58 | unsafe { 59 | ffi::meta_compositor_hide_tile_preview(self.to_glib_none().0); 60 | } 61 | } 62 | 63 | //#[doc(alias = "meta_compositor_hide_window")] 64 | //pub fn hide_window(&self, window: &Window, effect: /*Ignored*/CompEffect) { 65 | // unsafe { TODO: call ffi:meta_compositor_hide_window() } 66 | //} 67 | 68 | #[doc(alias = "meta_compositor_manage")] 69 | pub fn manage(&self) { 70 | unsafe { 71 | ffi::meta_compositor_manage(self.to_glib_none().0); 72 | } 73 | } 74 | 75 | #[doc(alias = "meta_compositor_queue_frame_drawn")] 76 | pub fn queue_frame_drawn(&self, window: &Window, no_delay_frame: bool) { 77 | unsafe { 78 | ffi::meta_compositor_queue_frame_drawn(self.to_glib_none().0, window.to_glib_none().0, no_delay_frame.into_glib()); 79 | } 80 | } 81 | 82 | #[doc(alias = "meta_compositor_remove_window")] 83 | pub fn remove_window(&self, window: &Window) { 84 | unsafe { 85 | ffi::meta_compositor_remove_window(self.to_glib_none().0, window.to_glib_none().0); 86 | } 87 | } 88 | 89 | #[doc(alias = "meta_compositor_show_tile_preview")] 90 | pub fn show_tile_preview(&self, window: &Window, tile_rect: &mut Rectangle, tile_monitor_number: i32) { 91 | unsafe { 92 | ffi::meta_compositor_show_tile_preview(self.to_glib_none().0, window.to_glib_none().0, tile_rect.to_glib_none_mut().0, tile_monitor_number); 93 | } 94 | } 95 | 96 | //#[doc(alias = "meta_compositor_show_window")] 97 | //pub fn show_window(&self, window: &Window, effect: /*Ignored*/CompEffect) { 98 | // unsafe { TODO: call ffi:meta_compositor_show_window() } 99 | //} 100 | 101 | //#[doc(alias = "meta_compositor_show_window_menu")] 102 | //pub fn show_window_menu(&self, window: &Window, menu: /*Ignored*/WindowMenuType, x: i32, y: i32) { 103 | // unsafe { TODO: call ffi:meta_compositor_show_window_menu() } 104 | //} 105 | 106 | //#[doc(alias = "meta_compositor_show_window_menu_for_rect")] 107 | //pub fn show_window_menu_for_rect(&self, window: &Window, menu: /*Ignored*/WindowMenuType, rect: &mut Rectangle) { 108 | // unsafe { TODO: call ffi:meta_compositor_show_window_menu_for_rect() } 109 | //} 110 | 111 | //#[doc(alias = "meta_compositor_size_change_window")] 112 | //pub fn size_change_window(&self, window: &Window, which_change: /*Ignored*/SizeChange, old_frame_rect: &mut Rectangle, old_buffer_rect: &mut Rectangle) { 113 | // unsafe { TODO: call ffi:meta_compositor_size_change_window() } 114 | //} 115 | 116 | #[doc(alias = "meta_compositor_switch_workspace")] 117 | pub fn switch_workspace(&self, from: &Workspace, to: &Workspace, direction: MotionDirection) { 118 | unsafe { 119 | ffi::meta_compositor_switch_workspace(self.to_glib_none().0, from.to_glib_none().0, to.to_glib_none().0, direction.into_glib()); 120 | } 121 | } 122 | 123 | //#[doc(alias = "meta_compositor_sync_stack")] 124 | //pub fn sync_stack(&self, stack: /*Unimplemented*/&[&Fundamental: Pointer]) { 125 | // unsafe { TODO: call ffi:meta_compositor_sync_stack() } 126 | //} 127 | 128 | #[doc(alias = "meta_compositor_sync_updates_frozen")] 129 | pub fn sync_updates_frozen(&self, window: &Window) { 130 | unsafe { 131 | ffi::meta_compositor_sync_updates_frozen(self.to_glib_none().0, window.to_glib_none().0); 132 | } 133 | } 134 | 135 | #[doc(alias = "meta_compositor_sync_window_geometry")] 136 | pub fn sync_window_geometry(&self, window: &Window, did_placement: bool) { 137 | unsafe { 138 | ffi::meta_compositor_sync_window_geometry(self.to_glib_none().0, window.to_glib_none().0, did_placement.into_glib()); 139 | } 140 | } 141 | 142 | #[doc(alias = "meta_compositor_unmanage")] 143 | pub fn unmanage(&self) { 144 | unsafe { 145 | ffi::meta_compositor_unmanage(self.to_glib_none().0); 146 | } 147 | } 148 | 149 | #[doc(alias = "meta_compositor_window_opacity_changed")] 150 | pub fn window_opacity_changed(&self, window: &Window) { 151 | unsafe { 152 | ffi::meta_compositor_window_opacity_changed(self.to_glib_none().0, window.to_glib_none().0); 153 | } 154 | } 155 | 156 | #[doc(alias = "meta_compositor_window_shape_changed")] 157 | pub fn window_shape_changed(&self, window: &Window) { 158 | unsafe { 159 | ffi::meta_compositor_window_shape_changed(self.to_glib_none().0, window.to_glib_none().0); 160 | } 161 | } 162 | 163 | pub fn backend(&self) -> Option { 164 | unsafe { 165 | let mut value = glib::Value::from_type(::static_type()); 166 | glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"backend\0".as_ptr() as *const _, value.to_glib_none_mut().0); 167 | value.get().expect("Return Value for property `backend` getter") 168 | } 169 | } 170 | 171 | pub fn display(&self) -> Option { 172 | unsafe { 173 | let mut value = glib::Value::from_type(::static_type()); 174 | glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"display\0".as_ptr() as *const _, value.to_glib_none_mut().0); 175 | value.get().expect("Return Value for property `display` getter") 176 | } 177 | } 178 | } 179 | 180 | impl fmt::Display for Compositor { 181 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 182 | f.write_str("Compositor") 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /clutter/src/auto/content.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | #[cfg(any(feature = "v1_10", feature = "dox"))] 7 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 8 | use crate::Actor; 9 | #[cfg(any(feature = "v1_10", feature = "dox"))] 10 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 11 | use glib::object::Cast; 12 | use glib::object::IsA; 13 | #[cfg(any(feature = "v1_10", feature = "dox"))] 14 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 15 | use glib::signal::connect_raw; 16 | #[cfg(any(feature = "v1_10", feature = "dox"))] 17 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 18 | use glib::signal::SignalHandlerId; 19 | use glib::translate::*; 20 | #[cfg(any(feature = "v1_10", feature = "dox"))] 21 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 22 | use std::boxed::Box as Box_; 23 | use std::fmt; 24 | #[cfg(any(feature = "v1_10", feature = "dox"))] 25 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 26 | use std::mem; 27 | #[cfg(any(feature = "v1_10", feature = "dox"))] 28 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 29 | use std::mem::transmute; 30 | 31 | glib::wrapper! { 32 | #[doc(alias = "ClutterContent")] 33 | pub struct Content(Interface); 34 | 35 | match fn { 36 | type_ => || ffi::clutter_content_get_type(), 37 | } 38 | } 39 | 40 | pub const NONE_CONTENT: Option<&Content> = None; 41 | 42 | /// Trait containing all [`struct@Content`] methods. 43 | /// 44 | /// # Implementors 45 | /// 46 | /// [`Canvas`][struct@crate::Canvas], [`Content`][struct@crate::Content], [`Image`][struct@crate::Image] 47 | pub trait ContentExt: 'static { 48 | /// Retrieves the natural size of the `self`, if any. 49 | /// 50 | /// The natural size of a [`Content`][crate::Content] is defined as the size the content 51 | /// would have regardless of the allocation of the actor that is painting it, 52 | /// for instance the size of an image data. 53 | /// 54 | /// # Returns 55 | /// 56 | /// [`true`] if the content has a preferred size, and [`false`] 57 | /// otherwise 58 | /// 59 | /// ## `width` 60 | /// return location for the natural width of the content 61 | /// 62 | /// ## `height` 63 | /// return location for the natural height of the content 64 | #[cfg(any(feature = "v1_10", feature = "dox"))] 65 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 66 | #[doc(alias = "clutter_content_get_preferred_size")] 67 | #[doc(alias = "get_preferred_size")] 68 | fn preferred_size(&self) -> Option<(f32, f32)>; 69 | 70 | /// Invalidates a [`Content`][crate::Content]. 71 | /// 72 | /// This function should be called by [`Content`][crate::Content] implementations when 73 | /// they change the way a the content should be painted regardless of the 74 | /// actor state. 75 | #[cfg(any(feature = "v1_10", feature = "dox"))] 76 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 77 | #[doc(alias = "clutter_content_invalidate")] 78 | fn invalidate(&self); 79 | 80 | /// Signals that `self`'s size changed. Attached actors with request mode 81 | /// set to [`RequestMode::ContentSize`][crate::RequestMode::ContentSize] will have a relayout queued. 82 | /// 83 | /// Attached actors with other request modes are not redrawn. To redraw them 84 | /// too, use [`invalidate()`][Self::invalidate()]. 85 | #[doc(alias = "clutter_content_invalidate_size")] 86 | fn invalidate_size(&self); 87 | 88 | /// This signal is emitted each time a [`Content`][crate::Content] implementation is 89 | /// assigned to a [`Actor`][crate::Actor]. 90 | /// ## `actor` 91 | /// a [`Actor`][crate::Actor] 92 | #[cfg(any(feature = "v1_10", feature = "dox"))] 93 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 94 | #[doc(alias = "attached")] 95 | fn connect_attached(&self, f: F) -> SignalHandlerId; 96 | 97 | /// This signal is emitted each time a [`Content`][crate::Content] implementation is 98 | /// removed from a [`Actor`][crate::Actor]. 99 | /// ## `actor` 100 | /// a [`Actor`][crate::Actor] 101 | #[cfg(any(feature = "v1_10", feature = "dox"))] 102 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 103 | #[doc(alias = "detached")] 104 | fn connect_detached(&self, f: F) -> SignalHandlerId; 105 | } 106 | 107 | impl> ContentExt for O { 108 | #[cfg(any(feature = "v1_10", feature = "dox"))] 109 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 110 | fn preferred_size(&self) -> Option<(f32, f32)> { 111 | unsafe { 112 | let mut width = mem::MaybeUninit::uninit(); 113 | let mut height = mem::MaybeUninit::uninit(); 114 | let ret = from_glib(ffi::clutter_content_get_preferred_size(self.as_ref().to_glib_none().0, width.as_mut_ptr(), height.as_mut_ptr())); 115 | let width = width.assume_init(); 116 | let height = height.assume_init(); 117 | if ret { Some((width, height)) } else { None } 118 | } 119 | } 120 | 121 | #[cfg(any(feature = "v1_10", feature = "dox"))] 122 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 123 | fn invalidate(&self) { 124 | unsafe { 125 | ffi::clutter_content_invalidate(self.as_ref().to_glib_none().0); 126 | } 127 | } 128 | 129 | fn invalidate_size(&self) { 130 | unsafe { 131 | ffi::clutter_content_invalidate_size(self.as_ref().to_glib_none().0); 132 | } 133 | } 134 | 135 | #[cfg(any(feature = "v1_10", feature = "dox"))] 136 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 137 | fn connect_attached(&self, f: F) -> SignalHandlerId { 138 | unsafe extern "C" fn attached_trampoline, F: Fn(&P, &Actor) + 'static>(this: *mut ffi::ClutterContent, actor: *mut ffi::ClutterActor, f: glib::ffi::gpointer) { 139 | let f: &F = &*(f as *const F); 140 | f(Content::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(actor)) 141 | } 142 | unsafe { 143 | let f: Box_ = Box_::new(f); 144 | connect_raw(self.as_ptr() as *mut _, b"attached\0".as_ptr() as *const _, 145 | Some(transmute::<_, unsafe extern "C" fn()>(attached_trampoline:: as *const ())), Box_::into_raw(f)) 146 | } 147 | } 148 | 149 | #[cfg(any(feature = "v1_10", feature = "dox"))] 150 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] 151 | fn connect_detached(&self, f: F) -> SignalHandlerId { 152 | unsafe extern "C" fn detached_trampoline, F: Fn(&P, &Actor) + 'static>(this: *mut ffi::ClutterContent, actor: *mut ffi::ClutterActor, f: glib::ffi::gpointer) { 153 | let f: &F = &*(f as *const F); 154 | f(Content::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(actor)) 155 | } 156 | unsafe { 157 | let f: Box_ = Box_::new(f); 158 | connect_raw(self.as_ptr() as *mut _, b"detached\0".as_ptr() as *const _, 159 | Some(transmute::<_, unsafe extern "C" fn()>(detached_trampoline:: as *const ())), Box_::into_raw(f)) 160 | } 161 | } 162 | } 163 | 164 | impl fmt::Display for Content { 165 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 166 | f.write_str("Content") 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /meta/src/auto/monitor_manager.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 45cd7bc) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use crate::Backend; 7 | use glib::object::ObjectType as ObjectType_; 8 | use glib::signal::connect_raw; 9 | use glib::signal::SignalHandlerId; 10 | use glib::translate::*; 11 | use glib::StaticType; 12 | use std::boxed::Box as Box_; 13 | use std::fmt; 14 | use std::mem::transmute; 15 | 16 | glib::wrapper! { 17 | #[doc(alias = "MetaMonitorManager")] 18 | pub struct MonitorManager(Object); 19 | 20 | match fn { 21 | type_ => || ffi::meta_monitor_manager_get_type(), 22 | } 23 | } 24 | 25 | impl MonitorManager { 26 | #[doc(alias = "meta_monitor_manager_can_switch_config")] 27 | pub fn can_switch_config(&self) -> bool { 28 | unsafe { 29 | from_glib(ffi::meta_monitor_manager_can_switch_config(self.to_glib_none().0)) 30 | } 31 | } 32 | 33 | /// Returns whether the built-in display (i.e. a laptop panel) is turned on. 34 | #[doc(alias = "meta_monitor_manager_get_is_builtin_display_on")] 35 | #[doc(alias = "get_is_builtin_display_on")] 36 | pub fn is_builtin_display_on(&self) -> bool { 37 | unsafe { 38 | from_glib(ffi::meta_monitor_manager_get_is_builtin_display_on(self.to_glib_none().0)) 39 | } 40 | } 41 | 42 | /// ## `connector` 43 | /// A valid connector name 44 | /// 45 | /// # Returns 46 | /// 47 | /// The monitor index or -1 if `id` isn't valid or the connector 48 | /// isn't associated with a logical monitor. 49 | #[doc(alias = "meta_monitor_manager_get_monitor_for_connector")] 50 | #[doc(alias = "get_monitor_for_connector")] 51 | pub fn monitor_for_connector(&self, connector: &str) -> i32 { 52 | unsafe { 53 | ffi::meta_monitor_manager_get_monitor_for_connector(self.to_glib_none().0, connector.to_glib_none().0) 54 | } 55 | } 56 | 57 | #[doc(alias = "meta_monitor_manager_get_panel_orientation_managed")] 58 | #[doc(alias = "get_panel_orientation_managed")] 59 | pub fn is_panel_orientation_managed(&self) -> bool { 60 | unsafe { 61 | from_glib(ffi::meta_monitor_manager_get_panel_orientation_managed(self.to_glib_none().0)) 62 | } 63 | } 64 | 65 | //#[doc(alias = "meta_monitor_manager_get_switch_config")] 66 | //#[doc(alias = "get_switch_config")] 67 | //pub fn switch_config(&self) -> /*Ignored*/MonitorSwitchConfigType { 68 | // unsafe { TODO: call ffi:meta_monitor_manager_get_switch_config() } 69 | //} 70 | 71 | //#[doc(alias = "meta_monitor_manager_switch_config")] 72 | //pub fn switch_config(&self, config_type: /*Ignored*/MonitorSwitchConfigType) { 73 | // unsafe { TODO: call ffi:meta_monitor_manager_switch_config() } 74 | //} 75 | 76 | pub fn backend(&self) -> Option { 77 | unsafe { 78 | let mut value = glib::Value::from_type(::static_type()); 79 | glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"backend\0".as_ptr() as *const _, value.to_glib_none_mut().0); 80 | value.get().expect("Return Value for property `backend` getter") 81 | } 82 | } 83 | 84 | /// Accessor for the singleton MetaMonitorManager. 85 | /// 86 | /// # Returns 87 | /// 88 | /// The only [`MonitorManager`][crate::MonitorManager] there is. 89 | #[doc(alias = "meta_monitor_manager_get")] 90 | pub fn get() -> Option { 91 | unsafe { 92 | from_glib_none(ffi::meta_monitor_manager_get()) 93 | } 94 | } 95 | 96 | #[doc(alias = "meta_monitor_manager_get_display_configuration_timeout")] 97 | #[doc(alias = "get_display_configuration_timeout")] 98 | pub fn display_configuration_timeout() -> i32 { 99 | unsafe { 100 | ffi::meta_monitor_manager_get_display_configuration_timeout() 101 | } 102 | } 103 | 104 | #[doc(alias = "confirm-display-change")] 105 | pub fn connect_confirm_display_change(&self, f: F) -> SignalHandlerId { 106 | unsafe extern "C" fn confirm_display_change_trampoline(this: *mut ffi::MetaMonitorManager, f: glib::ffi::gpointer) { 107 | let f: &F = &*(f as *const F); 108 | f(&from_glib_borrow(this)) 109 | } 110 | unsafe { 111 | let f: Box_ = Box_::new(f); 112 | connect_raw(self.as_ptr() as *mut _, b"confirm-display-change\0".as_ptr() as *const _, 113 | Some(transmute::<_, unsafe extern "C" fn()>(confirm_display_change_trampoline:: as *const ())), Box_::into_raw(f)) 114 | } 115 | } 116 | 117 | #[doc(alias = "monitors-changed")] 118 | pub fn connect_monitors_changed(&self, f: F) -> SignalHandlerId { 119 | unsafe extern "C" fn monitors_changed_trampoline(this: *mut ffi::MetaMonitorManager, f: glib::ffi::gpointer) { 120 | let f: &F = &*(f as *const F); 121 | f(&from_glib_borrow(this)) 122 | } 123 | unsafe { 124 | let f: Box_ = Box_::new(f); 125 | connect_raw(self.as_ptr() as *mut _, b"monitors-changed\0".as_ptr() as *const _, 126 | Some(transmute::<_, unsafe extern "C" fn()>(monitors_changed_trampoline:: as *const ())), Box_::into_raw(f)) 127 | } 128 | } 129 | 130 | #[doc(alias = "monitors-changed-internal")] 131 | pub fn connect_monitors_changed_internal(&self, f: F) -> SignalHandlerId { 132 | unsafe extern "C" fn monitors_changed_internal_trampoline(this: *mut ffi::MetaMonitorManager, f: glib::ffi::gpointer) { 133 | let f: &F = &*(f as *const F); 134 | f(&from_glib_borrow(this)) 135 | } 136 | unsafe { 137 | let f: Box_ = Box_::new(f); 138 | connect_raw(self.as_ptr() as *mut _, b"monitors-changed-internal\0".as_ptr() as *const _, 139 | Some(transmute::<_, unsafe extern "C" fn()>(monitors_changed_internal_trampoline:: as *const ())), Box_::into_raw(f)) 140 | } 141 | } 142 | 143 | #[doc(alias = "power-save-mode-changed")] 144 | pub fn connect_power_save_mode_changed(&self, f: F) -> SignalHandlerId { 145 | unsafe extern "C" fn power_save_mode_changed_trampoline(this: *mut ffi::MetaMonitorManager, f: glib::ffi::gpointer) { 146 | let f: &F = &*(f as *const F); 147 | f(&from_glib_borrow(this)) 148 | } 149 | unsafe { 150 | let f: Box_ = Box_::new(f); 151 | connect_raw(self.as_ptr() as *mut _, b"power-save-mode-changed\0".as_ptr() as *const _, 152 | Some(transmute::<_, unsafe extern "C" fn()>(power_save_mode_changed_trampoline:: as *const ())), Box_::into_raw(f)) 153 | } 154 | } 155 | 156 | #[doc(alias = "panel-orientation-managed")] 157 | pub fn connect_panel_orientation_managed_notify(&self, f: F) -> SignalHandlerId { 158 | unsafe extern "C" fn notify_panel_orientation_managed_trampoline(this: *mut ffi::MetaMonitorManager, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { 159 | let f: &F = &*(f as *const F); 160 | f(&from_glib_borrow(this)) 161 | } 162 | unsafe { 163 | let f: Box_ = Box_::new(f); 164 | connect_raw(self.as_ptr() as *mut _, b"notify::panel-orientation-managed\0".as_ptr() as *const _, 165 | Some(transmute::<_, unsafe extern "C" fn()>(notify_panel_orientation_managed_trampoline:: as *const ())), Box_::into_raw(f)) 166 | } 167 | } 168 | } 169 | 170 | impl fmt::Display for MonitorManager { 171 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 172 | f.write_str("MonitorManager") 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /xlib-sys/tests/abi.rs: -------------------------------------------------------------------------------- 1 | // Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb) 2 | // from gir-files (https://github.com/gtk-rs/gir-files.git @ 8e47c67) 3 | // from mutter-gir-files 4 | // DO NOT EDIT 5 | 6 | use xlib_sys::*; 7 | use std::mem::{align_of, size_of}; 8 | use std::env; 9 | use std::error::Error; 10 | use std::ffi::OsString; 11 | use std::path::Path; 12 | use std::process::Command; 13 | use std::str; 14 | use tempfile::Builder; 15 | 16 | static PACKAGES: &[&str] = &["x11"]; 17 | 18 | #[derive(Clone, Debug)] 19 | struct Compiler { 20 | pub args: Vec, 21 | } 22 | 23 | impl Compiler { 24 | pub fn new() -> Result> { 25 | let mut args = get_var("CC", "cc")?; 26 | args.push("-Wno-deprecated-declarations".to_owned()); 27 | // For _Generic 28 | args.push("-std=c11".to_owned()); 29 | // For %z support in printf when using MinGW. 30 | args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); 31 | args.extend(get_var("CFLAGS", "")?); 32 | args.extend(get_var("CPPFLAGS", "")?); 33 | args.extend(pkg_config_cflags(PACKAGES)?); 34 | Ok(Self { args }) 35 | } 36 | 37 | pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box> { 38 | let mut cmd = self.to_command(); 39 | cmd.arg(src); 40 | cmd.arg("-o"); 41 | cmd.arg(out); 42 | let status = cmd.spawn()?.wait()?; 43 | if !status.success() { 44 | return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); 45 | } 46 | Ok(()) 47 | } 48 | 49 | fn to_command(&self) -> Command { 50 | let mut cmd = Command::new(&self.args[0]); 51 | cmd.args(&self.args[1..]); 52 | cmd 53 | } 54 | } 55 | 56 | fn get_var(name: &str, default: &str) -> Result, Box> { 57 | match env::var(name) { 58 | Ok(value) => Ok(shell_words::split(&value)?), 59 | Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), 60 | Err(err) => Err(format!("{} {}", name, err).into()), 61 | } 62 | } 63 | 64 | fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { 65 | if packages.is_empty() { 66 | return Ok(Vec::new()); 67 | } 68 | let pkg_config = env::var_os("PKG_CONFIG") 69 | .unwrap_or_else(|| OsString::from("pkg-config")); 70 | let mut cmd = Command::new(pkg_config); 71 | cmd.arg("--cflags"); 72 | cmd.args(packages); 73 | let out = cmd.output()?; 74 | if !out.status.success() { 75 | return Err(format!("command {:?} returned {}", 76 | &cmd, out.status).into()); 77 | } 78 | let stdout = str::from_utf8(&out.stdout)?; 79 | Ok(shell_words::split(stdout.trim())?) 80 | } 81 | 82 | 83 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] 84 | struct Layout { 85 | size: usize, 86 | alignment: usize, 87 | } 88 | 89 | #[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] 90 | struct Results { 91 | /// Number of successfully completed tests. 92 | passed: usize, 93 | /// Total number of failed tests (including those that failed to compile). 94 | failed: usize, 95 | } 96 | 97 | impl Results { 98 | fn record_passed(&mut self) { 99 | self.passed += 1; 100 | } 101 | fn record_failed(&mut self) { 102 | self.failed += 1; 103 | } 104 | fn summary(&self) -> String { 105 | format!("{} passed; {} failed", self.passed, self.failed) 106 | } 107 | fn expect_total_success(&self) { 108 | if self.failed == 0 { 109 | println!("OK: {}", self.summary()); 110 | } else { 111 | panic!("FAILED: {}", self.summary()); 112 | }; 113 | } 114 | } 115 | 116 | #[test] 117 | fn cross_validate_constants_with_c() { 118 | let mut c_constants: Vec<(String, String)> = Vec::new(); 119 | 120 | for l in get_c_output("constant").unwrap().lines() { 121 | let mut words = l.trim().split(';'); 122 | let name = words.next().expect("Failed to parse name").to_owned(); 123 | let value = words 124 | .next() 125 | .and_then(|s| s.parse().ok()) 126 | .expect("Failed to parse value"); 127 | c_constants.push((name, value)); 128 | } 129 | 130 | let mut results = Results::default(); 131 | 132 | for ((rust_name, rust_value), (c_name, c_value)) in 133 | RUST_CONSTANTS.iter().zip(c_constants.iter()) 134 | { 135 | if rust_name != c_name { 136 | results.record_failed(); 137 | eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); 138 | continue; 139 | } 140 | 141 | if rust_value != c_value { 142 | results.record_failed(); 143 | eprintln!( 144 | "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", 145 | rust_name, rust_value, &c_value 146 | ); 147 | continue; 148 | } 149 | 150 | results.record_passed(); 151 | } 152 | 153 | results.expect_total_success(); 154 | } 155 | 156 | #[test] 157 | fn cross_validate_layout_with_c() { 158 | let mut c_layouts = Vec::new(); 159 | 160 | for l in get_c_output("layout").unwrap().lines() { 161 | let mut words = l.trim().split(';'); 162 | let name = words.next().expect("Failed to parse name").to_owned(); 163 | let size = words 164 | .next() 165 | .and_then(|s| s.parse().ok()) 166 | .expect("Failed to parse size"); 167 | let alignment = words 168 | .next() 169 | .and_then(|s| s.parse().ok()) 170 | .expect("Failed to parse alignment"); 171 | c_layouts.push((name, Layout { size, alignment })); 172 | } 173 | 174 | let mut results = Results::default(); 175 | 176 | for ((rust_name, rust_layout), (c_name, c_layout)) in 177 | RUST_LAYOUTS.iter().zip(c_layouts.iter()) 178 | { 179 | if rust_name != c_name { 180 | results.record_failed(); 181 | eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); 182 | continue; 183 | } 184 | 185 | if rust_layout != c_layout { 186 | results.record_failed(); 187 | eprintln!( 188 | "Layout mismatch for {}\nRust: {:?}\nC: {:?}", 189 | rust_name, rust_layout, &c_layout 190 | ); 191 | continue; 192 | } 193 | 194 | results.record_passed(); 195 | } 196 | 197 | results.expect_total_success(); 198 | } 199 | 200 | fn get_c_output(name: &str) -> Result> { 201 | let tmpdir = Builder::new().prefix("abi").tempdir()?; 202 | let exe = tmpdir.path().join(name); 203 | let c_file = Path::new("tests").join(name).with_extension("c"); 204 | 205 | let cc = Compiler::new().expect("configured compiler"); 206 | cc.compile(&c_file, &exe)?; 207 | 208 | let mut abi_cmd = Command::new(exe); 209 | let output = abi_cmd.output()?; 210 | if !output.status.success() { 211 | return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); 212 | } 213 | 214 | Ok(String::from_utf8(output.stdout)?) 215 | } 216 | 217 | const RUST_LAYOUTS: &[(&str, Layout)] = &[ 218 | ("Atom", Layout {size: size_of::(), alignment: align_of::()}), 219 | ("Colormap", Layout {size: size_of::(), alignment: align_of::()}), 220 | ("Cursor", Layout {size: size_of::(), alignment: align_of::()}), 221 | ("Drawable", Layout {size: size_of::(), alignment: align_of::()}), 222 | ("GC", Layout {size: size_of::(), alignment: align_of::()}), 223 | ("KeyCode", Layout {size: size_of::(), alignment: align_of::()}), 224 | ("KeySym", Layout {size: size_of::(), alignment: align_of::()}), 225 | ("Picture", Layout {size: size_of::(), alignment: align_of::()}), 226 | ("Pixmap", Layout {size: size_of::(), alignment: align_of::()}), 227 | ("Time", Layout {size: size_of::