pinnacle/src/main.rs

97 lines
2.7 KiB
Rust
Raw Normal View History

2023-06-01 20:23:37 -05:00
mod backend;
2023-05-28 19:14:30 -05:00
mod grab;
mod handlers;
2023-05-29 12:45:04 -05:00
mod layout;
2023-05-28 19:14:30 -05:00
mod pointer;
mod tag;
2023-05-28 19:14:30 -05:00
mod window;
mod xdg;
use std::{error::Error, os::fd::AsRawFd, sync::Arc, time::Duration};
2023-06-01 20:23:37 -05:00
use backend::{winit::WinitData, Backend};
2023-05-28 19:14:30 -05:00
use smithay::{
backend::{
2023-06-01 20:23:37 -05:00
egl::EGLDevice,
2023-05-28 19:14:30 -05:00
input::{
AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputEvent, KeyState,
KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent,
},
renderer::{
damage::OutputDamageTracker, element::surface::WaylandSurfaceRenderElement,
2023-06-01 20:23:37 -05:00
gles::GlesRenderer, ImportDma,
2023-05-28 19:14:30 -05:00
},
winit::{WinitError, WinitEvent},
},
desktop::{space, Space, Window, WindowSurfaceType},
input::{
keyboard::{keysyms, FilterResult},
pointer::{AxisFrame, ButtonEvent, CursorImageStatus, MotionEvent},
SeatState,
},
output::{Output, Subpixel},
reexports::{
calloop::{
generic::Generic,
timer::{TimeoutAction, Timer},
EventLoop, Interest, LoopHandle, LoopSignal, Mode, PostAction,
},
wayland_protocols::xdg::shell::server::xdg_toplevel::ResizeEdge,
wayland_server::{
backend::{ClientData, ClientId, DisconnectReason},
Display,
},
},
utils::{Clock, Logical, Monotonic, Physical, Point, Scale, Transform, SERIAL_COUNTER},
wayland::{
compositor::{CompositorClientState, CompositorState},
data_device::DataDeviceState,
2023-06-01 20:23:37 -05:00
dmabuf::{DmabufFeedbackBuilder, DmabufState},
2023-05-28 19:14:30 -05:00
output::OutputManagerState,
shell::xdg::XdgShellState,
shm::ShmState,
socket::ListeningSocketSource,
},
};
fn main() -> Result<(), Box<dyn Error>> {
2023-06-01 20:23:37 -05:00
crate::backend::winit::run_winit()?;
2023-05-28 19:14:30 -05:00
Ok(())
}
2023-06-01 20:23:37 -05:00
pub struct State<B: Backend> {
pub backend_data: B,
2023-05-28 19:14:30 -05:00
pub loop_signal: LoopSignal,
2023-06-01 20:23:37 -05:00
pub loop_handle: LoopHandle<'static, CalloopData>,
2023-05-28 19:14:30 -05:00
pub clock: Clock<Monotonic>,
pub compositor_state: CompositorState,
pub data_device_state: DataDeviceState,
pub seat_state: SeatState<Self>,
pub shm_state: ShmState,
pub space: Space<Window>,
pub cursor_status: CursorImageStatus,
pub pointer_location: Point<f64, Logical>,
pub output_manager_state: OutputManagerState,
pub xdg_shell_state: XdgShellState,
pub move_mode: bool,
}
2023-06-01 20:23:37 -05:00
pub struct CalloopData {
pub display: Display<State<WinitData>>,
pub state: State<WinitData>,
2023-05-28 19:14:30 -05:00
}
#[derive(Default)]
struct ClientState {
pub compositor_state: CompositorClientState,
}
impl ClientData for ClientState {
fn initialized(&self, _client_id: ClientId) {}
fn disconnected(&self, _client_id: ClientId, _reason: DisconnectReason) {}
// fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {}
}