1
0
Fork 0
forked from wry/wry

config: remove bincode command bridge

This commit is contained in:
kossLAN 2026-05-29 18:05:41 -04:00
parent d8920ed7a0
commit 87de5fcca3
No known key found for this signature in database
6 changed files with 64 additions and 119 deletions

View file

@ -15,10 +15,9 @@ use {
ptr_ext::PtrExt,
},
},
bincode::Options,
jay_config::{
_private::{
ConfigEntry, VERSION, bincode_ops,
ConfigEntry, VERSION,
ipc::{InitMessage, ServerFeature, ServerMessage, V1InitMessage},
},
input::{InputDevice, Seat, SwitchEvent},
@ -167,18 +166,17 @@ impl Drop for ConfigProxy {
}
}
unsafe extern "C" fn default_client_init(
unsafe fn default_client_init(
srv_data: *const u8,
srv_unref: unsafe extern "C" fn(data: *const u8),
srv_handler: unsafe extern "C" fn(data: *const u8, msg: *const u8, size: usize),
msg: *const u8,
size: usize,
srv_unref: jay_config::_private::Unref,
srv_handler: jay_config::_private::ServerHandler,
msg: InitMessage,
) -> *const u8 {
extern "C" fn configure() {
fn configure() {
jay_toml_config::configure();
}
unsafe {
jay_config::_private::client::init(srv_data, srv_unref, srv_handler, msg, size, configure)
jay_config::_private::client::init(srv_data, srv_unref, srv_handler, msg, configure)
}
}
@ -194,7 +192,6 @@ impl ConfigProxy {
state: state.clone(),
next_id: NumCell::new(1),
keymaps: Default::default(),
bufs: Default::default(),
workspace_ids: NumCell::new(1),
workspaces_by_name: Default::default(),
workspaces_by_id: Default::default(),
@ -218,16 +215,13 @@ impl ConfigProxy {
window_matcher_no_auto_focus: Default::default(),
window_matcher_initial_tile_state: Default::default(),
});
let init_msg = bincode_ops()
.serialize(&InitMessage::V1(V1InitMessage {}))
.unwrap();
let init_msg = InitMessage::V1(V1InitMessage {});
unsafe {
let client_data = (entry.init)(
Rc::into_raw(data.clone()) as _,
unref,
handle_msg,
init_msg.as_ptr(),
init_msg.len(),
init_msg,
);
data.client_data.set(client_data);
}
@ -259,21 +253,20 @@ impl ConfigProxy {
}
}
unsafe extern "C" fn unref(data: *const u8) {
unsafe fn unref(data: *const u8) {
let server = data as *const ConfigProxyHandler;
unsafe {
drop(Rc::from_raw(server));
}
}
unsafe extern "C" fn handle_msg(data: *const u8, msg: *const u8, size: usize) {
unsafe fn handle_msg(data: *const u8, msg: &jay_config::_private::ipc::ClientMessage<'_>) {
unsafe {
let server = (data as *const ConfigProxyHandler).deref();
if server.dropped.get() {
return;
}
let rc = Rc::from_raw(server);
let msg = std::slice::from_raw_parts(msg, size);
rc.handle_request(msg);
mem::forget(rc);
}