mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-26 21:58:10 +01:00
Move api stuff into single mod
This commit is contained in:
parent
a0a6efe45a
commit
ea913e898c
10 changed files with 27 additions and 26 deletions
|
@ -84,7 +84,7 @@ use smithay_drm_extras::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
api::msg::{Args, OutgoingMsg},
|
||||
config::api::msg::{Args, OutgoingMsg},
|
||||
render::{pointer::PointerElement, CustomRenderElements},
|
||||
state::{
|
||||
take_presentation_feedback, Backend, CalloopData, State, SurfaceDmabufFeedback, WithState,
|
||||
|
@ -952,7 +952,7 @@ impl State {
|
|||
.expect("Stream doesn't exist");
|
||||
let mut stream = stream.lock().expect("Couldn't lock stream");
|
||||
for callback_id in dt.state.output_callback_ids.iter() {
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::CallCallback {
|
||||
callback_id: *callback_id,
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
pub mod api;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use anyhow::Context;
|
||||
use smithay::input::keyboard::keysyms;
|
||||
use toml::Table;
|
||||
|
||||
use crate::api::msg::Modifier;
|
||||
use api::msg::Modifier;
|
||||
|
||||
#[derive(serde::Deserialize, Debug)]
|
||||
pub struct Metaconfig {
|
|
@ -3,7 +3,7 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
api::msg::{CallbackId, Modifier, ModifierMask, MouseEdge, OutgoingMsg},
|
||||
config::api::msg::{CallbackId, Modifier, ModifierMask, MouseEdge, OutgoingMsg},
|
||||
focus::FocusTarget,
|
||||
state::{Backend, WithState},
|
||||
window::WindowElement,
|
||||
|
@ -235,7 +235,7 @@ impl State {
|
|||
match action {
|
||||
Some(KeyAction::CallCallback(callback_id)) => {
|
||||
if let Some(stream) = self.api_state.stream.as_ref() {
|
||||
if let Err(err) = crate::api::send_to_client(
|
||||
if let Err(err) = crate::config::api::send_to_client(
|
||||
&mut stream.lock().expect("Could not lock stream mutex"),
|
||||
&OutgoingMsg::CallCallback {
|
||||
callback_id,
|
||||
|
@ -289,7 +289,7 @@ impl State {
|
|||
{
|
||||
if let Some(stream) = self.api_state.stream.clone() {
|
||||
let mut stream = stream.lock().expect("failed to lock api stream");
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::CallCallback {
|
||||
callback_id,
|
||||
|
|
|
@ -16,15 +16,14 @@ use tracing_appender::rolling::Rotation;
|
|||
use tracing_subscriber::{fmt::writer::MakeWriterExt, EnvFilter};
|
||||
use xdg::BaseDirectories;
|
||||
|
||||
mod api;
|
||||
mod backend;
|
||||
mod config;
|
||||
mod cursor;
|
||||
mod focus;
|
||||
mod grab;
|
||||
mod handlers;
|
||||
mod input;
|
||||
mod layout;
|
||||
mod metaconfig;
|
||||
mod output;
|
||||
mod pointer;
|
||||
mod render;
|
||||
|
|
12
src/state.rs
12
src/state.rs
|
@ -11,18 +11,18 @@ use std::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
api::{
|
||||
backend::{udev::Udev, winit::Winit, BackendData},
|
||||
config::api::{
|
||||
msg::{
|
||||
window_rules::{WindowRule, WindowRuleCondition},
|
||||
CallbackId, ModifierMask, Msg,
|
||||
},
|
||||
PinnacleSocketSource,
|
||||
},
|
||||
backend::{udev::Udev, winit::Winit, BackendData},
|
||||
config::Metaconfig,
|
||||
cursor::Cursor,
|
||||
focus::FocusState,
|
||||
grab::resize_grab::ResizeSurfaceState,
|
||||
metaconfig::Metaconfig,
|
||||
tag::TagId,
|
||||
window::WindowElement,
|
||||
};
|
||||
|
@ -206,7 +206,7 @@ impl State {
|
|||
let config_dir = get_config_dir();
|
||||
tracing::debug!("config dir is {:?}", config_dir);
|
||||
|
||||
let metaconfig = crate::metaconfig::parse(&config_dir)?;
|
||||
let metaconfig = crate::config::parse(&config_dir)?;
|
||||
|
||||
// If a socket is provided in the metaconfig, use it.
|
||||
let socket_dir = if let Some(socket_dir) = &metaconfig.socket_dir {
|
||||
|
@ -223,7 +223,7 @@ impl State {
|
|||
crate::XDG_BASE_DIRS
|
||||
.get_runtime_directory()
|
||||
.cloned()
|
||||
.unwrap_or(PathBuf::from(crate::api::DEFAULT_SOCKET_DIR))
|
||||
.unwrap_or(PathBuf::from(crate::config::api::DEFAULT_SOCKET_DIR))
|
||||
};
|
||||
|
||||
let socket_source = PinnacleSocketSource::new(tx_channel, &socket_dir)
|
||||
|
@ -497,7 +497,7 @@ impl State {
|
|||
let config_dir = get_config_dir();
|
||||
|
||||
let metaconfig =
|
||||
crate::metaconfig::parse(&config_dir).context("Failed to parse metaconfig.toml")?;
|
||||
crate::config::parse(&config_dir).context("Failed to parse metaconfig.toml")?;
|
||||
|
||||
let ConfigReturn {
|
||||
reload_keybind,
|
||||
|
|
|
@ -10,7 +10,7 @@ use smithay::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
api::msg::{
|
||||
config::api::msg::{
|
||||
Args, CallbackId, KeyIntOrString, Msg, OutgoingMsg, Request, RequestId, RequestResponse,
|
||||
},
|
||||
focus::FocusTarget,
|
||||
|
@ -313,7 +313,7 @@ impl State {
|
|||
.expect("stream doesn't exist");
|
||||
let mut stream = stream.lock().expect("couldn't lock stream");
|
||||
for output in self.space.outputs() {
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::CallCallback {
|
||||
callback_id,
|
||||
|
@ -372,7 +372,7 @@ impl State {
|
|||
.collect::<Vec<_>>();
|
||||
|
||||
// FIXME: figure out what to do if error
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::RequestResponse {
|
||||
request_id,
|
||||
|
@ -418,7 +418,7 @@ impl State {
|
|||
let fullscreen_or_maximized = window
|
||||
.as_ref()
|
||||
.map(|win| win.with_state(|state| state.fullscreen_or_maximized));
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::RequestResponse {
|
||||
request_id,
|
||||
|
@ -441,7 +441,7 @@ impl State {
|
|||
.outputs()
|
||||
.map(|output| output.name())
|
||||
.collect::<Vec<_>>();
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::RequestResponse {
|
||||
request_id,
|
||||
|
@ -486,7 +486,7 @@ impl State {
|
|||
state.tags.iter().map(|tag| tag.id()).collect::<Vec<_>>()
|
||||
})
|
||||
});
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::RequestResponse {
|
||||
request_id,
|
||||
|
@ -512,7 +512,7 @@ impl State {
|
|||
.map(|tag| tag.id())
|
||||
.collect::<Vec<_>>();
|
||||
tracing::debug!("GetTags: {:?}", tag_ids);
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::RequestResponse {
|
||||
request_id,
|
||||
|
@ -529,7 +529,7 @@ impl State {
|
|||
.map(|output| output.name());
|
||||
let active = tag.as_ref().map(|tag| tag.active());
|
||||
let name = tag.as_ref().map(|tag| tag.name());
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::RequestResponse {
|
||||
request_id,
|
||||
|
@ -609,7 +609,7 @@ impl State {
|
|||
Ok(0) => break,
|
||||
Ok(_) => {
|
||||
let mut stream = stream_out.lock().expect("Couldn't lock stream");
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::CallCallback {
|
||||
callback_id,
|
||||
|
@ -645,7 +645,7 @@ impl State {
|
|||
Ok(0) => break,
|
||||
Ok(_) => {
|
||||
let mut stream = stream_err.lock().expect("Couldn't lock stream");
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::CallCallback {
|
||||
callback_id,
|
||||
|
@ -675,7 +675,7 @@ impl State {
|
|||
match child.status().await {
|
||||
Ok(exit_status) => {
|
||||
let mut stream = stream_exit.lock().expect("Couldn't lock stream");
|
||||
crate::api::send_to_client(
|
||||
crate::config::api::send_to_client(
|
||||
&mut stream,
|
||||
&OutgoingMsg::CallCallback {
|
||||
callback_id,
|
||||
|
|
|
@ -34,7 +34,7 @@ use smithay::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
api::msg::window_rules::{self, WindowRule},
|
||||
config::api::msg::window_rules::{self, WindowRule},
|
||||
state::{State, WithState},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue