1
0
Fork 0
forked from wry/wry

autocommit 2022-02-14 21:13:42 CET

This commit is contained in:
Julian Orth 2022-02-14 21:13:42 +01:00
parent 9b8e1ac29f
commit da6b29f138
44 changed files with 5903 additions and 364 deletions

View file

@ -1,26 +1,29 @@
use crate::async_engine::{AsyncEngine, SpawnedFuture};
use crate::backend::{BackendEvent, OutputId, OutputIds, SeatId, SeatIds};
use crate::backend::{BackendEvent, KeyboardId, KeyboardIds, MouseId, MouseIds, OutputId, OutputIds};
use crate::client::{Client, Clients};
use crate::config::ConfigProxy;
use crate::cursor::ServerCursors;
use crate::event_loop::EventLoop;
use crate::globals::{Globals, GlobalsError, WaylandGlobal};
use crate::ifs::wl_output::WlOutputGlobal;
use crate::ifs::wl_seat::WlSeatGlobal;
use crate::ifs::wl_seat::{SeatIds, WlSeatGlobal};
use crate::ifs::wl_surface::NoneSurfaceExt;
use crate::render::RenderContext;
use crate::tree::{DisplayNode, NodeIds};
use crate::utils::asyncevent::AsyncEvent;
use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::linkedlist::LinkedList;
use crate::utils::numcell::NumCell;
use crate::utils::queue::AsyncQueue;
use crate::{ErrorFmt, Wheel};
use crate::{ErrorFmt, Wheel, XkbContext};
use ahash::AHashMap;
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use crate::xkbcommon::XkbKeymap;
pub struct State {
pub xkb_ctx: XkbContext,
pub default_keymap: Rc<XkbKeymap>,
pub eng: Rc<AsyncEngine>,
pub el: Rc<EventLoop>,
pub render_ctx: CloneCell<Option<Rc<RenderContext>>>,
@ -31,21 +34,36 @@ pub struct State {
pub globals: Globals,
pub output_ids: OutputIds,
pub seat_ids: SeatIds,
pub kb_ids: KeyboardIds,
pub mouse_ids: MouseIds,
pub node_ids: NodeIds,
pub root: Rc<DisplayNode>,
pub backend_events: AsyncQueue<BackendEvent>,
pub output_handlers: RefCell<AHashMap<OutputId, SpawnedFuture<()>>>,
pub seats: RefCell<AHashMap<SeatId, SeatData>>,
pub mouse_handlers: RefCell<AHashMap<MouseId, MouseData>>,
pub kb_handlers: RefCell<AHashMap<KeyboardId, KeyboardData>>,
pub outputs: CopyHashMap<OutputId, Rc<WlOutputGlobal>>,
pub seat_queue: LinkedList<Rc<WlSeatGlobal>>,
pub slow_clients: AsyncQueue<Rc<Client>>,
pub none_surface_ext: Rc<NoneSurfaceExt>,
pub tree_changed_sent: Cell<bool>,
pub config: CloneCell<Option<Rc<ConfigProxy>>>,
}
pub struct SeatData {
pub struct MouseData {
pub handler: SpawnedFuture<()>,
pub tree_changed: Rc<AsyncEvent>,
pub id: MouseId,
pub data: Rc<DeviceHandlerData>
}
pub struct KeyboardData {
pub handler: SpawnedFuture<()>,
pub id: KeyboardId,
pub data: Rc<DeviceHandlerData>
}
pub struct DeviceHandlerData {
pub seat: CloneCell<Option<Rc<WlSeatGlobal>>>,
}
impl State {
@ -73,9 +91,9 @@ impl State {
if self.tree_changed_sent.replace(true) {
return;
}
let seats = self.seats.borrow();
let seats = self.globals.seats.lock();
for seat in seats.values() {
seat.tree_changed.trigger();
seat.trigger_tree_changed();
}
}
}