autocommit 2022-02-06 03:46:03 CET
This commit is contained in:
parent
59ce74681a
commit
c92346324b
60 changed files with 1292 additions and 1958 deletions
|
|
@ -13,12 +13,12 @@ use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel;
|
|||
use crate::ifs::wl_surface::xdg_surface::XdgSurface;
|
||||
use crate::ifs::wl_surface::WlSurface;
|
||||
use crate::ifs::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1;
|
||||
use crate::ifs::zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1Id;
|
||||
use crate::tree::{FloatNode, FoundNode, Node};
|
||||
use crate::utils::smallmap::SmallMap;
|
||||
use crate::xkbcommon::{ModifierState, XKB_KEY_DOWN, XKB_KEY_UP};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::rc::Rc;
|
||||
use crate::ifs::zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1Id;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct NodeSeatState {
|
||||
|
|
@ -371,8 +371,8 @@ impl WlSeatGlobal {
|
|||
}
|
||||
|
||||
fn surface_primary_selection_device_event<F>(&self, ver: u32, surface: &WlSurface, mut f: F)
|
||||
where
|
||||
F: FnMut(&Rc<ZwpPrimarySelectionDeviceV1>) -> DynEventFormatter,
|
||||
where
|
||||
F: FnMut(&Rc<ZwpPrimarySelectionDeviceV1>) -> DynEventFormatter,
|
||||
{
|
||||
let client = &surface.client;
|
||||
self.for_each_primary_selection_device(ver, client.id, |p| {
|
||||
|
|
|
|||
|
|
@ -39,19 +39,11 @@ pub use handling::NodeSeatState;
|
|||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::io::Write;
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
pub use types::*;
|
||||
use uapi::{c, OwnedFd};
|
||||
|
||||
id!(WlSeatId);
|
||||
|
||||
const GET_POINTER: u32 = 0;
|
||||
const GET_KEYBOARD: u32 = 1;
|
||||
const GET_TOUCH: u32 = 2;
|
||||
const RELEASE: u32 = 3;
|
||||
|
||||
const CAPABILITIES: u32 = 0;
|
||||
const NAME: u32 = 1;
|
||||
use crate::wire::wl_seat::*;
|
||||
|
||||
const POINTER: u32 = 1;
|
||||
const KEYBOARD: u32 = 2;
|
||||
|
|
@ -317,15 +309,15 @@ pub struct WlSeat {
|
|||
impl WlSeat {
|
||||
fn capabilities(self: &Rc<Self>) -> DynEventFormatter {
|
||||
Box::new(Capabilities {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
capabilities: POINTER | KEYBOARD,
|
||||
})
|
||||
}
|
||||
|
||||
fn name(self: &Rc<Self>, name: &Rc<String>) -> DynEventFormatter {
|
||||
Box::new(Name {
|
||||
obj: self.clone(),
|
||||
name: name.clone(),
|
||||
Box::new(NameOut {
|
||||
self_id: self.id,
|
||||
name: name.deref().clone(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,100 +66,3 @@ pub enum ReleaseError {
|
|||
}
|
||||
efrom!(ReleaseError, ClientError, ClientError);
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
|
||||
pub(super) struct GetPointer {
|
||||
pub id: WlPointerId,
|
||||
}
|
||||
impl RequestParser<'_> for GetPointer {
|
||||
fn parse(parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self {
|
||||
id: parser.object()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl Debug for GetPointer {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "get_pointer(id: {})", self.id)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct GetKeyboard {
|
||||
pub id: WlKeyboardId,
|
||||
}
|
||||
impl RequestParser<'_> for GetKeyboard {
|
||||
fn parse(parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self {
|
||||
id: parser.object()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl Debug for GetKeyboard {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "get_keyboard(id: {})", self.id)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct GetTouch {
|
||||
pub id: WlTouchId,
|
||||
}
|
||||
impl RequestParser<'_> for GetTouch {
|
||||
fn parse(parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self {
|
||||
id: parser.object()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl Debug for GetTouch {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "get_touch(id: {})", self.id)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Release;
|
||||
impl RequestParser<'_> for Release {
|
||||
fn parse(_parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self)
|
||||
}
|
||||
}
|
||||
impl Debug for Release {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "release()")
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Capabilities {
|
||||
pub obj: Rc<WlSeat>,
|
||||
pub capabilities: u32,
|
||||
}
|
||||
impl EventFormatter for Capabilities {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, CAPABILITIES)
|
||||
.uint(self.capabilities);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
&*self.obj
|
||||
}
|
||||
}
|
||||
impl Debug for Capabilities {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "capabilities(capabilities: {})", self.capabilities)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Name {
|
||||
pub obj: Rc<WlSeat>,
|
||||
pub name: Rc<String>,
|
||||
}
|
||||
impl EventFormatter for Name {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, NAME).string(self.name.as_bytes());
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
&*self.obj
|
||||
}
|
||||
}
|
||||
impl Debug for Name {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "name(name: {})", self.name)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,15 +8,7 @@ use crate::utils::buffd::MsgParser;
|
|||
use std::rc::Rc;
|
||||
pub use types::*;
|
||||
use uapi::{c, Errno, OwnedFd};
|
||||
|
||||
const RELEASE: u32 = 0;
|
||||
|
||||
const KEYMAP: u32 = 0;
|
||||
const ENTER: u32 = 1;
|
||||
const LEAVE: u32 = 2;
|
||||
const KEY: u32 = 3;
|
||||
const MODIFIERS: u32 = 4;
|
||||
const REPEAT_INFO: u32 = 5;
|
||||
use crate::wire::wl_keyboard::*;
|
||||
|
||||
pub const REPEAT_INFO_SINCE: u32 = 4;
|
||||
|
||||
|
|
@ -24,13 +16,9 @@ pub const REPEAT_INFO_SINCE: u32 = 4;
|
|||
const NO_KEYMAP: u32 = 0;
|
||||
pub(super) const XKB_V1: u32 = 1;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(super) const RELEASED: u32 = 0;
|
||||
#[allow(dead_code)]
|
||||
pub(super) const PRESSED: u32 = 1;
|
||||
|
||||
id!(WlKeyboardId);
|
||||
|
||||
pub struct WlKeyboard {
|
||||
id: WlKeyboardId,
|
||||
seat: Rc<WlSeat>,
|
||||
|
|
@ -76,41 +64,38 @@ impl WlKeyboard {
|
|||
|
||||
pub fn keymap(self: &Rc<Self>, format: u32, fd: Rc<OwnedFd>, size: u32) -> DynEventFormatter {
|
||||
Box::new(Keymap {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
format,
|
||||
fd,
|
||||
size,
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn enter(
|
||||
self: &Rc<Self>,
|
||||
serial: u32,
|
||||
surface: WlSurfaceId,
|
||||
keys: Vec<u32>,
|
||||
) -> DynEventFormatter {
|
||||
Box::new(Enter {
|
||||
obj: self.clone(),
|
||||
Box::new(EnterOut {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
surface,
|
||||
keys,
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn leave(self: &Rc<Self>, serial: u32, surface: WlSurfaceId) -> DynEventFormatter {
|
||||
Box::new(Leave {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
serial,
|
||||
surface,
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn key(self: &Rc<Self>, serial: u32, time: u32, key: u32, state: u32) -> DynEventFormatter {
|
||||
Box::new(Key {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
serial,
|
||||
time,
|
||||
key,
|
||||
|
|
@ -118,7 +103,6 @@ impl WlKeyboard {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn modifiers(
|
||||
self: &Rc<Self>,
|
||||
serial: u32,
|
||||
|
|
@ -128,7 +112,7 @@ impl WlKeyboard {
|
|||
group: u32,
|
||||
) -> DynEventFormatter {
|
||||
Box::new(Modifiers {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
serial,
|
||||
mods_depressed,
|
||||
mods_latched,
|
||||
|
|
@ -137,10 +121,9 @@ impl WlKeyboard {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn repeat_info(self: &Rc<Self>, rate: i32, delay: i32) -> DynEventFormatter {
|
||||
Box::new(RepeatInfo {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
rate,
|
||||
delay,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -33,177 +33,3 @@ pub enum ReleaseError {
|
|||
}
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
efrom!(ReleaseError, ClientError, ClientError);
|
||||
|
||||
pub(super) struct Release;
|
||||
impl RequestParser<'_> for Release {
|
||||
fn parse(_parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self)
|
||||
}
|
||||
}
|
||||
impl Debug for Release {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "destroy()",)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Keymap {
|
||||
pub obj: Rc<WlKeyboard>,
|
||||
pub format: u32,
|
||||
pub fd: Rc<OwnedFd>,
|
||||
pub size: u32,
|
||||
}
|
||||
impl EventFormatter for Keymap {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, KEYMAP)
|
||||
.uint(self.format)
|
||||
.fd(self.fd)
|
||||
.uint(self.size);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Keymap {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"keymap(format: {}, fd: {}, size: {})",
|
||||
self.format,
|
||||
self.fd.raw(),
|
||||
self.size
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Enter {
|
||||
pub obj: Rc<WlKeyboard>,
|
||||
pub serial: u32,
|
||||
pub surface: WlSurfaceId,
|
||||
pub keys: Vec<u32>,
|
||||
}
|
||||
impl EventFormatter for Enter {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, ENTER)
|
||||
.uint(self.serial)
|
||||
.object(self.surface)
|
||||
.array(|f| {
|
||||
for &key in &self.keys {
|
||||
f.uint(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Enter {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"enter(serial: {}, surface: {}, keys: {:?})",
|
||||
self.serial, self.surface, self.keys
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Leave {
|
||||
pub obj: Rc<WlKeyboard>,
|
||||
pub serial: u32,
|
||||
pub surface: WlSurfaceId,
|
||||
}
|
||||
impl EventFormatter for Leave {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, LEAVE)
|
||||
.uint(self.serial)
|
||||
.object(self.surface);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Leave {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"leave(serial: {}, surface: {})",
|
||||
self.serial, self.surface
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Key {
|
||||
pub obj: Rc<WlKeyboard>,
|
||||
pub serial: u32,
|
||||
pub time: u32,
|
||||
pub key: u32,
|
||||
pub state: u32,
|
||||
}
|
||||
impl EventFormatter for Key {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, KEY)
|
||||
.uint(self.serial)
|
||||
.uint(self.time)
|
||||
.uint(self.key)
|
||||
.uint(self.state);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Key {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"key(serial: {}, time: {}, key: {}, state: {})",
|
||||
self.serial, self.time, self.key, self.state
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Modifiers {
|
||||
pub obj: Rc<WlKeyboard>,
|
||||
pub serial: u32,
|
||||
pub mods_depressed: u32,
|
||||
pub mods_latched: u32,
|
||||
pub mods_locked: u32,
|
||||
pub group: u32,
|
||||
}
|
||||
impl EventFormatter for Modifiers {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, MODIFIERS)
|
||||
.uint(self.serial)
|
||||
.uint(self.mods_depressed)
|
||||
.uint(self.mods_latched)
|
||||
.uint(self.mods_locked)
|
||||
.uint(self.group);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Modifiers {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "modifiers(serial: {}, mods_depressed: {}, mods_latched: {}, mods_locked: {}, group: {})", self.serial, self.mods_depressed, self.mods_latched, self.mods_locked, self.group)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct RepeatInfo {
|
||||
pub obj: Rc<WlKeyboard>,
|
||||
pub rate: i32,
|
||||
pub delay: i32,
|
||||
}
|
||||
impl EventFormatter for RepeatInfo {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, REPEAT_INFO)
|
||||
.int(self.rate)
|
||||
.int(self.delay);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for RepeatInfo {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "repeat_info(rate: {}, delay: {})", self.rate, self.delay)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,19 +9,7 @@ use crate::object::Object;
|
|||
use crate::utils::buffd::MsgParser;
|
||||
use std::rc::Rc;
|
||||
pub use types::*;
|
||||
|
||||
const SET_CURSOR: u32 = 0;
|
||||
const RELEASE: u32 = 1;
|
||||
|
||||
const ENTER: u32 = 0;
|
||||
const LEAVE: u32 = 1;
|
||||
const MOTION: u32 = 2;
|
||||
const BUTTON: u32 = 3;
|
||||
const AXIS: u32 = 4;
|
||||
const FRAME: u32 = 5;
|
||||
const AXIS_SOURCE: u32 = 6;
|
||||
const AXIS_STOP: u32 = 7;
|
||||
const AXIS_DISCRETE: u32 = 8;
|
||||
use crate::wire::wl_pointer::*;
|
||||
|
||||
#[allow(dead_code)]
|
||||
const ROLE: u32 = 0;
|
||||
|
|
@ -43,8 +31,6 @@ const WHEEL_TILT: u32 = 3;
|
|||
|
||||
pub const POINTER_FRAME_SINCE_VERSION: u32 = 5;
|
||||
|
||||
id!(WlPointerId);
|
||||
|
||||
pub struct WlPointer {
|
||||
id: WlPointerId,
|
||||
seat: Rc<WlSeat>,
|
||||
|
|
@ -66,7 +52,7 @@ impl WlPointer {
|
|||
y: Fixed,
|
||||
) -> DynEventFormatter {
|
||||
Box::new(Enter {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
serial,
|
||||
surface,
|
||||
surface_x: x,
|
||||
|
|
@ -76,7 +62,7 @@ impl WlPointer {
|
|||
|
||||
pub fn leave(self: &Rc<Self>, serial: u32, surface: WlSurfaceId) -> DynEventFormatter {
|
||||
Box::new(Leave {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
serial,
|
||||
surface,
|
||||
})
|
||||
|
|
@ -84,7 +70,7 @@ impl WlPointer {
|
|||
|
||||
pub fn motion(self: &Rc<Self>, time: u32, x: Fixed, y: Fixed) -> DynEventFormatter {
|
||||
Box::new(Motion {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
time,
|
||||
surface_x: x,
|
||||
surface_y: y,
|
||||
|
|
@ -99,7 +85,7 @@ impl WlPointer {
|
|||
state: u32,
|
||||
) -> DynEventFormatter {
|
||||
Box::new(Button {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
serial,
|
||||
time,
|
||||
button,
|
||||
|
|
@ -109,7 +95,7 @@ impl WlPointer {
|
|||
|
||||
pub fn axis(self: &Rc<Self>, time: u32, axis: u32, value: Fixed) -> DynEventFormatter {
|
||||
Box::new(Axis {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
time,
|
||||
axis,
|
||||
value,
|
||||
|
|
@ -118,13 +104,13 @@ impl WlPointer {
|
|||
|
||||
#[allow(dead_code)]
|
||||
pub fn frame(self: &Rc<Self>) -> DynEventFormatter {
|
||||
Box::new(Frame { obj: self.clone() })
|
||||
Box::new(Frame { self_id: self.id })
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn axis_source(self: &Rc<Self>, axis_source: u32) -> DynEventFormatter {
|
||||
Box::new(AxisSource {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
axis_source,
|
||||
})
|
||||
}
|
||||
|
|
@ -132,7 +118,7 @@ impl WlPointer {
|
|||
#[allow(dead_code)]
|
||||
pub fn axis_stop(self: &Rc<Self>, time: u32, axis: u32) -> DynEventFormatter {
|
||||
Box::new(AxisStop {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
time,
|
||||
axis,
|
||||
})
|
||||
|
|
@ -141,7 +127,7 @@ impl WlPointer {
|
|||
#[allow(dead_code)]
|
||||
pub fn axis_discrete(self: &Rc<Self>, axis: u32, discrete: i32) -> DynEventFormatter {
|
||||
Box::new(AxisDiscrete {
|
||||
obj: self.clone(),
|
||||
self_id: self.id,
|
||||
axis,
|
||||
discrete,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -44,265 +44,3 @@ pub enum ReleaseError {
|
|||
}
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
efrom!(ReleaseError, ClientError, ClientError);
|
||||
|
||||
pub(super) struct SetCursor {
|
||||
pub serial: u32,
|
||||
pub surface: WlSurfaceId,
|
||||
pub hotspot_x: i32,
|
||||
pub hotspot_y: i32,
|
||||
}
|
||||
impl RequestParser<'_> for SetCursor {
|
||||
fn parse(parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self {
|
||||
serial: parser.uint()?,
|
||||
surface: parser.object()?,
|
||||
hotspot_x: parser.int()?,
|
||||
hotspot_y: parser.int()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl Debug for SetCursor {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"set_cursor(serial: {}, surface: {}, hotspot_x: {}, hotspot_y: {})",
|
||||
self.serial, self.surface, self.hotspot_x, self.hotspot_y
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Release;
|
||||
impl RequestParser<'_> for Release {
|
||||
fn parse(_parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self)
|
||||
}
|
||||
}
|
||||
impl Debug for Release {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "destroy()",)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Enter {
|
||||
pub obj: Rc<WlPointer>,
|
||||
pub serial: u32,
|
||||
pub surface: WlSurfaceId,
|
||||
pub surface_x: Fixed,
|
||||
pub surface_y: Fixed,
|
||||
}
|
||||
impl EventFormatter for Enter {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, ENTER)
|
||||
.uint(self.serial)
|
||||
.object(self.surface)
|
||||
.fixed(self.surface_x)
|
||||
.fixed(self.surface_y);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Enter {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"enter(serial: {}, surface: {}, surface_x: {}, surface_y: {})",
|
||||
self.serial, self.surface, self.surface_x, self.surface_y
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Leave {
|
||||
pub obj: Rc<WlPointer>,
|
||||
pub serial: u32,
|
||||
pub surface: WlSurfaceId,
|
||||
}
|
||||
impl EventFormatter for Leave {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, LEAVE)
|
||||
.uint(self.serial)
|
||||
.object(self.surface);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Leave {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"leave(serial: {}, surface: {})",
|
||||
self.serial, self.surface
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Motion {
|
||||
pub obj: Rc<WlPointer>,
|
||||
pub time: u32,
|
||||
pub surface_x: Fixed,
|
||||
pub surface_y: Fixed,
|
||||
}
|
||||
impl EventFormatter for Motion {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, MOTION)
|
||||
.uint(self.time)
|
||||
.fixed(self.surface_x)
|
||||
.fixed(self.surface_y);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
fn should_log(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
impl Debug for Motion {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"motion(time: {}, surface_x: {}, surface_y: {})",
|
||||
self.time, self.surface_x, self.surface_y
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Button {
|
||||
pub obj: Rc<WlPointer>,
|
||||
pub serial: u32,
|
||||
pub time: u32,
|
||||
pub button: u32,
|
||||
pub state: u32,
|
||||
}
|
||||
impl EventFormatter for Button {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, BUTTON)
|
||||
.uint(self.serial)
|
||||
.uint(self.time)
|
||||
.uint(self.button)
|
||||
.uint(self.state);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Button {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"button(serial: {}, time: {}, button: 0x{:x}, state: {})",
|
||||
self.serial, self.time, self.button, self.state
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Axis {
|
||||
pub obj: Rc<WlPointer>,
|
||||
pub time: u32,
|
||||
pub axis: u32,
|
||||
pub value: Fixed,
|
||||
}
|
||||
impl EventFormatter for Axis {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, AXIS)
|
||||
.uint(self.time)
|
||||
.uint(self.axis)
|
||||
.fixed(self.value);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for Axis {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"axis(time: {}, axis: {}, value: {:?})",
|
||||
self.time, self.axis, self.value
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Frame {
|
||||
pub obj: Rc<WlPointer>,
|
||||
}
|
||||
impl EventFormatter for Frame {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, FRAME);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
fn should_log(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
impl Debug for Frame {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "frame()")
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct AxisSource {
|
||||
pub obj: Rc<WlPointer>,
|
||||
pub axis_source: u32,
|
||||
}
|
||||
impl EventFormatter for AxisSource {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, AXIS_SOURCE).uint(self.axis_source);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for AxisSource {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "axis_source(axis_source: {})", self.axis_source)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct AxisStop {
|
||||
pub obj: Rc<WlPointer>,
|
||||
pub time: u32,
|
||||
pub axis: u32,
|
||||
}
|
||||
impl EventFormatter for AxisStop {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, AXIS_STOP)
|
||||
.uint(self.time)
|
||||
.uint(self.axis);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for AxisStop {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "axis_stop(time: {}, axis: {})", self.time, self.axis)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct AxisDiscrete {
|
||||
pub obj: Rc<WlPointer>,
|
||||
pub axis: u32,
|
||||
pub discrete: i32,
|
||||
}
|
||||
impl EventFormatter for AxisDiscrete {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
|
||||
fmt.header(self.obj.id, AXIS_DISCRETE)
|
||||
.uint(self.axis)
|
||||
.int(self.discrete);
|
||||
}
|
||||
fn obj(&self) -> &dyn Object {
|
||||
self.obj.deref()
|
||||
}
|
||||
}
|
||||
impl Debug for AxisDiscrete {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"axis_discrete(axis: {}, discrete: {})",
|
||||
self.axis, self.discrete
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue