autocommit 2022-01-08 18:38:24 CET
This commit is contained in:
parent
33549184d4
commit
d061a5c313
38 changed files with 179 additions and 371 deletions
|
|
@ -19,12 +19,12 @@ id!(WlBufferId);
|
|||
|
||||
pub struct WlBuffer {
|
||||
id: WlBufferId,
|
||||
client: Rc<Client>,
|
||||
offset: usize,
|
||||
pub client: Rc<Client>,
|
||||
_offset: usize,
|
||||
pub width: u32,
|
||||
pub height: u32,
|
||||
stride: u32,
|
||||
format: &'static Format,
|
||||
_stride: u32,
|
||||
_format: &'static Format,
|
||||
pub image: Rc<pixman::Image<ClientMemOffset>>,
|
||||
pub(super) surfaces: CopyHashMap<WlSurfaceId, Rc<WlSurface>>,
|
||||
}
|
||||
|
|
@ -54,11 +54,11 @@ impl WlBuffer {
|
|||
Ok(Self {
|
||||
id,
|
||||
client: client.clone(),
|
||||
offset,
|
||||
_offset: offset,
|
||||
width,
|
||||
height,
|
||||
stride,
|
||||
format,
|
||||
_stride: stride,
|
||||
_format: format,
|
||||
image: Rc::new(image),
|
||||
surfaces: Default::default(),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -19,10 +19,9 @@ pub struct WlCompositorGlobal {
|
|||
}
|
||||
|
||||
pub struct WlCompositorObj {
|
||||
global: Rc<WlCompositorGlobal>,
|
||||
id: WlCompositorId,
|
||||
client: Rc<Client>,
|
||||
version: u32,
|
||||
_version: u32,
|
||||
}
|
||||
|
||||
impl WlCompositorGlobal {
|
||||
|
|
@ -37,10 +36,9 @@ impl WlCompositorGlobal {
|
|||
version: u32,
|
||||
) -> Result<(), WlCompositorError> {
|
||||
let obj = Rc::new(WlCompositorObj {
|
||||
global: self,
|
||||
id,
|
||||
client: client.clone(),
|
||||
version,
|
||||
_version: version,
|
||||
});
|
||||
client.add_client_obj(&obj)?;
|
||||
Ok(())
|
||||
|
|
@ -94,10 +92,6 @@ impl Global for WlCompositorGlobal {
|
|||
fn version(&self) -> u32 {
|
||||
4
|
||||
}
|
||||
|
||||
fn pre_remove(&self) {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
handle_request!(WlCompositorObj);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const MOTION: u32 = 4;
|
|||
const DROP: u32 = 5;
|
||||
const SELECTION: u32 = 5;
|
||||
|
||||
const ROLE: u32 = 0;
|
||||
#[allow(dead_code)] const ROLE: u32 = 0;
|
||||
|
||||
id!(WlDataDeviceId);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ use crate::ifs::wl_data_source::WlDataSource;
|
|||
const CREATE_DATA_SOURCE: u32 = 0;
|
||||
const GET_DATA_DEVICE: u32 = 1;
|
||||
|
||||
const DND_NONE: u32 = 0;
|
||||
const DND_COPY: u32 = 1;
|
||||
const DND_MOVE: u32 = 2;
|
||||
const DND_ASK: u32 = 4;
|
||||
#[allow(dead_code)] const DND_NONE: u32 = 0;
|
||||
#[allow(dead_code)] const DND_COPY: u32 = 1;
|
||||
#[allow(dead_code)] const DND_MOVE: u32 = 2;
|
||||
#[allow(dead_code)] const DND_ASK: u32 = 4;
|
||||
|
||||
id!(WlDataDeviceManagerId);
|
||||
|
||||
|
|
@ -98,10 +98,6 @@ impl Global for WlDataDeviceManagerGlobal {
|
|||
fn version(&self) -> u32 {
|
||||
3
|
||||
}
|
||||
|
||||
fn pre_remove(&self) {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
handle_request!(WlDataDeviceManagerObj);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ const OFFER: u32 = 0;
|
|||
const SOURCE_ACTIONS: u32 = 1;
|
||||
const ACTION: u32 = 2;
|
||||
|
||||
const INVALID_FINISH: u32 = 0;
|
||||
const INVALID_ACTION_MASK: u32 = 1;
|
||||
const INVALID_ACTION: u32 = 2;
|
||||
const INVALID_OFFER: u32 = 3;
|
||||
#[allow(dead_code)] const INVALID_FINISH: u32 = 0;
|
||||
#[allow(dead_code)] const INVALID_ACTION_MASK: u32 = 1;
|
||||
#[allow(dead_code)] const INVALID_ACTION: u32 = 2;
|
||||
#[allow(dead_code)] const INVALID_OFFER: u32 = 3;
|
||||
|
||||
id!(WlDataOfferId);
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ impl Object for WlDataOffer {
|
|||
}
|
||||
|
||||
fn interface(&self) -> Interface {
|
||||
Interface::WlDataSource
|
||||
Interface::WlDataOffer
|
||||
}
|
||||
|
||||
fn num_requests(&self) -> u32 {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ const DND_DROP_PERFORMED: u32 = 4;
|
|||
const DND_FINISHED: u32 = 5;
|
||||
const ACTION: u32 = 5;
|
||||
|
||||
const INVALID_ACTION_MASK: u32 = 0;
|
||||
const INVALID_SOURCE: u32 = 1;
|
||||
#[allow(dead_code)] const INVALID_ACTION_MASK: u32 = 0;
|
||||
#[allow(dead_code)] const INVALID_SOURCE: u32 = 1;
|
||||
|
||||
id!(WlDataSourceId);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const DELETE_ID: u32 = 1;
|
|||
|
||||
const INVALID_OBJECT: u32 = 0;
|
||||
const INVALID_METHOD: u32 = 1;
|
||||
const NO_MEMORY: u32 = 2;
|
||||
#[allow(dead_code)] const NO_MEMORY: u32 = 2;
|
||||
const IMPLEMENTATION: u32 = 3;
|
||||
|
||||
pub struct WlDisplay {
|
||||
|
|
|
|||
|
|
@ -22,23 +22,23 @@ const DONE: u32 = 2;
|
|||
const SCALE: u32 = 3;
|
||||
|
||||
const SP_UNKNOWN: i32 = 0;
|
||||
const SP_NONE: i32 = 1;
|
||||
const SP_HORIZONTAL_RGB: i32 = 2;
|
||||
const SP_HORIZONTAL_BGR: i32 = 3;
|
||||
const SP_VERTICAL_RGB: i32 = 4;
|
||||
const SP_VERTICAL_BGR: i32 = 5;
|
||||
#[allow(dead_code)] const SP_NONE: i32 = 1;
|
||||
#[allow(dead_code)] const SP_HORIZONTAL_RGB: i32 = 2;
|
||||
#[allow(dead_code)] const SP_HORIZONTAL_BGR: i32 = 3;
|
||||
#[allow(dead_code)] const SP_VERTICAL_RGB: i32 = 4;
|
||||
#[allow(dead_code)] const SP_VERTICAL_BGR: i32 = 5;
|
||||
|
||||
const TF_NORMAL: i32 = 0;
|
||||
const TF_90: i32 = 1;
|
||||
const TF_180: i32 = 2;
|
||||
const TF_270: i32 = 3;
|
||||
const TF_FLIPPED: i32 = 4;
|
||||
const TF_FLIPPED_90: i32 = 5;
|
||||
const TF_FLIPPED_180: i32 = 6;
|
||||
const TF_FLIPPED_270: i32 = 7;
|
||||
#[allow(dead_code)] const TF_90: i32 = 1;
|
||||
#[allow(dead_code)] const TF_180: i32 = 2;
|
||||
#[allow(dead_code)] const TF_270: i32 = 3;
|
||||
#[allow(dead_code)] const TF_FLIPPED: i32 = 4;
|
||||
#[allow(dead_code)] const TF_FLIPPED_90: i32 = 5;
|
||||
#[allow(dead_code)] const TF_FLIPPED_180: i32 = 6;
|
||||
#[allow(dead_code)] const TF_FLIPPED_270: i32 = 7;
|
||||
|
||||
const MODE_CURRENT: u32 = 1;
|
||||
const MODE_PREFERRED: u32 = 2;
|
||||
#[allow(dead_code)] const MODE_PREFERRED: u32 = 2;
|
||||
|
||||
pub struct WlOutputGlobal {
|
||||
name: GlobalName,
|
||||
|
|
@ -109,13 +109,18 @@ impl WlOutputGlobal {
|
|||
global: self.clone(),
|
||||
id,
|
||||
client: client.clone(),
|
||||
version,
|
||||
});
|
||||
client.add_client_obj(&obj)?;
|
||||
self.bindings.set((client.id, id), obj.clone());
|
||||
client.event(obj.geometry()).await?;
|
||||
client.event(obj.mode()).await?;
|
||||
client.event(obj.scale()).await?;
|
||||
client.event(obj.done()).await?;
|
||||
if obj.send_scale() {
|
||||
client.event(obj.scale()).await?;
|
||||
}
|
||||
if obj.send_done() {
|
||||
client.event(obj.done()).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
@ -139,10 +144,6 @@ impl Global for WlOutputGlobal {
|
|||
3
|
||||
}
|
||||
|
||||
fn pre_remove(&self) {
|
||||
//
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.bindings.clear();
|
||||
}
|
||||
|
|
@ -152,9 +153,18 @@ pub struct WlOutputObj {
|
|||
global: Rc<WlOutputGlobal>,
|
||||
id: WlOutputId,
|
||||
client: Rc<Client>,
|
||||
version: u32,
|
||||
}
|
||||
|
||||
impl WlOutputObj {
|
||||
fn send_done(&self) -> bool {
|
||||
self.version >= 2
|
||||
}
|
||||
|
||||
fn send_scale(&self) -> bool {
|
||||
self.version >= 2
|
||||
}
|
||||
|
||||
fn geometry(self: &Rc<Self>) -> DynEventFormatter {
|
||||
Box::new(Geometry {
|
||||
obj: self.clone(),
|
||||
|
|
@ -222,7 +232,11 @@ impl Object for WlOutputObj {
|
|||
}
|
||||
|
||||
fn num_requests(&self) -> u32 {
|
||||
RELEASE + 1
|
||||
if self.version < 3 {
|
||||
0
|
||||
} else {
|
||||
RELEASE + 1
|
||||
}
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@ const NAME: u32 = 1;
|
|||
|
||||
const POINTER: u32 = 1;
|
||||
const KEYBOARD: u32 = 2;
|
||||
const TOUCH: u32 = 4;
|
||||
#[allow(dead_code)] const TOUCH: u32 = 4;
|
||||
|
||||
const MISSING_CAPABILITY: u32 = 0;
|
||||
#[allow(dead_code)] const MISSING_CAPABILITY: u32 = 0;
|
||||
|
||||
pub struct WlSeatGlobal {
|
||||
name: GlobalName,
|
||||
state: Rc<State>,
|
||||
seat: Rc<dyn Seat>,
|
||||
_seat: Rc<dyn Seat>,
|
||||
move_: Cell<bool>,
|
||||
move_start_pos: Cell<(Fixed, Fixed)>,
|
||||
extents_start_pos: Cell<(i32, i32)>,
|
||||
|
|
@ -75,7 +75,7 @@ impl WlSeatGlobal {
|
|||
Self {
|
||||
name,
|
||||
state: state.clone(),
|
||||
seat: seat.clone(),
|
||||
_seat: seat.clone(),
|
||||
move_: Cell::new(false),
|
||||
move_start_pos: Cell::new((Fixed(0), Fixed(0))),
|
||||
extents_start_pos: Cell::new((0, 0)),
|
||||
|
|
@ -217,7 +217,7 @@ impl WlSeatGlobal {
|
|||
}
|
||||
}
|
||||
|
||||
async fn key_event(&self, key: u32, state: KeyState) {}
|
||||
async fn key_event(&self, _key: u32, _state: KeyState) {}
|
||||
|
||||
async fn bind_(
|
||||
self: Rc<Self>,
|
||||
|
|
@ -231,6 +231,7 @@ impl WlSeatGlobal {
|
|||
client: client.clone(),
|
||||
pointers: Default::default(),
|
||||
keyboards: Default::default(),
|
||||
version,
|
||||
});
|
||||
client.add_client_obj(&obj)?;
|
||||
client.event(obj.capabilities()).await?;
|
||||
|
|
@ -261,11 +262,7 @@ impl Global for WlSeatGlobal {
|
|||
}
|
||||
|
||||
fn version(&self) -> u32 {
|
||||
3
|
||||
}
|
||||
|
||||
fn pre_remove(&self) {
|
||||
//
|
||||
7
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
|
|
@ -279,6 +276,7 @@ pub struct WlSeatObj {
|
|||
client: Rc<Client>,
|
||||
pointers: CopyHashMap<WlPointerId, Rc<WlPointer>>,
|
||||
keyboards: CopyHashMap<WlKeyboardId, Rc<WlKeyboard>>,
|
||||
version: u32,
|
||||
}
|
||||
|
||||
impl WlSeatObj {
|
||||
|
|
@ -369,7 +367,11 @@ impl Object for WlSeatObj {
|
|||
}
|
||||
|
||||
fn num_requests(&self) -> u32 {
|
||||
RELEASE + 1
|
||||
if self.version < 5 {
|
||||
GET_TOUCH + 1
|
||||
} else {
|
||||
RELEASE + 1
|
||||
}
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ const KEY: u32 = 3;
|
|||
const MODIFIERS: u32 = 4;
|
||||
const REPEAT_INFO: u32 = 5;
|
||||
|
||||
const NO_KEYMAP: u32 = 0;
|
||||
#[allow(dead_code)] const NO_KEYMAP: u32 = 0;
|
||||
pub(super) const XKB_V1: u32 = 1;
|
||||
|
||||
const RELEASED: u32 = 0;
|
||||
const PRESSED: u32 = 1;
|
||||
#[allow(dead_code)] const RELEASED: u32 = 0;
|
||||
#[allow(dead_code)] const PRESSED: u32 = 1;
|
||||
|
||||
id!(WlKeyboardId);
|
||||
|
||||
|
|
@ -48,6 +48,7 @@ impl WlKeyboard {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn enter(
|
||||
self: &Rc<Self>,
|
||||
serial: u32,
|
||||
|
|
@ -62,6 +63,7 @@ impl WlKeyboard {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn leave(self: &Rc<Self>, serial: u32, surface: WlSurfaceId) -> DynEventFormatter {
|
||||
Box::new(Leave {
|
||||
obj: self.clone(),
|
||||
|
|
@ -70,6 +72,7 @@ impl WlKeyboard {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn key(self: &Rc<Self>, serial: u32, time: u32, key: u32, state: u32) -> DynEventFormatter {
|
||||
Box::new(Key {
|
||||
obj: self.clone(),
|
||||
|
|
@ -80,6 +83,7 @@ impl WlKeyboard {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn modifiers(
|
||||
self: &Rc<Self>,
|
||||
serial: u32,
|
||||
|
|
@ -98,6 +102,7 @@ impl WlKeyboard {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn repeat_info(self: &Rc<Self>, rate: i32, delay: i32) -> DynEventFormatter {
|
||||
Box::new(RepeatInfo {
|
||||
obj: self.clone(),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const AXIS_SOURCE: u32 = 6;
|
|||
const AXIS_STOP: u32 = 7;
|
||||
const AXIS_DISCRETE: u32 = 8;
|
||||
|
||||
const ROLE: u32 = 0;
|
||||
#[allow(dead_code)] const ROLE: u32 = 0;
|
||||
|
||||
pub(super) const RELEASED: u32 = 0;
|
||||
pub(super) const PRESSED: u32 = 1;
|
||||
|
|
@ -30,10 +30,10 @@ pub(super) const PRESSED: u32 = 1;
|
|||
pub(super) const VERTICAL_SCROLL: u32 = 0;
|
||||
pub(super) const HORIZONTAL_SCROLL: u32 = 1;
|
||||
|
||||
const WHEEL: u32 = 0;
|
||||
const FINGER: u32 = 1;
|
||||
const CONTINUOUS: u32 = 2;
|
||||
const WHEEL_TILT: u32 = 3;
|
||||
#[allow(dead_code)] const WHEEL: u32 = 0;
|
||||
#[allow(dead_code)] const FINGER: u32 = 1;
|
||||
#[allow(dead_code)] const CONTINUOUS: u32 = 2;
|
||||
#[allow(dead_code)] const WHEEL_TILT: u32 = 3;
|
||||
|
||||
id!(WlPointerId);
|
||||
|
||||
|
|
@ -108,10 +108,12 @@ impl WlPointer {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn frame(self: &Rc<Self>) -> DynEventFormatter {
|
||||
Box::new(Frame { obj: self.clone() })
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn axis_source(self: &Rc<Self>, axis_source: u32) -> DynEventFormatter {
|
||||
Box::new(AxisSource {
|
||||
obj: self.clone(),
|
||||
|
|
@ -119,6 +121,7 @@ impl WlPointer {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn axis_stop(self: &Rc<Self>, time: u32, axis: u32) -> DynEventFormatter {
|
||||
Box::new(AxisStop {
|
||||
obj: self.clone(),
|
||||
|
|
@ -127,6 +130,7 @@ impl WlPointer {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn axis_discrete(self: &Rc<Self>, axis: u32, discrete: i32) -> DynEventFormatter {
|
||||
Box::new(AxisDiscrete {
|
||||
obj: self.clone(),
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ pub use types::*;
|
|||
|
||||
const RELEASE: u32 = 0;
|
||||
|
||||
const DOWN: u32 = 0;
|
||||
const UP: u32 = 1;
|
||||
const MOTION: u32 = 2;
|
||||
const FRAME: u32 = 3;
|
||||
const CANCEL: u32 = 4;
|
||||
const SHAPE: u32 = 5;
|
||||
const ORIENTATION: u32 = 6;
|
||||
#[allow(dead_code)] const DOWN: u32 = 0;
|
||||
#[allow(dead_code)] const UP: u32 = 1;
|
||||
#[allow(dead_code)] const MOTION: u32 = 2;
|
||||
#[allow(dead_code)] const FRAME: u32 = 3;
|
||||
#[allow(dead_code)] const CANCEL: u32 = 4;
|
||||
#[allow(dead_code)] const SHAPE: u32 = 5;
|
||||
#[allow(dead_code)] const ORIENTATION: u32 = 6;
|
||||
|
||||
id!(WlTouchId);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pub struct WlShmGlobal {
|
|||
}
|
||||
|
||||
pub struct WlShmObj {
|
||||
global: Rc<WlShmGlobal>,
|
||||
_global: Rc<WlShmGlobal>,
|
||||
id: WlShmId,
|
||||
client: Rc<Client>,
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ impl WlShmGlobal {
|
|||
_version: u32,
|
||||
) -> Result<(), WlShmError> {
|
||||
let obj = Rc::new(WlShmObj {
|
||||
global: self,
|
||||
_global: self,
|
||||
id,
|
||||
client: client.clone(),
|
||||
});
|
||||
|
|
@ -100,10 +100,6 @@ impl Global for WlShmGlobal {
|
|||
fn version(&self) -> u32 {
|
||||
1
|
||||
}
|
||||
|
||||
fn pre_remove(&self) {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
handle_request!(WlShmObj);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub use types::*;
|
|||
const DESTROY: u32 = 0;
|
||||
const GET_SUBSURFACE: u32 = 1;
|
||||
|
||||
const BAD_SURFACE: u32 = 0;
|
||||
#[allow(dead_code)] const BAD_SURFACE: u32 = 0;
|
||||
|
||||
id!(WlSubcompositorId);
|
||||
|
||||
|
|
@ -20,7 +20,6 @@ pub struct WlSubcompositorGlobal {
|
|||
}
|
||||
|
||||
pub struct WlSubcompositorObj {
|
||||
global: Rc<WlSubcompositorGlobal>,
|
||||
id: WlSubcompositorId,
|
||||
client: Rc<Client>,
|
||||
}
|
||||
|
|
@ -37,7 +36,6 @@ impl WlSubcompositorGlobal {
|
|||
_version: u32,
|
||||
) -> Result<(), WlSubcompositorError> {
|
||||
let obj = Rc::new(WlSubcompositorObj {
|
||||
global: self,
|
||||
id,
|
||||
client: client.clone(),
|
||||
});
|
||||
|
|
@ -95,10 +93,6 @@ impl Global for WlSubcompositorGlobal {
|
|||
fn version(&self) -> u32 {
|
||||
1
|
||||
}
|
||||
|
||||
fn pre_remove(&self) {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
handle_request!(WlSubcompositorObj);
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ const SET_BUFFER_TRANSFORM: u32 = 7;
|
|||
const SET_BUFFER_SCALE: u32 = 8;
|
||||
const DAMAGE_BUFFER: u32 = 9;
|
||||
|
||||
const ENTER: u32 = 0;
|
||||
const LEAVE: u32 = 1;
|
||||
#[allow(dead_code)] const ENTER: u32 = 0;
|
||||
#[allow(dead_code)] const LEAVE: u32 = 1;
|
||||
|
||||
const INVALID_SCALE: u32 = 0;
|
||||
const INVALID_TRANSFORM: u32 = 1;
|
||||
const INVALID_SIZE: u32 = 2;
|
||||
#[allow(dead_code)] const INVALID_SCALE: u32 = 0;
|
||||
#[allow(dead_code)] const INVALID_TRANSFORM: u32 = 1;
|
||||
#[allow(dead_code)] const INVALID_SIZE: u32 = 2;
|
||||
|
||||
id!(WlSurfaceId);
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ impl XdgSurfaceRoleData {
|
|||
}
|
||||
|
||||
struct XdgPopupData {
|
||||
popup: Rc<XdgPopup>,
|
||||
_popup: Rc<XdgPopup>,
|
||||
parent: Option<Rc<XdgSurface>>,
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ impl WlSurface {
|
|||
for surface in children.subsurfaces.values() {
|
||||
let rd = surface.role_data.borrow();
|
||||
if let RoleData::Subsurface(ss) = &*rd {
|
||||
let mut ss_extents = surface.extents.get();
|
||||
let ss_extents = surface.extents.get();
|
||||
extents.x1 = extents.x1.min(ss_extents.x1 + ss.x);
|
||||
extents.y1 = extents.y1.min(ss_extents.y1 + ss.y);
|
||||
extents.x2 = extents.x2.max(ss_extents.x2 + ss.x);
|
||||
|
|
@ -249,10 +249,6 @@ impl WlSurface {
|
|||
parent.calculate_extents();
|
||||
}
|
||||
|
||||
pub fn is_subsurface(&self) -> bool {
|
||||
self.role.get() == SurfaceRole::Subsurface
|
||||
}
|
||||
|
||||
pub fn get_root(self: &Rc<Self>) -> Rc<WlSurface> {
|
||||
let mut root = self.clone();
|
||||
loop {
|
||||
|
|
@ -381,7 +377,7 @@ impl WlSurface {
|
|||
}
|
||||
|
||||
async fn damage(&self, parser: MsgParser<'_, '_>) -> Result<(), DamageError> {
|
||||
let req: Damage = self.parse(parser)?;
|
||||
let _req: Damage = self.parse(parser)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -518,17 +514,17 @@ impl WlSurface {
|
|||
&self,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), SetBufferTransformError> {
|
||||
let req: SetBufferTransform = self.parse(parser)?;
|
||||
let _req: SetBufferTransform = self.parse(parser)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn set_buffer_scale(&self, parser: MsgParser<'_, '_>) -> Result<(), SetBufferScaleError> {
|
||||
let req: SetBufferScale = self.parse(parser)?;
|
||||
let _req: SetBufferScale = self.parse(parser)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn damage_buffer(&self, parser: MsgParser<'_, '_>) -> Result<(), DamageBufferError> {
|
||||
let req: DamageBuffer = self.parse(parser)?;
|
||||
let _req: DamageBuffer = self.parse(parser)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const PLACE_BELOW: u32 = 3;
|
|||
const SET_SYNC: u32 = 4;
|
||||
const SET_DESYNC: u32 = 5;
|
||||
|
||||
const BAD_SURFACE: u32 = 0;
|
||||
#[allow(dead_code)] const BAD_SURFACE: u32 = 0;
|
||||
|
||||
const MAX_SUBSURFACE_DEPTH: u32 = 100;
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ pub struct WlSubsurface {
|
|||
pub(super) parent: Rc<WlSurface>,
|
||||
}
|
||||
|
||||
fn update_children_sync(surface: &Rc<WlSurface>, sync: bool) -> Result<(), WlSubsurfaceError> {
|
||||
fn update_children_sync(surface: &Rc<WlSurface>, sync: bool) {
|
||||
let children = surface.children.borrow();
|
||||
if let Some(children) = &*children {
|
||||
for child in children.subsurfaces.values() {
|
||||
|
|
@ -44,7 +44,6 @@ fn update_children_sync(surface: &Rc<WlSurface>, sync: bool) -> Result<(), WlSub
|
|||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update_children_attach(
|
||||
|
|
@ -63,7 +62,7 @@ fn update_children_attach(
|
|||
}
|
||||
data.sync_ancestor = sync;
|
||||
let sync = data.sync_ancestor || data.sync_requested;
|
||||
update_children_attach(child, sync, depth + 1);
|
||||
update_children_attach(child, sync, depth + 1)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,17 +24,16 @@ const ACK_CONFIGURE: u32 = 4;
|
|||
|
||||
const CONFIGURE: u32 = 0;
|
||||
|
||||
const NOT_CONSTRUCTED: u32 = 1;
|
||||
#[allow(dead_code)] const NOT_CONSTRUCTED: u32 = 1;
|
||||
const ALREADY_CONSTRUCTED: u32 = 2;
|
||||
const UNCONFIGURED_BUFFER: u32 = 3;
|
||||
#[allow(dead_code)] const UNCONFIGURED_BUFFER: u32 = 3;
|
||||
|
||||
id!(XdgSurfaceId);
|
||||
|
||||
pub struct XdgSurface {
|
||||
id: XdgSurfaceId,
|
||||
wm_base: Rc<XdgWmBaseObj>,
|
||||
base: Rc<XdgWmBaseObj>,
|
||||
pub surface: Rc<WlSurface>,
|
||||
version: u32,
|
||||
}
|
||||
|
||||
impl XdgSurface {
|
||||
|
|
@ -42,13 +41,11 @@ impl XdgSurface {
|
|||
wm_base: &Rc<XdgWmBaseObj>,
|
||||
id: XdgSurfaceId,
|
||||
surface: &Rc<WlSurface>,
|
||||
version: u32,
|
||||
) -> Self {
|
||||
Self {
|
||||
id,
|
||||
wm_base: wm_base.clone(),
|
||||
base: wm_base.clone(),
|
||||
surface: surface.clone(),
|
||||
version,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -64,6 +61,7 @@ impl XdgSurface {
|
|||
if !matches!(old_role, SurfaceRole::None | SurfaceRole::XdgSurface) {
|
||||
return Err(XdgSurfaceError::IncompatibleRole(self.surface.id, old_role));
|
||||
}
|
||||
self.surface.role.set(SurfaceRole::XdgSurface);
|
||||
let mut data = self.surface.role_data.borrow_mut();
|
||||
if data.is_some() {
|
||||
return Err(XdgSurfaceError::AlreadyAttached(self.surface.id));
|
||||
|
|
@ -101,7 +99,7 @@ impl XdgSurface {
|
|||
}
|
||||
*data = RoleData::None;
|
||||
}
|
||||
self.wm_base.surfaces.remove(&self.id);
|
||||
self.base.surfaces.remove(&self.id);
|
||||
self.surface.client.remove_obj(self).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -128,7 +126,7 @@ impl XdgSurface {
|
|||
return Err(GetToplevelError::AlreadyConstructed);
|
||||
}
|
||||
data.role = XdgSurfaceRole::Toplevel;
|
||||
let toplevel = Rc::new(XdgToplevel::new(req.id, self, self.version));
|
||||
let toplevel = Rc::new(XdgToplevel::new(req.id, self));
|
||||
self.surface.client.add_client_obj(&toplevel)?;
|
||||
data.role_data = XdgSurfaceRoleData::Toplevel(XdgToplevelData {
|
||||
toplevel,
|
||||
|
|
@ -161,7 +159,7 @@ impl XdgSurface {
|
|||
return Err(GetPopupError::AlreadyConstructed);
|
||||
}
|
||||
data.role = XdgSurfaceRole::Popup;
|
||||
let popup = Rc::new(XdgPopup::new(req.id, self, self.version));
|
||||
let popup = Rc::new(XdgPopup::new(req.id, self));
|
||||
self.surface.client.add_client_obj(&popup)?;
|
||||
if let Some(parent) = &parent {
|
||||
let mut data = parent.surface.role_data.borrow_mut();
|
||||
|
|
@ -169,7 +167,7 @@ impl XdgSurface {
|
|||
xdg.popups.set(self.surface.id, popup.clone());
|
||||
}
|
||||
}
|
||||
data.role_data = XdgSurfaceRoleData::Popup(XdgPopupData { popup, parent });
|
||||
data.role_data = XdgSurfaceRoleData::Popup(XdgPopupData { _popup: popup, parent });
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,22 +15,20 @@ const CONFIGURE: u32 = 0;
|
|||
const POPUP_DONE: u32 = 1;
|
||||
const REPOSITIONED: u32 = 2;
|
||||
|
||||
const INVALID_GRAB: u32 = 1;
|
||||
#[allow(dead_code)] const INVALID_GRAB: u32 = 1;
|
||||
|
||||
id!(XdgPopupId);
|
||||
|
||||
pub struct XdgPopup {
|
||||
id: XdgPopupId,
|
||||
pub(in super::super) surface: Rc<XdgSurface>,
|
||||
version: u32,
|
||||
}
|
||||
|
||||
impl XdgPopup {
|
||||
pub fn new(id: XdgPopupId, surface: &Rc<XdgSurface>, version: u32) -> Self {
|
||||
pub fn new(id: XdgPopupId, surface: &Rc<XdgSurface>) -> Self {
|
||||
Self {
|
||||
id,
|
||||
surface: surface.clone(),
|
||||
version,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,29 +40,27 @@ pub enum ResizeEdge {
|
|||
BottomRight = 10,
|
||||
}
|
||||
|
||||
const STATE_MAXIMIZED: u32 = 1;
|
||||
const STATE_FULLSCREEN: u32 = 2;
|
||||
const STATE_RESIZING: u32 = 3;
|
||||
const STATE_ACTIVATED: u32 = 4;
|
||||
const STATE_TILED_LEFT: u32 = 5;
|
||||
const STATE_TILED_RIGHT: u32 = 6;
|
||||
const STATE_TILED_TOP: u32 = 7;
|
||||
const STATE_TILED_BOTTOM: u32 = 8;
|
||||
#[allow(dead_code)] const STATE_MAXIMIZED: u32 = 1;
|
||||
#[allow(dead_code)] const STATE_FULLSCREEN: u32 = 2;
|
||||
#[allow(dead_code)] const STATE_RESIZING: u32 = 3;
|
||||
#[allow(dead_code)] const STATE_ACTIVATED: u32 = 4;
|
||||
#[allow(dead_code)] const STATE_TILED_LEFT: u32 = 5;
|
||||
#[allow(dead_code)] const STATE_TILED_RIGHT: u32 = 6;
|
||||
#[allow(dead_code)] const STATE_TILED_TOP: u32 = 7;
|
||||
#[allow(dead_code)] const STATE_TILED_BOTTOM: u32 = 8;
|
||||
|
||||
id!(XdgToplevelId);
|
||||
|
||||
pub struct XdgToplevel {
|
||||
id: XdgToplevelId,
|
||||
pub surface: Rc<XdgSurface>,
|
||||
version: u32,
|
||||
}
|
||||
|
||||
impl XdgToplevel {
|
||||
pub fn new(id: XdgToplevelId, surface: &Rc<XdgSurface>, version: u32) -> Self {
|
||||
pub fn new(id: XdgToplevelId, surface: &Rc<XdgSurface>) -> Self {
|
||||
Self {
|
||||
id,
|
||||
surface: surface.clone(),
|
||||
version,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use num_traits::FromPrimitive;
|
|||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
pub use types::*;
|
||||
use crate::ifs::xdg_wm_base::XdgWmBaseObj;
|
||||
|
||||
const DESTROY: u32 = 0;
|
||||
const SET_SIZE: u32 = 1;
|
||||
|
|
@ -78,8 +79,8 @@ id!(XdgPositionerId);
|
|||
|
||||
pub struct XdgPositioner {
|
||||
id: XdgPositionerId,
|
||||
base: Rc<XdgWmBaseObj>,
|
||||
client: Rc<Client>,
|
||||
version: u32,
|
||||
position: RefCell<XdgPositioned>,
|
||||
}
|
||||
|
||||
|
|
@ -103,15 +104,16 @@ pub struct XdgPositioned {
|
|||
}
|
||||
|
||||
impl XdgPositioner {
|
||||
pub fn new(id: XdgPositionerId, client: &Rc<Client>, version: u32) -> Self {
|
||||
pub fn new(base: &Rc<XdgWmBaseObj>, id: XdgPositionerId, client: &Rc<Client>) -> Self {
|
||||
Self {
|
||||
id,
|
||||
client: client.clone(),
|
||||
version,
|
||||
base: base.clone(),
|
||||
position: RefCell::new(Default::default()),
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn clone(&self) -> Box<XdgPositioned> {
|
||||
Box::new(*self.position.borrow())
|
||||
}
|
||||
|
|
@ -266,6 +268,10 @@ impl Object for XdgPositioner {
|
|||
}
|
||||
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_PARENT_CONFIGURE + 1
|
||||
if self.base.version < 3 {
|
||||
SET_OFFSET + 1
|
||||
} else {
|
||||
SET_PARENT_CONFIGURE + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ const PONG: u32 = 3;
|
|||
|
||||
const PING: u32 = 0;
|
||||
|
||||
const ROLE: u32 = 0;
|
||||
#[allow(dead_code)] const ROLE: u32 = 0;
|
||||
const DEFUNCT_SURFACES: u32 = 1;
|
||||
const NOT_THE_TOPMOST_POPUP: u32 = 2;
|
||||
const INVALID_POPUP_PARENT: u32 = 3;
|
||||
const INVALID_SURFACE_STATE: u32 = 4;
|
||||
const INVALID_POSITIONER: u32 = 5;
|
||||
#[allow(dead_code)] const NOT_THE_TOPMOST_POPUP: u32 = 2;
|
||||
#[allow(dead_code)] const INVALID_POPUP_PARENT: u32 = 3;
|
||||
#[allow(dead_code)] const INVALID_SURFACE_STATE: u32 = 4;
|
||||
#[allow(dead_code)] const INVALID_POSITIONER: u32 = 5;
|
||||
|
||||
id!(XdgWmBaseId);
|
||||
|
||||
|
|
@ -31,10 +31,9 @@ pub struct XdgWmBaseGlobal {
|
|||
}
|
||||
|
||||
pub struct XdgWmBaseObj {
|
||||
global: Rc<XdgWmBaseGlobal>,
|
||||
id: XdgWmBaseId,
|
||||
client: Rc<Client>,
|
||||
version: u32,
|
||||
pub version: u32,
|
||||
pub(super) surfaces: CopyHashMap<XdgSurfaceId, Rc<XdgSurface>>,
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +49,6 @@ impl XdgWmBaseGlobal {
|
|||
version: u32,
|
||||
) -> Result<(), XdgWmBaseError> {
|
||||
let obj = Rc::new(XdgWmBaseObj {
|
||||
global: self,
|
||||
id,
|
||||
client: client.clone(),
|
||||
version,
|
||||
|
|
@ -80,11 +78,11 @@ impl XdgWmBaseObj {
|
|||
}
|
||||
|
||||
async fn create_positioner(
|
||||
&self,
|
||||
self: &Rc<Self>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), CreatePositionerError> {
|
||||
let req: CreatePositioner = self.client.parse(self, parser)?;
|
||||
let pos = Rc::new(XdgPositioner::new(req.id, &self.client, 3));
|
||||
let req: CreatePositioner = self.client.parse(&**self, parser)?;
|
||||
let pos = Rc::new(XdgPositioner::new(self, req.id, &self.client));
|
||||
self.client.add_client_obj(&pos)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -95,7 +93,7 @@ impl XdgWmBaseObj {
|
|||
) -> Result<(), GetXdgSurfaceError> {
|
||||
let req: GetXdgSurface = self.client.parse(&**self, parser)?;
|
||||
let surface = self.client.get_surface(req.surface)?;
|
||||
let xdg_surface = Rc::new(XdgSurface::new(self, req.id, &surface, 3));
|
||||
let xdg_surface = Rc::new(XdgSurface::new(self, req.id, &surface));
|
||||
self.client.add_client_obj(&xdg_surface)?;
|
||||
xdg_surface.install()?;
|
||||
self.surfaces.set(req.id, xdg_surface);
|
||||
|
|
@ -141,10 +139,6 @@ impl Global for XdgWmBaseGlobal {
|
|||
fn version(&self) -> u32 {
|
||||
3
|
||||
}
|
||||
|
||||
fn pre_remove(&self) {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
handle_request!(XdgWmBaseObj);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue