Skip to content

Commit

Permalink
Generate plasma protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
morr0ne committed Sep 13, 2024
1 parent 14412dc commit 2e48d8c
Show file tree
Hide file tree
Showing 4 changed files with 15,055 additions and 0 deletions.
31 changes: 31 additions & 0 deletions gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,37 @@ const PROTOCOLS: &[&str] = &[
"protocols/wlr-protocols/unstable/wlr-output-power-management-unstable-v1.xml",
"protocols/wlr-protocols/unstable/wlr-screencopy-unstable-v1.xml",
"protocols/wlr-protocols/unstable/wlr-virtual-pointer-unstable-v1.xml",

// KDE Plasma protocols
"protocols/plasma-wayland-protocols/src/protocols/appmenu.xml",
"protocols/plasma-wayland-protocols/src/protocols/blur.xml",
"protocols/plasma-wayland-protocols/src/protocols/contrast.xml",
"protocols/plasma-wayland-protocols/src/protocols/fullscreen-shell.xml",
"protocols/plasma-wayland-protocols/src/protocols/idle.xml",
"protocols/plasma-wayland-protocols/src/protocols/keystate.xml",
"protocols/plasma-wayland-protocols/src/protocols/output-management.xml",
"protocols/plasma-wayland-protocols/src/protocols/outputdevice.xml",
"protocols/plasma-wayland-protocols/src/protocols/remote-access.xml",
"protocols/plasma-wayland-protocols/src/protocols/server-decoration-palette.xml",
"protocols/plasma-wayland-protocols/src/protocols/server-decoration.xml",
"protocols/plasma-wayland-protocols/src/protocols/shadow.xml",
"protocols/plasma-wayland-protocols/src/protocols/slide.xml",
"protocols/plasma-wayland-protocols/src/protocols/surface-extension.xml",
"protocols/plasma-wayland-protocols/src/protocols/text-input-unstable-v2.xml",
"protocols/plasma-wayland-protocols/src/protocols/text-input.xml",
"protocols/plasma-wayland-protocols/src/protocols/wayland-eglstream-controller.xml",
"protocols/plasma-wayland-protocols/src/protocols/dpms.xml",
"protocols/plasma-wayland-protocols/src/protocols/fake-input.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-lockscreen-overlay-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-device-v2.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-management-v2.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-order-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-primary-output-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-screen-edge-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/org-kde-plasma-virtual-desktop.xml",
"protocols/plasma-wayland-protocols/src/protocols/plasma-shell.xml",
"protocols/plasma-wayland-protocols/src/protocols/plasma-window-management.xml",
"protocols/plasma-wayland-protocols/src/protocols/zkde-screencast-unstable-v1.xml",
];

#[derive(Parser, Debug)]
Expand Down
3 changes: 3 additions & 0 deletions gen/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use heck::ToUpperCamelCase;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use serde::{Deserialize, Serialize};
use tracing::debug;

use crate::utils::make_ident;

Expand Down Expand Up @@ -73,6 +74,7 @@ pub struct Arg {
pub allow_null: bool,
#[serde(rename(deserialize = "@summary"))]
pub summary: Option<String>,
pub description: Option<String>,
}

#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
Expand Down Expand Up @@ -129,6 +131,7 @@ pub struct Entry {

impl Protocol {
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self> {
debug!("Parsing protocol {}", path.as_ref().display());
Ok(quick_xml::de::from_str(&fs::read_to_string(path)?)?)
}
}
Expand Down
Loading

0 comments on commit 2e48d8c

Please sign in to comment.