MCPcopy Create free account
hub / github.com/StrataWM/strata / process_input_event

Method process_input_event

src/state.rs:122–161  ·  view source on GitHub ↗
(
		&mut self,
		event: InputEvent<I>,
	)

Source from the content-addressed store, hash-verified

120
121impl StrataState {
122 pub fn process_input_event<I: InputBackend>(
123 &mut self,
124 event: InputEvent<I>,
125 ) -> anyhow::Result<()> {
126 match event {
127 InputEvent::Keyboard { event, .. } => self.keyboard::<I>(event)?,
128 InputEvent::PointerMotion { event, .. } => self.pointer_motion::<I>(event)?,
129 InputEvent::PointerMotionAbsolute { event, .. } => {
130 self.pointer_motion_absolute::<I>(event)?
131 }
132 InputEvent::PointerButton { event, .. } => self.pointer_button::<I>(event)?,
133 InputEvent::PointerAxis { event, .. } => self.pointer_axis::<I>(event)?,
134 InputEvent::DeviceAdded { device: _ } => {
135 // todo
136 println!("device added");
137 }
138 InputEvent::DeviceRemoved { device: _ } => todo!(),
139 InputEvent::GestureSwipeBegin { event: _ } => todo!(),
140 InputEvent::GestureSwipeUpdate { event: _ } => todo!(),
141 InputEvent::GestureSwipeEnd { event: _ } => todo!(),
142 InputEvent::GesturePinchBegin { event: _ } => todo!(),
143 InputEvent::GesturePinchUpdate { event: _ } => todo!(),
144 InputEvent::GesturePinchEnd { event: _ } => todo!(),
145 InputEvent::GestureHoldBegin { event: _ } => todo!(),
146 InputEvent::GestureHoldEnd { event: _ } => todo!(),
147 InputEvent::TouchDown { event: _ } => todo!(),
148 InputEvent::TouchMotion { event: _ } => todo!(),
149 InputEvent::TouchUp { event: _ } => todo!(),
150 InputEvent::TouchCancel { event: _ } => todo!(),
151 InputEvent::TouchFrame { event: _ } => todo!(),
152 InputEvent::TabletToolAxis { event: _ } => todo!(),
153 InputEvent::TabletToolProximity { event: _ } => todo!(),
154 InputEvent::TabletToolTip { event: _ } => todo!(),
155 InputEvent::TabletToolButton { event: _ } => todo!(),
156 InputEvent::Special(_) => todo!(),
157 // _ => anyhow::bail!("unhandled winit event: {:#?}", &event),
158 };
159
160 Ok(())
161 }
162
163 pub fn keyboard<I: InputBackend>(&mut self, event: I::KeyboardKeyEvent) -> anyhow::Result<()> {
164 let serial = SERIAL_COUNTER.next_serial();

Callers 1

winit_dispatchFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected