1
0
Fork 0
forked from wry/wry

autocommit 2022-02-06 03:46:03 CET

This commit is contained in:
Julian Orth 2022-02-06 03:46:03 +01:00
parent 59ce74681a
commit c92346324b
60 changed files with 1292 additions and 1958 deletions

View file

@ -11,15 +11,7 @@ use std::collections::hash_map::Entry;
use std::iter;
use std::rc::Rc;
pub use types::*;
id!(WlOutputId);
const RELEASE: u32 = 0;
const GEOMETRY: u32 = 0;
const MODE: u32 = 1;
const DONE: u32 = 2;
const SCALE: u32 = 3;
use crate::wire::wl_output::*;
const SP_UNKNOWN: i32 = 0;
#[allow(dead_code)]
@ -186,7 +178,7 @@ impl WlOutput {
fn mode(self: &Rc<Self>) -> DynEventFormatter {
Box::new(Mode {
obj: self.clone(),
self_id: self.id,
flags: MODE_CURRENT,
width: self.global.width.get() as _,
height: self.global.height.get() as _,
@ -196,13 +188,13 @@ impl WlOutput {
fn scale(self: &Rc<Self>) -> DynEventFormatter {
Box::new(Scale {
obj: self.clone(),
self_id: self.id,
factor: 1,
})
}
fn done(self: &Rc<Self>) -> DynEventFormatter {
Box::new(Done { obj: self.clone() })
Box::new(Done { self_id: self.id })
}
fn remove_binding(&self) {

View file

@ -24,113 +24,3 @@ pub enum ReleaseError {
}
efrom!(ReleaseError, ClientError);
efrom!(ReleaseError, ParseError, MsgParserError);
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 Geometry {
pub obj: Rc<WlOutput>,
pub x: i32,
pub y: i32,
pub physical_width: i32,
pub physical_height: i32,
pub subpixel: i32,
pub make: String,
pub model: String,
pub transform: i32,
}
impl EventFormatter for Geometry {
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
fmt.header(self.obj.id, GEOMETRY)
.int(self.x)
.int(self.y)
.int(self.physical_width)
.int(self.physical_height)
.int(self.subpixel)
.string(&self.make)
.string(&self.model)
.int(self.transform);
}
fn obj(&self) -> &dyn Object {
&*self.obj
}
}
impl Debug for Geometry {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "geometry(x: {}, y: {}, physical_width: {}, physical_height: {}, subpixel: {}, make: {}, model: {}, transform: {})",
self.x, self.y, self.physical_width, self.physical_height, self.subpixel, self.make, self.model, self.transform)
}
}
pub(super) struct Mode {
pub obj: Rc<WlOutput>,
pub flags: u32,
pub width: i32,
pub height: i32,
pub refresh: i32,
}
impl EventFormatter for Mode {
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
fmt.header(self.obj.id, MODE)
.uint(self.flags)
.int(self.width)
.int(self.height)
.int(self.refresh);
}
fn obj(&self) -> &dyn Object {
&*self.obj
}
}
impl Debug for Mode {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
f,
"mode(flags: 0x{:x}, width: {}, height: {}, refresh: {})",
self.flags, self.width, self.height, self.refresh
)
}
}
pub(super) struct Done {
pub obj: Rc<WlOutput>,
}
impl EventFormatter for Done {
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
fmt.header(self.obj.id, DONE);
}
fn obj(&self) -> &dyn Object {
&*self.obj
}
}
impl Debug for Done {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "done()")
}
}
pub(super) struct Scale {
pub obj: Rc<WlOutput>,
pub factor: i32,
}
impl EventFormatter for Scale {
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
fmt.header(self.obj.id, SCALE).int(self.factor);
}
fn obj(&self) -> &dyn Object {
&*self.obj
}
}
impl Debug for Scale {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "scale(factor: {})", self.factor)
}
}