backend: add ButtonState
This commit is contained in:
parent
e22e6680b6
commit
0e1be7544f
17 changed files with 75 additions and 66 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::KeyState,
|
||||
backend::ButtonState,
|
||||
ei::{
|
||||
ei_client::{EiClient, EiClientError},
|
||||
ei_ifs::ei_device::{EiDevice, EiDeviceInterface},
|
||||
|
|
@ -27,7 +27,7 @@ pub struct EiButton {
|
|||
ei_device_interface!(EiButton, ei_button, button);
|
||||
|
||||
impl EiButton {
|
||||
pub fn send_button(&self, button: u32, state: KeyState) {
|
||||
pub fn send_button(&self, button: u32, state: ButtonState) {
|
||||
self.client.event(ServerButton {
|
||||
self_id: self.id,
|
||||
button,
|
||||
|
|
@ -46,8 +46,8 @@ impl EiButtonRequestHandler for EiButton {
|
|||
|
||||
fn client_button(&self, req: ClientButton, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
let pressed = match req.state {
|
||||
0 => KeyState::Released,
|
||||
1 => KeyState::Pressed,
|
||||
0 => ButtonState::Released,
|
||||
1 => ButtonState::Pressed,
|
||||
_ => return Err(EiButtonError::InvalidButtonState(req.state)),
|
||||
};
|
||||
self.device.button_changes.push((req.button, pressed));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::{KeyState, ScrollAxis},
|
||||
backend::{ButtonState, KeyState, ScrollAxis},
|
||||
ei::{
|
||||
ei_client::{EiClient, EiClientError},
|
||||
ei_ifs::{ei_seat::EiSeat, ei_touchscreen::TouchChange},
|
||||
|
|
@ -40,7 +40,7 @@ pub struct EiDevice {
|
|||
pub version: EiVersion,
|
||||
pub seat: Rc<EiSeat>,
|
||||
|
||||
pub button_changes: SyncQueue<(u32, KeyState)>,
|
||||
pub button_changes: SyncQueue<(u32, ButtonState)>,
|
||||
pub touch_changes: CopyHashMap<u32, TouchChange>,
|
||||
pub scroll_px: [Cell<Option<f32>>; 2],
|
||||
pub scroll_v120: [Cell<Option<i32>>; 2],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::KeyState,
|
||||
backend::{ButtonState, KeyState},
|
||||
ei::{
|
||||
EiContext,
|
||||
ei_client::{EiClient, EiClientError},
|
||||
|
|
@ -150,7 +150,7 @@ impl EiSeat {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handle_button(&self, time_usec: u64, button: u32, state: KeyState) {
|
||||
pub fn handle_button(&self, time_usec: u64, button: u32, state: ButtonState) {
|
||||
if self.is_sender() {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue