├── .gitignore ├── Cargo.toml ├── LICENSE ├── README.md ├── doc ├── object-hierarchy.tex └── wire-format.tex ├── examples ├── simple-new.rs └── simple.rs └── src ├── lib.rs ├── new └── mod.rs ├── old ├── buffer.rs ├── compositor.rs ├── display.rs ├── list.rs ├── mod.rs ├── region.rs ├── registry.rs ├── seat.rs ├── shell.rs ├── shell_surface.rs ├── shm.rs ├── shm_pool.rs └── surface.rs └── raw ├── mod.rs ├── protocol ├── mod.rs ├── wl_buffer.rs ├── wl_callback.rs ├── wl_compositor.rs ├── wl_data_device.rs ├── wl_data_device_manager.rs ├── wl_data_offer.rs ├── wl_data_source.rs ├── wl_display.rs ├── wl_keyboard.rs ├── wl_output.rs ├── wl_pointer.rs ├── wl_region.rs ├── wl_registry.rs ├── wl_seat.rs ├── wl_shell.rs ├── wl_shell_surface.rs ├── wl_shm.rs ├── wl_shm_pool.rs ├── wl_subcompositor.rs ├── wl_subsurface.rs ├── wl_surface.rs └── wl_touch.rs └── types ├── enums.rs ├── listeners.rs ├── mod.rs ├── objects.rs └── utils.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /Cargo.lock 3 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | 3 | name = "wayland" 4 | version = "0.0.3-dev" 5 | authors = ["Jon Eyolfson "] 6 | license = "MIT" 7 | repository = "https://github.com/eyolfson/rust-wayland/" 8 | description = """ 9 | Simple bindings for Wayland. 10 | """ 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Jonathan Eyolfson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rust Wayland 2 | 3 | This library provides Rust bindings for Wayland. Currently the `raw` module 4 | mirrors the headers `wayland-client.h` and `wayland-client-protocol.h`. I 5 | suggest using everything through that right now as the Rust wrappers are very 6 | volatile. 7 | 8 | ## Building 9 | 10 | Run `cargo build`. 11 | 12 | ## License 13 | 14 | All code is licensed under the MIT license. 15 | -------------------------------------------------------------------------------- /doc/object-hierarchy.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usetikzlibrary{arrows} 4 | 5 | \begin{document} 6 | \begin{tikzpicture}[->,>=stealth',shorten >=0.5mm,grow=right, 7 | level distance=5cm,sibling distance=1cm] 8 | \tikzstyle{core} = [draw, rectangle, fill=blue!50] 9 | \tikzstyle{global} = [draw, rectangle, fill=green!50] 10 | \node [core] {wl\_display} 11 | child { 12 | node [core] {wl\_registry} 13 | child { 14 | node [global] {wl\_compositor} 15 | child { 16 | node {wl\_surface} 17 | } 18 | child { 19 | node {wl\_region} 20 | } 21 | } 22 | child { 23 | node [global] {wl\_subcompositor} 24 | } 25 | child { 26 | node [global] {wl\_scaler} 27 | } 28 | child { 29 | node [global] {wl\_data\_device\_manager} 30 | } 31 | child { 32 | node [global] {wl\_text\_input\_manager} 33 | } 34 | child { 35 | node [global] {wl\_shm} 36 | child { 37 | node {wl\_shm\_pool} 38 | } 39 | } 40 | child { 41 | node [global] {wl\_drm} 42 | } 43 | child { 44 | node [global] {wl\_seat} 45 | } 46 | child { 47 | node [global] {wl\_input\_method} 48 | } 49 | child { 50 | node [global] {wl\_output} 51 | } 52 | child { 53 | node [global] {wl\_input\_panel} 54 | } 55 | child { 56 | node [global] {wl\_shell} 57 | child { 58 | node {wl\_shell\_surface} 59 | } 60 | } 61 | } 62 | ; 63 | \end{tikzpicture} 64 | \end{document} 65 | -------------------------------------------------------------------------------- /doc/wire-format.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usetikzlibrary{arrows} 4 | 5 | \begin{document} 6 | \begin{tikzpicture}[->,>=stealth',shorten >=0.5mm,node distance=3cm] 7 | \tikzstyle{program} = [draw, rectangle] 8 | \tikzstyle{label} = [font=\scriptsize] 9 | \node [program] (S) {Server}; 10 | \node [program] (C) [right of=S] {Client}; 11 | 12 | \path 13 | (C) edge [bend left] node [label, below] {Request} (S) 14 | (S) edge [bend left] node [label, above] {Event} (C); 15 | \end{tikzpicture} 16 | \end{document} 17 | -------------------------------------------------------------------------------- /examples/simple-new.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Jonathan Eyolfson 2 | 3 | extern crate wayland; 4 | 5 | use wayland::new::*; 6 | 7 | fn main() { 8 | let mut display = Display::connect().unwrap(); 9 | display.get_registry().unwrap(); 10 | for _ in 0..17 { 11 | display.read_message().unwrap(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/simple.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | #![allow(dead_code)] 4 | 5 | #![feature(asm)] 6 | #![feature(core)] 7 | #![feature(libc)] 8 | 9 | extern crate libc; 10 | extern crate wayland; 11 | 12 | use std::ptr; 13 | use wayland::old::*; 14 | 15 | const SYSCALL_MEMFD_CREATE: u32 = 319; 16 | 17 | const MFD_CLOEXEC: u32 = 1; 18 | const MFD_ALLOW_SEALING: u32 = 2; 19 | 20 | const F_SEAL_SEAL: u32 = 1; 21 | const F_SEAL_SHRINK: u32 = 2; 22 | const F_SEAL_GROW: u32 = 4; 23 | const F_SEAL_WRITE: u32 = 8; 24 | 25 | const F_LINUX_SPECIFIC_BASE: u32 = 1024; 26 | const F_ADD_SEALS: u32 = F_LINUX_SPECIFIC_BASE + 9; 27 | const F_GET_SEALS: u32 = F_LINUX_SPECIFIC_BASE + 10; 28 | 29 | const MAP_SHARED: i32 = 1; 30 | 31 | #[derive(Show)] 32 | struct LinuxError { 33 | pub desc: &'static str, 34 | } 35 | 36 | struct MemFd { 37 | pub index: i32 38 | } 39 | 40 | impl MemFd { 41 | pub fn create(name: &[u8], flags: u32) -> Result { 42 | let mut index: i32; 43 | unsafe { 44 | asm!("syscall" 45 | : "={rax}"(index) 46 | : "{rax}"(SYSCALL_MEMFD_CREATE), "{rdi}"(name.as_ptr()), "{rsi}"(flags) 47 | : "rcx", "r11", "memory" 48 | : "volatile" 49 | ); 50 | } 51 | if index >= 0 { 52 | Ok(MemFd{index: index}) 53 | } 54 | else { 55 | Err(LinuxError{desc: "Function not implemented"}) 56 | } 57 | } 58 | } 59 | 60 | struct ShmBuffer { 61 | fd: i32, 62 | ptr: *mut libc::c_void, 63 | width: i32, 64 | height: i32, 65 | capacity: usize, 66 | } 67 | 68 | impl ShmBuffer { 69 | pub fn create(width: i32, height: i32) -> ShmBuffer { 70 | unsafe { 71 | let name = b"rust-wayland-shm\x00"; 72 | let fd = MemFd::create(name, MFD_CLOEXEC | MFD_ALLOW_SEALING) 73 | .unwrap(); 74 | let capacity = width as usize 75 | * height as usize 76 | * std::mem::size_of::(); 77 | assert!(libc::ftruncate(fd.index, capacity as i64) != -1); 78 | let ptr = libc::mmap(ptr::null_mut(), 79 | capacity as u64, 80 | libc::PROT_WRITE | libc::PROT_READ, 81 | MAP_SHARED, 82 | fd.index, 83 | 0); 84 | assert!(ptr != libc::MAP_FAILED); 85 | for i in range(0, width * height) { 86 | let p: *mut u32 = (ptr as *mut u32).offset(i as isize); 87 | let x = i % width; 88 | let y = i / width; 89 | match x { 90 | 0...5 => std::ptr::write(&mut *p, 0x7FFF0000), 91 | 294...299 => std::ptr::write(&mut *p, 0x7F0000FF), 92 | _ => match y { 93 | 0...5 => std::ptr::write(&mut *p, 0x7F00FF00), 94 | 194...199 => std::ptr::write(&mut *p, 0x7FFF00FF), 95 | _ => std::ptr::write(&mut *p, 0x7F000000), 96 | } 97 | } 98 | } 99 | ShmBuffer { 100 | fd: fd.index, 101 | ptr: ptr, 102 | width: width, 103 | height: height, 104 | capacity: capacity, 105 | } 106 | } 107 | } 108 | pub fn resize(&mut self, width: i32, height: i32) { 109 | if (width * height) > (self.width * self.height) { 110 | println!("TODO: actual"); 111 | } 112 | self.width = width; 113 | self.height = height; 114 | } 115 | pub fn fd(&self) -> i32 { 116 | self.fd 117 | } 118 | pub fn capacity(&self) -> usize { self.capacity } 119 | pub fn width(&self) -> i32 { self.width } 120 | pub fn height(&self) -> i32 { self.height } 121 | pub fn stride(&self) -> i32 { 122 | self.width * std::mem::size_of::() as i32 123 | } 124 | } 125 | 126 | impl Drop for ShmBuffer { 127 | fn drop(&mut self) { 128 | unsafe { 129 | libc::munmap(self.ptr, self.capacity as u64); 130 | libc::close(self.fd); 131 | } 132 | } 133 | } 134 | 135 | fn main() { 136 | let mut display = Display::connect_to_env_or_default(); 137 | let mut registry = Registry::new(&mut display); 138 | // Create the shell surface 139 | let mut surface = registry.compositor().create_surface(); 140 | let mut shell_surface = registry.shell().get_shell_surface(&mut surface); 141 | shell_surface.set_toplevel(); 142 | // Create the buffer 143 | let mut shm_buffer = ShmBuffer::create(300, 200); 144 | shm_buffer.resize(300, 200); 145 | let mut pool = registry.shm().create_pool(shm_buffer.fd(), 146 | shm_buffer.capacity() as i32); 147 | let mut buffer = pool.create_buffer( 148 | 0, shm_buffer.width(), shm_buffer.height(), shm_buffer.stride(), 149 | wayland::raw::WL_SHM_FORMAT_ARGB8888 150 | ); 151 | surface.attach(&mut buffer, 0, 0); 152 | surface.commit(); 153 | loop { 154 | display.dispatch(); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | #![allow(missing_copy_implementations)] 4 | 5 | #![feature(io)] 6 | #![feature(libc)] 7 | #![feature(os)] 8 | #![feature(path)] 9 | #![feature(std_misc)] 10 | 11 | extern crate libc; 12 | 13 | pub mod new; 14 | pub mod old; 15 | pub mod raw; 16 | -------------------------------------------------------------------------------- /src/new/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Jonathan Eyolfson 2 | 3 | use std::old_io::{IoError, IoResult}; 4 | use std::old_io::net::pipe::UnixStream; 5 | use std::os; 6 | 7 | pub type Opcode = u16; 8 | 9 | 10 | fn u16x2_to_u32(n1: u16, n2: u16) -> u32 { 11 | ((n1 as u32) << 16) | (n2 as u32) 12 | } 13 | 14 | fn u32_to_u16x2(n: u32) -> (u16, u16) { 15 | (((n & 0b11111111_11111111_00000000_00000000) >> 16) as u16, 16 | (n & 0b00000000_00000000_11111111_11111111) as u16) 17 | } 18 | 19 | const DISPLAY_ID: u32 = 1; 20 | const FIRST_ID: u32 = 2; 21 | const MAX_ID: u32 = 0xfe_ff_ff_ff; 22 | 23 | pub struct Display { 24 | stream: UnixStream, 25 | next_id: u32, 26 | } 27 | 28 | impl Display { 29 | pub fn connect() -> IoResult { 30 | let xdg_runtime_dir = match os::getenv("XDG_RUNTIME_DIR") { 31 | Some(d) => d, 32 | None => return Err(IoError::from_errno(20, false)), 33 | }; 34 | let mut socket = Path::new(xdg_runtime_dir); 35 | socket.push("wayland-0"); 36 | match UnixStream::connect(&socket) { 37 | Ok(s) => Ok(Display {stream: s, next_id: FIRST_ID}), 38 | Err(e) => Err(e), 39 | } 40 | } 41 | fn get_id(&mut self) -> u32 { 42 | if self.next_id > MAX_ID { 43 | panic!("Ran out of object IDs"); 44 | } 45 | let id = self.next_id; 46 | self.next_id += 1; 47 | id 48 | } 49 | pub fn sync(&mut self) -> IoResult<()> { 50 | const SYNC: Opcode = 0; 51 | try!(self.stream.write_le_u32(DISPLAY_ID)); 52 | try!(self.stream.write_le_u32(u16x2_to_u32(12, SYNC))); 53 | 54 | let id = self.get_id(); 55 | try!(self.stream.write_le_u32(id)); 56 | 57 | Ok(()) 58 | } 59 | pub fn get_registry(&mut self) -> IoResult { 60 | const GET_REGISTRY: Opcode = 1; 61 | try!(self.stream.write_le_u32(DISPLAY_ID)); 62 | try!(self.stream.write_le_u32(u16x2_to_u32(12, GET_REGISTRY))); 63 | 64 | let id = self.get_id(); 65 | try!(self.stream.write_le_u32(id)); 66 | 67 | Ok(Registry {id: id}) 68 | } 69 | pub fn read_message(&mut self) -> IoResult<()> { 70 | let sender = try!(self.stream.read_le_u32()); 71 | let (length, opcode) = u32_to_u16x2(try!(self.stream.read_le_u32())); 72 | println!("sender = {}, length = {}, opcode = {}", 73 | sender, length, opcode); 74 | 75 | let name = try!(self.stream.read_le_u32()); 76 | 77 | let len = try!(self.stream.read_le_u32()); 78 | let vec = try!(self.stream.read_exact(len as usize -1)); 79 | try!(self.stream.read_u8()); 80 | if len % 4 != 0 { 81 | for _ in 0..4-(len % 4) { 82 | try!(self.stream.read_u8()); 83 | } 84 | } 85 | 86 | let version = try!(self.stream.read_le_u32()); 87 | println!(" name = {}, interface = {}, version = {}", 88 | name, String::from_utf8(vec).unwrap(), version); 89 | 90 | Ok(()) 91 | } 92 | } 93 | 94 | pub struct Registry { 95 | id: u32, 96 | } 97 | 98 | impl Registry { 99 | pub fn bind(&mut self, name: u32) { 100 | const BIND: Opcode = 0; 101 | println!("bind, id = {}, opcode = {}, name = {}", self.id, BIND, name); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/old/buffer.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use raw; 4 | 5 | pub struct Buffer { 6 | ptr: *mut raw::wl_buffer 7 | } 8 | 9 | impl Buffer { 10 | pub unsafe fn from_ptr(ptr: *mut raw::wl_buffer) -> Buffer { 11 | Buffer { ptr: ptr } 12 | } 13 | pub unsafe fn to_ptr(&mut self) -> *mut raw::wl_buffer { 14 | self.ptr 15 | } 16 | } 17 | 18 | impl Drop for Buffer { 19 | fn drop(&mut self) { 20 | unsafe { 21 | raw::wl_buffer_destroy(self.ptr) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/old/compositor.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use raw; 4 | 5 | use super::Surface; 6 | 7 | pub struct Compositor { 8 | ptr: *mut raw::wl_compositor 9 | } 10 | 11 | impl Compositor { 12 | pub unsafe fn from_ptr(ptr: *mut raw::wl_compositor) -> Compositor { 13 | Compositor { ptr: ptr } 14 | } 15 | pub fn create_surface(&mut self) -> Surface { 16 | unsafe { 17 | let ptr = raw::wl_compositor_create_surface(self.ptr); 18 | Surface::from_ptr(ptr) 19 | } 20 | } 21 | } 22 | 23 | impl Drop for Compositor { 24 | fn drop(&mut self) { 25 | unsafe { 26 | raw::wl_compositor_destroy(self.ptr); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/old/display.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use std::ffi; 4 | use std::ptr; 5 | 6 | use raw; 7 | 8 | pub struct Display { 9 | ptr: *mut raw::wl_display 10 | } 11 | 12 | impl Display { 13 | pub fn connect_to_env_or_default() -> Display { 14 | unsafe { 15 | let ptr = raw::wl_display_connect(ptr::null()); 16 | assert!(!ptr.is_null(), "wl_display_connect failed"); 17 | Display { ptr: ptr } 18 | } 19 | } 20 | pub fn connect(name: &str) -> Display { 21 | let c_str = ffi::CString::from_slice(name.as_bytes()); 22 | unsafe { 23 | let ptr = raw::wl_display_connect(c_str.as_ptr()); 24 | assert!(!ptr.is_null(), "wl_display_connect failed"); 25 | Display { ptr: ptr } 26 | } 27 | } 28 | pub fn roundtrip(&mut self) -> i32 { 29 | unsafe { 30 | let r = raw::wl_display_roundtrip(self.ptr); 31 | assert!(r != -1, "wl_display_roundtrip failed"); 32 | r 33 | } 34 | } 35 | pub fn read_events(&mut self) { 36 | unsafe { 37 | let r = raw::wl_display_read_events(self.ptr); 38 | assert!(r != -1, "wl_display_read_events failed"); 39 | } 40 | } 41 | pub fn prepare_read(&mut self) { 42 | unsafe { 43 | let r = raw::wl_display_prepare_read(self.ptr); 44 | assert!(r != -1, "wl_display_prepare_read failed"); 45 | } 46 | } 47 | pub fn cancel_read(&mut self) { 48 | unsafe { 49 | raw::wl_display_cancel_read(self.ptr); 50 | } 51 | } 52 | pub fn dispatch(&mut self) -> i32 { 53 | unsafe { 54 | let r = raw::wl_display_dispatch(self.ptr); 55 | assert!(r != -1, "wl_display_dispatch failed"); 56 | r 57 | } 58 | } 59 | pub fn flush(&mut self) -> i32 { 60 | unsafe { 61 | let r = raw::wl_display_flush(self.ptr); 62 | assert!(r != -1, "wl_display_flush failed"); 63 | r 64 | } 65 | } 66 | pub unsafe fn to_ptr(&mut self) -> *mut raw::wl_display { self.ptr } 67 | } 68 | 69 | impl Drop for Display { 70 | fn drop(&mut self) { 71 | unsafe { 72 | raw::wl_display_disconnect(self.ptr); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/old/list.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use raw; 6 | 7 | pub struct List { 8 | link: raw::wl_list 9 | } 10 | 11 | impl List { 12 | pub fn new() -> List { 13 | unsafe { 14 | let mut l = List { 15 | link: raw::wl_list { 16 | prev: ptr::null_mut(), 17 | next: ptr::null_mut() 18 | } 19 | }; 20 | raw::wl_list_init(&mut l.link); 21 | l 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/old/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | pub use self::buffer::Buffer; 4 | pub use self::compositor::Compositor; 5 | pub use self::display::Display; 6 | pub use self::list::List; 7 | pub use self::region::Region; 8 | pub use self::registry::Registry; 9 | pub use self::seat::Seat; 10 | pub use self::shell::Shell; 11 | pub use self::shell_surface::ShellSurface; 12 | pub use self::shm::Shm; 13 | pub use self::shm_pool::ShmPool; 14 | pub use self::surface::Surface; 15 | 16 | mod buffer; 17 | mod compositor; 18 | mod display; 19 | mod list; 20 | mod region; 21 | mod registry; 22 | mod seat; 23 | mod shell; 24 | mod shell_surface; 25 | mod shm; 26 | mod shm_pool; 27 | mod surface; 28 | -------------------------------------------------------------------------------- /src/old/region.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use raw; 4 | 5 | pub struct Region { 6 | ptr: *mut raw::wl_region 7 | } 8 | 9 | impl Region { 10 | pub unsafe fn from_ptr(ptr: *mut raw::wl_region) -> Region { 11 | Region { ptr: ptr } 12 | } 13 | } 14 | 15 | impl Drop for Region { 16 | fn drop(&mut self) { 17 | unsafe { 18 | raw::wl_region_destroy(self.ptr) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/old/registry.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use std::ffi; 4 | use std::mem; 5 | use std::str; 6 | 7 | use libc::{c_char, c_void, strcmp, uint32_t}; 8 | 9 | use raw; 10 | 11 | use super::Compositor; 12 | use super::Display; 13 | use super::Seat; 14 | use super::Shell; 15 | use super::Shm; 16 | 17 | pub struct Registry { 18 | ptr: *mut raw::wl_registry, 19 | compositor: Option, 20 | seat: Option, 21 | shell: Option, 22 | shm: Option, 23 | } 24 | 25 | #[allow(unused_variables)] 26 | extern fn global( 27 | data: *mut c_void, 28 | registry: *mut raw::wl_registry, 29 | name: uint32_t, 30 | interface: *const c_char, 31 | version: uint32_t 32 | ) { 33 | unsafe { 34 | let r: &mut Registry = mem::transmute(data); 35 | if strcmp(interface, raw::wl_compositor_interface.name) == 0 { 36 | let ptr = raw::wl_registry_bind( 37 | registry, 38 | name, 39 | & raw::wl_compositor_interface, 40 | version 41 | ); 42 | let compositor = Compositor::from_ptr( 43 | ptr as *mut raw::wl_compositor 44 | ); 45 | r.compositor = Some(compositor); 46 | } 47 | else if strcmp(interface, raw::wl_seat_interface.name) == 0 { 48 | let ptr = raw::wl_registry_bind( 49 | registry, 50 | name, 51 | & raw::wl_seat_interface, 52 | version 53 | ); 54 | let seat = Seat::from_ptr( 55 | ptr as *mut raw::wl_seat 56 | ); 57 | r.seat = Some(seat); 58 | } 59 | else if strcmp(interface, raw::wl_shell_interface.name) == 0 { 60 | let ptr = raw::wl_registry_bind( 61 | registry, 62 | name, 63 | & raw::wl_shell_interface, 64 | version 65 | ); 66 | let shell = Shell::from_ptr( 67 | ptr as *mut raw::wl_shell 68 | ); 69 | r.shell = Some(shell); 70 | } 71 | else if strcmp(interface, raw::wl_shm_interface.name) == 0 { 72 | let ptr = raw::wl_registry_bind( 73 | registry, 74 | name, 75 | & raw::wl_shm_interface, 76 | version 77 | ); 78 | let shm = Shm::from_ptr( 79 | ptr as *mut raw::wl_shm 80 | ); 81 | r.shm = Some(shm); 82 | } 83 | let slice = ffi::c_str_to_bytes(&interface); 84 | println!("wl_registry.global name={} interface={} version={}", 85 | name, str::from_utf8(slice).unwrap(), version); 86 | } 87 | } 88 | 89 | #[allow(unused_variables)] 90 | extern fn global_remove( 91 | data: *mut c_void, 92 | registry: *mut raw::wl_registry, 93 | name: uint32_t 94 | ) { 95 | println!("wl_registry.global_remove name = {}", name); 96 | unimplemented!(); 97 | } 98 | 99 | static LISTENER: raw::wl_registry_listener = raw::wl_registry_listener { 100 | global: global, 101 | global_remove: global_remove 102 | }; 103 | 104 | impl Registry { 105 | pub fn new(display: &mut Display) -> Registry { 106 | unsafe { 107 | let ptr = raw::wl_display_get_registry(display.to_ptr()); 108 | let mut r = Registry { 109 | ptr: ptr, 110 | compositor: None, 111 | seat: None, 112 | shell: None, 113 | shm: None, 114 | }; 115 | raw::wl_registry_add_listener( 116 | ptr, 117 | &LISTENER, 118 | mem::transmute(&mut r) 119 | ); 120 | display.roundtrip(); 121 | r 122 | } 123 | } 124 | pub fn compositor(&mut self) -> &mut Compositor { 125 | match self.compositor { 126 | Some(ref mut c) => c, 127 | None => panic!("compositor not set"), 128 | } 129 | } 130 | pub fn seat(&mut self) -> &mut Seat { 131 | match self.seat { 132 | Some(ref mut s) => s, 133 | None => panic!("seat not set"), 134 | } 135 | } 136 | pub fn shell(&mut self) -> &mut Shell { 137 | match self.shell { 138 | Some(ref mut s) => s, 139 | None => panic!("shell not set"), 140 | } 141 | } 142 | pub fn shm(&mut self) -> &mut Shm { 143 | match self.shm { 144 | Some(ref mut s) => s, 145 | None => panic!("shell not set"), 146 | } 147 | } 148 | } 149 | 150 | impl Drop for Registry { 151 | fn drop(&mut self) { 152 | unsafe { 153 | raw::wl_registry_destroy(self.ptr); 154 | } 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /src/old/seat.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use raw; 4 | 5 | pub struct Seat { 6 | ptr: *mut raw::wl_seat 7 | } 8 | 9 | impl Seat { 10 | pub unsafe fn from_ptr(ptr: *mut raw::wl_seat) -> Seat { 11 | Seat { ptr: ptr } 12 | } 13 | } 14 | 15 | impl Drop for Seat { 16 | fn drop(&mut self) { 17 | unsafe { 18 | raw::wl_seat_destroy(self.ptr) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/old/shell.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use raw; 4 | 5 | use super::ShellSurface; 6 | use super::Surface; 7 | 8 | pub struct Shell { 9 | ptr: *mut raw::wl_shell 10 | } 11 | 12 | impl Shell { 13 | pub unsafe fn from_ptr(ptr: *mut raw::wl_shell) -> Shell { 14 | Shell { ptr: ptr } 15 | } 16 | pub fn get_shell_surface(&mut self, surface: &mut Surface) -> ShellSurface { 17 | unsafe { 18 | let ptr = raw::wl_shell_get_shell_surface( 19 | self.ptr, 20 | surface.to_ptr() 21 | ); 22 | ShellSurface::from_ptr(ptr) 23 | } 24 | } 25 | } 26 | 27 | impl Drop for Shell { 28 | fn drop(&mut self) { 29 | unsafe { 30 | raw::wl_shell_destroy(self.ptr) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/old/shell_surface.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use std::ffi; 4 | use std::ptr; 5 | 6 | use libc::{c_void, int32_t, uint32_t}; 7 | 8 | use raw; 9 | 10 | #[allow(unused_variables)] 11 | extern fn ping( 12 | data: *mut c_void, 13 | wl_shell_surface: *mut raw::wl_shell_surface, 14 | serial: uint32_t 15 | ) { 16 | println!("wl_shell_surface.ping serial = {}", serial); 17 | unsafe { 18 | raw::wl_shell_surface_pong(wl_shell_surface, serial); 19 | } 20 | } 21 | 22 | #[allow(unused_variables)] 23 | extern fn configure( 24 | data: *mut c_void, 25 | wl_shell_surface: *mut raw::wl_shell_surface, 26 | edges: uint32_t, 27 | width: int32_t, 28 | height: int32_t 29 | ) { 30 | println!("wl_shell_surface.configure: {}, {}, {}", edges, width, height); 31 | } 32 | 33 | #[allow(unused_variables)] 34 | extern fn popup_done( 35 | data: *mut c_void, 36 | wl_shell_surface: *mut raw::wl_shell_surface, 37 | ) { 38 | println!("wl_shell_surface.popup_done"); 39 | } 40 | 41 | static LISTENER: raw::wl_shell_surface_listener = 42 | raw::wl_shell_surface_listener { 43 | ping: ping, 44 | configure: configure, 45 | popup_done: popup_done 46 | }; 47 | 48 | pub struct ShellSurface { 49 | ptr: *mut raw::wl_shell_surface 50 | } 51 | 52 | impl ShellSurface { 53 | pub unsafe fn from_ptr(ptr: *mut raw::wl_shell_surface) -> ShellSurface { 54 | raw::wl_shell_surface_add_listener( 55 | ptr, 56 | &LISTENER, 57 | ptr::null_mut() 58 | ); 59 | ShellSurface { ptr: ptr } 60 | } 61 | pub fn set_title(&mut self, title: &str) { 62 | let c_str = ffi::CString::from_slice(title.as_bytes()); 63 | unsafe { 64 | raw::wl_shell_surface_set_title(self.ptr, c_str.as_ptr()); 65 | } 66 | } 67 | pub fn set_toplevel(&mut self) { 68 | unsafe { 69 | raw::wl_shell_surface_set_toplevel(self.ptr); 70 | } 71 | } 72 | } 73 | 74 | impl Drop for ShellSurface { 75 | fn drop(&mut self) { 76 | unsafe { 77 | raw::wl_shell_surface_destroy(self.ptr) 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/old/shm.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use raw; 4 | 5 | use super::ShmPool; 6 | 7 | pub struct Shm { 8 | ptr: *mut raw::wl_shm 9 | } 10 | 11 | impl Shm { 12 | pub unsafe fn from_ptr(ptr: *mut raw::wl_shm) -> Shm { 13 | Shm { ptr: ptr } 14 | } 15 | pub fn create_pool(&mut self, fd: i32, size: i32) -> ShmPool { 16 | unsafe { 17 | let ptr = raw::wl_shm_create_pool(self.ptr, fd, size); 18 | ShmPool::from_ptr(ptr) 19 | } 20 | } 21 | } 22 | 23 | impl Drop for Shm { 24 | fn drop(&mut self) { 25 | unsafe { 26 | raw::wl_shm_destroy(self.ptr) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/old/shm_pool.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use raw; 4 | 5 | use super::Buffer; 6 | 7 | pub struct ShmPool { 8 | ptr: *mut raw::wl_shm_pool 9 | } 10 | 11 | impl ShmPool { 12 | pub unsafe fn from_ptr(ptr: *mut raw::wl_shm_pool) -> ShmPool { 13 | ShmPool { ptr: ptr } 14 | } 15 | pub fn create_buffer( 16 | &mut self, 17 | offset: i32, 18 | width: i32, 19 | height: i32, 20 | stride: i32, 21 | format: u32 22 | ) -> Buffer { 23 | unsafe { 24 | let ptr = raw::wl_shm_pool_create_buffer( 25 | self.ptr, offset, width, height, stride, format); 26 | Buffer::from_ptr(ptr) 27 | } 28 | } 29 | } 30 | 31 | impl Drop for ShmPool { 32 | fn drop(&mut self) { 33 | unsafe { 34 | raw::wl_shm_pool_destroy(self.ptr) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/old/surface.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2015 Jonathan Eyolfson 2 | 3 | use raw; 4 | 5 | use super::Buffer; 6 | 7 | pub struct Surface { 8 | ptr: *mut raw::wl_surface 9 | } 10 | 11 | impl Surface { 12 | pub unsafe fn from_ptr(ptr: *mut raw::wl_surface) -> Surface { 13 | Surface { ptr: ptr } 14 | } 15 | pub unsafe fn to_ptr(&mut self) -> *mut raw::wl_surface { 16 | self.ptr 17 | } 18 | pub fn attach(&mut self, buffer: &mut Buffer, x: i32, y: i32) { 19 | unsafe { 20 | raw::wl_surface_attach(self.ptr, buffer.to_ptr(), x, y); 21 | } 22 | } 23 | pub fn commit(&mut self) { 24 | unsafe { 25 | raw::wl_surface_commit(self.ptr); 26 | } 27 | } 28 | } 29 | 30 | impl Drop for Surface { 31 | fn drop(&mut self) { 32 | unsafe { 33 | raw::wl_surface_destroy(self.ptr) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/raw/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | pub use raw::protocol::wl_buffer::*; 4 | pub use raw::protocol::wl_callback::*; 5 | pub use raw::protocol::wl_compositor::*; 6 | pub use raw::protocol::wl_data_device::*; 7 | pub use raw::protocol::wl_data_device_manager::*; 8 | pub use raw::protocol::wl_data_offer::*; 9 | pub use raw::protocol::wl_data_source::*; 10 | pub use raw::protocol::wl_display::*; 11 | pub use raw::protocol::wl_keyboard::*; 12 | pub use raw::protocol::wl_output::*; 13 | pub use raw::protocol::wl_pointer::*; 14 | pub use raw::protocol::wl_region::*; 15 | pub use raw::protocol::wl_registry::*; 16 | pub use raw::protocol::wl_seat::*; 17 | pub use raw::protocol::wl_shell::*; 18 | pub use raw::protocol::wl_shell_surface::*; 19 | pub use raw::protocol::wl_shm::*; 20 | pub use raw::protocol::wl_shm_pool::*; 21 | pub use raw::protocol::wl_subcompositor::*; 22 | pub use raw::protocol::wl_subsurface::*; 23 | pub use raw::protocol::wl_surface::*; 24 | pub use raw::protocol::wl_touch::*; 25 | pub use raw::types::enums::*; 26 | pub use raw::types::listeners::*; 27 | pub use raw::types::objects::*; 28 | pub use raw::types::utils::*; 29 | 30 | use libc::{c_char, c_int, c_void, size_t, uint32_t}; 31 | 32 | pub mod protocol; 33 | pub mod types; 34 | 35 | #[link(name = "wayland-client")] 36 | extern { 37 | pub static wl_buffer_interface: wl_interface; 38 | pub static wl_callback_interface: wl_interface; 39 | pub static wl_compositor_interface: wl_interface; 40 | pub static wl_data_device_interface: wl_interface; 41 | pub static wl_data_device_manager_interface: wl_interface; 42 | pub static wl_data_offer_interface: wl_interface; 43 | pub static wl_data_source_interface: wl_interface; 44 | pub static wl_display_interface: wl_interface; 45 | pub static wl_keyboard_interface: wl_interface; 46 | pub static wl_output_interface: wl_interface; 47 | pub static wl_pointer_interface: wl_interface; 48 | pub static wl_region_interface: wl_interface; 49 | pub static wl_registry_interface: wl_interface; 50 | pub static wl_seat_interface: wl_interface; 51 | pub static wl_shell_interface: wl_interface; 52 | pub static wl_shell_surface_interface: wl_interface; 53 | pub static wl_shm_interface: wl_interface; 54 | pub static wl_shm_pool_interface: wl_interface; 55 | pub static wl_subcompositor_interface: wl_interface; 56 | pub static wl_subsurface_interface: wl_interface; 57 | pub static wl_surface_interface: wl_interface; 58 | pub static wl_touch_interface: wl_interface; 59 | 60 | pub fn wl_event_queue_destroy(queue: *mut wl_event_queue); 61 | 62 | pub fn wl_proxy_marshal(p: *mut wl_proxy, opcode: uint32_t, ...); 63 | pub fn wl_proxy_marshal_array(p: *mut wl_proxy, 64 | opcode: uint32_t, 65 | args: *mut wl_argument); 66 | pub fn wl_proxy_create(factroy: *mut wl_proxy, 67 | interface: *const wl_interface) -> *mut wl_proxy; 68 | pub fn wl_proxy_marshal_constructor(proxy: *mut wl_proxy, 69 | opcode: uint32_t, 70 | interface: *const wl_interface, 71 | ...) -> *mut wl_proxy; 72 | pub fn wl_proxy_marshal_array_constructor( 73 | proxy: *mut wl_proxy, 74 | opcode: uint32_t, 75 | args: *mut wl_argument, 76 | interface: *const wl_interface) -> *mut wl_proxy; 77 | pub fn wl_proxy_destroy(proxy: *mut wl_proxy); 78 | pub fn wl_proxy_add_listener(proxy: *mut wl_proxy, 79 | implementation: *mut extern fn(), 80 | data: *mut c_void) -> c_int; 81 | pub fn wl_proxy_get_listener(proxy: *mut wl_proxy) -> *const c_void; 82 | pub fn wl_proxy_add_dispatcher(proxy: *mut wl_proxy, 83 | dispatcher_func: wl_dispatcher_func_t, 84 | dispatcher_data: *const c_void, 85 | data: *mut c_void) -> c_int; 86 | pub fn wl_proxy_set_user_data(proxy: *mut wl_proxy, user_data: *mut c_void); 87 | pub fn wl_proxy_get_user_data(proxy: *mut wl_proxy) -> *mut c_void; 88 | pub fn wl_proxy_get_id(proxy: *mut wl_proxy) -> uint32_t; 89 | pub fn wl_proxy_get_class(proxy: *mut wl_proxy) -> *const c_char; 90 | pub fn wl_proxy_set_queue(proxy: *mut wl_proxy, queue: *mut wl_event_queue); 91 | 92 | pub fn wl_display_connect(name: *const c_char) -> *mut wl_display; 93 | pub fn wl_display_connect_to_fd(fd: c_int) -> *mut wl_display; 94 | pub fn wl_display_disconnect(display: *mut wl_display); 95 | pub fn wl_display_get_fd(display: *mut wl_display) -> c_int; 96 | pub fn wl_display_dispatch(display: *mut wl_display) -> c_int; 97 | pub fn wl_display_dispatch_queue(display: *mut wl_display, 98 | queue: *mut wl_event_queue) -> c_int; 99 | pub fn wl_display_dispatch_queue_pending( 100 | display: *mut wl_display, 101 | queue: *mut wl_event_queue) -> c_int; 102 | pub fn wl_display_dispatch_pending(display: *mut wl_display) -> c_int; 103 | pub fn wl_display_get_error(display: *mut wl_display) -> c_int; 104 | pub fn wl_display_get_protocol_error(display: *mut wl_display, 105 | interface: *mut *const wl_interface, 106 | id: *mut uint32_t) -> uint32_t; 107 | pub fn wl_display_flush(display: *mut wl_display) -> c_int; 108 | pub fn wl_display_roundtrip_queue(display: *mut wl_display, 109 | queue: *mut wl_event_queue) -> c_int; 110 | pub fn wl_display_roundtrip(display: *mut wl_display) -> c_int; 111 | pub fn wl_display_create_queue( 112 | display: *mut wl_display) -> *mut wl_event_queue; 113 | pub fn wl_display_prepare_read_queue(display: *mut wl_display, 114 | queue: *mut wl_event_queue) -> c_int; 115 | pub fn wl_display_prepare_read(display: *mut wl_display) -> c_int; 116 | pub fn wl_display_cancel_read(display: *mut wl_display); 117 | pub fn wl_display_read_events(display: *mut wl_display) -> c_int; 118 | 119 | pub fn wl_log_set_handler_client(handler: wl_log_func_t); 120 | 121 | pub fn wl_list_init(list: *mut wl_list); 122 | pub fn wl_list_insert(list: *mut wl_list, elm: *mut wl_list); 123 | pub fn wl_list_remove(elm: *mut wl_list); 124 | pub fn wl_list_length(elm: *const wl_list) -> c_int; 125 | pub fn wl_list_empty(elm: *const wl_list) -> c_int; 126 | pub fn wl_list_insert_list(list: *mut wl_list, other: *mut wl_list); 127 | 128 | pub fn wl_array_init(array: *mut wl_array); 129 | pub fn wl_array_release(array: *mut wl_array); 130 | pub fn wl_array_add(array: *mut wl_array, size: size_t) -> *mut c_void; 131 | pub fn wl_array_copy(array: *mut wl_array, source: *mut wl_array) -> c_int; 132 | } 133 | -------------------------------------------------------------------------------- /src/raw/protocol/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | pub mod wl_buffer; 4 | pub mod wl_callback; 5 | pub mod wl_compositor; 6 | pub mod wl_data_device; 7 | pub mod wl_data_device_manager; 8 | pub mod wl_data_offer; 9 | pub mod wl_data_source; 10 | pub mod wl_display; 11 | pub mod wl_keyboard; 12 | pub mod wl_output; 13 | pub mod wl_pointer; 14 | pub mod wl_region; 15 | pub mod wl_registry; 16 | pub mod wl_seat; 17 | pub mod wl_shell; 18 | pub mod wl_shell_surface; 19 | pub mod wl_shm; 20 | pub mod wl_shm_pool; 21 | pub mod wl_subcompositor; 22 | pub mod wl_subsurface; 23 | pub mod wl_surface; 24 | pub mod wl_touch; 25 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_buffer.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_int, c_void, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::listeners; 7 | use raw::types::objects; 8 | 9 | pub const WL_BUFFER_DESTROY: uint32_t = 0; 10 | 11 | #[inline(always)] 12 | pub unsafe fn wl_buffer_add_listener( 13 | wl_buffer: *mut objects::wl_buffer, 14 | listener: *const listeners::wl_buffer_listener, 15 | data: *mut c_void 16 | ) -> c_int { 17 | raw::wl_proxy_add_listener( 18 | wl_buffer as *mut objects::wl_proxy, 19 | listener as *mut extern fn(), 20 | data 21 | ) 22 | } 23 | 24 | #[inline(always)] 25 | pub unsafe fn wl_buffer_set_user_data( 26 | wl_buffer: *mut objects::wl_buffer, 27 | user_data: *mut c_void 28 | ) { 29 | raw::wl_proxy_set_user_data( 30 | wl_buffer as *mut objects::wl_proxy, 31 | user_data 32 | ) 33 | } 34 | 35 | #[inline(always)] 36 | pub unsafe fn wl_buffer_get_user_data( 37 | wl_buffer: *mut objects::wl_buffer 38 | ) -> *mut c_void { 39 | raw::wl_proxy_get_user_data(wl_buffer as *mut objects::wl_proxy) 40 | } 41 | 42 | #[inline(always)] 43 | pub unsafe fn wl_buffer_destroy( 44 | wl_buffer: *mut objects::wl_buffer 45 | ) { 46 | raw::wl_proxy_marshal( 47 | wl_buffer as *mut objects::wl_proxy, 48 | WL_BUFFER_DESTROY 49 | ); 50 | raw::wl_proxy_destroy(wl_buffer as *mut objects::wl_proxy) 51 | } 52 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_callback.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_int, c_void}; 4 | 5 | use raw; 6 | use raw::types::objects; 7 | use raw::types::listeners; 8 | 9 | #[inline(always)] 10 | pub unsafe fn wl_callback_add_listener( 11 | wl_callback: *mut objects::wl_callback, 12 | listener: *const listeners::wl_callback_listener, 13 | data: *mut c_void 14 | ) -> c_int { 15 | raw::wl_proxy_add_listener( 16 | wl_callback as *mut objects::wl_proxy, 17 | listener as *mut extern fn(), 18 | data 19 | ) 20 | } 21 | 22 | #[inline(always)] 23 | pub unsafe fn wl_callback_set_user_data( 24 | wl_callback: *mut objects::wl_callback, 25 | user_data: *mut c_void 26 | ) { 27 | raw::wl_proxy_set_user_data( 28 | wl_callback as *mut objects::wl_proxy, 29 | user_data 30 | ) 31 | } 32 | 33 | #[inline(always)] 34 | pub unsafe fn wl_callback_get_user_data( 35 | wl_callback: *mut objects::wl_callback 36 | ) -> *mut c_void { 37 | raw::wl_proxy_get_user_data(wl_callback as *mut objects::wl_proxy) 38 | } 39 | 40 | #[inline(always)] 41 | pub unsafe fn wl_callback_destroy(wl_callback: *mut objects::wl_callback) { 42 | raw::wl_proxy_destroy(wl_callback as *mut objects::wl_proxy) 43 | } 44 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_compositor.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_void, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | 10 | pub const WL_COMPOSITOR_CREATE_SURFACE: uint32_t = 0; 11 | pub const WL_COMPOSITOR_CREATE_REGION: uint32_t = 1; 12 | 13 | #[inline(always)] 14 | pub unsafe fn wl_compositor_set_user_data( 15 | wl_compositor: *mut objects::wl_compositor, 16 | user_data: *mut c_void 17 | ) { 18 | raw::wl_proxy_set_user_data( 19 | wl_compositor as *mut objects::wl_proxy, 20 | user_data 21 | ) 22 | } 23 | 24 | #[inline(always)] 25 | pub unsafe fn wl_compositor_get_user_data( 26 | wl_compositor: *mut objects::wl_compositor 27 | ) -> *mut c_void { 28 | raw::wl_proxy_get_user_data(wl_compositor as *mut objects::wl_proxy) 29 | } 30 | 31 | #[inline(always)] 32 | pub unsafe fn wl_compositor_destroy(wl_compositor: *mut objects::wl_compositor) { 33 | raw::wl_proxy_destroy(wl_compositor as *mut objects::wl_proxy) 34 | } 35 | 36 | #[inline(always)] 37 | pub unsafe fn wl_compositor_create_surface( 38 | wl_compositor: *mut objects::wl_compositor 39 | ) -> *mut objects::wl_surface { 40 | let id = raw::wl_proxy_marshal_constructor( 41 | wl_compositor as *mut objects::wl_proxy, 42 | WL_COMPOSITOR_CREATE_SURFACE, 43 | &raw::wl_surface_interface, 44 | ptr::null_mut::() 45 | ); 46 | id as *mut objects::wl_surface 47 | } 48 | 49 | #[inline(always)] 50 | pub unsafe fn wl_compositor_create_region( 51 | wl_compositor: *mut objects::wl_compositor 52 | ) -> *mut objects::wl_region { 53 | let id = raw::wl_proxy_marshal_constructor( 54 | wl_compositor as *mut objects::wl_proxy, 55 | WL_COMPOSITOR_CREATE_REGION, 56 | &raw::wl_region_interface, 57 | ptr::null_mut::() 58 | ); 59 | id as *mut objects::wl_region 60 | } 61 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_data_device.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_int, c_void, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::listeners; 7 | use raw::types::objects; 8 | 9 | pub const WL_DATA_DEVICE_START_DRAG: uint32_t = 0; 10 | pub const WL_DATA_DEVICE_SET_SELECTION: uint32_t = 1; 11 | pub const WL_DATA_DEVICE_RELEASE: uint32_t = 2; 12 | 13 | #[inline(always)] 14 | pub unsafe fn wl_data_device_add_listener( 15 | wl_data_device: *mut objects::wl_data_device, 16 | listener: *const listeners::wl_data_device_listener, 17 | data: *mut c_void 18 | ) -> c_int { 19 | raw::wl_proxy_add_listener( 20 | wl_data_device as *mut objects::wl_proxy, 21 | listener as *mut extern fn(), 22 | data 23 | ) 24 | } 25 | 26 | #[inline(always)] 27 | pub unsafe fn wl_data_device_set_user_data( 28 | wl_data_device: *mut objects::wl_data_device, 29 | user_data: *mut c_void 30 | ) { 31 | raw::wl_proxy_set_user_data( 32 | wl_data_device as *mut objects::wl_proxy, 33 | user_data 34 | ) 35 | } 36 | 37 | #[inline(always)] 38 | pub unsafe fn wl_data_device_get_user_data( 39 | wl_data_device: *mut objects::wl_data_device 40 | ) -> *mut c_void { 41 | raw::wl_proxy_get_user_data(wl_data_device as *mut objects::wl_proxy) 42 | } 43 | 44 | #[inline(always)] 45 | pub unsafe fn wl_data_device_destroy(wl_data_device: *mut objects::wl_data_device) { 46 | raw::wl_proxy_destroy(wl_data_device as *mut objects::wl_proxy) 47 | } 48 | 49 | #[inline(always)] 50 | pub unsafe fn wl_data_device_start_drag( 51 | wl_data_device: *mut objects::wl_data_device, 52 | source: *mut objects::wl_data_source, 53 | origin: *mut objects::wl_surface, 54 | icon: *mut objects::wl_surface, 55 | serial: uint32_t 56 | ) { 57 | raw::wl_proxy_marshal( 58 | wl_data_device as *mut objects::wl_proxy, 59 | WL_DATA_DEVICE_START_DRAG, 60 | source, 61 | origin, 62 | icon, 63 | serial 64 | ) 65 | } 66 | 67 | #[inline(always)] 68 | pub unsafe fn wl_data_device_set_selection( 69 | wl_data_device: *mut objects::wl_data_device, 70 | source: *mut objects::wl_data_source, 71 | serial: uint32_t 72 | ) { 73 | raw::wl_proxy_marshal( 74 | wl_data_device as *mut objects::wl_proxy, 75 | WL_DATA_DEVICE_SET_SELECTION, 76 | source, 77 | serial 78 | ) 79 | } 80 | 81 | #[inline(always)] 82 | pub unsafe fn wl_data_device_release( 83 | wl_data_device: *mut objects::wl_data_device 84 | ) { 85 | raw::wl_proxy_marshal( 86 | wl_data_device as *mut objects::wl_proxy, 87 | WL_DATA_DEVICE_RELEASE 88 | ); 89 | raw::wl_proxy_destroy(wl_data_device as *mut objects::wl_proxy) 90 | } 91 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_data_device_manager.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_void, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | 10 | pub const WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE: uint32_t = 0; 11 | pub const WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE: uint32_t = 1; 12 | 13 | #[inline(always)] 14 | pub unsafe fn wl_data_device_manager_set_user_data( 15 | wl_data_device_manager: *mut objects::wl_data_device_manager, 16 | user_data: *mut c_void 17 | ) { 18 | raw::wl_proxy_set_user_data( 19 | wl_data_device_manager as *mut objects::wl_proxy, 20 | user_data 21 | ) 22 | } 23 | 24 | #[inline(always)] 25 | pub unsafe fn wl_data_device_manager_get_user_data( 26 | wl_data_device_manager: *mut objects::wl_data_device_manager 27 | ) -> *mut c_void { 28 | raw::wl_proxy_get_user_data(wl_data_device_manager as *mut objects::wl_proxy) 29 | } 30 | 31 | #[inline(always)] 32 | pub unsafe fn wl_data_device_manager_destroy(wl_data_device_manager: *mut objects::wl_data_device_manager) { 33 | raw::wl_proxy_destroy(wl_data_device_manager as *mut objects::wl_proxy) 34 | } 35 | 36 | #[inline(always)] 37 | pub unsafe fn wl_data_device_manager_create_data_source( 38 | wl_data_device_manager: *mut objects::wl_data_device_manager 39 | ) -> *mut objects::wl_data_source { 40 | let id = raw::wl_proxy_marshal_constructor( 41 | wl_data_device_manager as *mut objects::wl_proxy, 42 | WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE, 43 | &raw::wl_data_source_interface, 44 | ptr::null_mut::() 45 | ); 46 | id as *mut objects::wl_data_source 47 | } 48 | 49 | #[inline(always)] 50 | pub unsafe fn wl_data_device_manager_get_data_device( 51 | wl_data_device_manager: *mut objects::wl_data_device_manager, 52 | seat: *mut objects::wl_seat 53 | ) -> *mut objects::wl_data_device { 54 | let id = raw::wl_proxy_marshal_constructor( 55 | wl_data_device_manager as *mut objects::wl_proxy, 56 | WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE, 57 | &raw::wl_data_device_interface, 58 | ptr::null_mut::(), 59 | seat 60 | ); 61 | id as *mut objects::wl_data_device 62 | } 63 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_data_offer.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_char, c_int, c_void, int32_t, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::listeners; 7 | use raw::types::objects; 8 | 9 | pub const WL_DATA_OFFER_ACCEPT: uint32_t = 0; 10 | pub const WL_DATA_OFFER_RECEIVE: uint32_t = 1; 11 | pub const WL_DATA_OFFER_DESTROY: uint32_t = 2; 12 | 13 | #[inline(always)] 14 | pub unsafe fn wl_data_offer_add_listener( 15 | wl_data_offer: *mut objects::wl_data_offer, 16 | listener: *const listeners::wl_data_offer_listener, 17 | data: *mut c_void 18 | ) -> c_int { 19 | raw::wl_proxy_add_listener( 20 | wl_data_offer as *mut objects::wl_proxy, 21 | listener as *mut extern fn(), 22 | data 23 | ) 24 | } 25 | 26 | #[inline(always)] 27 | pub unsafe fn wl_data_offer_set_user_data( 28 | wl_data_offer: *mut objects::wl_data_offer, 29 | user_data: *mut c_void 30 | ) { 31 | raw::wl_proxy_set_user_data( 32 | wl_data_offer as *mut objects::wl_proxy, 33 | user_data 34 | ) 35 | } 36 | 37 | #[inline(always)] 38 | pub unsafe fn wl_data_offer_get_user_data( 39 | wl_data_offer: *mut objects::wl_data_offer 40 | ) -> *mut c_void { 41 | raw::wl_proxy_get_user_data(wl_data_offer as *mut objects::wl_proxy) 42 | } 43 | 44 | #[inline(always)] 45 | pub unsafe fn wl_data_offer_accept( 46 | wl_data_offer: *mut objects::wl_data_offer, 47 | serial: uint32_t, 48 | mime_type: *const c_char 49 | ) { 50 | raw::wl_proxy_marshal( 51 | wl_data_offer as *mut objects::wl_proxy, 52 | WL_DATA_OFFER_ACCEPT, 53 | serial, 54 | mime_type 55 | ) 56 | } 57 | 58 | #[inline(always)] 59 | pub unsafe fn wl_data_offer_receive( 60 | wl_data_offer: *mut objects::wl_data_offer, 61 | mime_type: *const c_char, 62 | fd: int32_t 63 | ) { 64 | raw::wl_proxy_marshal( 65 | wl_data_offer as *mut objects::wl_proxy, 66 | WL_DATA_OFFER_RECEIVE, 67 | mime_type, 68 | fd 69 | ) 70 | } 71 | 72 | #[inline(always)] 73 | pub unsafe fn wl_data_offer_destroy( 74 | wl_data_offer: *mut objects::wl_data_offer 75 | ) { 76 | raw::wl_proxy_marshal( 77 | wl_data_offer as *mut objects::wl_proxy, 78 | WL_DATA_OFFER_DESTROY 79 | ); 80 | raw::wl_proxy_destroy(wl_data_offer as *mut objects::wl_proxy) 81 | } 82 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_data_source.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_char, c_int, c_void, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::listeners; 7 | use raw::types::objects; 8 | 9 | pub const WL_DATA_SOURCE_OFFER: uint32_t = 0; 10 | pub const WL_DATA_SOURCE_DESTROY: uint32_t = 1; 11 | 12 | #[inline(always)] 13 | pub unsafe fn wl_data_source_add_listener( 14 | wl_data_source: *mut objects::wl_data_source, 15 | listener: *const listeners::wl_data_source_listener, 16 | data: *mut c_void 17 | ) -> c_int { 18 | raw::wl_proxy_add_listener( 19 | wl_data_source as *mut objects::wl_proxy, 20 | listener as *mut extern fn(), 21 | data 22 | ) 23 | } 24 | 25 | #[inline(always)] 26 | pub unsafe fn wl_data_source_set_user_data( 27 | wl_data_source: *mut objects::wl_data_source, 28 | user_data: *mut c_void 29 | ) { 30 | raw::wl_proxy_set_user_data( 31 | wl_data_source as *mut objects::wl_proxy, 32 | user_data 33 | ) 34 | } 35 | 36 | #[inline(always)] 37 | pub unsafe fn wl_data_source_get_user_data( 38 | wl_data_source: *mut objects::wl_data_source 39 | ) -> *mut c_void { 40 | raw::wl_proxy_get_user_data(wl_data_source as *mut objects::wl_proxy) 41 | } 42 | 43 | #[inline(always)] 44 | pub unsafe fn wl_data_source_offer( 45 | wl_data_source: *mut objects::wl_data_source, 46 | mime_type: *const c_char 47 | ) { 48 | raw::wl_proxy_marshal( 49 | wl_data_source as *mut objects::wl_proxy, 50 | WL_DATA_SOURCE_OFFER, 51 | mime_type 52 | ) 53 | } 54 | 55 | #[inline(always)] 56 | pub unsafe fn wl_data_source_destroy( 57 | wl_data_source: *mut objects::wl_data_source 58 | ) { 59 | raw::wl_proxy_marshal( 60 | wl_data_source as *mut objects::wl_proxy, 61 | WL_DATA_SOURCE_DESTROY 62 | ); 63 | raw::wl_proxy_destroy(wl_data_source as *mut objects::wl_proxy) 64 | } 65 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_display.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_int, c_void, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | use raw::types::listeners; 10 | 11 | pub const WL_DISPLAY_SYNC: uint32_t = 0; 12 | pub const WL_DISPLAY_GET_REGISTRY: uint32_t = 1; 13 | 14 | #[inline(always)] 15 | pub unsafe fn wl_display_add_listener( 16 | wl_display: *mut objects::wl_display, 17 | listener: *const listeners::wl_display_listener, 18 | data: *mut c_void 19 | ) -> c_int { 20 | raw::wl_proxy_add_listener( 21 | wl_display as *mut objects::wl_proxy, 22 | listener as *mut extern fn(), 23 | data 24 | ) 25 | } 26 | 27 | #[inline(always)] 28 | pub unsafe fn wl_display_set_user_data( 29 | wl_display: *mut objects::wl_display, 30 | user_data: *mut c_void 31 | ) { 32 | raw::wl_proxy_set_user_data( 33 | wl_display as *mut objects::wl_proxy, 34 | user_data 35 | ) 36 | } 37 | 38 | #[inline(always)] 39 | pub unsafe fn wl_display_get_user_data( 40 | wl_display: *mut objects::wl_display 41 | ) -> *mut c_void { 42 | raw::wl_proxy_get_user_data(wl_display as *mut objects::wl_proxy) 43 | } 44 | 45 | #[inline(always)] 46 | pub unsafe fn wl_display_sync( 47 | wl_display: *mut objects::wl_display 48 | ) -> *mut objects::wl_callback { 49 | let callback = raw::wl_proxy_marshal_constructor( 50 | wl_display as *mut objects::wl_proxy, 51 | WL_DISPLAY_SYNC, 52 | &raw::wl_callback_interface, 53 | ptr::null_mut::() 54 | ); 55 | callback as *mut objects::wl_callback 56 | } 57 | 58 | #[inline(always)] 59 | pub unsafe fn wl_display_get_registry( 60 | wl_display: *mut objects::wl_display 61 | ) -> *mut objects::wl_registry { 62 | let registry = raw::wl_proxy_marshal_constructor( 63 | wl_display as *mut objects::wl_proxy, 64 | WL_DISPLAY_GET_REGISTRY, 65 | &raw::wl_registry_interface, 66 | ptr::null_mut::() 67 | ); 68 | registry as *mut objects::wl_registry 69 | } 70 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_keyboard.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_int, c_void, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::objects; 7 | use raw::types::listeners; 8 | 9 | pub const WL_KEYBOARD_RELEASE: uint32_t = 0; 10 | 11 | #[inline(always)] 12 | pub unsafe fn wl_keyboard_add_listener( 13 | wl_keyboard: *mut objects::wl_keyboard, 14 | listener: *const listeners::wl_keyboard_listener, 15 | data: *mut c_void 16 | ) -> c_int { 17 | raw::wl_proxy_add_listener( 18 | wl_keyboard as *mut objects::wl_proxy, 19 | listener as *mut extern fn(), 20 | data 21 | ) 22 | } 23 | 24 | #[inline(always)] 25 | pub unsafe fn wl_keyboard_set_user_data( 26 | wl_keyboard: *mut objects::wl_keyboard, 27 | user_data: *mut c_void 28 | ) { 29 | raw::wl_proxy_set_user_data( 30 | wl_keyboard as *mut objects::wl_proxy, 31 | user_data 32 | ) 33 | } 34 | 35 | #[inline(always)] 36 | pub unsafe fn wl_keyboard_get_user_data( 37 | wl_keyboard: *mut objects::wl_keyboard 38 | ) -> *mut c_void { 39 | raw::wl_proxy_get_user_data(wl_keyboard as *mut objects::wl_proxy) 40 | } 41 | 42 | #[inline(always)] 43 | pub unsafe fn wl_keyboard_destroy(wl_keyboard: *mut objects::wl_keyboard) { 44 | raw::wl_proxy_destroy(wl_keyboard as *mut objects::wl_proxy) 45 | } 46 | 47 | #[inline(always)] 48 | pub unsafe fn wl_keyboard_release( 49 | wl_keyboard: *mut objects::wl_keyboard 50 | ) { 51 | raw::wl_proxy_marshal( 52 | wl_keyboard as *mut objects::wl_proxy, 53 | WL_KEYBOARD_RELEASE 54 | ); 55 | raw::wl_proxy_destroy(wl_keyboard as *mut objects::wl_proxy) 56 | } 57 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_output.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_int, c_void}; 4 | 5 | use raw; 6 | use raw::types::objects; 7 | use raw::types::listeners; 8 | 9 | #[inline(always)] 10 | pub unsafe fn wl_output_add_listener( 11 | wl_output: *mut objects::wl_output, 12 | listener: *const listeners::wl_output_listener, 13 | data: *mut c_void 14 | ) -> c_int { 15 | raw::wl_proxy_add_listener( 16 | wl_output as *mut objects::wl_proxy, 17 | listener as *mut extern fn(), 18 | data 19 | ) 20 | } 21 | 22 | #[inline(always)] 23 | pub unsafe fn wl_output_set_user_data( 24 | wl_output: *mut objects::wl_output, 25 | user_data: *mut c_void 26 | ) { 27 | raw::wl_proxy_set_user_data( 28 | wl_output as *mut objects::wl_proxy, 29 | user_data 30 | ) 31 | } 32 | 33 | #[inline(always)] 34 | pub unsafe fn wl_output_get_user_data( 35 | wl_output: *mut objects::wl_output 36 | ) -> *mut c_void { 37 | raw::wl_proxy_get_user_data(wl_output as *mut objects::wl_proxy) 38 | } 39 | 40 | #[inline(always)] 41 | pub unsafe fn wl_output_destroy(wl_output: *mut objects::wl_output) { 42 | raw::wl_proxy_destroy(wl_output as *mut objects::wl_proxy) 43 | } 44 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_pointer.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_int, c_void, int32_t, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::objects; 7 | use raw::types::listeners; 8 | 9 | pub const WL_POINTER_SET_CURSOR: uint32_t = 0; 10 | pub const WL_POINTER_RELEASE: uint32_t = 1; 11 | 12 | #[inline(always)] 13 | pub unsafe fn wl_pointer_add_listener( 14 | wl_pointer: *mut objects::wl_pointer, 15 | listener: *const listeners::wl_pointer_listener, 16 | data: *mut c_void 17 | ) -> c_int { 18 | raw::wl_proxy_add_listener( 19 | wl_pointer as *mut objects::wl_proxy, 20 | listener as *mut extern fn(), 21 | data 22 | ) 23 | } 24 | 25 | #[inline(always)] 26 | pub unsafe fn wl_pointer_set_user_data( 27 | wl_pointer: *mut objects::wl_pointer, 28 | user_data: *mut c_void 29 | ) { 30 | raw::wl_proxy_set_user_data( 31 | wl_pointer as *mut objects::wl_proxy, 32 | user_data 33 | ) 34 | } 35 | 36 | #[inline(always)] 37 | pub unsafe fn wl_pointer_get_user_data( 38 | wl_pointer: *mut objects::wl_pointer 39 | ) -> *mut c_void { 40 | raw::wl_proxy_get_user_data(wl_pointer as *mut objects::wl_proxy) 41 | } 42 | 43 | #[inline(always)] 44 | pub unsafe fn wl_pointer_destroy(wl_pointer: *mut objects::wl_pointer) { 45 | raw::wl_proxy_destroy(wl_pointer as *mut objects::wl_proxy) 46 | } 47 | 48 | #[inline(always)] 49 | pub unsafe fn wl_pointer_set_cursor( 50 | wl_pointer: *mut objects::wl_pointer, 51 | serial: uint32_t, 52 | surface: *mut objects::wl_surface, 53 | hotspot_x: int32_t, 54 | hotspot_y: int32_t 55 | ) { 56 | raw::wl_proxy_marshal( 57 | wl_pointer as *mut objects::wl_proxy, 58 | WL_POINTER_SET_CURSOR, 59 | serial, 60 | surface, 61 | hotspot_x, 62 | hotspot_y 63 | ) 64 | } 65 | 66 | #[inline(always)] 67 | pub unsafe fn wl_pointer_release( 68 | wl_pointer: *mut objects::wl_pointer 69 | ) { 70 | raw::wl_proxy_marshal( 71 | wl_pointer as *mut objects::wl_proxy, 72 | WL_POINTER_RELEASE 73 | ); 74 | raw::wl_proxy_destroy(wl_pointer as *mut objects::wl_proxy) 75 | } 76 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_region.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_void, int32_t, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::objects; 7 | 8 | pub const WL_REGION_DESTROY: uint32_t = 0; 9 | pub const WL_REGION_ADD: uint32_t = 1; 10 | pub const WL_REGION_SUBTRACT: uint32_t = 2; 11 | 12 | #[inline(always)] 13 | pub unsafe fn wl_region_set_user_data( 14 | wl_region: *mut objects::wl_region, 15 | user_data: *mut c_void 16 | ) { 17 | raw::wl_proxy_set_user_data( 18 | wl_region as *mut objects::wl_proxy, 19 | user_data 20 | ) 21 | } 22 | 23 | #[inline(always)] 24 | pub unsafe fn wl_region_get_user_data( 25 | wl_region: *mut objects::wl_region 26 | ) -> *mut c_void { 27 | raw::wl_proxy_get_user_data(wl_region as *mut objects::wl_proxy) 28 | } 29 | 30 | #[inline(always)] 31 | pub unsafe fn wl_region_destroy( 32 | wl_region: *mut objects::wl_region 33 | ) { 34 | raw::wl_proxy_marshal( 35 | wl_region as *mut objects::wl_proxy, 36 | WL_REGION_DESTROY 37 | ); 38 | raw::wl_proxy_destroy(wl_region as *mut objects::wl_proxy) 39 | } 40 | 41 | #[inline(always)] 42 | pub unsafe fn wl_region_add( 43 | wl_region: *mut objects::wl_region, 44 | x: int32_t, 45 | y: int32_t, 46 | width: int32_t, 47 | height: int32_t 48 | ) { 49 | raw::wl_proxy_marshal( 50 | wl_region as *mut objects::wl_proxy, 51 | WL_REGION_ADD, 52 | x, 53 | y, 54 | width, 55 | height 56 | ) 57 | } 58 | 59 | #[inline(always)] 60 | pub unsafe fn wl_region_subtract( 61 | wl_region: *mut objects::wl_region, 62 | x: int32_t, 63 | y: int32_t, 64 | width: int32_t, 65 | height: int32_t 66 | ) { 67 | raw::wl_proxy_marshal( 68 | wl_region as *mut objects::wl_proxy, 69 | WL_REGION_SUBTRACT, 70 | x, 71 | y, 72 | width, 73 | height 74 | ) 75 | } 76 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_registry.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_int, c_void, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | use raw::types::listeners; 10 | use raw::types::utils; 11 | 12 | pub const WL_REGISTRY_BIND: uint32_t = 0; 13 | 14 | #[inline(always)] 15 | pub unsafe fn wl_registry_add_listener( 16 | wl_registry: *mut objects::wl_registry, 17 | listener: *const listeners::wl_registry_listener, 18 | data: *mut c_void 19 | ) -> c_int { 20 | raw::wl_proxy_add_listener( 21 | wl_registry as *mut objects::wl_proxy, 22 | listener as *mut extern fn(), 23 | data 24 | ) 25 | } 26 | 27 | #[inline(always)] 28 | pub unsafe fn wl_registry_set_user_data( 29 | wl_registry: *mut objects::wl_registry, 30 | user_data: *mut c_void 31 | ) { 32 | raw::wl_proxy_set_user_data( 33 | wl_registry as *mut objects::wl_proxy, 34 | user_data 35 | ) 36 | } 37 | 38 | #[inline(always)] 39 | pub unsafe fn wl_registry_get_user_data( 40 | wl_registry: *mut objects::wl_registry 41 | ) -> *mut c_void { 42 | raw::wl_proxy_get_user_data(wl_registry as *mut objects::wl_proxy) 43 | } 44 | 45 | #[inline(always)] 46 | pub unsafe fn wl_registry_destroy(wl_registry: *mut objects::wl_registry) { 47 | raw::wl_proxy_destroy(wl_registry as *mut objects::wl_proxy) 48 | } 49 | 50 | #[inline(always)] 51 | pub unsafe fn wl_registry_bind( 52 | wl_registry: *mut objects::wl_registry, 53 | name: uint32_t, 54 | interface: *const utils::wl_interface, 55 | version: uint32_t 56 | ) -> *mut c_void { 57 | let id = raw::wl_proxy_marshal_constructor( 58 | wl_registry as *mut objects::wl_proxy, 59 | WL_REGISTRY_BIND, 60 | interface, 61 | name, 62 | (*interface).name, 63 | version, 64 | ptr::null_mut::() 65 | ); 66 | id as *mut c_void 67 | } 68 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_seat.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_int, c_void, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | use raw::types::listeners; 10 | 11 | pub const WL_SEAT_GET_POINTER: uint32_t = 0; 12 | pub const WL_SEAT_GET_KEYBOARD: uint32_t = 1; 13 | pub const WL_SEAT_GET_TOUCH: uint32_t = 2; 14 | 15 | #[inline(always)] 16 | pub unsafe fn wl_seat_add_listener( 17 | wl_seat: *mut objects::wl_seat, 18 | listener: *const listeners::wl_seat_listener, 19 | data: *mut c_void 20 | ) -> c_int { 21 | raw::wl_proxy_add_listener( 22 | wl_seat as *mut objects::wl_proxy, 23 | listener as *mut extern fn(), 24 | data 25 | ) 26 | } 27 | 28 | #[inline(always)] 29 | pub unsafe fn wl_seat_set_user_data( 30 | wl_seat: *mut objects::wl_seat, 31 | user_data: *mut c_void 32 | ) { 33 | raw::wl_proxy_set_user_data( 34 | wl_seat as *mut objects::wl_proxy, 35 | user_data 36 | ) 37 | } 38 | 39 | #[inline(always)] 40 | pub unsafe fn wl_seat_get_user_data( 41 | wl_seat: *mut objects::wl_seat 42 | ) -> *mut c_void { 43 | raw::wl_proxy_get_user_data(wl_seat as *mut objects::wl_proxy) 44 | } 45 | 46 | #[inline(always)] 47 | pub unsafe fn wl_seat_destroy(wl_seat: *mut objects::wl_seat) { 48 | raw::wl_proxy_destroy(wl_seat as *mut objects::wl_proxy) 49 | } 50 | 51 | #[inline(always)] 52 | pub unsafe fn wl_seat_get_pointer( 53 | wl_seat: *mut objects::wl_seat 54 | ) -> *mut objects::wl_pointer { 55 | let id = raw::wl_proxy_marshal_constructor( 56 | wl_seat as *mut objects::wl_proxy, 57 | WL_SEAT_GET_POINTER, 58 | &raw::wl_pointer_interface, 59 | ptr::null_mut::() 60 | ); 61 | id as *mut objects::wl_pointer 62 | } 63 | 64 | #[inline(always)] 65 | pub unsafe fn wl_seat_get_keyboard( 66 | wl_seat: *mut objects::wl_seat 67 | ) -> *mut objects::wl_keyboard { 68 | let id = raw::wl_proxy_marshal_constructor( 69 | wl_seat as *mut objects::wl_proxy, 70 | WL_SEAT_GET_KEYBOARD, 71 | &raw::wl_keyboard_interface, 72 | ptr::null_mut::() 73 | ); 74 | id as *mut objects::wl_keyboard 75 | } 76 | 77 | #[inline(always)] 78 | pub unsafe fn wl_seat_get_touch( 79 | wl_seat: *mut objects::wl_seat 80 | ) -> *mut objects::wl_touch { 81 | let id = raw::wl_proxy_marshal_constructor( 82 | wl_seat as *mut objects::wl_proxy, 83 | WL_SEAT_GET_TOUCH, 84 | &raw::wl_touch_interface, 85 | ptr::null_mut::() 86 | ); 87 | id as *mut objects::wl_touch 88 | } 89 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_shell.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_void, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | 10 | pub const WL_SHELL_GET_SHELL_SURFACE: uint32_t = 0; 11 | 12 | #[inline(always)] 13 | pub unsafe fn wl_shell_set_user_data( 14 | wl_shell: *mut objects::wl_shell, 15 | user_data: *mut c_void 16 | ) { 17 | raw::wl_proxy_set_user_data( 18 | wl_shell as *mut objects::wl_proxy, 19 | user_data 20 | ) 21 | } 22 | 23 | #[inline(always)] 24 | pub unsafe fn wl_shell_get_user_data( 25 | wl_shell: *mut objects::wl_shell 26 | ) -> *mut c_void { 27 | raw::wl_proxy_get_user_data(wl_shell as *mut objects::wl_proxy) 28 | } 29 | 30 | #[inline(always)] 31 | pub unsafe fn wl_shell_destroy(wl_shell: *mut objects::wl_shell) { 32 | raw::wl_proxy_destroy(wl_shell as *mut objects::wl_proxy) 33 | } 34 | 35 | #[inline(always)] 36 | pub unsafe fn wl_shell_get_shell_surface( 37 | wl_shell: *mut objects::wl_shell, 38 | surface: *mut objects::wl_surface 39 | ) -> *mut objects::wl_shell_surface { 40 | let id = raw::wl_proxy_marshal_constructor( 41 | wl_shell as *mut objects::wl_proxy, 42 | WL_SHELL_GET_SHELL_SURFACE, 43 | &raw::wl_shell_surface_interface, 44 | ptr::null_mut::(), 45 | surface 46 | ); 47 | id as *mut objects::wl_shell_surface 48 | } 49 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_shell_surface.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_char, c_int, c_void, int32_t, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::listeners; 7 | use raw::types::objects; 8 | 9 | pub const WL_SHELL_SURFACE_PONG: uint32_t = 0; 10 | pub const WL_SHELL_SURFACE_MOVE: uint32_t = 1; 11 | pub const WL_SHELL_SURFACE_RESIZE: uint32_t = 2; 12 | pub const WL_SHELL_SURFACE_SET_TOPLEVEL: uint32_t = 3; 13 | pub const WL_SHELL_SURFACE_SET_TRANSIENT: uint32_t = 4; 14 | pub const WL_SHELL_SURFACE_SET_FULLSCREEN: uint32_t = 5; 15 | pub const WL_SHELL_SURFACE_SET_POPUP: uint32_t = 6; 16 | pub const WL_SHELL_SURFACE_SET_MAXIMIZED: uint32_t = 7; 17 | pub const WL_SHELL_SURFACE_SET_TITLE: uint32_t = 8; 18 | pub const WL_SHELL_SURFACE_SET_CLASS: uint32_t = 9; 19 | 20 | #[inline(always)] 21 | pub unsafe fn wl_shell_surface_add_listener( 22 | wl_shell_surface: *mut objects::wl_shell_surface, 23 | listener: *const listeners::wl_shell_surface_listener, 24 | data: *mut c_void 25 | ) -> c_int { 26 | raw::wl_proxy_add_listener( 27 | wl_shell_surface as *mut objects::wl_proxy, 28 | listener as *mut extern fn(), 29 | data 30 | ) 31 | } 32 | 33 | #[inline(always)] 34 | pub unsafe fn wl_shell_surface_set_user_data( 35 | wl_shell_surface: *mut objects::wl_shell_surface, 36 | user_data: *mut c_void 37 | ) { 38 | raw::wl_proxy_set_user_data( 39 | wl_shell_surface as *mut objects::wl_proxy, 40 | user_data 41 | ) 42 | } 43 | 44 | #[inline(always)] 45 | pub unsafe fn wl_shell_surface_get_user_data( 46 | wl_shell_surface: *mut objects::wl_shell_surface 47 | ) -> *mut c_void { 48 | raw::wl_proxy_get_user_data(wl_shell_surface as *mut objects::wl_proxy) 49 | } 50 | 51 | #[inline(always)] 52 | pub unsafe fn wl_shell_surface_destroy(wl_shell_surface: *mut objects::wl_shell_surface) { 53 | raw::wl_proxy_destroy(wl_shell_surface as *mut objects::wl_proxy) 54 | } 55 | 56 | #[inline(always)] 57 | pub unsafe fn wl_shell_surface_pong( 58 | wl_shell_surface: *mut objects::wl_shell_surface, 59 | serial: uint32_t 60 | ) { 61 | raw::wl_proxy_marshal( 62 | wl_shell_surface as *mut objects::wl_proxy, 63 | WL_SHELL_SURFACE_PONG, 64 | serial 65 | ) 66 | } 67 | 68 | #[inline(always)] 69 | pub unsafe fn wl_shell_surface_move( 70 | wl_shell_surface: *mut objects::wl_shell_surface, 71 | seat: *mut objects::wl_seat, 72 | serial: uint32_t 73 | ) { 74 | raw::wl_proxy_marshal( 75 | wl_shell_surface as *mut objects::wl_proxy, 76 | WL_SHELL_SURFACE_MOVE, 77 | seat, 78 | serial 79 | ) 80 | } 81 | 82 | #[inline(always)] 83 | pub unsafe fn wl_shell_surface_resize( 84 | wl_shell_surface: *mut objects::wl_shell_surface, 85 | seat: *mut objects::wl_seat, 86 | serial: uint32_t, 87 | edges: uint32_t 88 | ) { 89 | raw::wl_proxy_marshal( 90 | wl_shell_surface as *mut objects::wl_proxy, 91 | WL_SHELL_SURFACE_RESIZE, 92 | seat, 93 | serial, 94 | edges 95 | ) 96 | } 97 | 98 | #[inline(always)] 99 | pub unsafe fn wl_shell_surface_set_toplevel( 100 | wl_shell_surface: *mut objects::wl_shell_surface 101 | ) { 102 | raw::wl_proxy_marshal( 103 | wl_shell_surface as *mut objects::wl_proxy, 104 | WL_SHELL_SURFACE_SET_TOPLEVEL 105 | ) 106 | } 107 | 108 | #[inline(always)] 109 | pub unsafe fn wl_shell_surface_set_transient( 110 | wl_shell_surface: *mut objects::wl_shell_surface, 111 | parent: *mut objects::wl_surface, 112 | x: int32_t, 113 | y: int32_t, 114 | flags: uint32_t 115 | ) { 116 | raw::wl_proxy_marshal( 117 | wl_shell_surface as *mut objects::wl_proxy, 118 | WL_SHELL_SURFACE_SET_TRANSIENT, 119 | parent, 120 | x, 121 | y, 122 | flags 123 | ) 124 | } 125 | 126 | #[inline(always)] 127 | pub unsafe fn wl_shell_surface_set_fullscreen( 128 | wl_shell_surface: *mut objects::wl_shell_surface, 129 | method: uint32_t, 130 | framerate: uint32_t, 131 | output: *mut objects::wl_output 132 | ) { 133 | raw::wl_proxy_marshal( 134 | wl_shell_surface as *mut objects::wl_proxy, 135 | WL_SHELL_SURFACE_SET_FULLSCREEN, 136 | method, 137 | framerate, 138 | output 139 | ) 140 | } 141 | 142 | #[inline(always)] 143 | pub unsafe fn wl_shell_surface_set_popup( 144 | wl_shell_surface: *mut objects::wl_shell_surface, 145 | seat: *mut objects::wl_seat, 146 | serial: uint32_t, 147 | parent: *mut objects::wl_surface, 148 | x: int32_t, 149 | y: int32_t, 150 | flags: uint32_t 151 | ) { 152 | raw::wl_proxy_marshal( 153 | wl_shell_surface as *mut objects::wl_proxy, 154 | WL_SHELL_SURFACE_SET_POPUP, 155 | seat, 156 | serial, 157 | parent, 158 | x, 159 | y, 160 | flags 161 | ) 162 | } 163 | 164 | #[inline(always)] 165 | pub unsafe fn wl_shell_surface_set_maximized( 166 | wl_shell_surface: *mut objects::wl_shell_surface, 167 | output: *mut objects::wl_output 168 | ) { 169 | raw::wl_proxy_marshal( 170 | wl_shell_surface as *mut objects::wl_proxy, 171 | WL_SHELL_SURFACE_SET_MAXIMIZED, 172 | output 173 | ) 174 | } 175 | 176 | #[inline(always)] 177 | pub unsafe fn wl_shell_surface_set_title( 178 | wl_shell_surface: *mut objects::wl_shell_surface, 179 | title: *const c_char 180 | ) { 181 | raw::wl_proxy_marshal( 182 | wl_shell_surface as *mut objects::wl_proxy, 183 | WL_SHELL_SURFACE_SET_TITLE, 184 | title 185 | ) 186 | } 187 | 188 | #[inline(always)] 189 | pub unsafe fn wl_shell_surface_set_class( 190 | wl_shell_surface: *mut objects::wl_shell_surface, 191 | class_: *const c_char 192 | ) { 193 | raw::wl_proxy_marshal( 194 | wl_shell_surface as *mut objects::wl_proxy, 195 | WL_SHELL_SURFACE_SET_CLASS, 196 | class_ 197 | ) 198 | } 199 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_shm.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_int, c_void, int32_t, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | use raw::types::listeners; 10 | 11 | pub const WL_SHM_CREATE_POOL: uint32_t = 0; 12 | 13 | #[inline(always)] 14 | pub unsafe fn wl_shm_add_listener( 15 | wl_shm: *mut objects::wl_shm, 16 | listener: *const listeners::wl_shm_listener, 17 | data: *mut c_void 18 | ) -> c_int { 19 | raw::wl_proxy_add_listener( 20 | wl_shm as *mut objects::wl_proxy, 21 | listener as *mut extern fn(), 22 | data 23 | ) 24 | } 25 | 26 | #[inline(always)] 27 | pub unsafe fn wl_shm_set_user_data( 28 | wl_shm: *mut objects::wl_shm, 29 | user_data: *mut c_void 30 | ) { 31 | raw::wl_proxy_set_user_data( 32 | wl_shm as *mut objects::wl_proxy, 33 | user_data 34 | ) 35 | } 36 | 37 | #[inline(always)] 38 | pub unsafe fn wl_shm_get_user_data( 39 | wl_shm: *mut objects::wl_shm 40 | ) -> *mut c_void { 41 | raw::wl_proxy_get_user_data(wl_shm as *mut objects::wl_proxy) 42 | } 43 | 44 | #[inline(always)] 45 | pub unsafe fn wl_shm_destroy(wl_shm: *mut objects::wl_shm) { 46 | raw::wl_proxy_destroy(wl_shm as *mut objects::wl_proxy) 47 | } 48 | 49 | #[inline(always)] 50 | pub unsafe fn wl_shm_create_pool( 51 | wl_shm: *mut objects::wl_shm, 52 | fd: int32_t, 53 | size: int32_t 54 | ) -> *mut objects::wl_shm_pool { 55 | let id = raw::wl_proxy_marshal_constructor( 56 | wl_shm as *mut objects::wl_proxy, 57 | WL_SHM_CREATE_POOL, 58 | &raw::wl_shm_pool_interface, 59 | ptr::null_mut::(), 60 | fd, 61 | size 62 | ); 63 | id as *mut objects::wl_shm_pool 64 | } 65 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_shm_pool.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_void, int32_t, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | 10 | pub const WL_SHM_POOL_CREATE_BUFFER: uint32_t = 0; 11 | pub const WL_SHM_POOL_DESTROY: uint32_t = 1; 12 | pub const WL_SHM_POOL_RESIZE: uint32_t = 2; 13 | 14 | #[inline(always)] 15 | pub unsafe fn wl_shm_pool_set_user_data( 16 | wl_shm_pool: *mut objects::wl_shm_pool, 17 | user_data: *mut c_void 18 | ) { 19 | raw::wl_proxy_set_user_data( 20 | wl_shm_pool as *mut objects::wl_proxy, 21 | user_data 22 | ) 23 | } 24 | 25 | #[inline(always)] 26 | pub unsafe fn wl_shm_pool_get_user_data( 27 | wl_shm_pool: *mut objects::wl_shm_pool 28 | ) -> *mut c_void { 29 | raw::wl_proxy_get_user_data(wl_shm_pool as *mut objects::wl_proxy) 30 | } 31 | 32 | #[inline(always)] 33 | pub unsafe fn wl_shm_pool_create_buffer( 34 | wl_shm_pool: *mut objects::wl_shm_pool, 35 | offset: int32_t, 36 | width: int32_t, 37 | height: int32_t, 38 | stride: int32_t, 39 | format: uint32_t 40 | ) -> *mut objects::wl_buffer { 41 | let id = raw::wl_proxy_marshal_constructor( 42 | wl_shm_pool as *mut objects::wl_proxy, 43 | WL_SHM_POOL_CREATE_BUFFER, 44 | &raw::wl_buffer_interface, 45 | ptr::null_mut::(), 46 | offset, 47 | width, 48 | height, 49 | stride, 50 | format 51 | ); 52 | id as *mut objects::wl_buffer 53 | } 54 | 55 | #[inline(always)] 56 | pub unsafe fn wl_shm_pool_destroy( 57 | wl_shm_pool: *mut objects::wl_shm_pool 58 | ) { 59 | raw::wl_proxy_marshal( 60 | wl_shm_pool as *mut objects::wl_proxy, 61 | WL_SHM_POOL_DESTROY 62 | ); 63 | raw::wl_proxy_destroy(wl_shm_pool as *mut objects::wl_proxy) 64 | } 65 | 66 | #[inline(always)] 67 | pub unsafe fn wl_shm_pool_resize( 68 | wl_shm_pool: *mut objects::wl_shm_pool, 69 | size: int32_t 70 | ) { 71 | raw::wl_proxy_marshal( 72 | wl_shm_pool as *mut objects::wl_proxy, 73 | WL_SHM_POOL_RESIZE, 74 | size 75 | ) 76 | } 77 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_subcompositor.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_void, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::objects; 9 | 10 | pub const WL_SUBCOMPOSITOR_DESTROY: uint32_t = 0; 11 | pub const WL_SUBCOMPOSITOR_GET_SUBSURFACE: uint32_t = 1; 12 | 13 | #[inline(always)] 14 | pub unsafe fn wl_subcompositor_set_user_data( 15 | wl_subcompositor: *mut objects::wl_subcompositor, 16 | user_data: *mut c_void 17 | ) { 18 | raw::wl_proxy_set_user_data( 19 | wl_subcompositor as *mut objects::wl_proxy, 20 | user_data 21 | ) 22 | } 23 | 24 | #[inline(always)] 25 | pub unsafe fn wl_subcompositor_get_user_data( 26 | wl_subcompositor: *mut objects::wl_subcompositor 27 | ) -> *mut c_void { 28 | raw::wl_proxy_get_user_data(wl_subcompositor as *mut objects::wl_proxy) 29 | } 30 | 31 | #[inline(always)] 32 | pub unsafe fn wl_subcompositor_destroy( 33 | wl_subcompositor: *mut objects::wl_subcompositor 34 | ) { 35 | raw::wl_proxy_marshal( 36 | wl_subcompositor as *mut objects::wl_proxy, 37 | WL_SUBCOMPOSITOR_DESTROY 38 | ); 39 | raw::wl_proxy_destroy(wl_subcompositor as *mut objects::wl_proxy) 40 | } 41 | 42 | #[inline(always)] 43 | pub unsafe fn wl_subcompositor_get_subsurface( 44 | wl_subcompositor: *mut objects::wl_subcompositor, 45 | surface: *mut objects::wl_surface, 46 | parent: *mut objects::wl_surface 47 | ) -> *mut objects::wl_subsurface { 48 | let id = raw::wl_proxy_marshal_constructor( 49 | wl_subcompositor as *mut objects::wl_proxy, 50 | WL_SUBCOMPOSITOR_GET_SUBSURFACE, 51 | &raw::wl_subsurface_interface, 52 | ptr::null_mut::(), 53 | surface, 54 | parent 55 | ); 56 | id as *mut objects::wl_subsurface 57 | } 58 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_subsurface.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_void, int32_t, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::objects; 7 | 8 | pub const WL_SUBSURFACE_DESTROY: uint32_t = 0; 9 | pub const WL_SUBSURFACE_SET_POSITION: uint32_t = 1; 10 | pub const WL_SUBSURFACE_PLACE_ABOVE: uint32_t = 2; 11 | pub const WL_SUBSURFACE_PLACE_BELOW: uint32_t = 3; 12 | pub const WL_SUBSURFACE_SET_SYNC: uint32_t = 4; 13 | pub const WL_SUBSURFACE_SET_DESYNC: uint32_t = 5; 14 | 15 | #[inline(always)] 16 | pub unsafe fn wl_subsurface_set_user_data( 17 | wl_subsurface: *mut objects::wl_subsurface, 18 | user_data: *mut c_void 19 | ) { 20 | raw::wl_proxy_set_user_data( 21 | wl_subsurface as *mut objects::wl_proxy, 22 | user_data 23 | ) 24 | } 25 | 26 | #[inline(always)] 27 | pub unsafe fn wl_subsurface_get_user_data( 28 | wl_subsurface: *mut objects::wl_subsurface 29 | ) -> *mut c_void { 30 | raw::wl_proxy_get_user_data(wl_subsurface as *mut objects::wl_proxy) 31 | } 32 | 33 | #[inline(always)] 34 | pub unsafe fn wl_subsurface_destroy( 35 | wl_subsurface: *mut objects::wl_subsurface 36 | ) { 37 | raw::wl_proxy_marshal( 38 | wl_subsurface as *mut objects::wl_proxy, 39 | WL_SUBSURFACE_DESTROY 40 | ); 41 | raw::wl_proxy_destroy(wl_subsurface as *mut objects::wl_proxy) 42 | } 43 | 44 | #[inline(always)] 45 | pub unsafe fn wl_subsurface_set_position( 46 | wl_subsurface: *mut objects::wl_subsurface, 47 | x: int32_t, 48 | y: int32_t 49 | ) { 50 | raw::wl_proxy_marshal( 51 | wl_subsurface as *mut objects::wl_proxy, 52 | WL_SUBSURFACE_SET_POSITION, 53 | x, 54 | y 55 | ) 56 | } 57 | 58 | #[inline(always)] 59 | pub unsafe fn wl_subsurface_place_above( 60 | wl_subsurface: *mut objects::wl_subsurface, 61 | sibling: *mut objects::wl_surface 62 | ) { 63 | raw::wl_proxy_marshal( 64 | wl_subsurface as *mut objects::wl_proxy, 65 | WL_SUBSURFACE_PLACE_ABOVE, 66 | sibling 67 | ) 68 | } 69 | 70 | #[inline(always)] 71 | pub unsafe fn wl_subsurface_place_below( 72 | wl_subsurface: *mut objects::wl_subsurface, 73 | sibling: *mut objects::wl_surface 74 | ) { 75 | raw::wl_proxy_marshal( 76 | wl_subsurface as *mut objects::wl_proxy, 77 | WL_SUBSURFACE_PLACE_BELOW, 78 | sibling 79 | ) 80 | } 81 | 82 | #[inline(always)] 83 | pub unsafe fn wl_subsurface_set_sync( 84 | wl_subsurface: *mut objects::wl_subsurface 85 | ) { 86 | raw::wl_proxy_marshal( 87 | wl_subsurface as *mut objects::wl_proxy, 88 | WL_SUBSURFACE_SET_SYNC 89 | ) 90 | } 91 | 92 | #[inline(always)] 93 | pub unsafe fn wl_subsurface_set_desync( 94 | wl_subsurface: *mut objects::wl_subsurface 95 | ) { 96 | raw::wl_proxy_marshal( 97 | wl_subsurface as *mut objects::wl_proxy, 98 | WL_SUBSURFACE_SET_DESYNC 99 | ) 100 | } 101 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_surface.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use std::ptr; 4 | 5 | use libc::{c_int, c_void, int32_t, uint32_t}; 6 | 7 | use raw; 8 | use raw::types::listeners; 9 | use raw::types::objects; 10 | 11 | pub const WL_SURFACE_DESTROY: uint32_t = 0; 12 | pub const WL_SURFACE_ATTACH: uint32_t = 1; 13 | pub const WL_SURFACE_DAMAGE: uint32_t = 2; 14 | pub const WL_SURFACE_FRAME: uint32_t = 3; 15 | pub const WL_SURFACE_SET_OPAQUE_REGION: uint32_t = 4; 16 | pub const WL_SURFACE_SET_INPUT_REGION: uint32_t = 5; 17 | pub const WL_SURFACE_COMMIT: uint32_t = 6; 18 | pub const WL_SURFACE_SET_BUFFER_TRANSFORM: uint32_t = 7; 19 | pub const WL_SURFACE_SET_BUFFER_SCALE: uint32_t = 8; 20 | 21 | #[inline(always)] 22 | pub unsafe fn wl_surface_add_listener( 23 | wl_surface: *mut objects::wl_surface, 24 | listener: *const listeners::wl_surface_listener, 25 | data: *mut c_void 26 | ) -> c_int { 27 | raw::wl_proxy_add_listener( 28 | wl_surface as *mut objects::wl_proxy, 29 | listener as *mut extern fn(), 30 | data 31 | ) 32 | } 33 | 34 | #[inline(always)] 35 | pub unsafe fn wl_surface_set_user_data( 36 | wl_surface: *mut objects::wl_surface, 37 | user_data: *mut c_void 38 | ) { 39 | raw::wl_proxy_set_user_data( 40 | wl_surface as *mut objects::wl_proxy, 41 | user_data 42 | ) 43 | } 44 | 45 | #[inline(always)] 46 | pub unsafe fn wl_surface_get_user_data( 47 | wl_surface: *mut objects::wl_surface 48 | ) -> *mut c_void { 49 | raw::wl_proxy_get_user_data(wl_surface as *mut objects::wl_proxy) 50 | } 51 | 52 | #[inline(always)] 53 | pub unsafe fn wl_surface_destroy( 54 | wl_surface: *mut objects::wl_surface 55 | ) { 56 | raw::wl_proxy_marshal( 57 | wl_surface as *mut objects::wl_proxy, 58 | WL_SURFACE_DESTROY 59 | ); 60 | raw::wl_proxy_destroy(wl_surface as *mut objects::wl_proxy) 61 | } 62 | 63 | #[inline(always)] 64 | pub unsafe fn wl_surface_attach( 65 | wl_surface: *mut objects::wl_surface, 66 | buffer: *mut objects::wl_buffer, 67 | x: int32_t, 68 | y: int32_t 69 | ) { 70 | raw::wl_proxy_marshal( 71 | wl_surface as *mut objects::wl_proxy, 72 | WL_SURFACE_ATTACH, 73 | buffer, 74 | x, 75 | y 76 | ) 77 | } 78 | 79 | #[inline(always)] 80 | pub unsafe fn wl_surface_damage( 81 | wl_surface: *mut objects::wl_surface, 82 | x: int32_t, 83 | y: int32_t, 84 | width: int32_t, 85 | height: int32_t 86 | ) { 87 | raw::wl_proxy_marshal( 88 | wl_surface as *mut objects::wl_proxy, 89 | WL_SURFACE_DAMAGE, 90 | x, 91 | y, 92 | width, 93 | height 94 | ) 95 | } 96 | 97 | #[inline(always)] 98 | pub unsafe fn wl_surface_frame( 99 | wl_surface: *mut objects::wl_surface 100 | ) -> *mut objects::wl_callback { 101 | let callback = raw::wl_proxy_marshal_constructor( 102 | wl_surface as *mut objects::wl_proxy, 103 | WL_SURFACE_FRAME, 104 | &raw::wl_callback_interface, 105 | ptr::null_mut::() 106 | ); 107 | callback as *mut objects::wl_callback 108 | } 109 | 110 | #[inline(always)] 111 | pub unsafe fn wl_surface_set_opaque_region( 112 | wl_surface: *mut objects::wl_surface, 113 | region: *mut objects::wl_region 114 | ) { 115 | raw::wl_proxy_marshal( 116 | wl_surface as *mut objects::wl_proxy, 117 | WL_SURFACE_SET_OPAQUE_REGION, 118 | region 119 | ) 120 | } 121 | 122 | #[inline(always)] 123 | pub unsafe fn wl_surface_set_input_region( 124 | wl_surface: *mut objects::wl_surface, 125 | region: *mut objects::wl_region 126 | ) { 127 | raw::wl_proxy_marshal( 128 | wl_surface as *mut objects::wl_proxy, 129 | WL_SURFACE_SET_INPUT_REGION, 130 | region 131 | ) 132 | } 133 | 134 | #[inline(always)] 135 | pub unsafe fn wl_surface_commit( 136 | wl_surface: *mut objects::wl_surface 137 | ) { 138 | raw::wl_proxy_marshal( 139 | wl_surface as *mut objects::wl_proxy, 140 | WL_SURFACE_COMMIT 141 | ) 142 | } 143 | 144 | #[inline(always)] 145 | pub unsafe fn wl_surface_set_buffer_transform( 146 | wl_surface: *mut objects::wl_surface, 147 | transform: int32_t 148 | ) { 149 | raw::wl_proxy_marshal( 150 | wl_surface as *mut objects::wl_proxy, 151 | WL_SURFACE_SET_BUFFER_TRANSFORM, 152 | transform 153 | ) 154 | } 155 | 156 | #[inline(always)] 157 | pub unsafe fn wl_surface_set_buffer_scale( 158 | wl_surface: *mut objects::wl_surface, 159 | scale: int32_t 160 | ) { 161 | raw::wl_proxy_marshal( 162 | wl_surface as *mut objects::wl_proxy, 163 | WL_SURFACE_SET_BUFFER_SCALE, 164 | scale 165 | ) 166 | } 167 | -------------------------------------------------------------------------------- /src/raw/protocol/wl_touch.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_int, c_void, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::objects; 7 | use raw::types::listeners; 8 | 9 | pub const WL_TOUCH_RELEASE: uint32_t = 0; 10 | 11 | #[inline(always)] 12 | pub unsafe fn wl_touch_add_listener( 13 | wl_touch: *mut objects::wl_touch, 14 | listener: *const listeners::wl_touch_listener, 15 | data: *mut c_void 16 | ) -> c_int { 17 | raw::wl_proxy_add_listener( 18 | wl_touch as *mut objects::wl_proxy, 19 | listener as *mut extern fn(), 20 | data 21 | ) 22 | } 23 | 24 | #[inline(always)] 25 | pub unsafe fn wl_touch_set_user_data( 26 | wl_touch: *mut objects::wl_touch, 27 | user_data: *mut c_void 28 | ) { 29 | raw::wl_proxy_set_user_data( 30 | wl_touch as *mut objects::wl_proxy, 31 | user_data 32 | ) 33 | } 34 | 35 | #[inline(always)] 36 | pub unsafe fn wl_touch_get_user_data( 37 | wl_touch: *mut objects::wl_touch 38 | ) -> *mut c_void { 39 | raw::wl_proxy_get_user_data(wl_touch as *mut objects::wl_proxy) 40 | } 41 | 42 | #[inline(always)] 43 | pub unsafe fn wl_touch_destroy(wl_touch: *mut objects::wl_touch) { 44 | raw::wl_proxy_destroy(wl_touch as *mut objects::wl_proxy) 45 | } 46 | 47 | #[inline(always)] 48 | pub unsafe fn wl_touch_release( 49 | wl_touch: *mut objects::wl_touch 50 | ) { 51 | raw::wl_proxy_marshal( 52 | wl_touch as *mut objects::wl_proxy, 53 | WL_TOUCH_RELEASE 54 | ); 55 | raw::wl_proxy_destroy(wl_touch as *mut objects::wl_proxy) 56 | } 57 | -------------------------------------------------------------------------------- /src/raw/types/enums.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::uint32_t; 4 | 5 | #[repr(C)] 6 | pub type wl_data_device_error = uint32_t; 7 | pub const WL_DATA_DEVICE_ERROR_ROLE: wl_data_device_error = 0; 8 | 9 | #[repr(C)] 10 | pub type wl_display_error = uint32_t; 11 | pub const WL_DISPLAY_ERROR_INVALID_OBJECT: wl_display_error = 0; 12 | pub const WL_DISPLAY_ERROR_INVALID_METHOD: wl_display_error = 1; 13 | pub const WL_DISPLAY_ERROR_NO_MEMORY: wl_display_error = 2; 14 | 15 | #[repr(C)] 16 | pub type wl_keyboard_key_state = uint32_t; 17 | pub const WL_KEYBOARD_KEY_STATE_RELEASED: wl_keyboard_key_state = 0; 18 | pub const WL_KEYBOARD_KEY_STATE_PRESSED: wl_keyboard_key_state = 1; 19 | 20 | #[repr(C)] 21 | pub type wl_keyboard_keymap_format = uint32_t; 22 | pub const WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP: wl_keyboard_keymap_format = 0; 23 | pub const WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1: wl_keyboard_keymap_format = 1; 24 | 25 | #[repr(C)] 26 | pub type wl_output_mode = uint32_t; 27 | pub const WL_OUTPUT_MODE_CURRENT: wl_output_mode = 0x1; 28 | pub const WL_OUTPUT_MODE_PREFERRED: wl_output_mode = 0x2; 29 | 30 | #[repr(C)] 31 | pub type wl_output_subpixel = uint32_t; 32 | pub const WL_OUTPUT_SUBPIXEL_UNKNOWN: wl_output_subpixel = 0; 33 | pub const WL_OUTPUT_SUBPIXEL_NONE: wl_output_subpixel = 1; 34 | pub const WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: wl_output_subpixel = 2; 35 | pub const WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: wl_output_subpixel = 3; 36 | pub const WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: wl_output_subpixel = 4; 37 | pub const WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: wl_output_subpixel = 5; 38 | 39 | #[repr(C)] 40 | pub type wl_output_transform = uint32_t; 41 | pub const WL_OUTPUT_TRANSFORM_NORMAL: wl_output_transform = 0; 42 | pub const WL_OUTPUT_TRANSFORM_90: wl_output_transform = 1; 43 | pub const WL_OUTPUT_TRANSFORM_180: wl_output_transform = 2; 44 | pub const WL_OUTPUT_TRANSFORM_270: wl_output_transform = 3; 45 | pub const WL_OUTPUT_TRANSFORM_FLIPPED: wl_output_transform = 4; 46 | pub const WL_OUTPUT_TRANSFORM_FLIPPED_90: wl_output_transform = 5; 47 | pub const WL_OUTPUT_TRANSFORM_FLIPPED_180: wl_output_transform = 6; 48 | pub const WL_OUTPUT_TRANSFORM_FLIPPED_270: wl_output_transform = 7; 49 | 50 | #[repr(C)] 51 | pub type wl_pointer_axis = uint32_t; 52 | pub const WL_POINTER_AXIS_VERTICAL_SCROLL: wl_pointer_axis = 0; 53 | pub const WL_POINTER_AXIS_HORIZONTAL_SCROLL: wl_pointer_axis = 1; 54 | 55 | #[repr(C)] 56 | pub type wl_pointer_button_state = uint32_t; 57 | pub const WL_POINTER_BUTTON_STATE_RELEASED: wl_pointer_button_state = 0; 58 | pub const WL_POINTER_BUTTON_STATE_PRESSED: wl_pointer_button_state = 1; 59 | 60 | #[repr(C)] 61 | pub type wl_pointer_error = uint32_t; 62 | pub const WL_POINTER_ERROR_ROLE: wl_pointer_error = 0; 63 | 64 | #[repr(C)] 65 | pub type wl_seat_capability = uint32_t; 66 | pub const WL_SEAT_CAPABILITY_POINTER: wl_seat_capability = 1; 67 | pub const WL_SEAT_CAPABILITY_KEYBOARD: wl_seat_capability = 2; 68 | pub const WL_SEAT_CAPABILITY_TOUCH: wl_seat_capability = 4; 69 | 70 | #[repr(C)] 71 | pub type wl_shell_error = uint32_t; 72 | pub const WL_SHELL_ERROR_ROLE: wl_shell_error = 0; 73 | 74 | #[repr(C)] 75 | pub type wl_shell_surface_fullscreen_method = uint32_t; 76 | pub const WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT: 77 | wl_shell_surface_fullscreen_method = 0; 78 | pub const WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE: 79 | wl_shell_surface_fullscreen_method = 1; 80 | pub const WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER: 81 | wl_shell_surface_fullscreen_method = 2; 82 | pub const WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL: 83 | wl_shell_surface_fullscreen_method = 3; 84 | 85 | #[repr(C)] 86 | pub type wl_shell_surface_resize = uint32_t; 87 | pub const WL_SHELL_SURFACE_RESIZE_NONE: wl_shell_surface_resize = 0; 88 | pub const WL_SHELL_SURFACE_RESIZE_TOP: wl_shell_surface_resize = 1; 89 | pub const WL_SHELL_SURFACE_RESIZE_BOTTOM: wl_shell_surface_resize = 2; 90 | pub const WL_SHELL_SURFACE_RESIZE_LEFT: wl_shell_surface_resize = 4; 91 | pub const WL_SHELL_SURFACE_RESIZE_TOP_LEFT: wl_shell_surface_resize = 5; 92 | pub const WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT: wl_shell_surface_resize = 6; 93 | pub const WL_SHELL_SURFACE_RESIZE_RIGHT: wl_shell_surface_resize = 8; 94 | pub const WL_SHELL_SURFACE_RESIZE_TOP_RIGHT: wl_shell_surface_resize = 9; 95 | pub const WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT: wl_shell_surface_resize = 10; 96 | 97 | #[repr(C)] 98 | pub type wl_shell_surface_transient = uint32_t; 99 | pub const WL_SHELL_SURFACE_TRANSIENT_INACTIVE: wl_shell_surface_transient = 0x1; 100 | 101 | #[repr(C)] 102 | pub type wl_shm_error = uint32_t; 103 | pub const WL_SHM_ERROR_INVALID_FORMAT: wl_shm_error = 0; 104 | pub const WL_SHM_ERROR_INVALID_STRIDE: wl_shm_error = 1; 105 | pub const WL_SHM_ERROR_INVALID_FD: wl_shm_error = 2; 106 | 107 | #[repr(C)] 108 | pub type wl_shm_format = uint32_t; 109 | pub const WL_SHM_FORMAT_ARGB8888: wl_shm_format = 0; 110 | pub const WL_SHM_FORMAT_XRGB8888: wl_shm_format = 1; 111 | pub const WL_SHM_FORMAT_C8: wl_shm_format = 0x20203843; 112 | pub const WL_SHM_FORMAT_RGB332: wl_shm_format = 0x38424752; 113 | pub const WL_SHM_FORMAT_BGR233: wl_shm_format = 0x38524742; 114 | pub const WL_SHM_FORMAT_XRGB4444: wl_shm_format = 0x32315258; 115 | pub const WL_SHM_FORMAT_XBGR4444: wl_shm_format = 0x32314258; 116 | pub const WL_SHM_FORMAT_RGBX4444: wl_shm_format = 0x32315852; 117 | pub const WL_SHM_FORMAT_BGRX4444: wl_shm_format = 0x32315842; 118 | pub const WL_SHM_FORMAT_ARGB4444: wl_shm_format = 0x32315241; 119 | pub const WL_SHM_FORMAT_ABGR4444: wl_shm_format = 0x32314241; 120 | pub const WL_SHM_FORMAT_RGBA4444: wl_shm_format = 0x32314152; 121 | pub const WL_SHM_FORMAT_BGRA4444: wl_shm_format = 0x32314142; 122 | pub const WL_SHM_FORMAT_XRGB1555: wl_shm_format = 0x35315258; 123 | pub const WL_SHM_FORMAT_XBGR1555: wl_shm_format = 0x35314258; 124 | pub const WL_SHM_FORMAT_RGBX5551: wl_shm_format = 0x35315852; 125 | pub const WL_SHM_FORMAT_BGRX5551: wl_shm_format = 0x35315842; 126 | pub const WL_SHM_FORMAT_ARGB1555: wl_shm_format = 0x35315241; 127 | pub const WL_SHM_FORMAT_ABGR1555: wl_shm_format = 0x35314241; 128 | pub const WL_SHM_FORMAT_RGBA5551: wl_shm_format = 0x35314152; 129 | pub const WL_SHM_FORMAT_BGRA5551: wl_shm_format = 0x35314142; 130 | pub const WL_SHM_FORMAT_RGB565: wl_shm_format = 0x36314752; 131 | pub const WL_SHM_FORMAT_BGR565: wl_shm_format = 0x36314742; 132 | pub const WL_SHM_FORMAT_RGB888: wl_shm_format = 0x34324752; 133 | pub const WL_SHM_FORMAT_BGR888: wl_shm_format = 0x34324742; 134 | pub const WL_SHM_FORMAT_XBGR8888: wl_shm_format = 0x34324258; 135 | pub const WL_SHM_FORMAT_RGBX8888: wl_shm_format = 0x34325852; 136 | pub const WL_SHM_FORMAT_BGRX8888: wl_shm_format = 0x34325842; 137 | pub const WL_SHM_FORMAT_ABGR8888: wl_shm_format = 0x34324241; 138 | pub const WL_SHM_FORMAT_RGBA8888: wl_shm_format = 0x34324152; 139 | pub const WL_SHM_FORMAT_BGRA8888: wl_shm_format = 0x34324142; 140 | pub const WL_SHM_FORMAT_XRGB2101010: wl_shm_format = 0x30335258; 141 | pub const WL_SHM_FORMAT_XBGR2101010: wl_shm_format = 0x30334258; 142 | pub const WL_SHM_FORMAT_RGBX1010102: wl_shm_format = 0x30335852; 143 | pub const WL_SHM_FORMAT_BGRX1010102: wl_shm_format = 0x30335842; 144 | pub const WL_SHM_FORMAT_ARGB2101010: wl_shm_format = 0x30335241; 145 | pub const WL_SHM_FORMAT_ABGR2101010: wl_shm_format = 0x30334241; 146 | pub const WL_SHM_FORMAT_RGBA1010102: wl_shm_format = 0x30334152; 147 | pub const WL_SHM_FORMAT_BGRA1010102: wl_shm_format = 0x30334142; 148 | pub const WL_SHM_FORMAT_YUYV: wl_shm_format = 0x56595559; 149 | pub const WL_SHM_FORMAT_YVYU: wl_shm_format = 0x55595659; 150 | pub const WL_SHM_FORMAT_UYVY: wl_shm_format = 0x59565955; 151 | pub const WL_SHM_FORMAT_VYUY: wl_shm_format = 0x59555956; 152 | pub const WL_SHM_FORMAT_AYUV: wl_shm_format = 0x56555941; 153 | pub const WL_SHM_FORMAT_NV12: wl_shm_format = 0x3231564e; 154 | pub const WL_SHM_FORMAT_NV21: wl_shm_format = 0x3132564e; 155 | pub const WL_SHM_FORMAT_NV16: wl_shm_format = 0x3631564e; 156 | pub const WL_SHM_FORMAT_NV61: wl_shm_format = 0x3136564e; 157 | pub const WL_SHM_FORMAT_YUV410: wl_shm_format = 0x39565559; 158 | pub const WL_SHM_FORMAT_YVU410: wl_shm_format = 0x39555659; 159 | pub const WL_SHM_FORMAT_YUV411: wl_shm_format = 0x31315559; 160 | pub const WL_SHM_FORMAT_YVU411: wl_shm_format = 0x31315659; 161 | pub const WL_SHM_FORMAT_YUV420: wl_shm_format = 0x32315559; 162 | pub const WL_SHM_FORMAT_YVU420: wl_shm_format = 0x32315659; 163 | pub const WL_SHM_FORMAT_YUV422: wl_shm_format = 0x36315559; 164 | pub const WL_SHM_FORMAT_YVU422: wl_shm_format = 0x36315659; 165 | pub const WL_SHM_FORMAT_YUV444: wl_shm_format = 0x34325559; 166 | pub const WL_SHM_FORMAT_YVU444: wl_shm_format = 0x34325659; 167 | 168 | #[repr(C)] 169 | pub type wl_subcompositor_error = uint32_t; 170 | pub const WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE: wl_subcompositor_error = 0; 171 | 172 | #[repr(C)] 173 | pub type wl_subsurface_error = uint32_t; 174 | pub const WL_SUBSURFACE_ERROR_BAD_SURFACE: wl_subsurface_error = 0; 175 | 176 | #[repr(C)] 177 | pub type wl_surface_error = uint32_t; 178 | pub const WL_SURFACE_ERROR_INVALID_SCALE: wl_surface_error = 0; 179 | pub const WL_SURFACE_ERROR_INVALID_TRANSFORM: wl_surface_error = 1; 180 | -------------------------------------------------------------------------------- /src/raw/types/listeners.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_char, c_void, int32_t, uint32_t}; 4 | 5 | use raw; 6 | use raw::types::objects; 7 | use raw::types::utils; 8 | 9 | #[repr(C)] 10 | pub struct wl_buffer_listener { 11 | pub release: extern fn( 12 | data: *mut c_void, 13 | wl_buffer: *mut objects::wl_buffer 14 | ) 15 | } 16 | 17 | #[repr(C)] 18 | pub struct wl_callback_listener { 19 | pub done: extern fn( 20 | data: *mut c_void, 21 | wl_callback: *mut objects::wl_callback, 22 | callback_data: uint32_t 23 | ) 24 | } 25 | 26 | #[repr(C)] 27 | pub struct wl_data_device_listener { 28 | pub data_offer: extern fn( 29 | data: *mut c_void, 30 | wl_data_device: *mut objects::wl_data_device, 31 | id: *mut objects::wl_data_offer 32 | ), 33 | pub enter: extern fn( 34 | data: *mut c_void, 35 | wl_data_device: *mut objects::wl_data_device, 36 | serial: uint32_t, 37 | surface: *mut objects::wl_surface, 38 | x: raw::wl_fixed_t, 39 | y: raw::wl_fixed_t, 40 | id: *mut objects::wl_data_offer 41 | ), 42 | pub leave: extern fn( 43 | data: *mut c_void, 44 | wl_data_device: *mut objects::wl_data_device 45 | ), 46 | pub motion: extern fn( 47 | data: *mut c_void, 48 | wl_data_device: *mut objects::wl_data_device, 49 | time: uint32_t, 50 | x: raw::wl_fixed_t, 51 | y: raw::wl_fixed_t 52 | ), 53 | pub drop: extern fn( 54 | data: *mut c_void, 55 | wl_data_device: *mut objects::wl_data_device 56 | ), 57 | pub selection: extern fn( 58 | data: *mut c_void, 59 | wl_data_device: *mut objects::wl_data_device, 60 | id: *mut objects::wl_data_offer 61 | ) 62 | } 63 | 64 | #[repr(C)] 65 | pub struct wl_data_offer_listener { 66 | pub offer: extern fn( 67 | data: *mut c_void, 68 | wl_data_offer: *mut objects::wl_data_offer, 69 | mime_type: *const c_char 70 | ) 71 | } 72 | 73 | #[repr(C)] 74 | pub struct wl_data_source_listener { 75 | pub target: extern fn( 76 | data: *mut c_void, 77 | wl_data_source: *mut objects::wl_data_source, 78 | mime_type: *const c_char 79 | ), 80 | pub send: extern fn( 81 | data: *mut c_void, 82 | wl_data_source: *mut objects::wl_data_source, 83 | mime_type: *const c_char, 84 | fd: int32_t 85 | ), 86 | pub cancelled: extern fn( 87 | data: *mut c_void, 88 | wl_data_source: *mut objects::wl_data_source 89 | ) 90 | } 91 | 92 | #[repr(C)] 93 | pub struct wl_display_listener { 94 | pub error: extern fn( 95 | data: *mut c_void, 96 | wl_display: *mut objects::wl_display, 97 | object_id: *mut c_void, 98 | code: uint32_t, 99 | message: *const c_char 100 | ), 101 | pub delete_id: extern fn( 102 | data: *mut c_void, 103 | wl_display: *mut objects::wl_display, 104 | id: uint32_t 105 | ) 106 | } 107 | 108 | #[repr(C)] 109 | pub struct wl_keyboard_listener { 110 | pub keymap: extern fn( 111 | data: *mut c_void, 112 | wl_keyboard: *mut objects::wl_keyboard, 113 | format: uint32_t, 114 | fd: int32_t, 115 | size: uint32_t 116 | ), 117 | pub enter: extern fn( 118 | data: *mut c_void, 119 | wl_keyboard: *mut objects::wl_keyboard, 120 | serial: uint32_t, 121 | surface: *mut objects::wl_surface, 122 | keys: *mut utils::wl_array 123 | ), 124 | pub leave: extern fn( 125 | data: *mut c_void, 126 | wl_keyboard: *mut objects::wl_keyboard, 127 | serial: uint32_t, 128 | surface: *mut objects::wl_surface 129 | ), 130 | pub key: extern fn( 131 | data: *mut c_void, 132 | wl_keyboard: *mut objects::wl_keyboard, 133 | serial: uint32_t, 134 | time: uint32_t, 135 | key: uint32_t, 136 | state: uint32_t 137 | ), 138 | pub modifiers: extern fn( 139 | data: *mut c_void, 140 | wl_keyboard: *mut objects::wl_keyboard, 141 | serial: uint32_t, 142 | mods_depressed: uint32_t, 143 | mods_latched: uint32_t, 144 | mods_locked: uint32_t, 145 | group: uint32_t 146 | ), 147 | pub repeat_info: extern fn( 148 | data: *mut c_void, 149 | wl_keyboard: *mut objects::wl_keyboard, 150 | rate: int32_t, 151 | delay: int32_t 152 | ) 153 | } 154 | 155 | #[repr(C)] 156 | pub struct wl_output_listener { 157 | pub geometry: extern fn( 158 | data: *mut c_void, 159 | wl_output: *mut objects::wl_output, 160 | x: int32_t, 161 | y: int32_t, 162 | physical_width: int32_t, 163 | physical_height: int32_t, 164 | subpixel: int32_t, 165 | make: *const c_char, 166 | model: *const c_char, 167 | transform: int32_t 168 | ), 169 | pub mode: extern fn( 170 | data: *mut c_void, 171 | wl_output: *mut objects::wl_output, 172 | flags: uint32_t, 173 | width: int32_t, 174 | height: int32_t, 175 | refresh: int32_t 176 | ), 177 | pub done: extern fn( 178 | data: *mut c_void, 179 | wl_output: *mut objects::wl_output 180 | ), 181 | pub scale: extern fn( 182 | data: *mut c_void, 183 | wl_output: *mut objects::wl_output, 184 | factor: int32_t 185 | ) 186 | } 187 | 188 | #[repr(C)] 189 | pub struct wl_pointer_listener { 190 | pub enter: extern fn( 191 | data: *mut c_void, 192 | wl_pointer: *mut objects::wl_pointer, 193 | serial: uint32_t, 194 | surface: *mut objects::wl_surface, 195 | surface_x: raw::wl_fixed_t, 196 | surface_y: raw::wl_fixed_t 197 | ), 198 | pub leave: extern fn( 199 | data: *mut c_void, 200 | wl_pointer: *mut objects::wl_pointer, 201 | serial: uint32_t, 202 | surface: *mut objects::wl_surface 203 | ), 204 | pub motion: extern fn( 205 | data: *mut c_void, 206 | wl_pointer: *mut objects::wl_pointer, 207 | time: uint32_t, 208 | surface_x: raw::wl_fixed_t, 209 | surface_y: raw::wl_fixed_t 210 | ), 211 | pub button: extern fn( 212 | data: *mut c_void, 213 | wl_pointer: *mut objects::wl_pointer, 214 | serial: uint32_t, 215 | time: uint32_t, 216 | button: uint32_t, 217 | state: uint32_t 218 | ), 219 | pub axis: extern fn( 220 | data: *mut c_void, 221 | wl_pointer: *mut objects::wl_pointer, 222 | time: uint32_t, 223 | axis: uint32_t, 224 | value: raw::wl_fixed_t 225 | ) 226 | } 227 | 228 | #[repr(C)] 229 | pub struct wl_registry_listener { 230 | pub global: extern fn( 231 | data: *mut c_void, 232 | wl_registry: *mut objects::wl_registry, 233 | name: uint32_t, 234 | interface: *const c_char, 235 | version: uint32_t 236 | ), 237 | pub global_remove: extern fn( 238 | data: *mut c_void, 239 | wl_registry: *mut objects::wl_registry, 240 | name: uint32_t 241 | ) 242 | } 243 | 244 | #[repr(C)] 245 | pub struct wl_seat_listener { 246 | pub capabilities: extern fn( 247 | data: *mut c_void, 248 | wl_seat: *mut objects::wl_seat, 249 | capabilities: uint32_t 250 | ), 251 | pub name: extern fn( 252 | data: *mut c_void, 253 | wl_seat: *mut objects::wl_seat, 254 | name: *const c_char 255 | ) 256 | } 257 | 258 | #[repr(C)] 259 | pub struct wl_shell_surface_listener { 260 | pub ping: extern fn( 261 | data: *mut c_void, 262 | wl_shell_surface: *mut objects::wl_shell_surface, 263 | serial: uint32_t 264 | ), 265 | pub configure: extern fn( 266 | data: *mut c_void, 267 | wl_shell_surface: *mut objects::wl_shell_surface, 268 | edges: uint32_t, 269 | width: int32_t, 270 | height: int32_t 271 | ), 272 | pub popup_done: extern fn( 273 | data: *mut c_void, 274 | wl_shell_surface: *mut objects::wl_shell_surface, 275 | ) 276 | } 277 | 278 | #[repr(C)] 279 | pub struct wl_shm_listener { 280 | pub format: extern fn( 281 | data: *mut c_void, 282 | wl_shm: *mut objects::wl_shm, 283 | format: uint32_t 284 | ) 285 | } 286 | 287 | #[repr(C)] 288 | pub struct wl_surface_listener { 289 | pub enter: extern fn( 290 | data: *mut c_void, 291 | wl_surface: *mut objects::wl_surface, 292 | output: *mut objects::wl_output 293 | ), 294 | pub leave: extern fn( 295 | data: *mut c_void, 296 | wl_surface: *mut objects::wl_surface, 297 | output: *mut objects::wl_output 298 | ) 299 | } 300 | 301 | #[repr(C)] 302 | pub struct wl_touch_listener { 303 | pub down: extern fn( 304 | data: *mut c_void, 305 | wl_touch: *mut objects::wl_touch, 306 | serial: uint32_t, 307 | time: uint32_t, 308 | surface: *mut objects::wl_surface, 309 | id: int32_t, 310 | x: raw::wl_fixed_t, 311 | y: raw::wl_fixed_t 312 | ), 313 | pub up: extern fn( 314 | data: *mut c_void, 315 | wl_touch: *mut objects::wl_touch, 316 | serial: uint32_t, 317 | time: uint32_t, 318 | id: int32_t 319 | ), 320 | pub motion: extern fn( 321 | data: *mut c_void, 322 | wl_touch: *mut objects::wl_touch, 323 | time: uint32_t, 324 | id: int32_t, 325 | x: raw::wl_fixed_t, 326 | y: raw::wl_fixed_t 327 | ), 328 | pub frame: extern fn( 329 | data: *mut c_void, 330 | wl_touch: *mut objects::wl_touch 331 | ), 332 | pub cancel: extern fn( 333 | data: *mut c_void, 334 | wl_touch: *mut objects::wl_touch 335 | ) 336 | } 337 | -------------------------------------------------------------------------------- /src/raw/types/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | pub mod enums; 4 | pub mod listeners; 5 | pub mod objects; 6 | pub mod utils; 7 | -------------------------------------------------------------------------------- /src/raw/types/objects.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | #[repr(C)] 4 | pub struct wl_buffer; 5 | 6 | #[repr(C)] 7 | pub struct wl_callback; 8 | 9 | #[repr(C)] 10 | pub struct wl_client; 11 | 12 | #[repr(C)] 13 | pub struct wl_compositor; 14 | 15 | #[repr(C)] 16 | pub struct wl_data_device; 17 | 18 | #[repr(C)] 19 | pub struct wl_data_device_manager; 20 | 21 | #[repr(C)] 22 | pub struct wl_data_offer; 23 | 24 | #[repr(C)] 25 | pub struct wl_data_source; 26 | 27 | #[repr(C)] 28 | pub struct wl_display; 29 | 30 | #[repr(C)] 31 | pub struct wl_event_queue; 32 | 33 | #[repr(C)] 34 | pub struct wl_keyboard; 35 | 36 | #[repr(C)] 37 | pub struct wl_output; 38 | 39 | #[repr(C)] 40 | pub struct wl_pointer; 41 | 42 | #[repr(C)] 43 | pub struct wl_proxy; 44 | 45 | #[repr(C)] 46 | pub struct wl_region; 47 | 48 | #[repr(C)] 49 | pub struct wl_registry; 50 | 51 | #[repr(C)] 52 | pub struct wl_resource; 53 | 54 | #[repr(C)] 55 | pub struct wl_seat; 56 | 57 | #[repr(C)] 58 | pub struct wl_shell; 59 | 60 | #[repr(C)] 61 | pub struct wl_shell_surface; 62 | 63 | #[repr(C)] 64 | pub struct wl_shm; 65 | 66 | #[repr(C)] 67 | pub struct wl_shm_pool; 68 | 69 | #[repr(C)] 70 | pub struct wl_subcompositor; 71 | 72 | #[repr(C)] 73 | pub struct wl_subsurface; 74 | 75 | #[repr(C)] 76 | pub struct wl_surface; 77 | 78 | #[repr(C)] 79 | pub struct wl_touch; 80 | -------------------------------------------------------------------------------- /src/raw/types/utils.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Jonathan Eyolfson 2 | 3 | use libc::{c_char, c_int, c_void, size_t, uint32_t, uint64_t}; 4 | 5 | #[repr(C)] 6 | pub type wl_argument = uint64_t; 7 | 8 | #[repr(C)] 9 | pub struct wl_array { 10 | pub size: size_t, 11 | pub alloc: size_t, 12 | pub data: *mut c_void, 13 | } 14 | 15 | #[repr(C)] 16 | pub type wl_dispatcher_func_t = extern fn( 17 | _: *const c_void, 18 | _: *mut c_void, 19 | _: uint32_t, 20 | _: *const wl_message, 21 | _: *mut wl_argument); 22 | 23 | #[repr(C)] 24 | pub type wl_fixed_t = uint32_t; 25 | 26 | #[repr(C)] 27 | pub struct wl_interface { 28 | pub name: *const c_char, 29 | pub version: c_int, 30 | pub method_count: c_int, 31 | pub methods: *const wl_message, 32 | pub event_count: c_int, 33 | pub events: *const wl_message, 34 | } 35 | 36 | #[repr(C)] 37 | pub struct wl_list { 38 | pub prev: *mut wl_list, 39 | pub next: *mut wl_list, 40 | } 41 | 42 | #[repr(C)] 43 | pub type wl_log_func_t = extern fn(_: *const c_char, ...); 44 | 45 | #[repr(C)] 46 | pub struct wl_message { 47 | pub name: *const c_char, 48 | pub signature: *const c_char, 49 | pub types: *mut *const wl_interface, 50 | } 51 | 52 | #[repr(C)] 53 | pub struct wl_object; 54 | --------------------------------------------------------------------------------