config: expose runtime protocol
This commit is contained in:
parent
bcc85c8b1b
commit
e3f122e903
16 changed files with 179 additions and 157 deletions
|
|
@ -84,7 +84,7 @@ use {
|
|||
},
|
||||
ahash::AHashSet,
|
||||
forker::ForkerProxy,
|
||||
jay_config::_private::DEFAULT_SEAT_NAME,
|
||||
jay_config::protocol::DEFAULT_SEAT_NAME,
|
||||
std::{
|
||||
cell::{Cell, RefCell},
|
||||
env,
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ use {
|
|||
},
|
||||
},
|
||||
jay_config::{
|
||||
_private::{
|
||||
ConfigEntry, VERSION,
|
||||
messages::{InitMessage, ServerFeature, ServerMessage, V1InitMessage},
|
||||
protocol::{
|
||||
ClientMessage, ConfigEntry, InitMessage, ServerFeature, ServerHandler, ServerMessage,
|
||||
Unref, V1InitMessage, VERSION, handle_client_message, init_client, unref_client,
|
||||
},
|
||||
input::{InputDevice, Seat, SwitchEvent},
|
||||
keyboard::{mods::Modifiers, syms::KeySym},
|
||||
|
|
@ -168,15 +168,15 @@ impl Drop for ConfigProxy {
|
|||
|
||||
unsafe fn default_client_init(
|
||||
srv_data: *const u8,
|
||||
srv_unref: jay_config::_private::Unref,
|
||||
srv_handler: jay_config::_private::ServerHandler,
|
||||
srv_unref: Unref,
|
||||
srv_handler: ServerHandler,
|
||||
msg: InitMessage,
|
||||
) -> *const u8 {
|
||||
fn configure() {
|
||||
jay_toml_config::configure();
|
||||
}
|
||||
unsafe {
|
||||
jay_config::_private::client::init(srv_data, srv_unref, srv_handler, msg, configure)
|
||||
init_client(srv_data, srv_unref, srv_handler, msg, configure)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -241,8 +241,8 @@ impl ConfigProxy {
|
|||
let entry = ConfigEntry {
|
||||
version: VERSION,
|
||||
init: default_client_init,
|
||||
unref: jay_config::_private::client::unref,
|
||||
handle_msg: jay_config::_private::client::handle_msg,
|
||||
unref: unref_client,
|
||||
handle_msg: handle_client_message,
|
||||
};
|
||||
Self::new(&entry, state)
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ unsafe fn unref(data: *const u8) {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe fn handle_msg(data: *const u8, msg: &jay_config::_private::messages::ClientMessage<'_>) {
|
||||
unsafe fn handle_msg(data: *const u8, msg: &ClientMessage<'_>) {
|
||||
unsafe {
|
||||
let server = (data as *const ConfigProxyHandler).deref();
|
||||
if server.dropped.get() {
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ use {
|
|||
},
|
||||
},
|
||||
jay_config::{
|
||||
_private::{
|
||||
ClientCriterionPayload, ClientCriterionStringField, GenericCriterionPayload, PollableId,
|
||||
ConfigHandler, Unref, WindowCriterionPayload, WindowCriterionStringField, WireMode,
|
||||
messages::{ClientMessage, Response, ServerMessage, WorkspaceSource},
|
||||
protocol::{
|
||||
ClientCriterionPayload, ClientCriterionStringField, ClientMessage, ConfigHandler,
|
||||
GenericCriterionPayload, PollableId, Response, ServerMessage, Unref,
|
||||
WindowCriterionPayload, WindowCriterionStringField, WireMode, WorkspaceSource,
|
||||
},
|
||||
Axis, Direction, Workspace,
|
||||
client::{Client as ConfigClient, ClientMatcher},
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ use {
|
|||
},
|
||||
ahash::AHashMap,
|
||||
bincode::Options,
|
||||
jay_config::_private::bincode_ops,
|
||||
log::Level,
|
||||
serde::{Deserialize, Serialize},
|
||||
std::{
|
||||
|
|
@ -38,6 +37,13 @@ use {
|
|||
uapi::{Errno, Fd, IntoUstr, OwnedFd, UstrPtr, c},
|
||||
};
|
||||
|
||||
pub fn bincode_ops() -> impl Options {
|
||||
bincode::DefaultOptions::new()
|
||||
.with_fixint_encoding()
|
||||
.with_little_endian()
|
||||
.with_no_limit()
|
||||
}
|
||||
|
||||
pub struct ForkerProxy {
|
||||
pidfd: Rc<OwnedFd>,
|
||||
socket: Rc<OwnedFd>,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use {
|
|||
|
||||
use {
|
||||
crate::{
|
||||
forker::ForkerError,
|
||||
forker::{ForkerError, bincode_ops},
|
||||
io_uring::IoUring,
|
||||
utils::{
|
||||
buf::DynamicBuf,
|
||||
|
|
@ -14,7 +14,6 @@ use {
|
|||
vec_ext::VecExt,
|
||||
},
|
||||
},
|
||||
jay_config::_private::bincode_ops,
|
||||
uapi::OwnedFd,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ use {
|
|||
},
|
||||
isnt::std_1::primitive::IsntConstPtrExt,
|
||||
jay_config::{
|
||||
_private::{
|
||||
ConfigEntry, VERSION,
|
||||
messages::{ClientMessage, Response, ServerMessage},
|
||||
protocol::{
|
||||
ClientMessage, ConfigEntry, InitMessage, Response, ServerHandler, ServerMessage, Unref,
|
||||
VERSION,
|
||||
},
|
||||
Axis, Direction,
|
||||
input::{InputDevice, Seat},
|
||||
|
|
@ -54,9 +54,9 @@ where
|
|||
|
||||
unsafe fn init(
|
||||
srv_data: *const u8,
|
||||
srv_unref: jay_config::_private::Unref,
|
||||
srv_handler: jay_config::_private::ServerHandler,
|
||||
_msg: jay_config::_private::messages::InitMessage,
|
||||
srv_unref: Unref,
|
||||
srv_handler: ServerHandler,
|
||||
_msg: InitMessage,
|
||||
) -> *const u8 {
|
||||
let tc = CONFIG.get();
|
||||
assert!(tc.is_not_null());
|
||||
|
|
@ -128,8 +128,8 @@ unsafe fn handle_msg(data: *const u8, msg: &ServerMessage) {
|
|||
#[derive(Copy, Clone)]
|
||||
struct ServerData {
|
||||
srv_data: *const u8,
|
||||
srv_unref: jay_config::_private::Unref,
|
||||
srv_handler: jay_config::_private::ServerHandler,
|
||||
srv_unref: Unref,
|
||||
srv_handler: ServerHandler,
|
||||
}
|
||||
|
||||
pub struct TestConfig {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use {
|
|||
tasks::udev_utils::{UdevProps, udev_props},
|
||||
utils::{asyncevent::AsyncEvent, event_listener::EventListener},
|
||||
},
|
||||
jay_config::_private::DEFAULT_SEAT_NAME,
|
||||
jay_config::protocol::DEFAULT_SEAT_NAME,
|
||||
std::{
|
||||
cell::Cell,
|
||||
rc::{Rc, Weak},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue