all: split reusable components into workspace crates
This commit is contained in:
parent
2a079ed800
commit
657e7ce2f7
225 changed files with 7422 additions and 17602 deletions
|
|
@ -3,16 +3,14 @@
|
|||
use {
|
||||
crate::{
|
||||
_private::{
|
||||
ClientCriterionIpc, ClientCriterionStringField, Config, ConfigEntry, ConfigEntryGen,
|
||||
GenericCriterionIpc, PollableId, VERSION, WindowCriterionIpc,
|
||||
WindowCriterionStringField, WireMode, bincode_ops,
|
||||
ClientCriterionIpc, ClientCriterionStringField, GenericCriterionIpc, PollableId,
|
||||
WindowCriterionIpc, WindowCriterionStringField, WireMode, bincode_ops,
|
||||
ipc::{
|
||||
ClientMessage, InitMessage, Response, ServerFeature, ServerMessage, WorkspaceSource,
|
||||
},
|
||||
logging,
|
||||
},
|
||||
Axis, Direction, ModifiedKeySym, PciId, Workspace,
|
||||
client::{Client, ClientCapabilities, ClientCriterion, ClientMatcher, MatchedClient},
|
||||
client::{Client, ClientCriterion, ClientMatcher, MatchedClient},
|
||||
exec::Command,
|
||||
input::{
|
||||
FallbackOutputMode, FocusFollowsMouseMode, InputDevice, LayerDirection, Seat,
|
||||
|
|
@ -199,35 +197,6 @@ unsafe fn with_client<T, F: FnOnce(&ConfigClient) -> T>(data: *const u8, f: F) -
|
|||
})
|
||||
}
|
||||
|
||||
impl<T: Config> ConfigEntryGen<T> {
|
||||
pub const ENTRY: ConfigEntry = ConfigEntry {
|
||||
version: VERSION,
|
||||
init: Self::init,
|
||||
unref,
|
||||
handle_msg,
|
||||
};
|
||||
|
||||
pub unsafe extern "C" fn 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),
|
||||
init_data: *const u8,
|
||||
size: usize,
|
||||
) -> *const u8 {
|
||||
logging::init();
|
||||
unsafe {
|
||||
init(
|
||||
srv_data,
|
||||
srv_unref,
|
||||
srv_handler,
|
||||
init_data,
|
||||
size,
|
||||
T::configure,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe extern "C" fn init(
|
||||
srv_data: *const u8,
|
||||
srv_unref: unsafe extern "C" fn(data: *const u8),
|
||||
|
|
@ -348,15 +317,7 @@ impl ConfigClient {
|
|||
.drain()
|
||||
.map(|(a, b)| (a, b.into_raw_fd()))
|
||||
.collect();
|
||||
if command.tag.is_some() {
|
||||
self.send(&ClientMessage::Run3 {
|
||||
prog: &command.prog,
|
||||
args: command.args.clone(),
|
||||
env,
|
||||
fds,
|
||||
tag: command.tag.as_deref(),
|
||||
});
|
||||
} else if fds.is_empty() {
|
||||
if fds.is_empty() {
|
||||
self.send(&ClientMessage::Run {
|
||||
prog: &command.prog,
|
||||
args: command.args.clone(),
|
||||
|
|
@ -1556,22 +1517,6 @@ impl ConfigClient {
|
|||
connector
|
||||
}
|
||||
|
||||
pub fn set_client_matcher_capabilities(
|
||||
&self,
|
||||
matcher: ClientMatcher,
|
||||
caps: ClientCapabilities,
|
||||
) {
|
||||
self.send(&ClientMessage::SetClientMatcherCapabilities { matcher, caps });
|
||||
}
|
||||
|
||||
pub fn set_client_matcher_bounding_capabilities(
|
||||
&self,
|
||||
matcher: ClientMatcher,
|
||||
caps: ClientCapabilities,
|
||||
) {
|
||||
self.send(&ClientMessage::SetClientMatcherBoundingCapabilities { matcher, caps });
|
||||
}
|
||||
|
||||
pub fn latch<F: FnOnce() + 'static>(&self, seat: Seat, f: F) {
|
||||
if !self.feat_mod_mask.get() {
|
||||
log::error!("compositor does not support latching");
|
||||
|
|
@ -1673,12 +1618,6 @@ impl ConfigClient {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn get_socket_path(&self) -> Option<String> {
|
||||
let res = self.send_with_response(&ClientMessage::GetSocketPath);
|
||||
get_response!(res, None, GetSocketPath { path });
|
||||
Some(path)
|
||||
}
|
||||
|
||||
pub fn create_pollable(&self, fd: i32) -> Result<PollableId, String> {
|
||||
let res = self.send_with_response(&ClientMessage::AddPollable { fd });
|
||||
get_response!(
|
||||
|
|
@ -1867,8 +1806,6 @@ impl ConfigClient {
|
|||
ClientCriterion::CommRegex(t) => string!(t, Comm, true),
|
||||
ClientCriterion::Exe(t) => string!(t, Exe, false),
|
||||
ClientCriterion::ExeRegex(t) => string!(t, Exe, true),
|
||||
ClientCriterion::Tag(t) => string!(t, Tag, false),
|
||||
ClientCriterion::TagRegex(t) => string!(t, Tag, true),
|
||||
};
|
||||
let res = self.send_with_response(&ClientMessage::CreateClientMatcher { criterion });
|
||||
get_response!(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use {
|
|||
crate::{
|
||||
_private::{ClientCriterionIpc, PollableId, WindowCriterionIpc, WireMode},
|
||||
Axis, Direction, PciId, Workspace,
|
||||
client::{Client, ClientCapabilities, ClientMatcher},
|
||||
client::{Client, ClientMatcher},
|
||||
input::{
|
||||
FallbackOutputMode, FocusFollowsMouseMode, InputDevice, LayerDirection, Seat,
|
||||
SwitchEvent, Timeline, acceleration::AccelProfile, capability::Capability,
|
||||
|
|
@ -488,7 +488,6 @@ pub enum ClientMessage<'a> {
|
|||
SetExplicitSyncEnabled {
|
||||
enabled: bool,
|
||||
},
|
||||
GetSocketPath,
|
||||
DeviceSetKeymap {
|
||||
device: InputDevice,
|
||||
keymap: Keymap,
|
||||
|
|
@ -806,14 +805,6 @@ pub enum ClientMessage<'a> {
|
|||
SetTitleFont {
|
||||
font: &'a str,
|
||||
},
|
||||
SetClientMatcherCapabilities {
|
||||
matcher: ClientMatcher,
|
||||
caps: ClientCapabilities,
|
||||
},
|
||||
SetClientMatcherBoundingCapabilities {
|
||||
matcher: ClientMatcher,
|
||||
caps: ClientCapabilities,
|
||||
},
|
||||
ShowWorkspaceOn {
|
||||
seat: Seat,
|
||||
workspace: Workspace,
|
||||
|
|
@ -868,13 +859,6 @@ pub enum ClientMessage<'a> {
|
|||
SetXWaylandEnabled {
|
||||
enabled: bool,
|
||||
},
|
||||
Run3 {
|
||||
prog: &'a str,
|
||||
args: Vec<String>,
|
||||
env: Vec<(String, String)>,
|
||||
fds: Vec<(i32, i32)>,
|
||||
tag: Option<&'a str>,
|
||||
},
|
||||
ConnectorSupportsArbitraryModes {
|
||||
connector: Connector,
|
||||
},
|
||||
|
|
@ -1081,9 +1065,6 @@ pub enum Response {
|
|||
GetInputDeviceDevnode {
|
||||
devnode: String,
|
||||
},
|
||||
GetSocketPath {
|
||||
path: String,
|
||||
},
|
||||
GetFloatAboveFullscreen {
|
||||
above: bool,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue