autocommit 2022-01-08 16:57:40 CET
This commit is contained in:
parent
f8e7557d1d
commit
33549184d4
42 changed files with 2072 additions and 190 deletions
|
|
@ -6,7 +6,7 @@ use crate::client::{AddObj, DynEventFormatter};
|
|||
use crate::ifs::wl_surface::xdg_surface::xdg_popup::XdgPopup;
|
||||
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel;
|
||||
use crate::ifs::wl_surface::{
|
||||
RoleData, SurfaceRole, WlSurface, XdgPopupData, XdgSurfaceData, XdgSurfaceRole,
|
||||
RoleData, SurfaceExtents, SurfaceRole, WlSurface, XdgPopupData, XdgSurfaceData, XdgSurfaceRole,
|
||||
XdgSurfaceRoleData, XdgToplevelData,
|
||||
};
|
||||
use crate::ifs::xdg_wm_base::XdgWmBaseObj;
|
||||
|
|
@ -73,8 +73,10 @@ impl XdgSurface {
|
|||
requested_serial: 0,
|
||||
acked_serial: None,
|
||||
role: XdgSurfaceRole::None,
|
||||
extents: None,
|
||||
role_data: XdgSurfaceRoleData::None,
|
||||
popups: Default::default(),
|
||||
pending: Default::default(),
|
||||
}));
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -176,7 +178,20 @@ impl XdgSurface {
|
|||
&self,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), SetWindowGeometryError> {
|
||||
let _req: SetWindowGeometry = self.surface.client.parse(self, parser)?;
|
||||
let req: SetWindowGeometry = self.surface.client.parse(self, parser)?;
|
||||
if req.height <= 0 || req.width <= 0 {
|
||||
return Err(SetWindowGeometryError::NonPositiveWidthHeight);
|
||||
}
|
||||
let mut rd = self.surface.role_data.borrow_mut();
|
||||
if let RoleData::XdgSurface(xdg) = rd.deref_mut() {
|
||||
let extents = SurfaceExtents {
|
||||
x1: req.x,
|
||||
y1: req.y,
|
||||
x2: req.x + req.width,
|
||||
y2: req.y + req.height,
|
||||
};
|
||||
xdg.pending.extents.set(Some(extents));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ pub enum SetWindowGeometryError {
|
|||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Tried no set a non-positive width/height")]
|
||||
NonPositiveWidthHeight,
|
||||
}
|
||||
efrom!(SetWindowGeometryError, ParseFailed, MsgParserError);
|
||||
efrom!(SetWindowGeometryError, ClientError, ClientError);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use crate::ifs::wl_surface::{RoleData, XdgSurfaceRoleData};
|
|||
use crate::object::{Interface, Object, ObjectId};
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use num_derive::FromPrimitive;
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
pub use types::*;
|
||||
|
||||
|
|
@ -97,7 +98,16 @@ impl XdgToplevel {
|
|||
}
|
||||
|
||||
async fn move_(&self, parser: MsgParser<'_, '_>) -> Result<(), MoveError> {
|
||||
let _req: Move = self.surface.surface.client.parse(self, parser)?;
|
||||
let req: Move = self.surface.surface.client.parse(self, parser)?;
|
||||
let rd = self.surface.surface.role_data.borrow();
|
||||
if let RoleData::XdgSurface(xdg) = rd.deref() {
|
||||
if let XdgSurfaceRoleData::Toplevel(tl) = &xdg.role_data {
|
||||
if let Some(node) = tl.node.as_ref() {
|
||||
let seat = self.surface.surface.client.get_wl_seat(req.seat)?;
|
||||
seat.move_(&node.node);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue