all: use trait upcasting
This commit is contained in:
parent
f0caafc862
commit
09e5f89174
44 changed files with 90 additions and 269 deletions
|
|
@ -39,13 +39,11 @@ linear_ids!(ConnectorIds, ConnectorId);
|
|||
linear_ids!(InputDeviceIds, InputDeviceId);
|
||||
linear_ids!(DrmDeviceIds, DrmDeviceId);
|
||||
|
||||
pub trait Backend {
|
||||
pub trait Backend: Any {
|
||||
fn run(self: Rc<Self>) -> SpawnedFuture<Result<(), Box<dyn Error>>>;
|
||||
fn clear(&self) {
|
||||
// nothing
|
||||
}
|
||||
#[cfg_attr(not(feature = "it"), expect(dead_code))]
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any>;
|
||||
|
||||
fn switch_to(&self, vtnr: u32) {
|
||||
let _ = vtnr;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use {
|
|||
},
|
||||
video::drm::ConnectorType,
|
||||
},
|
||||
std::{any::Any, error::Error, rc::Rc},
|
||||
std::{error::Error, rc::Rc},
|
||||
};
|
||||
|
||||
pub struct DummyBackend;
|
||||
|
|
@ -15,10 +15,6 @@ impl Backend for DummyBackend {
|
|||
fn run(self: Rc<Self>) -> SpawnedFuture<Result<(), Box<dyn Error>>> {
|
||||
unreachable!();
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DummyOutput {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ use {
|
|||
},
|
||||
bstr::ByteSlice,
|
||||
std::{
|
||||
any::Any,
|
||||
cell::{Cell, RefCell},
|
||||
error::Error,
|
||||
ffi::{CStr, CString},
|
||||
|
|
@ -233,10 +232,6 @@ impl Backend for MetalBackend {
|
|||
}
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn switch_to(&self, vtnr: u32) {
|
||||
self.session.switch_to(vtnr, move |res| {
|
||||
if let Err(e) = res {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ use {
|
|||
},
|
||||
jay_config::video::GfxApi,
|
||||
std::{
|
||||
any::Any,
|
||||
borrow::Cow,
|
||||
cell::{Cell, RefCell},
|
||||
collections::VecDeque,
|
||||
|
|
@ -251,10 +250,6 @@ impl Backend for XBackend {
|
|||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub struct XBackend {
|
||||
|
|
|
|||
|
|
@ -45,15 +45,13 @@ pub trait CpuWork: Send {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait AsyncCpuWork {
|
||||
pub trait AsyncCpuWork: Any {
|
||||
fn run(
|
||||
self: Box<Self>,
|
||||
eng: &Rc<AsyncEngine>,
|
||||
ring: &Rc<IoUring>,
|
||||
completion: WorkCompletion,
|
||||
) -> SpawnedFuture<CompletedWork>;
|
||||
|
||||
fn into_any(self: Box<Self>) -> Box<dyn Any>;
|
||||
}
|
||||
|
||||
pub struct WorkCompletion {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ impl CpuWork for ReadWriteWork {
|
|||
}
|
||||
|
||||
fn async_work_done(&mut self, work: Box<dyn AsyncCpuWork>) {
|
||||
let work = work.into_any().downcast().unwrap();
|
||||
let work = (work as Box<dyn Any>).downcast().unwrap();
|
||||
self.config = Some(work);
|
||||
}
|
||||
}
|
||||
|
|
@ -144,8 +144,4 @@ impl AsyncCpuWork for ReadWriteWorkConfig {
|
|||
completion.complete(self)
|
||||
})
|
||||
}
|
||||
|
||||
fn into_any(self: Box<Self>) -> Box<dyn Any> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,6 @@ impl AsyncCpuWork for AsyncWork {
|
|||
completion.complete(self)
|
||||
})
|
||||
}
|
||||
|
||||
fn into_any(self: Box<Self>) -> Box<dyn Any> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn run(cancel: bool) {
|
||||
|
|
|
|||
|
|
@ -335,8 +335,7 @@ impl CursorImageScaled {
|
|||
extents: Rect::new_sized(-xhot, -yhot, width, height).unwrap(),
|
||||
tex: ctx
|
||||
.clone()
|
||||
.shmem_texture(None, data, ARGB8888, width, height, width * 4, None)?
|
||||
.into_texture(),
|
||||
.shmem_texture(None, data, ARGB8888, width, height, width * 4, None)?,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,9 +292,7 @@ pub enum ResetStatus {
|
|||
Other(u32),
|
||||
}
|
||||
|
||||
pub trait GfxBlendBuffer: Debug {
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any>;
|
||||
}
|
||||
pub trait GfxBlendBuffer: Any + Debug {}
|
||||
|
||||
pub trait GfxFramebuffer: Debug {
|
||||
fn physical_size(&self) -> (i32, i32);
|
||||
|
|
@ -321,7 +319,6 @@ pub trait GfxFramebuffer: Debug {
|
|||
}
|
||||
|
||||
pub trait GfxInternalFramebuffer: GfxFramebuffer {
|
||||
fn into_fb(self: Rc<Self>) -> Rc<dyn GfxFramebuffer>;
|
||||
fn stride(&self) -> i32;
|
||||
|
||||
fn staging_size(&self) -> usize;
|
||||
|
|
@ -645,17 +642,13 @@ pub trait GfxImage {
|
|||
fn height(&self) -> i32;
|
||||
}
|
||||
|
||||
pub trait GfxTexture: Debug {
|
||||
pub trait GfxTexture: Any + Debug {
|
||||
fn size(&self) -> (i32, i32);
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any>;
|
||||
fn dmabuf(&self) -> Option<&DmaBuf>;
|
||||
fn format(&self) -> &'static Format;
|
||||
}
|
||||
|
||||
pub trait ShmGfxTexture: GfxTexture {
|
||||
fn into_texture(self: Rc<Self>) -> Rc<dyn GfxTexture>;
|
||||
}
|
||||
pub trait ShmGfxTexture: GfxTexture {}
|
||||
|
||||
pub trait AsyncShmGfxTextureCallback {
|
||||
fn completed(self: Rc<Self>, res: Result<(), GfxError>);
|
||||
|
|
@ -667,9 +660,8 @@ bitflags! {
|
|||
STAGING_DOWNLOAD = 1 << 1,
|
||||
}
|
||||
|
||||
pub trait GfxStagingBuffer {
|
||||
pub trait GfxStagingBuffer: Any {
|
||||
fn size(&self) -> usize;
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any>;
|
||||
}
|
||||
|
||||
pub trait AsyncShmGfxTextureTransferCancellable {
|
||||
|
|
@ -729,8 +721,6 @@ pub trait AsyncShmGfxTexture: GfxTexture {
|
|||
height: i32,
|
||||
stride: i32,
|
||||
) -> bool;
|
||||
|
||||
fn into_texture(self: Rc<Self>) -> Rc<dyn GfxTexture>;
|
||||
}
|
||||
|
||||
pub trait GfxContext: Debug {
|
||||
|
|
@ -792,10 +782,6 @@ pub trait GfxContext: Debug {
|
|||
fn size(&self) -> usize {
|
||||
self.0
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
}
|
||||
Rc::new(Dummy(size))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ use {
|
|||
},
|
||||
isnt::std_1::vec::IsntVecExt,
|
||||
once_cell::sync::Lazy,
|
||||
std::{cell::RefCell, error::Error, rc::Rc, sync::Arc},
|
||||
std::{any::Any, cell::RefCell, error::Error, rc::Rc, sync::Arc},
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ fn handle_explicit_sync(ctx: &GlRenderContext, img: Option<&Rc<EglImage>>, sync:
|
|||
|
||||
impl dyn GfxTexture {
|
||||
fn as_gl(&self) -> &Texture {
|
||||
self.as_any()
|
||||
(self as &dyn Any)
|
||||
.downcast_ref()
|
||||
.expect("Non-gl texture passed into gl")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,10 +127,6 @@ impl GfxFramebuffer for Framebuffer {
|
|||
}
|
||||
|
||||
impl GfxInternalFramebuffer for Framebuffer {
|
||||
fn into_fb(self: Rc<Self>) -> Rc<dyn GfxFramebuffer> {
|
||||
self
|
||||
}
|
||||
|
||||
fn stride(&self) -> i32 {
|
||||
self.gl.rb.stride
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ use {
|
|||
video::dmabuf::DmaBuf,
|
||||
},
|
||||
std::{
|
||||
any::Any,
|
||||
cell::Cell,
|
||||
fmt::{Debug, Formatter},
|
||||
rc::Rc,
|
||||
|
|
@ -52,14 +51,6 @@ impl GfxTexture for Texture {
|
|||
(self.width(), self.height())
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn dmabuf(&self) -> Option<&DmaBuf> {
|
||||
self.gl.img.as_ref().map(|i| &i.dmabuf)
|
||||
}
|
||||
|
|
@ -69,11 +60,7 @@ impl GfxTexture for Texture {
|
|||
}
|
||||
}
|
||||
|
||||
impl ShmGfxTexture for Texture {
|
||||
fn into_texture(self: Rc<Self>) -> Rc<dyn GfxTexture> {
|
||||
self
|
||||
}
|
||||
}
|
||||
impl ShmGfxTexture for Texture {}
|
||||
|
||||
impl AsyncShmGfxTexture for Texture {
|
||||
fn async_upload(
|
||||
|
|
@ -136,8 +123,4 @@ impl AsyncShmGfxTexture for Texture {
|
|||
&& height == self.gl.height
|
||||
&& stride == self.gl.stride
|
||||
}
|
||||
|
||||
fn into_texture(self: Rc<Self>) -> Rc<dyn GfxTexture> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use {
|
|||
format::Format,
|
||||
gfx_api::{
|
||||
AsyncShmGfxTexture, GfxBlendBuffer, GfxContext, GfxError, GfxFormat, GfxImage,
|
||||
GfxInternalFramebuffer, GfxStagingBuffer, ResetStatus, STAGING_DOWNLOAD,
|
||||
GfxInternalFramebuffer, GfxStagingBuffer, GfxTexture, ResetStatus, STAGING_DOWNLOAD,
|
||||
STAGING_UPLOAD, ShmGfxTexture, StagingBufferUsecase,
|
||||
},
|
||||
gfx_apis::vulkan::{
|
||||
|
|
@ -272,7 +272,7 @@ impl GfxContext for Context {
|
|||
damage: Option<&[Rect]>,
|
||||
) -> Result<Rc<dyn ShmGfxTexture>, GfxError> {
|
||||
if let Some(old) = old {
|
||||
let old = old.into_texture().into_vk(&self.0.device.device);
|
||||
let old = (old as Rc<dyn GfxTexture>).into_vk(&self.0.device.device);
|
||||
let shm = match &old.ty {
|
||||
VulkanImageMemory::DmaBuf(_) => unreachable!(),
|
||||
VulkanImageMemory::Blend(_) => unreachable!(),
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use {
|
|||
ImageTiling, ImageType, ImageViewCreateInfo, ImageViewType, SampleCountFlags, SharingMode,
|
||||
},
|
||||
gpu_alloc::UsageFlags,
|
||||
std::{any::Any, cell::Cell, collections::hash_map::Entry, rc::Rc},
|
||||
std::{cell::Cell, collections::hash_map::Entry, rc::Rc},
|
||||
};
|
||||
|
||||
impl VulkanRenderer {
|
||||
|
|
@ -113,8 +113,4 @@ impl VulkanRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
impl GfxBlendBuffer for VulkanImage {
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
}
|
||||
impl GfxBlendBuffer for VulkanImage {}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ use {
|
|||
},
|
||||
gpu_alloc::UsageFlags,
|
||||
std::{
|
||||
any::Any,
|
||||
cell::Cell,
|
||||
fmt::{Debug, Formatter},
|
||||
mem,
|
||||
|
|
@ -591,10 +590,6 @@ impl GfxFramebuffer for VulkanImage {
|
|||
}
|
||||
|
||||
impl GfxInternalFramebuffer for VulkanImage {
|
||||
fn into_fb(self: Rc<Self>) -> Rc<dyn GfxFramebuffer> {
|
||||
self
|
||||
}
|
||||
|
||||
fn stride(&self) -> i32 {
|
||||
let VulkanImageMemory::Internal(shm) = &self.ty else {
|
||||
unreachable!();
|
||||
|
|
@ -637,14 +632,6 @@ impl GfxTexture for VulkanImage {
|
|||
(self.width as _, self.height as _)
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn dmabuf(&self) -> Option<&DmaBuf> {
|
||||
match &self.ty {
|
||||
VulkanImageMemory::DmaBuf(b) => Some(&b.template.dmabuf),
|
||||
|
|
@ -658,11 +645,7 @@ impl GfxTexture for VulkanImage {
|
|||
}
|
||||
}
|
||||
|
||||
impl ShmGfxTexture for VulkanImage {
|
||||
fn into_texture(self: Rc<Self>) -> Rc<dyn GfxTexture> {
|
||||
self
|
||||
}
|
||||
}
|
||||
impl ShmGfxTexture for VulkanImage {}
|
||||
|
||||
impl AsyncShmGfxTexture for VulkanImage {
|
||||
fn staging_size(&self) -> usize {
|
||||
|
|
@ -711,10 +694,6 @@ impl AsyncShmGfxTexture for VulkanImage {
|
|||
&& self.height == height as u32
|
||||
&& self.stride == stride as u32
|
||||
}
|
||||
|
||||
fn into_texture(self: Rc<Self>) -> Rc<dyn GfxTexture> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl AsyncShmGfxTextureTransferCancellable for VulkanImage {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ use {
|
|||
jay_algorithms::rect::Tag,
|
||||
linearize::{Linearize, LinearizeExt, StaticMap, static_map},
|
||||
std::{
|
||||
any::Any,
|
||||
borrow::Cow,
|
||||
cell::{Cell, RefCell},
|
||||
collections::hash_map::Entry,
|
||||
|
|
@ -1967,8 +1968,7 @@ impl VulkanImage {
|
|||
|
||||
impl dyn GfxTexture {
|
||||
fn as_vk(&self, device: &Device) -> &VulkanImage {
|
||||
let img: &VulkanImage = self
|
||||
.as_any()
|
||||
let img: &VulkanImage = (self as &dyn Any)
|
||||
.downcast_ref()
|
||||
.expect("Non-vulkan texture passed into vulkan");
|
||||
img.assert_device(device);
|
||||
|
|
@ -1976,8 +1976,7 @@ impl dyn GfxTexture {
|
|||
}
|
||||
|
||||
pub(super) fn into_vk(self: Rc<Self>, device: &Device) -> Rc<VulkanImage> {
|
||||
let img: Rc<VulkanImage> = self
|
||||
.into_any()
|
||||
let img: Rc<VulkanImage> = (self as Rc<dyn Any>)
|
||||
.downcast()
|
||||
.expect("Non-vulkan texture passed into vulkan");
|
||||
img.assert_device(device);
|
||||
|
|
@ -1987,8 +1986,7 @@ impl dyn GfxTexture {
|
|||
|
||||
impl dyn GfxBlendBuffer {
|
||||
pub(super) fn into_vk(self: Rc<Self>, device: &Device) -> Rc<VulkanImage> {
|
||||
let img: Rc<VulkanImage> = self
|
||||
.into_any()
|
||||
let img: Rc<VulkanImage> = (self as Rc<dyn Any>)
|
||||
.downcast()
|
||||
.expect("Non-vulkan blend buffer passed into vulkan");
|
||||
img.assert_device(device);
|
||||
|
|
|
|||
|
|
@ -178,10 +178,6 @@ impl GfxStagingBuffer for VulkanStagingShell {
|
|||
fn size(&self) -> usize {
|
||||
self.size as _
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanStagingShell {
|
||||
|
|
@ -196,8 +192,7 @@ impl VulkanStagingShell {
|
|||
|
||||
impl dyn GfxStagingBuffer {
|
||||
pub(super) fn into_vk(self: Rc<Self>, device: &Device) -> Rc<VulkanStagingShell> {
|
||||
let shell: Rc<VulkanStagingShell> = self
|
||||
.into_any()
|
||||
let shell: Rc<VulkanStagingShell> = (self as Rc<dyn Any>)
|
||||
.downcast()
|
||||
.expect("Non-vulkan staging buffer passed into vulkan");
|
||||
shell.assert_device(device);
|
||||
|
|
|
|||
|
|
@ -138,11 +138,7 @@ impl ExtImageCopyCaptureFrameV1 {
|
|||
Some(s) => s,
|
||||
_ => ctx.create_staging_buffer(bridge.staging_size(), STAGING_DOWNLOAD),
|
||||
};
|
||||
let res = f(
|
||||
bridge.clone().into_fb(),
|
||||
AcquireSync::Unnecessary,
|
||||
ReleaseSync::None,
|
||||
);
|
||||
let res = f(bridge.clone(), AcquireSync::Unnecessary, ReleaseSync::None);
|
||||
if let Err(e) = res {
|
||||
log::error!("Could not copy frame to staging texture: {}", ErrorFmt(e));
|
||||
return Err(FrameFailureReason::Unknown);
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ impl LatchListener for ExtImageCopyCaptureSessionV1 {
|
|||
self.force_capture.set(true);
|
||||
return;
|
||||
}
|
||||
frame.copy_node(on, tl.tl_as_node(), data.desired_pixel_size());
|
||||
frame.copy_node(on, &*tl, data.desired_pixel_size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ impl JayScreencast {
|
|||
AcquireSync::Implicit,
|
||||
ReleaseSync::Implicit,
|
||||
self.client.state.color_manager.srgb_srgb(),
|
||||
tl.tl_as_node(),
|
||||
&*tl,
|
||||
&self.client.state,
|
||||
Some(tl.node_absolute_position()),
|
||||
scale,
|
||||
|
|
|
|||
|
|
@ -212,12 +212,9 @@ impl WlBuffer {
|
|||
match &*self.storage.borrow() {
|
||||
None => None,
|
||||
Some(s) => match s {
|
||||
WlBufferStorage::Shm { .. } => surface
|
||||
.shm_textures
|
||||
.front()
|
||||
.tex
|
||||
.get()
|
||||
.map(|t| t.into_texture()),
|
||||
WlBufferStorage::Shm { .. } => {
|
||||
surface.shm_textures.front().tex.get().map(|t| t as _)
|
||||
}
|
||||
WlBufferStorage::Dmabuf { tex, .. } => tex.clone(),
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -420,8 +420,8 @@ impl WlSeatGlobal {
|
|||
Some(cn) => cn,
|
||||
_ => return,
|
||||
};
|
||||
let kb_foci = collect_kb_foci(tl.clone().tl_into_node());
|
||||
cn.cnode_remove_child2(tl.tl_as_node(), true);
|
||||
let kb_foci = collect_kb_foci(tl.clone());
|
||||
cn.cnode_remove_child2(&*tl, true);
|
||||
if !ws.visible.get() {
|
||||
for focus in kb_foci {
|
||||
old_ws.clone().node_do_focus(&focus, Direction::Unspecified);
|
||||
|
|
@ -604,7 +604,7 @@ impl WlSeatGlobal {
|
|||
};
|
||||
if let Some(pn) = pn.node_into_containing_node() {
|
||||
let cn = ContainerNode::new(&self.state, &ws, tl.clone(), axis);
|
||||
pn.cnode_replace_child(tl.tl_as_node(), cn);
|
||||
pn.cnode_replace_child(&*tl, cn);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -612,7 +612,7 @@ impl WlSeatGlobal {
|
|||
if let Some(tl) = self.keyboard_node.get().node_toplevel() {
|
||||
if let Some(parent) = tl.tl_data().parent.get() {
|
||||
if let Some(tl) = parent.node_toplevel() {
|
||||
self.focus_node(tl.tl_into_node());
|
||||
self.focus_node(tl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -646,10 +646,10 @@ impl WlSeatGlobal {
|
|||
_ => return,
|
||||
};
|
||||
if !floating {
|
||||
parent.cnode_remove_child2(tl.tl_as_node(), true);
|
||||
parent.cnode_remove_child2(&*tl, true);
|
||||
self.state.map_tiled(tl);
|
||||
} else if let Some(ws) = data.workspace.get() {
|
||||
parent.cnode_remove_child2(tl.tl_as_node(), true);
|
||||
parent.cnode_remove_child2(&*tl, true);
|
||||
let (width, height) = data.float_size(&ws);
|
||||
self.state.map_floating(tl, width, height, &ws, None);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -926,7 +926,7 @@ impl WlSeatGlobal {
|
|||
pub fn focus_toplevel(self: &Rc<Self>, n: Rc<dyn ToplevelNode>) {
|
||||
let node = match n.tl_focus_child() {
|
||||
Some(n) => n,
|
||||
_ => n.tl_into_node(),
|
||||
_ => n,
|
||||
};
|
||||
self.focus_node(node);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1089,7 +1089,7 @@ impl WindowManagementGrabUsecase for MoveToplevelGrabPointerOwner {
|
|||
) {
|
||||
let (x, y) = seat.pointer_cursor.position();
|
||||
let (x, y) = (x.round_down() - self.dx, y.round_down() - self.dy);
|
||||
parent.cnode_set_child_position(tl.tl_as_node(), x, y);
|
||||
parent.cnode_set_child_position(&**tl, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1144,7 +1144,7 @@ impl WindowManagementGrabUsecase for ResizeToplevelGrabPointerOwner {
|
|||
}
|
||||
}
|
||||
if x1.is_some() || x2.is_some() || y1.is_some() || y2.is_some() {
|
||||
parent.cnode_resize_child(tl.tl_as_node(), x1, y1, x2, y2);
|
||||
parent.cnode_resize_child(&**tl, x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1230,13 +1230,11 @@ impl UiDragUsecase for TileDragUsecase {
|
|||
let placeholder = Rc::new_cyclic(|weak| PlaceholderNode::new_empty(&seat.state, weak));
|
||||
src_parent
|
||||
.clone()
|
||||
.cnode_replace_child(src.tl_as_node(), placeholder.clone());
|
||||
.cnode_replace_child(&*src, placeholder.clone());
|
||||
placeholder
|
||||
};
|
||||
let new_container = |workspace: &Rc<WorkspaceNode>| {
|
||||
src_parent
|
||||
.clone()
|
||||
.cnode_remove_child2(src.tl_as_node(), true);
|
||||
src_parent.clone().cnode_remove_child2(&*src, true);
|
||||
let cn = ContainerNode::new(
|
||||
&seat.state,
|
||||
&workspace,
|
||||
|
|
@ -1251,8 +1249,8 @@ impl UiDragUsecase for TileDragUsecase {
|
|||
return;
|
||||
};
|
||||
let placeholder = detach();
|
||||
dst_parent.cnode_replace_child(dst.tl_as_node(), src);
|
||||
src_parent.cnode_replace_child(placeholder.tl_as_node(), dst);
|
||||
dst_parent.cnode_replace_child(&*dst, src);
|
||||
src_parent.cnode_replace_child(&*placeholder, dst);
|
||||
}
|
||||
TddType::Split {
|
||||
node,
|
||||
|
|
@ -1268,12 +1266,12 @@ impl UiDragUsecase for TileDragUsecase {
|
|||
};
|
||||
let placeholder = detach();
|
||||
let cn = ContainerNode::new(&seat.state, &ws, node.clone(), split);
|
||||
pn.cnode_replace_child(node.tl_as_node(), cn.clone());
|
||||
pn.cnode_replace_child(&*node, cn.clone());
|
||||
match before {
|
||||
true => cn.add_child_before(node.tl_as_node(), src),
|
||||
false => cn.add_child_after(node.tl_as_node(), src),
|
||||
true => cn.add_child_before(&*node, src),
|
||||
false => cn.add_child_after(&*node, src),
|
||||
}
|
||||
src_parent.cnode_remove_child(placeholder.tl_as_node());
|
||||
src_parent.cnode_remove_child(&*placeholder);
|
||||
}
|
||||
TddType::Insert {
|
||||
container,
|
||||
|
|
@ -1282,10 +1280,10 @@ impl UiDragUsecase for TileDragUsecase {
|
|||
} => {
|
||||
let placeholder = detach();
|
||||
match before {
|
||||
true => container.add_child_before(neighbor.tl_as_node(), src),
|
||||
false => container.add_child_after(neighbor.tl_as_node(), src),
|
||||
true => container.add_child_before(&*neighbor, src),
|
||||
false => container.add_child_after(&*neighbor, src),
|
||||
};
|
||||
src_parent.cnode_remove_child(placeholder.tl_as_node());
|
||||
src_parent.cnode_remove_child(&*placeholder);
|
||||
}
|
||||
TddType::NewWorkspace { output } => {
|
||||
new_container(&output.ensure_workspace());
|
||||
|
|
@ -1294,12 +1292,12 @@ impl UiDragUsecase for TileDragUsecase {
|
|||
new_container(&workspace);
|
||||
}
|
||||
TddType::MoveToWorkspace { workspace } => {
|
||||
src_parent.cnode_remove_child(src.tl_as_node());
|
||||
src_parent.cnode_remove_child(&*src);
|
||||
seat.state.map_tiled_on(src, &workspace);
|
||||
}
|
||||
TddType::MoveToNewWorkspace { output } => {
|
||||
let ws = output.generate_workspace();
|
||||
src_parent.cnode_remove_child(src.tl_as_node());
|
||||
src_parent.cnode_remove_child(&*src);
|
||||
seat.state.map_tiled_on(src, &ws);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1656,7 +1656,7 @@ impl WlSurface {
|
|||
|
||||
pub fn request_activation(&self) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
tl.tl_data().request_attention(tl.tl_as_node());
|
||||
tl.tl_data().request_attention(&*tl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ impl TrayItemData {
|
|||
pub trait DynTrayItem: Node {
|
||||
fn send_current_configure(&self);
|
||||
fn data(&self) -> &TrayItemData;
|
||||
fn into_node(self: Rc<Self>) -> Rc<dyn Node>;
|
||||
fn set_position(&self, abs_pos: Rect, rel_pos: Rect);
|
||||
fn destroy_popups(&self);
|
||||
fn destroy_node(&self);
|
||||
|
|
@ -93,10 +92,6 @@ impl<T: TrayItem> DynTrayItem for T {
|
|||
<Self as TrayItem>::data(self)
|
||||
}
|
||||
|
||||
fn into_node(self: Rc<Self>) -> Rc<dyn Node> {
|
||||
self
|
||||
}
|
||||
|
||||
fn set_position(&self, abs_pos: Rect, rel_pos: Rect) {
|
||||
let data = self.data();
|
||||
data.surface
|
||||
|
|
|
|||
|
|
@ -488,8 +488,6 @@ impl ToplevelNodeBase for Xwindow {
|
|||
}
|
||||
|
||||
impl StackedNode for Xwindow {
|
||||
stacked_node_impl!();
|
||||
|
||||
fn stacked_set_visible(&self, visible: bool) {
|
||||
self.damage_override_redirect();
|
||||
self.tl_set_visible(visible);
|
||||
|
|
|
|||
|
|
@ -356,8 +356,6 @@ impl Node for XdgPopup {
|
|||
}
|
||||
|
||||
impl StackedNode for XdgPopup {
|
||||
stacked_node_impl!();
|
||||
|
||||
fn stacked_prepare_set_visible(&self) {
|
||||
self.set_visible_prepared.set(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use {
|
|||
log::Level,
|
||||
parking_lot::Mutex,
|
||||
std::{
|
||||
cell::Cell, collections::VecDeque, future::pending, pin::Pin, rc::Rc, sync::Arc,
|
||||
any::Any, cell::Cell, collections::VecDeque, future::pending, pin::Pin, rc::Rc, sync::Arc,
|
||||
time::SystemTime,
|
||||
},
|
||||
uapi::c,
|
||||
|
|
@ -132,7 +132,7 @@ fn run_test(it_run: &ItRun, test: &'static dyn TestCase, cfg: Rc<TestConfig>) {
|
|||
sun_path[path.len()] = 0;
|
||||
addr
|
||||
};
|
||||
let backend: Rc<TestBackend> = state.backend.get().into_any().downcast().unwrap();
|
||||
let backend: Rc<TestBackend> = (state.backend.get() as Rc<dyn Any>).downcast().unwrap();
|
||||
let testrun = Rc::new(TestRun {
|
||||
state: state.clone(),
|
||||
backend,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use {
|
|||
},
|
||||
},
|
||||
bstr::ByteSlice,
|
||||
std::{any::Any, cell::Cell, error::Error, io, os::unix::ffi::OsStrExt, pin::Pin, rc::Rc},
|
||||
std::{cell::Cell, error::Error, io, os::unix::ffi::OsStrExt, pin::Pin, rc::Rc},
|
||||
thiserror::Error,
|
||||
uapi::c,
|
||||
};
|
||||
|
|
@ -287,10 +287,6 @@ impl Backend for TestBackend {
|
|||
})
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn switch_to(&self, vtnr: u32) {
|
||||
let _ = vtnr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,14 +278,6 @@ impl GfxTexture for TestGfxImage {
|
|||
}
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
|
||||
self
|
||||
}
|
||||
|
||||
fn dmabuf(&self) -> Option<&DmaBuf> {
|
||||
match self {
|
||||
TestGfxImage::Shm(_) => None,
|
||||
|
|
@ -298,11 +290,7 @@ impl GfxTexture for TestGfxImage {
|
|||
}
|
||||
}
|
||||
|
||||
impl ShmGfxTexture for TestGfxImage {
|
||||
fn into_texture(self: Rc<Self>) -> Rc<dyn GfxTexture> {
|
||||
self
|
||||
}
|
||||
}
|
||||
impl ShmGfxTexture for TestGfxImage {}
|
||||
|
||||
impl AsyncShmGfxTexture for TestGfxImage {
|
||||
fn async_upload(
|
||||
|
|
@ -344,10 +332,6 @@ impl AsyncShmGfxTexture for TestGfxImage {
|
|||
};
|
||||
shm.format == format && shm.width == width && shm.height == height && shm.stride == stride
|
||||
}
|
||||
|
||||
fn into_texture(self: Rc<Self>) -> Rc<dyn GfxTexture> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl GfxImage for TestGfxImage {
|
||||
|
|
@ -573,10 +557,6 @@ impl GfxFramebuffer for TestGfxFb {
|
|||
}
|
||||
|
||||
impl GfxInternalFramebuffer for TestGfxFb {
|
||||
fn into_fb(self: Rc<Self>) -> Rc<dyn GfxFramebuffer> {
|
||||
self
|
||||
}
|
||||
|
||||
fn stride(&self) -> i32 {
|
||||
let TestGfxImage::Shm(shm) = &*self.img else {
|
||||
unreachable!();
|
||||
|
|
@ -604,7 +584,7 @@ impl GfxInternalFramebuffer for TestGfxFb {
|
|||
|
||||
impl dyn GfxTexture {
|
||||
fn as_native(&self) -> &TestGfxImage {
|
||||
self.as_any()
|
||||
(self as &dyn Any)
|
||||
.downcast_ref()
|
||||
.expect("Non-test texture passed into vulkan")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{it::test_error::TestError, object::Object},
|
||||
std::rc::Rc,
|
||||
std::{any::Any, rc::Rc},
|
||||
};
|
||||
|
||||
pub trait TestObjectExt {
|
||||
|
|
@ -9,7 +9,7 @@ pub trait TestObjectExt {
|
|||
|
||||
impl TestObjectExt for dyn Object {
|
||||
fn downcast<T: 'static>(self: Rc<Self>) -> Result<Rc<T>, TestError> {
|
||||
match self.into_any().downcast() {
|
||||
match (self as Rc<dyn Any>).downcast() {
|
||||
Ok(t) => Ok(t),
|
||||
_ => bail!("Object has an incompatible type id"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,10 +49,6 @@ macro_rules! object_base {
|
|||
$version
|
||||
}
|
||||
|
||||
fn into_any($self: std::rc::Rc<Self>) -> std::rc::Rc<dyn std::any::Any> {
|
||||
$self
|
||||
}
|
||||
|
||||
fn handle_request(
|
||||
$self: std::rc::Rc<Self>,
|
||||
client: &crate::client::Client,
|
||||
|
|
@ -458,14 +454,6 @@ macro_rules! fatal {
|
|||
}}
|
||||
}
|
||||
|
||||
macro_rules! stacked_node_impl {
|
||||
() => {
|
||||
fn stacked_into_node(self: Rc<Self>) -> Rc<dyn Node> {
|
||||
self
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! bitflags {
|
||||
($name:ident: $rep:ty; $($var:ident = $val:expr,)*) => {
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Default)]
|
||||
|
|
|
|||
|
|
@ -36,11 +36,9 @@ impl Display for ObjectId {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait ObjectBase {
|
||||
pub trait ObjectBase: Any {
|
||||
fn id(&self) -> ObjectId;
|
||||
fn version(&self) -> Version;
|
||||
#[cfg_attr(not(feature = "it"), expect(dead_code))]
|
||||
fn into_any(self: Rc<Self>) -> Rc<dyn Any>;
|
||||
fn handle_request(
|
||||
self: Rc<Self>,
|
||||
client: &Client,
|
||||
|
|
|
|||
|
|
@ -98,5 +98,5 @@ pub fn render(
|
|||
None,
|
||||
)
|
||||
.ok()
|
||||
.map(|t| (t.into_texture(), measurement))
|
||||
.map(|t| (t as _, measurement))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ impl Renderer<'_> {
|
|||
let srgb_srgb = self.state.color_manager.srgb_srgb();
|
||||
let srgb = &srgb_srgb.linear;
|
||||
if let Some(fs) = fullscreen {
|
||||
fs.tl_as_node().node_render(self, x, y, None);
|
||||
fs.node_render(self, x, y, None);
|
||||
} else {
|
||||
render_layer!(output.layers[0]);
|
||||
render_layer!(output.layers[1]);
|
||||
|
|
|
|||
|
|
@ -678,7 +678,7 @@ impl State {
|
|||
.get()
|
||||
.and_then(|n| n.node_into_container());
|
||||
if let Some(lap) = lap {
|
||||
lap.add_child_after(la.tl_as_node(), node);
|
||||
lap.add_child_after(&*la, node);
|
||||
} else {
|
||||
c.append_child(node);
|
||||
}
|
||||
|
|
@ -1120,7 +1120,7 @@ impl State {
|
|||
acquire_sync,
|
||||
ReleaseSync::None,
|
||||
src_cd,
|
||||
&fb.clone().into_fb(),
|
||||
&(fb.clone() as Rc<dyn GfxFramebuffer>),
|
||||
AcquireSync::Unnecessary,
|
||||
ReleaseSync::None,
|
||||
transform,
|
||||
|
|
|
|||
|
|
@ -383,12 +383,7 @@ impl TextTexture {
|
|||
}
|
||||
|
||||
pub fn texture(&self) -> Option<Rc<dyn GfxTexture>> {
|
||||
self.data
|
||||
.textures
|
||||
.front()
|
||||
.tex
|
||||
.get()
|
||||
.map(|t| t.into_texture())
|
||||
self.data.textures.front().tex.get().map(|t| t as _)
|
||||
}
|
||||
|
||||
fn apply_config(&self, on_completed: Rc<dyn OnCompleted>, config: Config<'_>) {
|
||||
|
|
|
|||
|
|
@ -856,7 +856,7 @@ impl ContainerNode {
|
|||
return;
|
||||
}
|
||||
if !preserve_focus {
|
||||
let seats = collect_kb_foci(mc.node.clone().tl_into_node());
|
||||
let seats = collect_kb_foci(mc.node.clone());
|
||||
mc.node.tl_set_visible(false);
|
||||
for seat in seats {
|
||||
child
|
||||
|
|
@ -898,7 +898,7 @@ impl ContainerNode {
|
|||
let mut seats = SmallVec::<[_; 3]>::new();
|
||||
for other in self.children.iter() {
|
||||
if other.node.node_id() != child_id {
|
||||
collect_kb_foci2(other.node.clone().tl_into_node(), &mut seats);
|
||||
collect_kb_foci2(other.node.clone(), &mut seats);
|
||||
other.node.tl_set_visible(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -996,9 +996,7 @@ impl ContainerNode {
|
|||
// CASE 1: This is the only child of the container. Replace the container by the child.
|
||||
if self.num_children.get() == 1 {
|
||||
if let Some(parent) = self.toplevel_data.parent.get() {
|
||||
if !self.toplevel_data.is_fullscreen.get()
|
||||
&& parent.cnode_accepts_child(child.tl_as_node())
|
||||
{
|
||||
if !self.toplevel_data.is_fullscreen.get() && parent.cnode_accepts_child(&*child) {
|
||||
parent.cnode_replace_child(self.deref(), child.clone());
|
||||
}
|
||||
}
|
||||
|
|
@ -1019,13 +1017,13 @@ impl ContainerNode {
|
|||
};
|
||||
if let Some(neighbor) = neighbor {
|
||||
if let Some(cn) = neighbor.node.clone().node_into_container() {
|
||||
if cn.cnode_accepts_child(child.tl_as_node()) {
|
||||
if cn.cnode_accepts_child(&*child) {
|
||||
if let Some(mc) = self.mono_child.get() {
|
||||
if mc.node.node_id() == child.node_id() {
|
||||
self.activate_child2(&neighbor, true);
|
||||
}
|
||||
}
|
||||
self.cnode_remove_child2(child.tl_as_node(), true);
|
||||
self.cnode_remove_child2(&*child, true);
|
||||
cn.insert_child(child, direction);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1053,7 +1051,7 @@ impl ContainerNode {
|
|||
Some(p) => p,
|
||||
_ => return,
|
||||
};
|
||||
self.cnode_remove_child2(child.tl_as_node(), true);
|
||||
self.cnode_remove_child2(&*child, true);
|
||||
match prev {
|
||||
true => parent.add_child_before(&*neighbor, child.clone()),
|
||||
false => parent.add_child_after(&*neighbor, child.clone()),
|
||||
|
|
@ -1567,7 +1565,7 @@ impl Node for ContainerNode {
|
|||
if content.contains(x, y) {
|
||||
let (x, y) = content.translate(x, y);
|
||||
tree.push(FoundNode {
|
||||
node: child.node.clone().tl_into_node(),
|
||||
node: child.node.clone(),
|
||||
x,
|
||||
y,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ impl Node for FloatNode {
|
|||
let x = x - bw;
|
||||
let y = y - bw - th - 1;
|
||||
tree.push(FoundNode {
|
||||
node: child.clone().tl_into_node(),
|
||||
node: child.clone(),
|
||||
x,
|
||||
y,
|
||||
});
|
||||
|
|
@ -833,8 +833,6 @@ impl ContainingNode for FloatNode {
|
|||
}
|
||||
|
||||
impl StackedNode for FloatNode {
|
||||
stacked_node_impl!();
|
||||
|
||||
fn stacked_set_visible(&self, visible: bool) {
|
||||
if self.visible.replace(visible) != visible {
|
||||
self.state.damage(self.position.get());
|
||||
|
|
|
|||
|
|
@ -881,7 +881,7 @@ impl OutputNode {
|
|||
let (x, y) = ext.translate(x_abs, y_abs);
|
||||
let idx = tree.len();
|
||||
tree.push(FoundNode {
|
||||
node: stacked.deref().clone().stacked_into_node(),
|
||||
node: stacked.deref().clone(),
|
||||
x,
|
||||
y,
|
||||
});
|
||||
|
|
@ -1401,11 +1401,11 @@ impl Node for OutputNode {
|
|||
}
|
||||
if let Some(fs) = fullscreen {
|
||||
tree.push(FoundNode {
|
||||
node: fs.clone().tl_into_node(),
|
||||
node: fs.clone(),
|
||||
x,
|
||||
y,
|
||||
});
|
||||
fs.tl_as_node().node_find_tree_at(x, y, tree, usecase)
|
||||
fs.node_find_tree_at(x, y, tree, usecase)
|
||||
} else {
|
||||
let mut search_layers = true;
|
||||
let non_exclusive_rect = self.non_exclusive_rect_rel.get();
|
||||
|
|
@ -1419,7 +1419,7 @@ impl Node for OutputNode {
|
|||
if pos.contains(x, y) {
|
||||
let (x, y) = pos.translate(x, y);
|
||||
tree.push(FoundNode {
|
||||
node: item.deref().clone().into_node(),
|
||||
node: item.deref().clone(),
|
||||
x,
|
||||
y,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use {crate::tree::Node, std::rc::Rc};
|
||||
use crate::tree::Node;
|
||||
|
||||
pub trait StackedNode: Node {
|
||||
fn stacked_into_node(self: Rc<Self>) -> Rc<dyn Node>;
|
||||
fn stacked_prepare_set_visible(&self) {
|
||||
// nothing
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@ use {
|
|||
tree_id!(ToplevelNodeId);
|
||||
|
||||
pub trait ToplevelNode: ToplevelNodeBase {
|
||||
fn tl_as_node(&self) -> &dyn Node;
|
||||
fn tl_into_node(self: Rc<Self>) -> Rc<dyn Node>;
|
||||
fn tl_into_dyn(self: Rc<Self>) -> Rc<dyn ToplevelNode>;
|
||||
fn tl_surface_active_changed(&self, active: bool);
|
||||
fn tl_set_fullscreen(self: Rc<Self>, fullscreen: bool);
|
||||
fn tl_title_changed(&self);
|
||||
|
|
@ -56,18 +53,6 @@ pub trait ToplevelNode: ToplevelNodeBase {
|
|||
}
|
||||
|
||||
impl<T: ToplevelNodeBase> ToplevelNode for T {
|
||||
fn tl_as_node(&self) -> &dyn Node {
|
||||
self
|
||||
}
|
||||
|
||||
fn tl_into_node(self: Rc<Self>) -> Rc<dyn Node> {
|
||||
self
|
||||
}
|
||||
|
||||
fn tl_into_dyn(self: Rc<Self>) -> Rc<dyn ToplevelNode> {
|
||||
self
|
||||
}
|
||||
|
||||
fn tl_surface_active_changed(&self, active: bool) {
|
||||
let data = self.tl_data();
|
||||
data.update_active(self, || {
|
||||
|
|
@ -79,10 +64,10 @@ impl<T: ToplevelNodeBase> ToplevelNode for T {
|
|||
let data = self.tl_data();
|
||||
if fullscreen {
|
||||
if let Some(ws) = data.workspace.get() {
|
||||
data.set_fullscreen2(&data.state, self.clone().tl_into_dyn(), &ws);
|
||||
data.set_fullscreen2(&data.state, self.clone(), &ws);
|
||||
}
|
||||
} else {
|
||||
data.unset_fullscreen(&data.state, self.clone().tl_into_dyn());
|
||||
data.unset_fullscreen(&data.state, self.clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -323,7 +308,7 @@ impl ToplevelData {
|
|||
if active_old != active_new {
|
||||
tl.tl_set_active(active_new);
|
||||
if let Some(parent) = self.parent.get() {
|
||||
parent.node_child_active_changed(tl.tl_as_node(), active_new, 1);
|
||||
parent.node_child_active_changed(tl, active_new, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -480,14 +465,14 @@ impl ToplevelData {
|
|||
}
|
||||
let placeholder =
|
||||
Rc::new_cyclic(|weak| PlaceholderNode::new_for(state, node.clone(), weak));
|
||||
parent.cnode_replace_child(node.tl_as_node(), placeholder.clone());
|
||||
parent.cnode_replace_child(&*node, placeholder.clone());
|
||||
let mut kb_foci = Default::default();
|
||||
if ws.visible.get() {
|
||||
if let Some(container) = ws.container.get() {
|
||||
kb_foci = collect_kb_foci(container);
|
||||
}
|
||||
for stacked in ws.stacked.iter() {
|
||||
collect_kb_foci2(stacked.deref().clone().stacked_into_node(), &mut kb_foci);
|
||||
collect_kb_foci2(stacked.deref().clone(), &mut kb_foci);
|
||||
}
|
||||
}
|
||||
*data = Some(FullscreenedData {
|
||||
|
|
@ -501,9 +486,7 @@ impl ToplevelData {
|
|||
node.clone()
|
||||
.tl_change_extents(&ws.output.get().global.pos.get());
|
||||
for seat in kb_foci {
|
||||
node.clone()
|
||||
.tl_into_node()
|
||||
.node_do_focus(&seat, Direction::Unspecified);
|
||||
node.clone().node_do_focus(&seat, Direction::Unspecified);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -527,7 +510,7 @@ impl ToplevelData {
|
|||
);
|
||||
return;
|
||||
}
|
||||
Some(f) if f.tl_as_node().node_id() != node.tl_as_node().node_id() => {
|
||||
Some(f) if f.node_id() != node.node_id() => {
|
||||
log::error!(
|
||||
"Node is supposed to be fullscreened on a workspace but the workspace has a different node attached."
|
||||
);
|
||||
|
|
@ -542,12 +525,10 @@ impl ToplevelData {
|
|||
}
|
||||
let parent = fd.placeholder.tl_data().parent.get().unwrap();
|
||||
parent.cnode_replace_child(fd.placeholder.deref(), node.clone());
|
||||
if node.tl_as_node().node_visible() {
|
||||
if node.node_visible() {
|
||||
let kb_foci = collect_kb_foci(fd.placeholder.clone());
|
||||
for seat in kb_foci {
|
||||
node.clone()
|
||||
.tl_into_node()
|
||||
.node_do_focus(&seat, Direction::Unspecified);
|
||||
node.clone().node_do_focus(&seat, Direction::Unspecified);
|
||||
}
|
||||
}
|
||||
fd.placeholder
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ impl Node for WorkspaceNode {
|
|||
visitor.visit_container(&c);
|
||||
}
|
||||
if let Some(fs) = self.fullscreen.get() {
|
||||
fs.tl_into_node().node_visit(visitor);
|
||||
fs.node_visit(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ impl Node for WorkspaceNode {
|
|||
|
||||
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
|
||||
if let Some(fs) = self.fullscreen.get() {
|
||||
fs.tl_into_node().node_do_focus(seat, direction);
|
||||
fs.node_do_focus(seat, direction);
|
||||
} else if let Some(container) = self.container.get() {
|
||||
container.node_do_focus(seat, direction);
|
||||
} else if let Some(float) = self
|
||||
|
|
@ -359,7 +359,7 @@ impl ContainingNode for WorkspaceNode {
|
|||
fn cnode_replace_child(self: Rc<Self>, old: &dyn Node, new: Rc<dyn ToplevelNode>) {
|
||||
if let Some(container) = self.container.get() {
|
||||
if container.node_id() == old.node_id() {
|
||||
let new = match new.tl_into_node().node_into_container() {
|
||||
let new = match new.node_into_container() {
|
||||
Some(c) => c,
|
||||
_ => {
|
||||
log::error!("cnode_replace_child called with non-container new");
|
||||
|
|
@ -383,7 +383,7 @@ impl ContainingNode for WorkspaceNode {
|
|||
}
|
||||
}
|
||||
if let Some(fs) = self.fullscreen.get() {
|
||||
if fs.tl_as_node().node_id() == child.node_id() {
|
||||
if fs.node_id() == child.node_id() {
|
||||
self.remove_fullscreen_node();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue