all: refactor to cargo workspace, remove config shared library, remove protocol perms, add dpms cli (#7)
This commit is contained in:
parent
5db14936e7
commit
bfc2a525de
616 changed files with 32344 additions and 31026 deletions
129
build/enums.rs
129
build/enums.rs
|
|
@ -4,18 +4,27 @@ use {
|
|||
std::{env, io::Write},
|
||||
};
|
||||
|
||||
#[expect(unused_macros)]
|
||||
#[macro_use]
|
||||
#[path = "../src/macros.rs"]
|
||||
mod macros;
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! cenum {
|
||||
($name:ident, $uc:ident; $($name2:ident = $val:expr,)*) => {
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub struct $name(pub i32);
|
||||
|
||||
#[path = "../src/libinput/consts.rs"]
|
||||
mod libinput;
|
||||
impl $name {
|
||||
pub fn raw(self) -> i32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[path = "../src/pango/consts.rs"]
|
||||
mod pango;
|
||||
pub const $uc: &[i32] = &[$($val,)*];
|
||||
|
||||
#[path = "../src/fontconfig/consts.rs"]
|
||||
$(
|
||||
pub const $name2: $name = $name($val);
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
#[path = "fontconfig_consts.rs"]
|
||||
mod fontconfig;
|
||||
|
||||
fn get_target() -> repc::Target {
|
||||
|
|
@ -49,108 +58,6 @@ fn write_ty<W: Write>(f: &mut W, vals: &[i32], ty: &str) -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
pub fn main() -> anyhow::Result<()> {
|
||||
let mut f = open("libinput_tys.rs")?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_LOG_PRIORITY,
|
||||
"libinput_log_priority",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_DEVICE_CAPABILITY,
|
||||
"libinput_device_capability",
|
||||
)?;
|
||||
write_ty(&mut f, libinput::LIBINPUT_KEY_STATE, "libinput_key_state")?;
|
||||
write_ty(&mut f, libinput::LIBINPUT_LED, "libinput_led")?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_BUTTON_STATE,
|
||||
"libinput_button_state",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_POINTER_AXIS,
|
||||
"libinput_pointer_axis",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_POINTER_AXIS_SOURCE,
|
||||
"libinput_pointer_axis_source",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_TABLET_PAD_RING_AXIS_SOURCE,
|
||||
"libinput_tablet_pad_ring_axis_source",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_TABLET_PAD_STRIP_AXIS_SOURCE,
|
||||
"libinput_tablet_pad_strip_axis_source",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_TABLET_TOOL_TYPE,
|
||||
"libinput_tablet_tool_type",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_TABLET_TOOL_PROXIMITY_STATE,
|
||||
"libinput_tablet_tool_proximity_state",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_TABLET_TOOL_TIP_STATE,
|
||||
"libinput_tablet_tool_tip_state",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_SWITCH_STATE,
|
||||
"libinput_switch_state",
|
||||
)?;
|
||||
write_ty(&mut f, libinput::LIBINPUT_SWITCH, "libinput_switch")?;
|
||||
write_ty(&mut f, libinput::LIBINPUT_EVENT_TYPE, "libinput_event_type")?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_CONFIG_STATUS,
|
||||
"libinput_config_status",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_CONFIG_ACCEL_PROFILE,
|
||||
"libinput_config_accel_profile",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_CONFIG_TAP_STATE,
|
||||
"libinput_config_tap_state",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_CONFIG_DRAG_STATE,
|
||||
"libinput_config_drag_state",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_CONFIG_DRAG_LOCK_STATE,
|
||||
"libinput_config_drag_lock_state",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_CONFIG_CLICK_METHOD,
|
||||
"libinput_config_click_method",
|
||||
)?;
|
||||
write_ty(
|
||||
&mut f,
|
||||
libinput::LIBINPUT_CONFIG_MIDDLE_EMULATION_STATE,
|
||||
"libinput_config_middle_emulation_state",
|
||||
)?;
|
||||
|
||||
let mut f = open("pango_tys.rs")?;
|
||||
write_ty(&mut f, pango::CAIRO_FORMATS, "cairo_format_t")?;
|
||||
write_ty(&mut f, pango::CAIRO_STATUSES, "cairo_status_t")?;
|
||||
write_ty(&mut f, pango::CAIRO_OPERATORS, "cairo_operator_t")?;
|
||||
write_ty(&mut f, pango::PANGO_ELLIPSIZE_MODES, "PangoEllipsizeMode_")?;
|
||||
|
||||
let mut f = open("fontconfig_tys.rs")?;
|
||||
write_ty(&mut f, fontconfig::FC_MATCH_KINDS, "FcMatchKind")?;
|
||||
write_ty(&mut f, fontconfig::FC_RESULTS, "FcResult")?;
|
||||
|
|
|
|||
20
build/fontconfig_consts.rs
Normal file
20
build/fontconfig_consts.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
cenum! {
|
||||
_FcMatchKind, FC_MATCH_KINDS;
|
||||
|
||||
FC_MATCH_PATTERN = 0,
|
||||
FC_MATCH_FONT = 1,
|
||||
FC_MATCH_SCAN = 2,
|
||||
FC_MATCH_KIND_END = 3,
|
||||
}
|
||||
|
||||
cenum! {
|
||||
_FcResult, FC_RESULTS;
|
||||
|
||||
FC_RESULT_MATCH = 0,
|
||||
FC_RESULT_NO_MATCH = 1,
|
||||
FC_RESULT_TYPE_MISMATCH = 2,
|
||||
FC_RESULT_NO_ID = 3,
|
||||
FC_RESULT_OUT_OF_MEMORY = 4,
|
||||
}
|
||||
|
|
@ -4,17 +4,10 @@ use {
|
|||
};
|
||||
|
||||
pub fn main() -> anyhow::Result<()> {
|
||||
create_bridge()?;
|
||||
create_version()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_bridge() -> anyhow::Result<()> {
|
||||
println!("cargo:rerun-if-changed=src/bridge.c");
|
||||
cc::Build::new().file("src/bridge.c").compile("bridge");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_version() -> anyhow::Result<()> {
|
||||
let mut version_string = env!("CARGO_PKG_VERSION").to_string();
|
||||
if let Ok(output) = Command::new("git").arg("rev-parse").arg("HEAD").output()
|
||||
|
|
|
|||
|
|
@ -417,6 +417,7 @@ fn write_file<W: Write>(
|
|||
let messages = parse_messages(&contents)?;
|
||||
writeln!(f)?;
|
||||
writeln!(f, "pub mod {} {{", obj_name)?;
|
||||
writeln!(f, " #![allow(dead_code)]")?;
|
||||
writeln!(f, " use super::*;")?;
|
||||
for message in messages.requests.iter().chain(messages.events.iter()) {
|
||||
write_message(f, &camel_obj_name, &message.val)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue