Add wlcs stub

This commit is contained in:
Leon Vack 2024-04-13 17:56:02 +02:00
parent 7e80a6a64f
commit bb832ae885
5 changed files with 181 additions and 4 deletions

55
Cargo.lock generated
View file

@ -562,6 +562,15 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "container_of"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89f5bbeb86761f66a87f8e327265ea0111f82f1928a84037b9abedab9f79472b"
dependencies = [
"memoffset 0.6.5",
]
[[package]]
name = "core-foundation"
version = "0.9.4"
@ -1461,6 +1470,15 @@ dependencies = [
"libc",
]
[[package]]
name = "memoffset"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.9.1"
@ -1532,6 +1550,17 @@ dependencies = [
"jni-sys",
]
[[package]]
name = "nix"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [
"bitflags 2.5.0",
"cfg-if",
"libc",
]
[[package]]
name = "nix"
version = "0.28.0"
@ -1765,7 +1794,7 @@ dependencies = [
"cliclack",
"dircpy",
"image",
"nix",
"nix 0.28.0",
"pinnacle",
"pinnacle-api",
"pinnacle-api-defs",
@ -3071,7 +3100,7 @@ dependencies = [
"dlib",
"libc",
"log",
"memoffset",
"memoffset 0.9.1",
"once_cell",
"pkg-config",
]
@ -3409,6 +3438,28 @@ dependencies = [
"memchr",
]
[[package]]
name = "wlcs"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d99c305ce368db32f0c675a3a17abbfd4123a59f4a1c56c0ee70b372cb7609e"
dependencies = [
"container_of",
"memoffset 0.9.1",
"nix 0.27.1",
"wayland-sys",
]
[[package]]
name = "wlcs_pinnacle"
version = "0.0.1"
dependencies = [
"pinnacle",
"smithay",
"wayland-sys",
"wlcs",
]
[[package]]
name = "x11-dl"
version = "2.21.0"

View file

@ -1,5 +1,10 @@
[workspace]
members = ["pinnacle-api-defs", "api/rust", "api/rust/pinnacle-api-macros"]
members = [
"pinnacle-api-defs",
"api/rust",
"api/rust/pinnacle-api-macros",
"wlcs_pinnacle",
]
[workspace.package]
authors = ["Ottatop <ottatop1227@gmail.com>"]
@ -76,8 +81,9 @@ dircpy = { workspace = true }
chrono = "0.4.37"
bytemuck = "1.15.0"
pinnacle-api = { path = "./api/rust" }
smithay = { workspace = true }
[dependencies.smithay]
[workspace.dependencies.smithay]
git = "https://github.com/Smithay/smithay"
rev = "c293ec7"
default-features = false

View file

@ -31,6 +31,17 @@
rust-analyzer
cargo-outdated
# wlcs
(writeScriptBin "wlcs" ''
#!/bin/sh
${wlcs}/libexec/wlcs/wlcs "$@"
'')
# build time stuff
pkg-config
protobuf
luarocks
wayland
# build time stuff

16
wlcs_pinnacle/Cargo.toml Normal file
View file

@ -0,0 +1,16 @@
[package]
name = "wlcs_pinnacle"
version = "0.0.1"
authors.workspace = true
edition.workspace = true
repository.workspace = true
publish = false
[lib]
crate-type = ["cdylib"]
[dependencies]
smithay = { workspace = true }
pinnacle = { path = ".." }
wayland-sys = { version = "0.31.1", features = ["client", "server"] }
wlcs = "0.1"

93
wlcs_pinnacle/src/lib.rs Normal file
View file

@ -0,0 +1,93 @@
use wayland_sys::{client::{wl_display, wl_proxy}, common::wl_fixed_t};
use wlcs::{
ffi_display_server_api::WlcsServerIntegration, ffi_wrappers::wlcs_server,
wlcs_server_integration, Pointer, Touch, Wlcs,
};
wlcs_server_integration!(PinnacleHandle);
struct PinnacleHandle {
// server: Option<(Sender<WlcsEvent>, JoinHandle<()>)>,
}
impl Wlcs for PinnacleHandle {
type Pointer = PointerHandle;
type Touch = TouchHandle;
fn new() -> Self {
todo!()
}
fn start(&mut self) {
todo!()
}
fn stop(&mut self) {
todo!()
}
fn create_client_socket(&self) -> std::io::Result<std::os::unix::prelude::OwnedFd> {
todo!()
}
fn position_window_absolute(
&self,
display: *mut wl_display,
surface: *mut wl_proxy,
x: i32,
y: i32,
) {
todo!()
}
fn create_pointer(&mut self) -> Option<Self::Pointer> {
todo!()
}
fn create_touch(&mut self) -> Option<Self::Touch> {
todo!()
}
fn get_descriptor(&self) -> &wlcs::ffi_display_server_api::WlcsIntegrationDescriptor {
todo!()
}
fn start_on_this_thread(&self, _event_loop: *mut wayland_sys::server::wl_event_loop) {}
}
struct PointerHandle {}
impl Pointer for PointerHandle {
fn move_absolute(&mut self, x: wl_fixed_t, y: wl_fixed_t) {
todo!()
}
fn move_relative(&mut self, dx: wl_fixed_t, dy: wl_fixed_t) {
todo!()
}
fn button_up(&mut self, button: i32) {
todo!()
}
fn button_down(&mut self, button: i32) {
todo!()
}
}
struct TouchHandle {}
impl Touch for TouchHandle {
fn touch_down(&mut self, x: wayland_sys::common::wl_fixed_t, y: wayland_sys::common::wl_fixed_t) {
todo!()
}
fn touch_move(&mut self, x: wayland_sys::common::wl_fixed_t, y: wayland_sys::common::wl_fixed_t) {
todo!()
}
fn touch_up(&mut self) {
todo!()
}
}