backend: add ButtonState
This commit is contained in:
parent
e22e6680b6
commit
0e1be7544f
17 changed files with 75 additions and 66 deletions
|
|
@ -317,6 +317,12 @@ pub enum KeyState {
|
||||||
Pressed,
|
Pressed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||||
|
pub enum ButtonState {
|
||||||
|
Released,
|
||||||
|
Pressed,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Linearize)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, Linearize)]
|
||||||
pub enum ScrollAxis {
|
pub enum ScrollAxis {
|
||||||
Horizontal = HORIZONTAL_SCROLL as _,
|
Horizontal = HORIZONTAL_SCROLL as _,
|
||||||
|
|
@ -369,7 +375,7 @@ pub enum InputEvent {
|
||||||
Button {
|
Button {
|
||||||
time_usec: u64,
|
time_usec: u64,
|
||||||
button: u32,
|
button: u32,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
},
|
},
|
||||||
|
|
||||||
AxisPx {
|
AxisPx {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
async_engine::SpawnedFuture,
|
async_engine::SpawnedFuture,
|
||||||
backend::{
|
backend::{
|
||||||
Backend, InputDevice, InputDeviceAccelProfile, InputDeviceCapability,
|
Backend, ButtonState, InputDevice, InputDeviceAccelProfile, InputDeviceCapability,
|
||||||
InputDeviceClickMethod, InputDeviceGroupId, InputDeviceId, InputEvent, KeyState, Leds,
|
InputDeviceClickMethod, InputDeviceGroupId, InputDeviceId, InputEvent, KeyState, Leds,
|
||||||
TransformMatrix, transaction::BackendConnectorTransactionError,
|
TransformMatrix, transaction::BackendConnectorTransactionError,
|
||||||
},
|
},
|
||||||
|
|
@ -598,7 +598,7 @@ impl MetalInputDevice {
|
||||||
self.event(InputEvent::Button {
|
self.event(InputEvent::Button {
|
||||||
time_usec,
|
time_usec,
|
||||||
button,
|
button,
|
||||||
state: KeyState::Released,
|
state: ButtonState::Released,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::{AxisSource, InputEvent, KeyState, ScrollAxis},
|
backend::{AxisSource, ButtonState, InputEvent, KeyState, ScrollAxis},
|
||||||
backends::metal::MetalBackend,
|
backends::metal::MetalBackend,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
ifs::wl_seat::tablet::{
|
ifs::wl_seat::tablet::{
|
||||||
|
|
@ -216,12 +216,12 @@ impl MetalBackend {
|
||||||
if dev.pressed_buttons.insert(event.button(), ()).is_some() {
|
if dev.pressed_buttons.insert(event.button(), ()).is_some() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KeyState::Pressed
|
ButtonState::Pressed
|
||||||
} else {
|
} else {
|
||||||
if dev.pressed_buttons.remove(&event.button()).is_none() {
|
if dev.pressed_buttons.remove(&event.button()).is_none() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KeyState::Released
|
ButtonState::Released
|
||||||
};
|
};
|
||||||
dev.event(InputEvent::Button {
|
dev.event(InputEvent::Button {
|
||||||
time_usec: event.time_usec(),
|
time_usec: event.time_usec(),
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,10 @@ use {
|
||||||
async_engine::{Phase, SpawnedFuture},
|
async_engine::{Phase, SpawnedFuture},
|
||||||
backend::{
|
backend::{
|
||||||
AXIS_120, AxisSource, Backend, BackendConnectorState, BackendDrmDevice, BackendEvent,
|
AXIS_120, AxisSource, Backend, BackendConnectorState, BackendDrmDevice, BackendEvent,
|
||||||
Connector, ConnectorEvent, ConnectorId, ConnectorKernelId, DrmDeviceId, DrmEvent,
|
ButtonState, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId, DrmDeviceId,
|
||||||
InputDevice, InputDeviceAccelProfile, InputDeviceCapability, InputDeviceClickMethod,
|
DrmEvent, InputDevice, InputDeviceAccelProfile, InputDeviceCapability,
|
||||||
InputDeviceId, InputEvent, KeyState, Mode, MonitorInfo, ScrollAxis, TransformMatrix,
|
InputDeviceClickMethod, InputDeviceId, InputEvent, KeyState, Mode, MonitorInfo,
|
||||||
|
ScrollAxis, TransformMatrix,
|
||||||
transaction::{
|
transaction::{
|
||||||
BackendAppliedConnectorTransaction, BackendConnectorTransaction,
|
BackendAppliedConnectorTransaction, BackendConnectorTransaction,
|
||||||
BackendConnectorTransactionError, BackendConnectorTransactionType,
|
BackendConnectorTransactionError, BackendConnectorTransactionType,
|
||||||
|
|
@ -817,8 +818,8 @@ impl XBackend {
|
||||||
match event.code() {
|
match event.code() {
|
||||||
XiMotion::OPCODE => self.handle_input_motion(event),
|
XiMotion::OPCODE => self.handle_input_motion(event),
|
||||||
XiEnter::OPCODE => self.handle_input_enter(event),
|
XiEnter::OPCODE => self.handle_input_enter(event),
|
||||||
XiButtonPress::OPCODE => self.handle_input_button_press(event, KeyState::Pressed),
|
XiButtonPress::OPCODE => self.handle_input_button_press(event, ButtonState::Pressed),
|
||||||
XiButtonRelease::OPCODE => self.handle_input_button_press(event, KeyState::Released),
|
XiButtonRelease::OPCODE => self.handle_input_button_press(event, ButtonState::Released),
|
||||||
XiKeyPress::OPCODE => self.handle_input_key_press(event, KeyState::Pressed),
|
XiKeyPress::OPCODE => self.handle_input_key_press(event, KeyState::Pressed),
|
||||||
XiKeyRelease::OPCODE => self.handle_input_key_press(event, KeyState::Released),
|
XiKeyRelease::OPCODE => self.handle_input_key_press(event, KeyState::Released),
|
||||||
XiHierarchy::OPCODE => self.handle_input_hierarchy(event).await,
|
XiHierarchy::OPCODE => self.handle_input_hierarchy(event).await,
|
||||||
|
|
@ -829,14 +830,14 @@ impl XBackend {
|
||||||
fn handle_input_button_press(
|
fn handle_input_button_press(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
event: &Event,
|
event: &Event,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
) -> Result<(), XBackendError> {
|
) -> Result<(), XBackendError> {
|
||||||
let event: XiButtonPress = event.parse()?;
|
let event: XiButtonPress = event.parse()?;
|
||||||
if let Some(seat) = self.mouse_seats.get(&event.deviceid) {
|
if let Some(seat) = self.mouse_seats.get(&event.deviceid) {
|
||||||
let button = event.detail;
|
let button = event.detail;
|
||||||
// let button = seat.button_map.get(&event.detail).unwrap_or(event.detail);
|
// let button = seat.button_map.get(&event.detail).unwrap_or(event.detail);
|
||||||
if matches!(button, 4..=7) {
|
if matches!(button, 4..=7) {
|
||||||
if state == KeyState::Pressed {
|
if state == ButtonState::Pressed {
|
||||||
let (axis, val) = match button {
|
let (axis, val) = match button {
|
||||||
4 => (ScrollAxis::Vertical, -1),
|
4 => (ScrollAxis::Vertical, -1),
|
||||||
5 => (ScrollAxis::Vertical, 1),
|
5 => (ScrollAxis::Vertical, 1),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::KeyState,
|
backend::ButtonState,
|
||||||
ei::{
|
ei::{
|
||||||
ei_client::{EiClient, EiClientError},
|
ei_client::{EiClient, EiClientError},
|
||||||
ei_ifs::ei_device::{EiDevice, EiDeviceInterface},
|
ei_ifs::ei_device::{EiDevice, EiDeviceInterface},
|
||||||
|
|
@ -27,7 +27,7 @@ pub struct EiButton {
|
||||||
ei_device_interface!(EiButton, ei_button, button);
|
ei_device_interface!(EiButton, ei_button, button);
|
||||||
|
|
||||||
impl EiButton {
|
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.client.event(ServerButton {
|
||||||
self_id: self.id,
|
self_id: self.id,
|
||||||
button,
|
button,
|
||||||
|
|
@ -46,8 +46,8 @@ impl EiButtonRequestHandler for EiButton {
|
||||||
|
|
||||||
fn client_button(&self, req: ClientButton, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
fn client_button(&self, req: ClientButton, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||||
let pressed = match req.state {
|
let pressed = match req.state {
|
||||||
0 => KeyState::Released,
|
0 => ButtonState::Released,
|
||||||
1 => KeyState::Pressed,
|
1 => ButtonState::Pressed,
|
||||||
_ => return Err(EiButtonError::InvalidButtonState(req.state)),
|
_ => return Err(EiButtonError::InvalidButtonState(req.state)),
|
||||||
};
|
};
|
||||||
self.device.button_changes.push((req.button, pressed));
|
self.device.button_changes.push((req.button, pressed));
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::{KeyState, ScrollAxis},
|
backend::{ButtonState, KeyState, ScrollAxis},
|
||||||
ei::{
|
ei::{
|
||||||
ei_client::{EiClient, EiClientError},
|
ei_client::{EiClient, EiClientError},
|
||||||
ei_ifs::{ei_seat::EiSeat, ei_touchscreen::TouchChange},
|
ei_ifs::{ei_seat::EiSeat, ei_touchscreen::TouchChange},
|
||||||
|
|
@ -40,7 +40,7 @@ pub struct EiDevice {
|
||||||
pub version: EiVersion,
|
pub version: EiVersion,
|
||||||
pub seat: Rc<EiSeat>,
|
pub seat: Rc<EiSeat>,
|
||||||
|
|
||||||
pub button_changes: SyncQueue<(u32, KeyState)>,
|
pub button_changes: SyncQueue<(u32, ButtonState)>,
|
||||||
pub touch_changes: CopyHashMap<u32, TouchChange>,
|
pub touch_changes: CopyHashMap<u32, TouchChange>,
|
||||||
pub scroll_px: [Cell<Option<f32>>; 2],
|
pub scroll_px: [Cell<Option<f32>>; 2],
|
||||||
pub scroll_v120: [Cell<Option<i32>>; 2],
|
pub scroll_v120: [Cell<Option<i32>>; 2],
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::KeyState,
|
backend::{ButtonState, KeyState},
|
||||||
ei::{
|
ei::{
|
||||||
EiContext,
|
EiContext,
|
||||||
ei_client::{EiClient, EiClientError},
|
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() {
|
if self.is_sender() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::{InputDeviceId, KeyState, ScrollAxis},
|
backend::{ButtonState, InputDeviceId, KeyState, ScrollAxis},
|
||||||
client::Client,
|
client::Client,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
ifs::wl_seat::{
|
ifs::wl_seat::{
|
||||||
|
|
@ -79,7 +79,7 @@ impl JaySeatEvents {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_button(&self, seat: SeatId, time_usec: u64, button: u32, state: KeyState) {
|
pub fn send_button(&self, seat: SeatId, time_usec: u64, button: u32, state: ButtonState) {
|
||||||
self.client.event(Button {
|
self.client.event(Button {
|
||||||
self_id: self.id,
|
self_id: self.id,
|
||||||
seat: seat.raw(),
|
seat: seat.raw(),
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ pub mod zwp_virtual_keyboard_v1;
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
async_engine::SpawnedFuture,
|
async_engine::SpawnedFuture,
|
||||||
backend::{KeyState, Leds},
|
backend::{ButtonState, Leds},
|
||||||
client::{Client, ClientError, ClientId},
|
client::{Client, ClientError, ClientId},
|
||||||
cursor_user::{CursorUser, CursorUserGroup, CursorUserOwner},
|
cursor_user::{CursorUser, CursorUserGroup, CursorUserOwner},
|
||||||
ei::ei_ifs::ei_seat::EiSeat,
|
ei::ei_ifs::ei_seat::EiSeat,
|
||||||
|
|
@ -1387,10 +1387,10 @@ impl WlSeatGlobal {
|
||||||
node: Rc<dyn Node>,
|
node: Rc<dyn Node>,
|
||||||
time_usec: u64,
|
time_usec: u64,
|
||||||
button: u32,
|
button: u32,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
serial: u64,
|
serial: u64,
|
||||||
) {
|
) {
|
||||||
if self.tray_popups.is_not_empty() && state == KeyState::Pressed {
|
if self.tray_popups.is_not_empty() && state == ButtonState::Pressed {
|
||||||
let id = node.node_tray_item();
|
let id = node.node_tray_item();
|
||||||
self.tray_popups.lock().retain(|&(tray_item_id, _), item| {
|
self.tray_popups.lock().retain(|&(tray_item_id, _), item| {
|
||||||
let retain = Some(tray_item_id) == id;
|
let retain = Some(tray_item_id) == id;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::{
|
backend::{
|
||||||
AXIS_120, AxisSource, ConnectorId, InputDeviceId, InputEvent, KeyState, ScrollAxis,
|
AXIS_120, AxisSource, ButtonState, ConnectorId, InputDeviceId, InputEvent, KeyState,
|
||||||
|
ScrollAxis,
|
||||||
},
|
},
|
||||||
client::ClientId,
|
client::ClientId,
|
||||||
config::InvokedShortcut,
|
config::InvokedShortcut,
|
||||||
|
|
@ -672,7 +673,7 @@ impl WlSeatGlobal {
|
||||||
self.motion_event_abs(time_usec, x, y, false);
|
self.motion_event_abs(time_usec, x, y, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn button_event(self: &Rc<Self>, time_usec: u64, button: u32, state: KeyState) {
|
pub fn button_event(self: &Rc<Self>, time_usec: u64, button: u32, state: ButtonState) {
|
||||||
self.for_each_ei_seat(|ei_seat| {
|
self.for_each_ei_seat(|ei_seat| {
|
||||||
ei_seat.handle_button(time_usec, button, state);
|
ei_seat.handle_button(time_usec, button, state);
|
||||||
});
|
});
|
||||||
|
|
@ -1314,12 +1315,12 @@ impl WlSeatGlobal {
|
||||||
surface: &Rc<WlSurface>,
|
surface: &Rc<WlSurface>,
|
||||||
time_usec: u64,
|
time_usec: u64,
|
||||||
button: u32,
|
button: u32,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
serial: u64,
|
serial: u64,
|
||||||
) {
|
) {
|
||||||
let (state, pressed) = match state {
|
let (state, pressed) = match state {
|
||||||
KeyState::Released => (wl_pointer::RELEASED, false),
|
ButtonState::Released => (wl_pointer::RELEASED, false),
|
||||||
KeyState::Pressed => {
|
ButtonState::Pressed => {
|
||||||
surface.client.focus_stealing_serial.set(Some(serial));
|
surface.client.focus_stealing_serial.set(Some(serial));
|
||||||
(wl_pointer::PRESSED, true)
|
(wl_pointer::PRESSED, true)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::{AXIS_120, AxisSource, KeyState, ScrollAxis},
|
backend::{AXIS_120, AxisSource, ButtonState, ScrollAxis},
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
ifs::{
|
ifs::{
|
||||||
|
|
@ -57,7 +57,7 @@ impl Default for PointerOwnerHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PointerOwnerHolder {
|
impl PointerOwnerHolder {
|
||||||
pub fn button(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, button: u32, state: KeyState) {
|
pub fn button(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, button: u32, state: ButtonState) {
|
||||||
self.owner.get().button(seat, time_usec, button, state)
|
self.owner.get().button(seat, time_usec, button, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@ impl PointerOwnerHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
trait PointerOwner {
|
trait PointerOwner {
|
||||||
fn button(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, button: u32, state: KeyState);
|
fn button(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, button: u32, state: ButtonState);
|
||||||
fn axis_node(&self, seat: &Rc<WlSeatGlobal>) -> Option<Rc<dyn Node>> {
|
fn axis_node(&self, seat: &Rc<WlSeatGlobal>) -> Option<Rc<dyn Node>> {
|
||||||
let _ = seat;
|
let _ = seat;
|
||||||
None
|
None
|
||||||
|
|
@ -318,8 +318,8 @@ struct SelectWorkspaceUsecase<S: ?Sized> {
|
||||||
struct WindowManagementUsecase;
|
struct WindowManagementUsecase;
|
||||||
|
|
||||||
impl<T: SimplePointerOwnerUsecase> PointerOwner for SimplePointerOwner<T> {
|
impl<T: SimplePointerOwnerUsecase> PointerOwner for SimplePointerOwner<T> {
|
||||||
fn button(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, button: u32, state: KeyState) {
|
fn button(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, button: u32, state: ButtonState) {
|
||||||
if state != KeyState::Pressed {
|
if state != ButtonState::Pressed {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let pn = match seat.pointer_node() {
|
let pn = match seat.pointer_node() {
|
||||||
|
|
@ -436,9 +436,9 @@ impl<T: SimplePointerOwnerUsecase> PointerOwner for SimplePointerOwner<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: SimplePointerOwnerUsecase> PointerOwner for SimpleGrabPointerOwner<T> {
|
impl<T: SimplePointerOwnerUsecase> PointerOwner for SimpleGrabPointerOwner<T> {
|
||||||
fn button(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, button: u32, state: KeyState) {
|
fn button(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, button: u32, state: ButtonState) {
|
||||||
match state {
|
match state {
|
||||||
KeyState::Released => {
|
ButtonState::Released => {
|
||||||
if self.buttons.remove(&button).is_none() {
|
if self.buttons.remove(&button).is_none() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -449,7 +449,7 @@ impl<T: SimplePointerOwnerUsecase> PointerOwner for SimpleGrabPointerOwner<T> {
|
||||||
seat.tree_changed.trigger();
|
seat.tree_changed.trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyState::Pressed => {
|
ButtonState::Pressed => {
|
||||||
if self.buttons.insert(button, ()).is_some() {
|
if self.buttons.insert(button, ()).is_some() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -493,7 +493,7 @@ impl<T: SimplePointerOwnerUsecase> PointerOwner for SimpleGrabPointerOwner<T> {
|
||||||
self.node.clone(),
|
self.node.clone(),
|
||||||
time_usec,
|
time_usec,
|
||||||
button,
|
button,
|
||||||
KeyState::Released,
|
ButtonState::Released,
|
||||||
serial,
|
serial,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -511,8 +511,8 @@ impl<T: SimplePointerOwnerUsecase> PointerOwner for SimpleGrabPointerOwner<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PointerOwner for DndPointerOwner {
|
impl PointerOwner for DndPointerOwner {
|
||||||
fn button(&self, seat: &Rc<WlSeatGlobal>, _time_usec: u64, button: u32, state: KeyState) {
|
fn button(&self, seat: &Rc<WlSeatGlobal>, _time_usec: u64, button: u32, state: ButtonState) {
|
||||||
if button != self.button || state != KeyState::Released {
|
if button != self.button || state != ButtonState::Released {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let target = self.target.get();
|
let target = self.target.get();
|
||||||
|
|
@ -1068,8 +1068,8 @@ impl<T> PointerOwner for ToplevelGrabPointerOwner<T>
|
||||||
where
|
where
|
||||||
T: WindowManagementGrabUsecase,
|
T: WindowManagementGrabUsecase,
|
||||||
{
|
{
|
||||||
fn button(&self, seat: &Rc<WlSeatGlobal>, _time_usec: u64, button: u32, state: KeyState) {
|
fn button(&self, seat: &Rc<WlSeatGlobal>, _time_usec: u64, button: u32, state: ButtonState) {
|
||||||
if button != T::BUTTON || state != KeyState::Released {
|
if button != T::BUTTON || state != ButtonState::Released {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.tl.node_seat_state().remove_pointer_grab(seat);
|
self.tl.node_seat_state().remove_pointer_grab(seat);
|
||||||
|
|
@ -1238,12 +1238,12 @@ impl<T> PointerOwner for UiDragPointerOwner<T>
|
||||||
where
|
where
|
||||||
T: UiDragUsecase,
|
T: UiDragUsecase,
|
||||||
{
|
{
|
||||||
fn button(&self, seat: &Rc<WlSeatGlobal>, _time_usec: u64, button: u32, state: KeyState) {
|
fn button(&self, seat: &Rc<WlSeatGlobal>, _time_usec: u64, button: u32, state: ButtonState) {
|
||||||
if button == BTN_RIGHT {
|
if button == BTN_RIGHT {
|
||||||
self.do_revert_to_default(seat, false);
|
self.do_revert_to_default(seat, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if button != BTN_LEFT || state != KeyState::Released {
|
if button != BTN_LEFT || state != ButtonState::Released {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.apply_changes(seat);
|
self.apply_changes(seat);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ pub mod zwp_input_popup_surface_v2;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::KeyState,
|
backend::{ButtonState, KeyState},
|
||||||
client::{Client, ClientError},
|
client::{Client, ClientError},
|
||||||
cmm::cmm_description::ColorDescription,
|
cmm::cmm_description::ColorDescription,
|
||||||
cursor_user::{CursorUser, CursorUserId},
|
cursor_user::{CursorUser, CursorUserId},
|
||||||
|
|
@ -1907,7 +1907,7 @@ impl Node for WlSurface {
|
||||||
seat: &Rc<WlSeatGlobal>,
|
seat: &Rc<WlSeatGlobal>,
|
||||||
time_usec: u64,
|
time_usec: u64,
|
||||||
button: u32,
|
button: u32,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
serial: u64,
|
serial: u64,
|
||||||
) {
|
) {
|
||||||
seat.button_surface(&self, time_usec, button, state, serial);
|
seat.button_surface(&self, time_usec, button, state, serial);
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ use {
|
||||||
allocator::{Allocator, AllocatorError},
|
allocator::{Allocator, AllocatorError},
|
||||||
async_engine::SpawnedFuture,
|
async_engine::SpawnedFuture,
|
||||||
backend::{
|
backend::{
|
||||||
AxisSource, Backend, BackendConnectorState, BackendEvent, Connector, ConnectorEvent,
|
AxisSource, Backend, BackendConnectorState, BackendEvent, ButtonState, Connector,
|
||||||
ConnectorId, ConnectorKernelId, DrmDeviceId, InputDevice, InputDeviceAccelProfile,
|
ConnectorEvent, ConnectorId, ConnectorKernelId, DrmDeviceId, InputDevice,
|
||||||
InputDeviceCapability, InputDeviceClickMethod, InputDeviceId, InputEvent, KeyState,
|
InputDeviceAccelProfile, InputDeviceCapability, InputDeviceClickMethod, InputDeviceId,
|
||||||
Mode, MonitorInfo, ScrollAxis, TransformMatrix,
|
InputEvent, KeyState, Mode, MonitorInfo, ScrollAxis, TransformMatrix,
|
||||||
transaction::{
|
transaction::{
|
||||||
BackendAppliedConnectorTransaction, BackendConnectorTransaction,
|
BackendAppliedConnectorTransaction, BackendConnectorTransaction,
|
||||||
BackendConnectorTransactionError, BackendConnectorTransactionType,
|
BackendConnectorTransactionError, BackendConnectorTransactionType,
|
||||||
|
|
@ -423,7 +423,7 @@ impl Drop for TestMouseClick {
|
||||||
self.mouse.common.event(InputEvent::Button {
|
self.mouse.common.event(InputEvent::Button {
|
||||||
time_usec: self.mouse.common.state.now_usec(),
|
time_usec: self.mouse.common.state.now_usec(),
|
||||||
button: self.button,
|
button: self.button,
|
||||||
state: KeyState::Released,
|
state: ButtonState::Released,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -460,7 +460,7 @@ impl TestBackendMouse {
|
||||||
self.common.event(InputEvent::Button {
|
self.common.event(InputEvent::Button {
|
||||||
time_usec: self.common.state.now_usec(),
|
time_usec: self.common.state.now_usec(),
|
||||||
button,
|
button,
|
||||||
state: KeyState::Pressed,
|
state: ButtonState::Pressed,
|
||||||
});
|
});
|
||||||
TestMouseClick {
|
TestMouseClick {
|
||||||
mouse: self.clone(),
|
mouse: self.clone(),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::KeyState,
|
backend::{ButtonState, KeyState},
|
||||||
client::{Client, ClientId},
|
client::{Client, ClientId},
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
ifs::{
|
ifs::{
|
||||||
|
|
@ -346,7 +346,7 @@ pub trait Node: 'static {
|
||||||
seat: &Rc<WlSeatGlobal>,
|
seat: &Rc<WlSeatGlobal>,
|
||||||
time_usec: u64,
|
time_usec: u64,
|
||||||
button: u32,
|
button: u32,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
serial: u64,
|
serial: u64,
|
||||||
) {
|
) {
|
||||||
let _ = seat;
|
let _ = seat;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::KeyState,
|
backend::ButtonState,
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
cursor_user::CursorUser,
|
cursor_user::CursorUser,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
|
@ -1700,11 +1700,11 @@ impl Node for ContainerNode {
|
||||||
seat: &Rc<WlSeatGlobal>,
|
seat: &Rc<WlSeatGlobal>,
|
||||||
time_usec: u64,
|
time_usec: u64,
|
||||||
button: u32,
|
button: u32,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
_serial: u64,
|
_serial: u64,
|
||||||
) {
|
) {
|
||||||
let id = CursorType::Seat(seat.id());
|
let id = CursorType::Seat(seat.id());
|
||||||
self.button(id, seat, time_usec, state == KeyState::Pressed, button);
|
self.button(id, seat, time_usec, state == ButtonState::Pressed, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn node_on_axis_event(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, event: &PendingScroll) {
|
fn node_on_axis_event(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, event: &PendingScroll) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::KeyState,
|
backend::ButtonState,
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
cursor_user::CursorUser,
|
cursor_user::CursorUser,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
|
@ -776,10 +776,10 @@ impl Node for FloatNode {
|
||||||
seat: &Rc<WlSeatGlobal>,
|
seat: &Rc<WlSeatGlobal>,
|
||||||
time_usec: u64,
|
time_usec: u64,
|
||||||
button: u32,
|
button: u32,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
_serial: u64,
|
_serial: u64,
|
||||||
) {
|
) {
|
||||||
if button == BTN_RIGHT && state == KeyState::Pressed {
|
if button == BTN_RIGHT && state == ButtonState::Pressed {
|
||||||
self.toggle_pinned();
|
self.toggle_pinned();
|
||||||
}
|
}
|
||||||
if button != BTN_LEFT {
|
if button != BTN_LEFT {
|
||||||
|
|
@ -790,7 +790,7 @@ impl Node for FloatNode {
|
||||||
seat.pointer_cursor(),
|
seat.pointer_cursor(),
|
||||||
seat,
|
seat,
|
||||||
time_usec,
|
time_usec,
|
||||||
state == KeyState::Pressed,
|
state == ButtonState::Pressed,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
backend::{
|
backend::{
|
||||||
BackendColorSpace, BackendConnectorState, BackendEotfs, HardwareCursor, KeyState, Mode,
|
BackendColorSpace, BackendConnectorState, BackendEotfs, ButtonState, HardwareCursor,
|
||||||
|
Mode,
|
||||||
},
|
},
|
||||||
client::ClientId,
|
client::ClientId,
|
||||||
cmm::cmm_description::ColorDescription,
|
cmm::cmm_description::ColorDescription,
|
||||||
|
|
@ -1685,13 +1686,13 @@ impl Node for OutputNode {
|
||||||
seat: &Rc<WlSeatGlobal>,
|
seat: &Rc<WlSeatGlobal>,
|
||||||
_time_usec: u64,
|
_time_usec: u64,
|
||||||
button: u32,
|
button: u32,
|
||||||
state: KeyState,
|
state: ButtonState,
|
||||||
_serial: u64,
|
_serial: u64,
|
||||||
) {
|
) {
|
||||||
if button != BTN_LEFT {
|
if button != BTN_LEFT {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if state != KeyState::Pressed {
|
if state != ButtonState::Pressed {
|
||||||
self.pointer_down.remove(&seat.id());
|
self.pointer_down.remove(&seat.id());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue