gdk4-x11-sys-0.3.1/.cargo_vcs_info.json0000644000000001120000000000100131030ustar { "git": { "sha1": "55b67a928dad6cfca8e0caaa360953833bd3a0d7" } } gdk4-x11-sys-0.3.1/Cargo.toml0000644000000026640000000000100111170ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies # # If you believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] edition = "2018" name = "gdk4-x11-sys" version = "0.3.1" authors = ["The gtk-rs Project Developers"] build = "build.rs" description = "FFI bindings of GDK4 X11" homepage = "http://gtk-rs.org/" documentation = "https://gtk-rs.org/gtk4-rs/git/docs/gdk4_x11_sys/" keywords = ["gdk4", "gdk4-x11", "ffi", "gtk-rs", "gnome"] license = "MIT" repository = "https://github.com/gtk-rs/gtk4-rs" [package.metadata.docs.rs] features = ["dox"] [package.metadata.system-deps.gtk4_x11] name = "gtk4-x11" version = "4.0.0" [package.metadata.system-deps.gtk4_x11.v4_4] version = "4.3.2" [lib] name = "gdk4_x11_sys" [dependencies.gdk4-sys] version = "0.3" [dependencies.glib-sys] version = "0.14" [dependencies.libc] version = "0.2" [dependencies.x11] version = "2.18" [dev-dependencies.shell-words] version = "1.0.0" [dev-dependencies.tempfile] version = "3" [build-dependencies.system-deps] version = "5" [features] dox = [] v4_4 = [] gdk4-x11-sys-0.3.1/Cargo.toml.orig0000644000000015660000000000100120560ustar [package] authors = ["The gtk-rs Project Developers"] build = "build.rs" description = "FFI bindings of GDK4 X11" documentation = "https://gtk-rs.org/gtk4-rs/git/docs/gdk4_x11_sys/" edition = "2018" homepage = "http://gtk-rs.org/" keywords = ["gdk4", "gdk4-x11", "ffi", "gtk-rs", "gnome"] license = "MIT" name = "gdk4-x11-sys" repository = "https://github.com/gtk-rs/gtk4-rs" version = "0.3.1" [package.metadata.system-deps.gtk4_x11] name = "gtk4-x11" version = "4.0.0" [package.metadata.system-deps.gtk4_x11.v4_4] version = "4.3.2" [package.metadata.docs.rs] features = ["dox"] [lib] name = "gdk4_x11_sys" [features] dox = [] v4_4 = [] [dependencies] libc = "0.2" x11 = "2.18" [dependencies.gdk4-sys] path = "../../gdk4/sys" version = "0.3" [dependencies.glib-sys] version = "0.14" [build-dependencies] system-deps = "5" [dev-dependencies] shell-words = "1.0.0" tempfile = "3" gdk4-x11-sys-0.3.1/Cargo.toml.orig000064400000000000000000000015660072674642500146300ustar 00000000000000[package] authors = ["The gtk-rs Project Developers"] build = "build.rs" description = "FFI bindings of GDK4 X11" documentation = "https://gtk-rs.org/gtk4-rs/git/docs/gdk4_x11_sys/" edition = "2018" homepage = "http://gtk-rs.org/" keywords = ["gdk4", "gdk4-x11", "ffi", "gtk-rs", "gnome"] license = "MIT" name = "gdk4-x11-sys" repository = "https://github.com/gtk-rs/gtk4-rs" version = "0.3.1" [package.metadata.system-deps.gtk4_x11] name = "gtk4-x11" version = "4.0.0" [package.metadata.system-deps.gtk4_x11.v4_4] version = "4.3.2" [package.metadata.docs.rs] features = ["dox"] [lib] name = "gdk4_x11_sys" [features] dox = [] v4_4 = [] [dependencies] libc = "0.2" x11 = "2.18" [dependencies.gdk4-sys] path = "../../gdk4/sys" version = "0.3" [dependencies.glib-sys] version = "0.14" [build-dependencies] system-deps = "5" [dev-dependencies] shell-words = "1.0.0" tempfile = "3" gdk4-x11-sys-0.3.1/Gir.toml000064400000000000000000000003430072674642500133470ustar 00000000000000[options] work_mode = "sys" library = "GdkX11" version = "4.0" min_cfg_version = "4.0.0" single_version_file = "." girs_directories = ["../../gir-files"] external_libraries = [ "GLib", ] [external_libraries] gdk4 = "Gdk" gdk4-x11-sys-0.3.1/LICENSE000064400000000000000000000020000072674642500127260ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gdk4-x11-sys-0.3.1/build.rs000064400000000000000000000007150072674642500134010ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT #[cfg(not(feature = "dox"))] use std::process; #[cfg(feature = "dox")] fn main() {} // prevent linking libraries to avoid documentation failure #[cfg(not(feature = "dox"))] fn main() { if let Err(s) = system_deps::Config::new().probe() { println!("cargo:warning={}", s); process::exit(1); } } gdk4-x11-sys-0.3.1/src/lib.rs000064400000000000000000000317330072674642500136430ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow( clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal, clippy::upper_case_acronyms )] #![cfg_attr(feature = "dox", feature(doc_cfg))] use gdk4_sys as gdk; use glib_sys as glib; mod manual; pub use manual::*; #[allow(unused_imports)] use libc::{ c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE, }; #[allow(unused_imports)] use glib::{gboolean, gconstpointer, gpointer, GType}; // Enums pub type GdkX11DeviceType = c_int; pub const GDK_X11_DEVICE_TYPE_LOGICAL: GdkX11DeviceType = 0; pub const GDK_X11_DEVICE_TYPE_PHYSICAL: GdkX11DeviceType = 1; pub const GDK_X11_DEVICE_TYPE_FLOATING: GdkX11DeviceType = 2; // Records #[repr(C)] pub struct _GdkX11AppLaunchContextClass(c_void); pub type GdkX11AppLaunchContextClass = *mut _GdkX11AppLaunchContextClass; #[repr(C)] pub struct _GdkX11DeviceManagerXI2Class(c_void); pub type GdkX11DeviceManagerXI2Class = *mut _GdkX11DeviceManagerXI2Class; #[repr(C)] pub struct _GdkX11DeviceXI2Class(c_void); pub type GdkX11DeviceXI2Class = *mut _GdkX11DeviceXI2Class; #[repr(C)] pub struct _GdkX11DisplayClass(c_void); pub type GdkX11DisplayClass = *mut _GdkX11DisplayClass; #[repr(C)] pub struct _GdkX11DragClass(c_void); pub type GdkX11DragClass = *mut _GdkX11DragClass; #[repr(C)] pub struct _GdkX11GLContextClass(c_void); pub type GdkX11GLContextClass = *mut _GdkX11GLContextClass; #[repr(C)] pub struct _GdkX11MonitorClass(c_void); pub type GdkX11MonitorClass = *mut _GdkX11MonitorClass; #[repr(C)] pub struct _GdkX11ScreenClass(c_void); pub type GdkX11ScreenClass = *mut _GdkX11ScreenClass; #[repr(C)] pub struct _GdkX11SurfaceClass(c_void); pub type GdkX11SurfaceClass = *mut _GdkX11SurfaceClass; // Classes #[repr(C)] pub struct GdkX11AppLaunchContext(c_void); impl ::std::fmt::Debug for GdkX11AppLaunchContext { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11AppLaunchContext @ {:p}", self)) .finish() } } #[repr(C)] pub struct GdkX11DeviceManagerXI2(c_void); impl ::std::fmt::Debug for GdkX11DeviceManagerXI2 { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11DeviceManagerXI2 @ {:p}", self)) .finish() } } #[repr(C)] pub struct GdkX11DeviceXI2(c_void); impl ::std::fmt::Debug for GdkX11DeviceXI2 { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11DeviceXI2 @ {:p}", self)) .finish() } } #[repr(C)] pub struct GdkX11Display(c_void); impl ::std::fmt::Debug for GdkX11Display { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11Display @ {:p}", self)) .finish() } } #[repr(C)] pub struct GdkX11Drag(c_void); impl ::std::fmt::Debug for GdkX11Drag { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11Drag @ {:p}", self)).finish() } } #[repr(C)] pub struct GdkX11GLContext(c_void); impl ::std::fmt::Debug for GdkX11GLContext { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11GLContext @ {:p}", self)) .finish() } } #[repr(C)] pub struct GdkX11Monitor(c_void); impl ::std::fmt::Debug for GdkX11Monitor { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11Monitor @ {:p}", self)) .finish() } } #[repr(C)] pub struct GdkX11Screen(c_void); impl ::std::fmt::Debug for GdkX11Screen { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11Screen @ {:p}", self)) .finish() } } #[repr(C)] pub struct GdkX11Surface(c_void); impl ::std::fmt::Debug for GdkX11Surface { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { f.debug_struct(&format!("GdkX11Surface @ {:p}", self)) .finish() } } #[link(name = "gtk-4")] extern "C" { //========================================================================= // GdkX11AppLaunchContext //========================================================================= pub fn gdk_x11_app_launch_context_get_type() -> GType; //========================================================================= // GdkX11DeviceManagerXI2 //========================================================================= pub fn gdk_x11_device_manager_xi2_get_type() -> GType; //========================================================================= // GdkX11DeviceXI2 //========================================================================= pub fn gdk_x11_device_xi2_get_type() -> GType; //========================================================================= // GdkX11Display //========================================================================= pub fn gdk_x11_display_get_type() -> GType; pub fn gdk_x11_display_open(display_name: *const c_char) -> *mut gdk::GdkDisplay; pub fn gdk_x11_display_set_program_class( display: *mut gdk::GdkDisplay, program_class: *const c_char, ); pub fn gdk_x11_display_broadcast_startup_message( display: *mut GdkX11Display, message_type: *const c_char, ... ); pub fn gdk_x11_display_error_trap_pop(display: *mut GdkX11Display) -> c_int; pub fn gdk_x11_display_error_trap_pop_ignored(display: *mut GdkX11Display); pub fn gdk_x11_display_error_trap_push(display: *mut GdkX11Display); pub fn gdk_x11_display_get_default_group(display: *mut GdkX11Display) -> *mut gdk::GdkSurface; #[cfg(any(feature = "v4_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v4_4")))] pub fn gdk_x11_display_get_egl_display(display: *mut GdkX11Display) -> gpointer; #[cfg(any(feature = "v4_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v4_4")))] pub fn gdk_x11_display_get_egl_version( display: *mut GdkX11Display, major: *mut c_int, minor: *mut c_int, ) -> gboolean; pub fn gdk_x11_display_get_glx_version( display: *mut GdkX11Display, major: *mut c_int, minor: *mut c_int, ) -> gboolean; pub fn gdk_x11_display_get_primary_monitor(display: *mut GdkX11Display) -> *mut gdk::GdkMonitor; pub fn gdk_x11_display_get_screen(display: *mut GdkX11Display) -> *mut GdkX11Screen; pub fn gdk_x11_display_get_startup_notification_id( display: *mut GdkX11Display, ) -> *const c_char; pub fn gdk_x11_display_get_user_time(display: *mut GdkX11Display) -> u32; pub fn gdk_x11_display_get_xcursor( display: *mut GdkX11Display, cursor: *mut gdk::GdkCursor, ) -> xlib::Cursor; pub fn gdk_x11_display_get_xdisplay(display: *mut GdkX11Display) -> *mut xlib::Display; pub fn gdk_x11_display_get_xrootwindow(display: *mut GdkX11Display) -> xlib::Window; pub fn gdk_x11_display_get_xscreen(display: *mut GdkX11Display) -> *mut xlib::Screen; pub fn gdk_x11_display_grab(display: *mut GdkX11Display); pub fn gdk_x11_display_set_cursor_theme( display: *mut GdkX11Display, theme: *const c_char, size: c_int, ); pub fn gdk_x11_display_set_startup_notification_id( display: *mut GdkX11Display, startup_id: *const c_char, ); pub fn gdk_x11_display_set_surface_scale(display: *mut GdkX11Display, scale: c_int); pub fn gdk_x11_display_string_to_compound_text( display: *mut GdkX11Display, str: *const c_char, encoding: *mut *const c_char, format: *mut c_int, ctext: *mut *mut u8, length: *mut c_int, ) -> c_int; pub fn gdk_x11_display_text_property_to_text_list( display: *mut GdkX11Display, encoding: *const c_char, format: c_int, text: *const u8, length: c_int, list: *mut *mut *mut c_char, ) -> c_int; pub fn gdk_x11_display_ungrab(display: *mut GdkX11Display); pub fn gdk_x11_display_utf8_to_compound_text( display: *mut GdkX11Display, str: *const c_char, encoding: *mut *const c_char, format: *mut c_int, ctext: *mut *mut u8, length: *mut c_int, ) -> gboolean; //========================================================================= // GdkX11Drag //========================================================================= pub fn gdk_x11_drag_get_type() -> GType; //========================================================================= // GdkX11GLContext //========================================================================= pub fn gdk_x11_gl_context_get_type() -> GType; //========================================================================= // GdkX11Monitor //========================================================================= pub fn gdk_x11_monitor_get_type() -> GType; pub fn gdk_x11_monitor_get_output(monitor: *mut GdkX11Monitor) -> xlib::XID; pub fn gdk_x11_monitor_get_workarea( monitor: *mut GdkX11Monitor, workarea: *mut gdk::GdkRectangle, ); //========================================================================= // GdkX11Screen //========================================================================= pub fn gdk_x11_screen_get_type() -> GType; pub fn gdk_x11_screen_get_current_desktop(screen: *mut GdkX11Screen) -> u32; pub fn gdk_x11_screen_get_monitor_output( screen: *mut GdkX11Screen, monitor_num: c_int, ) -> xlib::XID; pub fn gdk_x11_screen_get_number_of_desktops(screen: *mut GdkX11Screen) -> u32; pub fn gdk_x11_screen_get_screen_number(screen: *mut GdkX11Screen) -> c_int; pub fn gdk_x11_screen_get_window_manager_name(screen: *mut GdkX11Screen) -> *const c_char; pub fn gdk_x11_screen_get_xscreen(screen: *mut GdkX11Screen) -> *mut xlib::Screen; pub fn gdk_x11_screen_supports_net_wm_hint( screen: *mut GdkX11Screen, property_name: *const c_char, ) -> gboolean; //========================================================================= // GdkX11Surface //========================================================================= pub fn gdk_x11_surface_get_type() -> GType; pub fn gdk_x11_surface_lookup_for_display( display: *mut GdkX11Display, window: xlib::Window, ) -> *mut GdkX11Surface; pub fn gdk_x11_surface_get_desktop(surface: *mut GdkX11Surface) -> u32; pub fn gdk_x11_surface_get_group(surface: *mut GdkX11Surface) -> *mut gdk::GdkSurface; pub fn gdk_x11_surface_get_xid(surface: *mut GdkX11Surface) -> xlib::Window; pub fn gdk_x11_surface_move_to_current_desktop(surface: *mut GdkX11Surface); pub fn gdk_x11_surface_move_to_desktop(surface: *mut GdkX11Surface, desktop: u32); pub fn gdk_x11_surface_set_frame_sync_enabled( surface: *mut GdkX11Surface, frame_sync_enabled: gboolean, ); pub fn gdk_x11_surface_set_group(surface: *mut GdkX11Surface, leader: *mut gdk::GdkSurface); pub fn gdk_x11_surface_set_skip_pager_hint(surface: *mut GdkX11Surface, skips_pager: gboolean); pub fn gdk_x11_surface_set_skip_taskbar_hint( surface: *mut GdkX11Surface, skips_taskbar: gboolean, ); pub fn gdk_x11_surface_set_theme_variant(surface: *mut GdkX11Surface, variant: *const c_char); pub fn gdk_x11_surface_set_urgency_hint(surface: *mut GdkX11Surface, urgent: gboolean); pub fn gdk_x11_surface_set_user_time(surface: *mut GdkX11Surface, timestamp: u32); pub fn gdk_x11_surface_set_utf8_property( surface: *mut GdkX11Surface, name: *const c_char, value: *const c_char, ); //========================================================================= // Other functions //========================================================================= pub fn gdk_x11_device_get_id(device: *mut GdkX11DeviceXI2) -> c_int; pub fn gdk_x11_device_manager_lookup( device_manager: *mut GdkX11DeviceManagerXI2, device_id: c_int, ) -> *mut GdkX11DeviceXI2; pub fn gdk_x11_free_compound_text(ctext: *mut u8); pub fn gdk_x11_free_text_list(list: *mut *mut c_char); pub fn gdk_x11_get_server_time(surface: *mut GdkX11Surface) -> u32; pub fn gdk_x11_get_xatom_by_name_for_display( display: *mut GdkX11Display, atom_name: *const c_char, ) -> xlib::Atom; pub fn gdk_x11_get_xatom_name_for_display( display: *mut GdkX11Display, xatom: xlib::Atom, ) -> *const c_char; pub fn gdk_x11_lookup_xdisplay(xdisplay: *mut xlib::Display) -> *mut GdkX11Display; pub fn gdk_x11_set_sm_client_id(sm_client_id: *const c_char); } gdk4-x11-sys-0.3.1/src/manual.rs000064400000000000000000000001440072674642500143420ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. pub use x11::xlib; gdk4-x11-sys-0.3.1/tests/abi.rs000064400000000000000000000146760072674642500142120ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use gdk4_x11_sys::*; use std::env; use std::error::Error; use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; use std::str; use tempfile::Builder; static PACKAGES: &[&str] = &["gtk4-x11"]; #[derive(Clone, Debug)] struct Compiler { pub args: Vec, } impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); // For _Generic args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CPPFLAGS", "")?); args.extend(pkg_config_cflags(PACKAGES)?); Ok(Self { args }) } pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box> { let mut cmd = self.to_command(); cmd.arg(src); cmd.arg("-o"); cmd.arg(out); let status = cmd.spawn()?.wait()?; if !status.success() { return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); } Ok(()) } fn to_command(&self) -> Command { let mut cmd = Command::new(&self.args[0]); cmd.args(&self.args[1..]); cmd } } fn get_var(name: &str, default: &str) -> Result, Box> { match env::var(name) { Ok(value) => Ok(shell_words::split(&value)?), Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), Err(err) => Err(format!("{} {}", name, err).into()), } } fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { return Ok(Vec::new()); } let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config")); let mut cmd = Command::new(pkg_config); cmd.arg("--cflags"); cmd.args(packages); let out = cmd.output()?; if !out.status.success() { return Err(format!("command {:?} returned {}", &cmd, out.status).into()); } let stdout = str::from_utf8(&out.stdout)?; Ok(shell_words::split(stdout.trim())?) } #[derive(Copy, Clone, Debug, Eq, PartialEq)] struct Layout { size: usize, alignment: usize, } #[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] struct Results { /// Number of successfully completed tests. passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, } impl Results { fn record_passed(&mut self) { self.passed += 1; } fn record_failed(&mut self) { self.failed += 1; } fn summary(&self) -> String { format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { println!("OK: {}", self.summary()); } else { panic!("FAILED: {}", self.summary()); }; } } #[test] fn cross_validate_constants_with_c() { let mut c_constants: Vec<(String, String)> = Vec::new(); for l in get_c_output("constant").unwrap().lines() { let mut words = l.trim().split(';'); let name = words.next().expect("Failed to parse name").to_owned(); let value = words .next() .and_then(|s| s.parse().ok()) .expect("Failed to parse value"); c_constants.push((name, value)); } let mut results = Results::default(); for ((rust_name, rust_value), (c_name, c_value)) in RUST_CONSTANTS.iter().zip(c_constants.iter()) { if rust_name != c_name { results.record_failed(); eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); continue; } if rust_value != c_value { results.record_failed(); eprintln!( "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", rust_name, rust_value, &c_value ); continue; } results.record_passed(); } results.expect_total_success(); } #[test] fn cross_validate_layout_with_c() { let mut c_layouts = Vec::new(); for l in get_c_output("layout").unwrap().lines() { let mut words = l.trim().split(';'); let name = words.next().expect("Failed to parse name").to_owned(); let size = words .next() .and_then(|s| s.parse().ok()) .expect("Failed to parse size"); let alignment = words .next() .and_then(|s| s.parse().ok()) .expect("Failed to parse alignment"); c_layouts.push((name, Layout { size, alignment })); } let mut results = Results::default(); for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter()) { if rust_name != c_name { results.record_failed(); eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); continue; } if rust_layout != c_layout { results.record_failed(); eprintln!( "Layout mismatch for {}\nRust: {:?}\nC: {:?}", rust_name, rust_layout, &c_layout ); continue; } results.record_passed(); } results.expect_total_success(); } fn get_c_output(name: &str) -> Result> { let tmpdir = Builder::new().prefix("abi").tempdir()?; let exe = tmpdir.path().join(name); let c_file = Path::new("tests").join(name).with_extension("c"); let cc = Compiler::new().expect("configured compiler"); cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); } Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[( "GdkX11DeviceType", Layout { size: size_of::(), alignment: align_of::(), }, )]; const RUST_CONSTANTS: &[(&str, &str)] = &[ ("(gint) GDK_X11_DEVICE_TYPE_FLOATING", "2"), ("(gint) GDK_X11_DEVICE_TYPE_LOGICAL", "0"), ("(gint) GDK_X11_DEVICE_TYPE_PHYSICAL", "1"), ]; gdk4-x11-sys-0.3.1/tests/manual.h000064400000000000000000000001600072674642500145160ustar 00000000000000// Feel free to edit this file, it won't be regenerated by gir generator unless removed. #include gdk4-x11-sys-0.3.1/versions.txt000064400000000000000000000002100072674642500143330ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ 4aa58cff8048) from gir-files (https://github.com/gtk-rs/gir-files.git @ b827978e7d18)