Merge branch 'serde_json' into 'master'
Serde json See merge request snakedye/ristate!3
This commit is contained in:
commit
8517af171a
100
Cargo.lock
generated
100
Cargo.lock
generated
@ -10,15 +10,15 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.67"
|
||||
version = "1.0.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
|
||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
@ -33,10 +33,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.119"
|
||||
name = "itoa"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
|
||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.125"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
@ -62,30 +68,30 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.7.2"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.19"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
||||
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.27"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
|
||||
checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -94,6 +100,8 @@ dependencies = [
|
||||
name = "ristate"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wayland-client",
|
||||
"wayland-commons",
|
||||
"wayland-protocols",
|
||||
@ -101,16 +109,64 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.6.1"
|
||||
name = "ryu"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.137"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.137"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04"
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
@ -172,6 +228,6 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a"
|
||||
checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
|
||||
|
@ -4,8 +4,6 @@ version = "0.1.0"
|
||||
authors = ["Bryan Ndjeutcha <ndjeutcha@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
wayland-scanner = "0.29.3"
|
||||
|
||||
@ -13,3 +11,5 @@ wayland-scanner = "0.29.3"
|
||||
wayland-protocols = "0.29.3"
|
||||
wayland-commons = "0.29.3"
|
||||
wayland-client = "0.29.3"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
28
build.rs
28
build.rs
@ -1,22 +1,14 @@
|
||||
extern crate wayland_scanner;
|
||||
|
||||
use std::env::var;
|
||||
use std::path::Path;
|
||||
use wayland_scanner::{generate_code, Side};
|
||||
|
||||
pub fn main() {
|
||||
generate("river_status_unstable_v1");
|
||||
}
|
||||
|
||||
fn generate(protocol_name: &str) {
|
||||
let out_dir = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/src/wayland/"));
|
||||
|
||||
let mut protocol_dir = String::from(concat!(env!("CARGO_MANIFEST_DIR"), "/protocol/"));
|
||||
protocol_dir.push_str(&protocol_name.replace("_", "-"));
|
||||
protocol_dir.push_str(".xml");
|
||||
|
||||
let protocol = Path::new(&protocol_dir);
|
||||
let mut protocol_file = protocol_name.to_string();
|
||||
protocol_file.push_str(".rs");
|
||||
|
||||
generate_code(protocol, out_dir.join(protocol_file), Side::Client);
|
||||
fn main() {
|
||||
let out_dir = var("OUT_DIR").unwrap();
|
||||
let out_dir = Path::new(&out_dir);
|
||||
|
||||
generate_code(
|
||||
"./protocol/river-status-unstable-v1.xml",
|
||||
out_dir.join("river-status-unstable-v1.rs"),
|
||||
Side::Client,
|
||||
);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zriver_status_manager_v1" version="2">
|
||||
<interface name="zriver_status_manager_v1" version="3">
|
||||
<description summary="manage river status objects">
|
||||
A global factory for objects that receive status information specific
|
||||
to river. It could be used to implement, for example, a status bar.
|
||||
@ -85,7 +85,7 @@
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
<interface name="zriver_seat_status_v1" version="1">
|
||||
<interface name="zriver_seat_status_v1" version="3">
|
||||
<description summary="track seat focus">
|
||||
This interface allows clients to receive information about the current
|
||||
focus of a seat. Note that (un)focused_output events will only be sent
|
||||
@ -121,5 +121,13 @@
|
||||
</description>
|
||||
<arg name="title" type="string" summary="title of the focused view"/>
|
||||
</event>
|
||||
|
||||
<event name="mode" since="3">
|
||||
<description summary="the active mode changed">
|
||||
Sent once on binding the interface and again whenever a new mode
|
||||
is entered (e.g. with riverctl enter-mode foobar).
|
||||
</description>
|
||||
<arg name="name" type="string" summary="name of the mode"/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
||||
|
150
src/main.rs
150
src/main.rs
@ -1,8 +1,10 @@
|
||||
mod wayland;
|
||||
mod river_protocols;
|
||||
|
||||
use crate::wayland::river_status_unstable_v1::{
|
||||
use river_protocols::{
|
||||
zriver_output_status_v1, zriver_seat_status_v1, zriver_status_manager_v1::ZriverStatusManagerV1,
|
||||
};
|
||||
use serde::ser::{SerializeSeq, Serializer};
|
||||
use serde::Serialize;
|
||||
use std::collections::BTreeMap;
|
||||
use wayland_client::protocol::{wl_output, wl_output::WlOutput, wl_seat, wl_seat::WlSeat};
|
||||
use wayland_client::{Display, GlobalManager, Main};
|
||||
@ -30,83 +32,44 @@ impl Flags {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Tags(u32);
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct Env {
|
||||
#[serde(skip)]
|
||||
flags: Flags,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
title: Option<String>,
|
||||
tags: BTreeMap<String, u32>,
|
||||
urgency: BTreeMap<String, u32>,
|
||||
viewstag: BTreeMap<String, Vec<u32>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
tags: Option<BTreeMap<String, Tags>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
urgency: Option<BTreeMap<String, Tags>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
viewstag: Option<BTreeMap<String, Vec<u32>>>,
|
||||
#[serde(skip)]
|
||||
status_manager: Option<Main<ZriverStatusManagerV1>>,
|
||||
}
|
||||
|
||||
impl Env {
|
||||
fn new() -> Env {
|
||||
let flags = configuration();
|
||||
Env {
|
||||
title: None,
|
||||
flags: configuration(),
|
||||
viewstag: BTreeMap::new(),
|
||||
urgency: BTreeMap::new(),
|
||||
tags: BTreeMap::new(),
|
||||
tags: flags.tags.then(BTreeMap::new),
|
||||
urgency: flags.urgency.then(BTreeMap::new),
|
||||
viewstag: flags.viewstag.then(BTreeMap::new),
|
||||
status_manager: None,
|
||||
flags,
|
||||
}
|
||||
}
|
||||
|
||||
fn fmt(&self) {
|
||||
if !self.tags.is_empty()
|
||||
|| !self.viewstag.is_empty()
|
||||
|| !self.urgency.is_empty()
|
||||
|| self.title.is_some() {
|
||||
print!("{{");
|
||||
let mut comma = false;
|
||||
if !self.tags.is_empty() {
|
||||
print!("\"tags\" : [");
|
||||
let len = self.tags.len();
|
||||
for (i, (key, tags)) in self.tags.iter().enumerate() {
|
||||
print!("{{{:?} : ", key);
|
||||
print!("[");
|
||||
fmt_tags(*tags);
|
||||
print!("]}}");
|
||||
if i < len - 1 { print!(", "); }
|
||||
}
|
||||
print!("]");
|
||||
comma = true;
|
||||
}
|
||||
if !self.urgency.is_empty() {
|
||||
print!("\"urgent\" : [");
|
||||
let len = self.urgency.len();
|
||||
for (i, (key, tags)) in self.urgency.iter().enumerate() {
|
||||
print!("{{{:?} : ", key);
|
||||
print!("[");
|
||||
fmt_tags(*tags);
|
||||
print!("]}}");
|
||||
if i < len - 1 { print!(", "); }
|
||||
}
|
||||
print!("]");
|
||||
comma = true;
|
||||
}
|
||||
if !self.viewstag.is_empty() {
|
||||
if comma { print!(", "); }
|
||||
print!("\"viewstag\" : [");
|
||||
let vlen = self.viewstag.len();
|
||||
for (i, (key, tags)) in self.viewstag.iter().enumerate() {
|
||||
print!("{{{:?} : ", key);
|
||||
print!("[");
|
||||
let len = tags.len();
|
||||
for (i, tag) in tags.iter().enumerate() {
|
||||
print!("\"{}\"", tag);
|
||||
if i < len - 1 { print!(", "); }
|
||||
}
|
||||
print!("]}}");
|
||||
if i < vlen - 1 { print!(", "); }
|
||||
}
|
||||
print!("]");
|
||||
comma = true;
|
||||
}
|
||||
if let Some(title) = self.title.as_ref() {
|
||||
if comma { print!(", "); }
|
||||
print!("\"title\" : {:?}", title);
|
||||
}
|
||||
println!("}}");
|
||||
if self.title.is_some()
|
||||
|| self.tags.is_some()
|
||||
|| self.urgency.is_some()
|
||||
|| self.viewstag.is_some()
|
||||
{
|
||||
println!("{}", serde_json::to_string(self).unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,20 +144,25 @@ fn main() {
|
||||
if let Some(env) = env.get::<Env>() {
|
||||
match event {
|
||||
zriver_output_status_v1::Event::FocusedTags {
|
||||
tags,
|
||||
tags: focused_tags,
|
||||
} => {
|
||||
if env.flags.tags {
|
||||
if let Some(inner_value) = env.tags.get_mut(&make) {
|
||||
(*inner_value) = tags;
|
||||
if let Some(tags) = &mut env.tags {
|
||||
if let Some(inner_value) =
|
||||
tags.get_mut(&make)
|
||||
{
|
||||
(*inner_value) = Tags(focused_tags);
|
||||
} else {
|
||||
env.tags.insert(make.clone(), tags);
|
||||
tags.insert(
|
||||
make.clone(),
|
||||
Tags(focused_tags),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
zriver_output_status_v1::Event::ViewTags {
|
||||
tags,
|
||||
} => {
|
||||
if env.flags.viewstag {
|
||||
if let Some(viewstag) = &mut env.viewstag {
|
||||
let tags: Vec<u32> = tags[0..]
|
||||
.chunks(4)
|
||||
.map(|s| {
|
||||
@ -203,27 +171,32 @@ fn main() {
|
||||
u32::from_le_bytes(buf);
|
||||
for i in 0..32 {
|
||||
if 1 << i == tagmask {
|
||||
return 1+i;
|
||||
return 1 + i;
|
||||
}
|
||||
}
|
||||
0
|
||||
})
|
||||
.collect();
|
||||
if let Some(inner_value) = env.viewstag.get_mut(&make) {
|
||||
if let Some(inner_value) =
|
||||
viewstag.get_mut(&make)
|
||||
{
|
||||
(*inner_value) = tags;
|
||||
} else {
|
||||
env.viewstag.insert(make.clone(), tags);
|
||||
viewstag.insert(make.clone(), tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
zriver_output_status_v1::Event::UrgentTags {
|
||||
tags,
|
||||
} => {
|
||||
if env.flags.urgency {
|
||||
if let Some(inner_value) = env.urgency.get_mut(&make) {
|
||||
(*inner_value) = tags;
|
||||
if let Some(urgency) = &mut env.urgency {
|
||||
if let Some(inner_value) =
|
||||
urgency.get_mut(&make)
|
||||
{
|
||||
(*inner_value) = Tags(tags);
|
||||
} else {
|
||||
env.urgency.insert(make.clone(), tags);
|
||||
urgency
|
||||
.insert(make.clone(), Tags(tags));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -279,23 +252,24 @@ fn configuration() -> Flags {
|
||||
std::process::exit(0);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
None => break
|
||||
},
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
default
|
||||
}
|
||||
|
||||
fn fmt_tags(tagmask: u32) {
|
||||
let mut first = true;
|
||||
impl Serialize for Tags {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let mut seq = serializer.serialize_seq(Some(self.0.count_ones() as usize))?;
|
||||
for i in 0..32 {
|
||||
if tagmask >> i & 1 == 1 {
|
||||
if !first {
|
||||
print!(", \"{}\"", i + 1);
|
||||
} else {
|
||||
print!("\"{}\"", i + 1);
|
||||
first = false;
|
||||
if self.0 >> i & 1 == 1 {
|
||||
seq.serialize_element(&format!("{}", i + 1))?;
|
||||
}
|
||||
}
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
|
27
src/river_protocols.rs
Normal file
27
src/river_protocols.rs
Normal file
@ -0,0 +1,27 @@
|
||||
pub use generated::client::*;
|
||||
|
||||
pub mod generated {
|
||||
// The generated code tends to trigger a lot of warnings
|
||||
// so we isolate it into a very permissive module
|
||||
#![allow(dead_code, non_camel_case_types, unused_unsafe, unused_variables)]
|
||||
#![allow(non_upper_case_globals, non_snake_case, unused_imports)]
|
||||
#![allow(clippy::all)]
|
||||
|
||||
pub mod client {
|
||||
// These imports are used by the generated code
|
||||
use wayland_client::protocol::wl_output;
|
||||
use wayland_client::{protocol, sys};
|
||||
use wayland_client::{
|
||||
AnonymousObject, Attached, Display, GlobalManager, Main, Proxy, ProxyMap,
|
||||
};
|
||||
use wayland_commons::map::{Object, ObjectMetadata};
|
||||
use wayland_commons::smallvec;
|
||||
use wayland_commons::wire::{Argument, ArgumentType, Message, MessageDesc};
|
||||
use wayland_commons::{Interface, MessageGroup};
|
||||
// pub(crate) use wayland_protocols::unstable::xdg_output::v1::client::zxdg_output_v1::Event;
|
||||
// If you protocol interacts with objects from other protocols, you'll need to import
|
||||
// their modules, like so:
|
||||
use wayland_client::protocol::{wl_region, wl_seat, wl_surface};
|
||||
include!(concat!(env!("OUT_DIR"), "/river-status-unstable-v1.rs"));
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
extern crate wayland_client;
|
||||
extern crate wayland_commons;
|
||||
extern crate wayland_protocols;
|
||||
|
||||
// Re-export only the actual code, and then only use this re-export
|
||||
// The `generated` module below is just some boilerplate to properly isolate stuff
|
||||
// and avoid exposing internal details.
|
||||
//
|
||||
// You can use all the types from my_protocol as if they went from `wayland_client::protocol`.
|
||||
pub use wayland::client as river_status_unstable_v1;
|
||||
|
||||
pub mod wayland {
|
||||
// The generated code tends to trigger a lot of warnings
|
||||
// so we isolate it into a very permissive module
|
||||
#![allow(dead_code, non_camel_case_types, unused_unsafe, unused_variables)]
|
||||
#![allow(non_upper_case_globals, non_snake_case, unused_imports)]
|
||||
|
||||
pub mod client {
|
||||
// These imports are used by the generated code
|
||||
pub(crate) use wayland_client::protocol::wl_output;
|
||||
pub(crate) use wayland_client::{protocol, sys};
|
||||
pub(crate) use wayland_client::{
|
||||
AnonymousObject, Attached, Display, GlobalManager, Main, Proxy, ProxyMap,
|
||||
};
|
||||
pub(crate) use wayland_commons::map::{Object, ObjectMetadata};
|
||||
pub(crate) use wayland_commons::smallvec;
|
||||
pub(crate) use wayland_commons::wire::{Argument, ArgumentType, Message, MessageDesc};
|
||||
pub(crate) use wayland_commons::{Interface, MessageGroup};
|
||||
// pub(crate) use wayland_protocols::unstable::xdg_output::v1::client::zxdg_output_v1::Event;
|
||||
// If you protocol interacts with objects from other protocols, you'll need to import
|
||||
// their modules, like so:
|
||||
pub(crate) use wayland_client::protocol::{wl_region, wl_seat, wl_surface};
|
||||
include!(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/src/wayland/river_status_unstable_v1.rs"
|
||||
));
|
||||
}
|
||||
}
|
@ -1,906 +0,0 @@
|
||||
use std::os::raw::{c_char, c_void};
|
||||
const NULLPTR: *const c_void = 0 as *const c_void;
|
||||
static mut types_null: [*const sys::common::wl_interface; 1] =
|
||||
[NULLPTR as *const sys::common::wl_interface];
|
||||
#[doc = "manage river status objects\n\nA global factory for objects that receive status information specific\nto river. It could be used to implement, for example, a status bar."]
|
||||
pub mod zriver_status_manager_v1 {
|
||||
use super::sys::client::*;
|
||||
use super::sys::common::{wl_argument, wl_array, wl_interface, wl_message};
|
||||
use super::{
|
||||
smallvec, types_null, AnonymousObject, Argument, ArgumentType, Interface, Main, Message,
|
||||
MessageDesc, MessageGroup, Object, ObjectMetadata, Proxy, NULLPTR,
|
||||
};
|
||||
use std::os::raw::c_char;
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum Request {
|
||||
#[doc = "destroy the river_status_manager object\n\nThis request indicates that the client will not use the\nriver_status_manager object any more. Objects that have been created\nthrough this instance are not affected.\n\nThis is a destructor, once sent this object cannot be used any longer."]
|
||||
Destroy,
|
||||
#[doc = "create an output status object\n\nThis creates a new river_output_status object for the given wl_output."]
|
||||
GetRiverOutputStatus { output: super::wl_output::WlOutput },
|
||||
#[doc = "create a seat status object\n\nThis creates a new river_seat_status object for the given wl_seat."]
|
||||
GetRiverSeatStatus { seat: super::wl_seat::WlSeat },
|
||||
}
|
||||
impl super::MessageGroup for Request {
|
||||
const MESSAGES: &'static [super::MessageDesc] = &[
|
||||
super::MessageDesc {
|
||||
name: "destroy",
|
||||
since: 1,
|
||||
signature: &[],
|
||||
destructor: true,
|
||||
},
|
||||
super::MessageDesc {
|
||||
name: "get_river_output_status",
|
||||
since: 1,
|
||||
signature: &[super::ArgumentType::NewId, super::ArgumentType::Object],
|
||||
destructor: false,
|
||||
},
|
||||
super::MessageDesc {
|
||||
name: "get_river_seat_status",
|
||||
since: 1,
|
||||
signature: &[super::ArgumentType::NewId, super::ArgumentType::Object],
|
||||
destructor: false,
|
||||
},
|
||||
];
|
||||
type Map = super::ProxyMap;
|
||||
fn is_destructor(&self) -> bool {
|
||||
match *self {
|
||||
Request::Destroy => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn opcode(&self) -> u16 {
|
||||
match *self {
|
||||
Request::Destroy => 0,
|
||||
Request::GetRiverOutputStatus { .. } => 1,
|
||||
Request::GetRiverSeatStatus { .. } => 2,
|
||||
}
|
||||
}
|
||||
fn since(&self) -> u32 {
|
||||
match *self {
|
||||
Request::Destroy => 1,
|
||||
Request::GetRiverOutputStatus { .. } => 1,
|
||||
Request::GetRiverSeatStatus { .. } => 1,
|
||||
}
|
||||
}
|
||||
fn child<Meta: ObjectMetadata>(
|
||||
opcode: u16,
|
||||
version: u32,
|
||||
meta: &Meta,
|
||||
) -> Option<Object<Meta>> {
|
||||
match opcode {
|
||||
1 => Some(Object::from_interface::<
|
||||
super::zriver_output_status_v1::ZriverOutputStatusV1,
|
||||
>(version, meta.child())),
|
||||
2 => Some(Object::from_interface::<
|
||||
super::zriver_seat_status_v1::ZriverSeatStatusV1,
|
||||
>(version, meta.child())),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()> {
|
||||
panic!("Request::from_raw can not be used Client-side.")
|
||||
}
|
||||
fn into_raw(self, sender_id: u32) -> Message {
|
||||
match self {
|
||||
Request::Destroy => Message {
|
||||
sender_id: sender_id,
|
||||
opcode: 0,
|
||||
args: smallvec![],
|
||||
},
|
||||
Request::GetRiverOutputStatus { output } => Message {
|
||||
sender_id: sender_id,
|
||||
opcode: 1,
|
||||
args: smallvec![Argument::NewId(0), Argument::Object(output.as_ref().id()),],
|
||||
},
|
||||
Request::GetRiverSeatStatus { seat } => Message {
|
||||
sender_id: sender_id,
|
||||
opcode: 2,
|
||||
args: smallvec![Argument::NewId(0), Argument::Object(seat.as_ref().id()),],
|
||||
},
|
||||
}
|
||||
}
|
||||
unsafe fn from_raw_c(
|
||||
obj: *mut ::std::os::raw::c_void,
|
||||
opcode: u32,
|
||||
args: *const wl_argument,
|
||||
) -> Result<Request, ()> {
|
||||
panic!("Request::from_raw_c can not be used Client-side.")
|
||||
}
|
||||
fn as_raw_c_in<F, T>(self, f: F) -> T
|
||||
where
|
||||
F: FnOnce(u32, &mut [wl_argument]) -> T,
|
||||
{
|
||||
match self {
|
||||
Request::Destroy => {
|
||||
let mut _args_array: [wl_argument; 0] = unsafe { ::std::mem::zeroed() };
|
||||
f(0, &mut _args_array)
|
||||
}
|
||||
Request::GetRiverOutputStatus { output } => {
|
||||
let mut _args_array: [wl_argument; 2] = unsafe { ::std::mem::zeroed() };
|
||||
_args_array[0].o = ::std::ptr::null_mut() as *mut _;
|
||||
_args_array[1].o = output.as_ref().c_ptr() as *mut _;
|
||||
f(1, &mut _args_array)
|
||||
}
|
||||
Request::GetRiverSeatStatus { seat } => {
|
||||
let mut _args_array: [wl_argument; 2] = unsafe { ::std::mem::zeroed() };
|
||||
_args_array[0].o = ::std::ptr::null_mut() as *mut _;
|
||||
_args_array[1].o = seat.as_ref().c_ptr() as *mut _;
|
||||
f(2, &mut _args_array)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum Event {}
|
||||
impl super::MessageGroup for Event {
|
||||
const MESSAGES: &'static [super::MessageDesc] = &[];
|
||||
type Map = super::ProxyMap;
|
||||
fn is_destructor(&self) -> bool {
|
||||
match *self {}
|
||||
}
|
||||
fn opcode(&self) -> u16 {
|
||||
match *self {}
|
||||
}
|
||||
fn since(&self) -> u32 {
|
||||
match *self {}
|
||||
}
|
||||
fn child<Meta: ObjectMetadata>(
|
||||
opcode: u16,
|
||||
version: u32,
|
||||
meta: &Meta,
|
||||
) -> Option<Object<Meta>> {
|
||||
match opcode {
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()> {
|
||||
match msg.opcode {
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
fn into_raw(self, sender_id: u32) -> Message {
|
||||
panic!("Event::into_raw can not be used Client-side.")
|
||||
}
|
||||
unsafe fn from_raw_c(
|
||||
obj: *mut ::std::os::raw::c_void,
|
||||
opcode: u32,
|
||||
args: *const wl_argument,
|
||||
) -> Result<Event, ()> {
|
||||
match opcode {
|
||||
_ => return Err(()),
|
||||
}
|
||||
}
|
||||
fn as_raw_c_in<F, T>(self, f: F) -> T
|
||||
where
|
||||
F: FnOnce(u32, &mut [wl_argument]) -> T,
|
||||
{
|
||||
panic!("Event::as_raw_c_in can not be used Client-side.")
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct ZriverStatusManagerV1(Proxy<ZriverStatusManagerV1>);
|
||||
impl AsRef<Proxy<ZriverStatusManagerV1>> for ZriverStatusManagerV1 {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &Proxy<Self> {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
impl From<Proxy<ZriverStatusManagerV1>> for ZriverStatusManagerV1 {
|
||||
#[inline]
|
||||
fn from(value: Proxy<Self>) -> Self {
|
||||
ZriverStatusManagerV1(value)
|
||||
}
|
||||
}
|
||||
impl From<ZriverStatusManagerV1> for Proxy<ZriverStatusManagerV1> {
|
||||
#[inline]
|
||||
fn from(value: ZriverStatusManagerV1) -> Self {
|
||||
value.0
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for ZriverStatusManagerV1 {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_fmt(format_args!("{:?}", self.0))
|
||||
}
|
||||
}
|
||||
impl Interface for ZriverStatusManagerV1 {
|
||||
type Request = Request;
|
||||
type Event = Event;
|
||||
const NAME: &'static str = "zriver_status_manager_v1";
|
||||
const VERSION: u32 = 2;
|
||||
fn c_interface() -> *const wl_interface {
|
||||
unsafe { &zriver_status_manager_v1_interface }
|
||||
}
|
||||
}
|
||||
impl ZriverStatusManagerV1 {
|
||||
#[doc = "destroy the river_status_manager object\n\nThis request indicates that the client will not use the\nriver_status_manager object any more. Objects that have been created\nthrough this instance are not affected.\n\nThis is a destructor, you cannot send requests to this object any longer once this method is called."]
|
||||
pub fn destroy(&self) -> () {
|
||||
let msg = Request::Destroy;
|
||||
self.0.send::<AnonymousObject>(msg, None);
|
||||
}
|
||||
#[doc = "create an output status object\n\nThis creates a new river_output_status object for the given wl_output."]
|
||||
pub fn get_river_output_status(
|
||||
&self,
|
||||
output: &super::wl_output::WlOutput,
|
||||
) -> Main<super::zriver_output_status_v1::ZriverOutputStatusV1> {
|
||||
let msg = Request::GetRiverOutputStatus {
|
||||
output: output.clone(),
|
||||
};
|
||||
self.0.send(msg, None).unwrap()
|
||||
}
|
||||
#[doc = "create a seat status object\n\nThis creates a new river_seat_status object for the given wl_seat."]
|
||||
pub fn get_river_seat_status(
|
||||
&self,
|
||||
seat: &super::wl_seat::WlSeat,
|
||||
) -> Main<super::zriver_seat_status_v1::ZriverSeatStatusV1> {
|
||||
let msg = Request::GetRiverSeatStatus { seat: seat.clone() };
|
||||
self.0.send(msg, None).unwrap()
|
||||
}
|
||||
}
|
||||
#[doc = r" The minimal object version supporting this request"]
|
||||
pub const REQ_DESTROY_SINCE: u32 = 1u32;
|
||||
#[doc = r" The minimal object version supporting this request"]
|
||||
pub const REQ_GET_RIVER_OUTPUT_STATUS_SINCE: u32 = 1u32;
|
||||
#[doc = r" The minimal object version supporting this request"]
|
||||
pub const REQ_GET_RIVER_SEAT_STATUS_SINCE: u32 = 1u32;
|
||||
static mut zriver_status_manager_v1_requests_get_river_output_status_types:
|
||||
[*const wl_interface; 2] = [
|
||||
unsafe {
|
||||
&super::zriver_output_status_v1::zriver_output_status_v1_interface
|
||||
as *const wl_interface
|
||||
},
|
||||
unsafe { &super::wl_output::wl_output_interface as *const wl_interface },
|
||||
];
|
||||
static mut zriver_status_manager_v1_requests_get_river_seat_status_types:
|
||||
[*const wl_interface; 2] = [
|
||||
unsafe {
|
||||
&super::zriver_seat_status_v1::zriver_seat_status_v1_interface as *const wl_interface
|
||||
},
|
||||
unsafe { &super::wl_seat::wl_seat_interface as *const wl_interface },
|
||||
];
|
||||
#[doc = r" C-representation of the messages of this interface, for interop"]
|
||||
pub static mut zriver_status_manager_v1_requests: [wl_message; 3] = [
|
||||
wl_message {
|
||||
name: b"destroy\0" as *const u8 as *const c_char,
|
||||
signature: b"\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &types_null as *const _ },
|
||||
},
|
||||
wl_message {
|
||||
name: b"get_river_output_status\0" as *const u8 as *const c_char,
|
||||
signature: b"no\0" as *const u8 as *const c_char,
|
||||
types: unsafe {
|
||||
&zriver_status_manager_v1_requests_get_river_output_status_types as *const _
|
||||
},
|
||||
},
|
||||
wl_message {
|
||||
name: b"get_river_seat_status\0" as *const u8 as *const c_char,
|
||||
signature: b"no\0" as *const u8 as *const c_char,
|
||||
types: unsafe {
|
||||
&zriver_status_manager_v1_requests_get_river_seat_status_types as *const _
|
||||
},
|
||||
},
|
||||
];
|
||||
#[doc = r" C representation of this interface, for interop"]
|
||||
pub static mut zriver_status_manager_v1_interface: wl_interface = wl_interface {
|
||||
name: b"zriver_status_manager_v1\0" as *const u8 as *const c_char,
|
||||
version: 2,
|
||||
request_count: 3,
|
||||
requests: unsafe { &zriver_status_manager_v1_requests as *const _ },
|
||||
event_count: 0,
|
||||
events: NULLPTR as *const wl_message,
|
||||
};
|
||||
}
|
||||
#[doc = "track output tags and focus\n\nThis interface allows clients to receive information about the current\nwindowing state of an output."]
|
||||
pub mod zriver_output_status_v1 {
|
||||
use super::sys::client::*;
|
||||
use super::sys::common::{wl_argument, wl_array, wl_interface, wl_message};
|
||||
use super::{
|
||||
smallvec, types_null, AnonymousObject, Argument, ArgumentType, Interface, Main, Message,
|
||||
MessageDesc, MessageGroup, Object, ObjectMetadata, Proxy, NULLPTR,
|
||||
};
|
||||
use std::os::raw::c_char;
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum Request {
|
||||
#[doc = "destroy the river_output_status object\n\nThis request indicates that the client will not use the\nriver_output_status object any more.\n\nThis is a destructor, once sent this object cannot be used any longer."]
|
||||
Destroy,
|
||||
}
|
||||
impl super::MessageGroup for Request {
|
||||
const MESSAGES: &'static [super::MessageDesc] = &[super::MessageDesc {
|
||||
name: "destroy",
|
||||
since: 1,
|
||||
signature: &[],
|
||||
destructor: true,
|
||||
}];
|
||||
type Map = super::ProxyMap;
|
||||
fn is_destructor(&self) -> bool {
|
||||
match *self {
|
||||
Request::Destroy => true,
|
||||
}
|
||||
}
|
||||
fn opcode(&self) -> u16 {
|
||||
match *self {
|
||||
Request::Destroy => 0,
|
||||
}
|
||||
}
|
||||
fn since(&self) -> u32 {
|
||||
match *self {
|
||||
Request::Destroy => 1,
|
||||
}
|
||||
}
|
||||
fn child<Meta: ObjectMetadata>(
|
||||
opcode: u16,
|
||||
version: u32,
|
||||
meta: &Meta,
|
||||
) -> Option<Object<Meta>> {
|
||||
match opcode {
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()> {
|
||||
panic!("Request::from_raw can not be used Client-side.")
|
||||
}
|
||||
fn into_raw(self, sender_id: u32) -> Message {
|
||||
match self {
|
||||
Request::Destroy => Message {
|
||||
sender_id: sender_id,
|
||||
opcode: 0,
|
||||
args: smallvec![],
|
||||
},
|
||||
}
|
||||
}
|
||||
unsafe fn from_raw_c(
|
||||
obj: *mut ::std::os::raw::c_void,
|
||||
opcode: u32,
|
||||
args: *const wl_argument,
|
||||
) -> Result<Request, ()> {
|
||||
panic!("Request::from_raw_c can not be used Client-side.")
|
||||
}
|
||||
fn as_raw_c_in<F, T>(self, f: F) -> T
|
||||
where
|
||||
F: FnOnce(u32, &mut [wl_argument]) -> T,
|
||||
{
|
||||
match self {
|
||||
Request::Destroy => {
|
||||
let mut _args_array: [wl_argument; 0] = unsafe { ::std::mem::zeroed() };
|
||||
f(0, &mut _args_array)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum Event {
|
||||
#[doc = "focused tags of the output\n\nSent once binding the interface and again whenever the tag focus of\nthe output changes."]
|
||||
FocusedTags { tags: u32 },
|
||||
#[doc = "tag state of an output's views\n\nSent once on binding the interface and again whenever the tag state\nof the output changes."]
|
||||
ViewTags { tags: Vec<u8> },
|
||||
#[doc = "tags of the output with an urgent view\n\nSent once on binding the interface and again whenever the set of\ntags with at least one urgent view changes.\n\nOnly available since version 2 of the interface"]
|
||||
UrgentTags { tags: u32 },
|
||||
}
|
||||
impl super::MessageGroup for Event {
|
||||
const MESSAGES: &'static [super::MessageDesc] = &[
|
||||
super::MessageDesc {
|
||||
name: "focused_tags",
|
||||
since: 1,
|
||||
signature: &[super::ArgumentType::Uint],
|
||||
destructor: false,
|
||||
},
|
||||
super::MessageDesc {
|
||||
name: "view_tags",
|
||||
since: 1,
|
||||
signature: &[super::ArgumentType::Array],
|
||||
destructor: false,
|
||||
},
|
||||
super::MessageDesc {
|
||||
name: "urgent_tags",
|
||||
since: 2,
|
||||
signature: &[super::ArgumentType::Uint],
|
||||
destructor: false,
|
||||
},
|
||||
];
|
||||
type Map = super::ProxyMap;
|
||||
fn is_destructor(&self) -> bool {
|
||||
match *self {
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn opcode(&self) -> u16 {
|
||||
match *self {
|
||||
Event::FocusedTags { .. } => 0,
|
||||
Event::ViewTags { .. } => 1,
|
||||
Event::UrgentTags { .. } => 2,
|
||||
}
|
||||
}
|
||||
fn since(&self) -> u32 {
|
||||
match *self {
|
||||
Event::FocusedTags { .. } => 1,
|
||||
Event::ViewTags { .. } => 1,
|
||||
Event::UrgentTags { .. } => 2,
|
||||
}
|
||||
}
|
||||
fn child<Meta: ObjectMetadata>(
|
||||
opcode: u16,
|
||||
version: u32,
|
||||
meta: &Meta,
|
||||
) -> Option<Object<Meta>> {
|
||||
match opcode {
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()> {
|
||||
match msg.opcode {
|
||||
0 => {
|
||||
let mut args = msg.args.into_iter();
|
||||
Ok(Event::FocusedTags {
|
||||
tags: {
|
||||
if let Some(Argument::Uint(val)) = args.next() {
|
||||
val
|
||||
} else {
|
||||
return Err(());
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
1 => {
|
||||
let mut args = msg.args.into_iter();
|
||||
Ok(Event::ViewTags {
|
||||
tags: {
|
||||
if let Some(Argument::Array(val)) = args.next() {
|
||||
*val
|
||||
} else {
|
||||
return Err(());
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
2 => {
|
||||
let mut args = msg.args.into_iter();
|
||||
Ok(Event::UrgentTags {
|
||||
tags: {
|
||||
if let Some(Argument::Uint(val)) = args.next() {
|
||||
val
|
||||
} else {
|
||||
return Err(());
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
fn into_raw(self, sender_id: u32) -> Message {
|
||||
panic!("Event::into_raw can not be used Client-side.")
|
||||
}
|
||||
unsafe fn from_raw_c(
|
||||
obj: *mut ::std::os::raw::c_void,
|
||||
opcode: u32,
|
||||
args: *const wl_argument,
|
||||
) -> Result<Event, ()> {
|
||||
match opcode {
|
||||
0 => {
|
||||
let _args = ::std::slice::from_raw_parts(args, 1);
|
||||
Ok(Event::FocusedTags { tags: _args[0].u })
|
||||
}
|
||||
1 => {
|
||||
let _args = ::std::slice::from_raw_parts(args, 1);
|
||||
Ok(Event::ViewTags {
|
||||
tags: {
|
||||
let array = &*_args[0].a;
|
||||
::std::slice::from_raw_parts(array.data as *const u8, array.size)
|
||||
.to_owned()
|
||||
},
|
||||
})
|
||||
}
|
||||
2 => {
|
||||
let _args = ::std::slice::from_raw_parts(args, 1);
|
||||
Ok(Event::UrgentTags { tags: _args[0].u })
|
||||
}
|
||||
_ => return Err(()),
|
||||
}
|
||||
}
|
||||
fn as_raw_c_in<F, T>(self, f: F) -> T
|
||||
where
|
||||
F: FnOnce(u32, &mut [wl_argument]) -> T,
|
||||
{
|
||||
panic!("Event::as_raw_c_in can not be used Client-side.")
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct ZriverOutputStatusV1(Proxy<ZriverOutputStatusV1>);
|
||||
impl AsRef<Proxy<ZriverOutputStatusV1>> for ZriverOutputStatusV1 {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &Proxy<Self> {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
impl From<Proxy<ZriverOutputStatusV1>> for ZriverOutputStatusV1 {
|
||||
#[inline]
|
||||
fn from(value: Proxy<Self>) -> Self {
|
||||
ZriverOutputStatusV1(value)
|
||||
}
|
||||
}
|
||||
impl From<ZriverOutputStatusV1> for Proxy<ZriverOutputStatusV1> {
|
||||
#[inline]
|
||||
fn from(value: ZriverOutputStatusV1) -> Self {
|
||||
value.0
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for ZriverOutputStatusV1 {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_fmt(format_args!("{:?}", self.0))
|
||||
}
|
||||
}
|
||||
impl Interface for ZriverOutputStatusV1 {
|
||||
type Request = Request;
|
||||
type Event = Event;
|
||||
const NAME: &'static str = "zriver_output_status_v1";
|
||||
const VERSION: u32 = 2;
|
||||
fn c_interface() -> *const wl_interface {
|
||||
unsafe { &zriver_output_status_v1_interface }
|
||||
}
|
||||
}
|
||||
impl ZriverOutputStatusV1 {
|
||||
#[doc = "destroy the river_output_status object\n\nThis request indicates that the client will not use the\nriver_output_status object any more.\n\nThis is a destructor, you cannot send requests to this object any longer once this method is called."]
|
||||
pub fn destroy(&self) -> () {
|
||||
let msg = Request::Destroy;
|
||||
self.0.send::<AnonymousObject>(msg, None);
|
||||
}
|
||||
}
|
||||
#[doc = r" The minimal object version supporting this request"]
|
||||
pub const REQ_DESTROY_SINCE: u32 = 1u32;
|
||||
#[doc = r" The minimal object version supporting this event"]
|
||||
pub const EVT_FOCUSED_TAGS_SINCE: u32 = 1u32;
|
||||
#[doc = r" The minimal object version supporting this event"]
|
||||
pub const EVT_VIEW_TAGS_SINCE: u32 = 1u32;
|
||||
#[doc = r" The minimal object version supporting this event"]
|
||||
pub const EVT_URGENT_TAGS_SINCE: u32 = 2u32;
|
||||
#[doc = r" C-representation of the messages of this interface, for interop"]
|
||||
pub static mut zriver_output_status_v1_requests: [wl_message; 1] = [wl_message {
|
||||
name: b"destroy\0" as *const u8 as *const c_char,
|
||||
signature: b"\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &types_null as *const _ },
|
||||
}];
|
||||
#[doc = r" C-representation of the messages of this interface, for interop"]
|
||||
pub static mut zriver_output_status_v1_events: [wl_message; 3] = [
|
||||
wl_message {
|
||||
name: b"focused_tags\0" as *const u8 as *const c_char,
|
||||
signature: b"u\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &types_null as *const _ },
|
||||
},
|
||||
wl_message {
|
||||
name: b"view_tags\0" as *const u8 as *const c_char,
|
||||
signature: b"a\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &types_null as *const _ },
|
||||
},
|
||||
wl_message {
|
||||
name: b"urgent_tags\0" as *const u8 as *const c_char,
|
||||
signature: b"2u\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &types_null as *const _ },
|
||||
},
|
||||
];
|
||||
#[doc = r" C representation of this interface, for interop"]
|
||||
pub static mut zriver_output_status_v1_interface: wl_interface = wl_interface {
|
||||
name: b"zriver_output_status_v1\0" as *const u8 as *const c_char,
|
||||
version: 2,
|
||||
request_count: 1,
|
||||
requests: unsafe { &zriver_output_status_v1_requests as *const _ },
|
||||
event_count: 3,
|
||||
events: unsafe { &zriver_output_status_v1_events as *const _ },
|
||||
};
|
||||
}
|
||||
#[doc = "track seat focus\n\nThis interface allows clients to receive information about the current\nfocus of a seat. Note that (un)focused_output events will only be sent\nif the client has bound the relevant wl_output globals."]
|
||||
pub mod zriver_seat_status_v1 {
|
||||
use super::sys::client::*;
|
||||
use super::sys::common::{wl_argument, wl_array, wl_interface, wl_message};
|
||||
use super::{
|
||||
smallvec, types_null, AnonymousObject, Argument, ArgumentType, Interface, Main, Message,
|
||||
MessageDesc, MessageGroup, Object, ObjectMetadata, Proxy, NULLPTR,
|
||||
};
|
||||
use std::os::raw::c_char;
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum Request {
|
||||
#[doc = "destroy the river_seat_status object\n\nThis request indicates that the client will not use the\nriver_seat_status object any more.\n\nThis is a destructor, once sent this object cannot be used any longer."]
|
||||
Destroy,
|
||||
}
|
||||
impl super::MessageGroup for Request {
|
||||
const MESSAGES: &'static [super::MessageDesc] = &[super::MessageDesc {
|
||||
name: "destroy",
|
||||
since: 1,
|
||||
signature: &[],
|
||||
destructor: true,
|
||||
}];
|
||||
type Map = super::ProxyMap;
|
||||
fn is_destructor(&self) -> bool {
|
||||
match *self {
|
||||
Request::Destroy => true,
|
||||
}
|
||||
}
|
||||
fn opcode(&self) -> u16 {
|
||||
match *self {
|
||||
Request::Destroy => 0,
|
||||
}
|
||||
}
|
||||
fn since(&self) -> u32 {
|
||||
match *self {
|
||||
Request::Destroy => 1,
|
||||
}
|
||||
}
|
||||
fn child<Meta: ObjectMetadata>(
|
||||
opcode: u16,
|
||||
version: u32,
|
||||
meta: &Meta,
|
||||
) -> Option<Object<Meta>> {
|
||||
match opcode {
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()> {
|
||||
panic!("Request::from_raw can not be used Client-side.")
|
||||
}
|
||||
fn into_raw(self, sender_id: u32) -> Message {
|
||||
match self {
|
||||
Request::Destroy => Message {
|
||||
sender_id: sender_id,
|
||||
opcode: 0,
|
||||
args: smallvec![],
|
||||
},
|
||||
}
|
||||
}
|
||||
unsafe fn from_raw_c(
|
||||
obj: *mut ::std::os::raw::c_void,
|
||||
opcode: u32,
|
||||
args: *const wl_argument,
|
||||
) -> Result<Request, ()> {
|
||||
panic!("Request::from_raw_c can not be used Client-side.")
|
||||
}
|
||||
fn as_raw_c_in<F, T>(self, f: F) -> T
|
||||
where
|
||||
F: FnOnce(u32, &mut [wl_argument]) -> T,
|
||||
{
|
||||
match self {
|
||||
Request::Destroy => {
|
||||
let mut _args_array: [wl_argument; 0] = unsafe { ::std::mem::zeroed() };
|
||||
f(0, &mut _args_array)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum Event {
|
||||
#[doc = "the seat focused an output\n\nSent on binding the interface and again whenever an output gains focus."]
|
||||
FocusedOutput { output: super::wl_output::WlOutput },
|
||||
#[doc = "the seat unfocused an output\n\nSent whenever an output loses focus."]
|
||||
UnfocusedOutput { output: super::wl_output::WlOutput },
|
||||
#[doc = "information on the focused view\n\nSent once on binding the interface and again whenever the focused\nview or a property thereof changes. The title may be an empty string\nif no view is focused or the focused view did not set a title."]
|
||||
FocusedView { title: String },
|
||||
}
|
||||
impl super::MessageGroup for Event {
|
||||
const MESSAGES: &'static [super::MessageDesc] = &[
|
||||
super::MessageDesc {
|
||||
name: "focused_output",
|
||||
since: 1,
|
||||
signature: &[super::ArgumentType::Object],
|
||||
destructor: false,
|
||||
},
|
||||
super::MessageDesc {
|
||||
name: "unfocused_output",
|
||||
since: 1,
|
||||
signature: &[super::ArgumentType::Object],
|
||||
destructor: false,
|
||||
},
|
||||
super::MessageDesc {
|
||||
name: "focused_view",
|
||||
since: 1,
|
||||
signature: &[super::ArgumentType::Str],
|
||||
destructor: false,
|
||||
},
|
||||
];
|
||||
type Map = super::ProxyMap;
|
||||
fn is_destructor(&self) -> bool {
|
||||
match *self {
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn opcode(&self) -> u16 {
|
||||
match *self {
|
||||
Event::FocusedOutput { .. } => 0,
|
||||
Event::UnfocusedOutput { .. } => 1,
|
||||
Event::FocusedView { .. } => 2,
|
||||
}
|
||||
}
|
||||
fn since(&self) -> u32 {
|
||||
match *self {
|
||||
Event::FocusedOutput { .. } => 1,
|
||||
Event::UnfocusedOutput { .. } => 1,
|
||||
Event::FocusedView { .. } => 1,
|
||||
}
|
||||
}
|
||||
fn child<Meta: ObjectMetadata>(
|
||||
opcode: u16,
|
||||
version: u32,
|
||||
meta: &Meta,
|
||||
) -> Option<Object<Meta>> {
|
||||
match opcode {
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()> {
|
||||
match msg.opcode {
|
||||
0 => {
|
||||
let mut args = msg.args.into_iter();
|
||||
Ok(Event::FocusedOutput {
|
||||
output: {
|
||||
if let Some(Argument::Object(val)) = args.next() {
|
||||
map.get_or_dead(val).into()
|
||||
} else {
|
||||
return Err(());
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
1 => {
|
||||
let mut args = msg.args.into_iter();
|
||||
Ok(Event::UnfocusedOutput {
|
||||
output: {
|
||||
if let Some(Argument::Object(val)) = args.next() {
|
||||
map.get_or_dead(val).into()
|
||||
} else {
|
||||
return Err(());
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
2 => {
|
||||
let mut args = msg.args.into_iter();
|
||||
Ok(Event::FocusedView {
|
||||
title: {
|
||||
if let Some(Argument::Str(val)) = args.next() {
|
||||
let s = String::from_utf8(val.into_bytes()).unwrap_or_else(|e| {
|
||||
String::from_utf8_lossy(&e.into_bytes()).into()
|
||||
});
|
||||
s
|
||||
} else {
|
||||
return Err(());
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
fn into_raw(self, sender_id: u32) -> Message {
|
||||
panic!("Event::into_raw can not be used Client-side.")
|
||||
}
|
||||
unsafe fn from_raw_c(
|
||||
obj: *mut ::std::os::raw::c_void,
|
||||
opcode: u32,
|
||||
args: *const wl_argument,
|
||||
) -> Result<Event, ()> {
|
||||
match opcode {
|
||||
0 => {
|
||||
let _args = ::std::slice::from_raw_parts(args, 1);
|
||||
Ok(Event::FocusedOutput {
|
||||
output: Proxy::<super::wl_output::WlOutput>::from_c_ptr(
|
||||
_args[0].o as *mut _,
|
||||
)
|
||||
.into(),
|
||||
})
|
||||
}
|
||||
1 => {
|
||||
let _args = ::std::slice::from_raw_parts(args, 1);
|
||||
Ok(Event::UnfocusedOutput {
|
||||
output: Proxy::<super::wl_output::WlOutput>::from_c_ptr(
|
||||
_args[0].o as *mut _,
|
||||
)
|
||||
.into(),
|
||||
})
|
||||
}
|
||||
2 => {
|
||||
let _args = ::std::slice::from_raw_parts(args, 1);
|
||||
Ok(Event::FocusedView {
|
||||
title: ::std::ffi::CStr::from_ptr(_args[0].s)
|
||||
.to_string_lossy()
|
||||
.into_owned(),
|
||||
})
|
||||
}
|
||||
_ => return Err(()),
|
||||
}
|
||||
}
|
||||
fn as_raw_c_in<F, T>(self, f: F) -> T
|
||||
where
|
||||
F: FnOnce(u32, &mut [wl_argument]) -> T,
|
||||
{
|
||||
panic!("Event::as_raw_c_in can not be used Client-side.")
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct ZriverSeatStatusV1(Proxy<ZriverSeatStatusV1>);
|
||||
impl AsRef<Proxy<ZriverSeatStatusV1>> for ZriverSeatStatusV1 {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &Proxy<Self> {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
impl From<Proxy<ZriverSeatStatusV1>> for ZriverSeatStatusV1 {
|
||||
#[inline]
|
||||
fn from(value: Proxy<Self>) -> Self {
|
||||
ZriverSeatStatusV1(value)
|
||||
}
|
||||
}
|
||||
impl From<ZriverSeatStatusV1> for Proxy<ZriverSeatStatusV1> {
|
||||
#[inline]
|
||||
fn from(value: ZriverSeatStatusV1) -> Self {
|
||||
value.0
|
||||
}
|
||||
}
|
||||
impl std::fmt::Debug for ZriverSeatStatusV1 {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_fmt(format_args!("{:?}", self.0))
|
||||
}
|
||||
}
|
||||
impl Interface for ZriverSeatStatusV1 {
|
||||
type Request = Request;
|
||||
type Event = Event;
|
||||
const NAME: &'static str = "zriver_seat_status_v1";
|
||||
const VERSION: u32 = 1;
|
||||
fn c_interface() -> *const wl_interface {
|
||||
unsafe { &zriver_seat_status_v1_interface }
|
||||
}
|
||||
}
|
||||
impl ZriverSeatStatusV1 {
|
||||
#[doc = "destroy the river_seat_status object\n\nThis request indicates that the client will not use the\nriver_seat_status object any more.\n\nThis is a destructor, you cannot send requests to this object any longer once this method is called."]
|
||||
pub fn destroy(&self) -> () {
|
||||
let msg = Request::Destroy;
|
||||
self.0.send::<AnonymousObject>(msg, None);
|
||||
}
|
||||
}
|
||||
#[doc = r" The minimal object version supporting this request"]
|
||||
pub const REQ_DESTROY_SINCE: u32 = 1u32;
|
||||
#[doc = r" The minimal object version supporting this event"]
|
||||
pub const EVT_FOCUSED_OUTPUT_SINCE: u32 = 1u32;
|
||||
#[doc = r" The minimal object version supporting this event"]
|
||||
pub const EVT_UNFOCUSED_OUTPUT_SINCE: u32 = 1u32;
|
||||
#[doc = r" The minimal object version supporting this event"]
|
||||
pub const EVT_FOCUSED_VIEW_SINCE: u32 = 1u32;
|
||||
#[doc = r" C-representation of the messages of this interface, for interop"]
|
||||
pub static mut zriver_seat_status_v1_requests: [wl_message; 1] = [wl_message {
|
||||
name: b"destroy\0" as *const u8 as *const c_char,
|
||||
signature: b"\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &types_null as *const _ },
|
||||
}];
|
||||
static mut zriver_seat_status_v1_events_focused_output_types: [*const wl_interface; 1] =
|
||||
[unsafe { &super::wl_output::wl_output_interface as *const wl_interface }];
|
||||
static mut zriver_seat_status_v1_events_unfocused_output_types: [*const wl_interface; 1] =
|
||||
[unsafe { &super::wl_output::wl_output_interface as *const wl_interface }];
|
||||
#[doc = r" C-representation of the messages of this interface, for interop"]
|
||||
pub static mut zriver_seat_status_v1_events: [wl_message; 3] = [
|
||||
wl_message {
|
||||
name: b"focused_output\0" as *const u8 as *const c_char,
|
||||
signature: b"o\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &zriver_seat_status_v1_events_focused_output_types as *const _ },
|
||||
},
|
||||
wl_message {
|
||||
name: b"unfocused_output\0" as *const u8 as *const c_char,
|
||||
signature: b"o\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &zriver_seat_status_v1_events_unfocused_output_types as *const _ },
|
||||
},
|
||||
wl_message {
|
||||
name: b"focused_view\0" as *const u8 as *const c_char,
|
||||
signature: b"s\0" as *const u8 as *const c_char,
|
||||
types: unsafe { &types_null as *const _ },
|
||||
},
|
||||
];
|
||||
#[doc = r" C representation of this interface, for interop"]
|
||||
pub static mut zriver_seat_status_v1_interface: wl_interface = wl_interface {
|
||||
name: b"zriver_seat_status_v1\0" as *const u8 as *const c_char,
|
||||
version: 1,
|
||||
request_count: 1,
|
||||
requests: unsafe { &zriver_seat_status_v1_requests as *const _ },
|
||||
event_count: 3,
|
||||
events: unsafe { &zriver_seat_status_v1_events as *const _ },
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user