fix: subsurface improvements
this fixes a couple issues in the greeter
This commit is contained in:
parent
2a680eeb32
commit
f7dc180371
7 changed files with 100 additions and 25 deletions
|
|
@ -206,6 +206,7 @@ pub enum CommonSurface {
|
|||
Layer(LayerSurface),
|
||||
Lock(SessionLockSurface),
|
||||
Subsurface {
|
||||
parent: WlSurface,
|
||||
wl_surface: WlSurface,
|
||||
wl_subsurface: WlSubsurface,
|
||||
},
|
||||
|
|
@ -1821,6 +1822,7 @@ impl SctkState {
|
|||
parent.wl_surface().clone(),
|
||||
wl_surface.clone(),
|
||||
CommonSurface::Subsurface {
|
||||
parent: parent.wl_surface().clone(),
|
||||
wl_surface,
|
||||
wl_subsurface,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ use cctk::sctk::{
|
|||
compositor::CompositorHandler,
|
||||
delegate_compositor,
|
||||
reexports::client::{
|
||||
Connection, QueueHandle,
|
||||
protocol::{wl_output, wl_surface},
|
||||
Connection, Proxy, QueueHandle,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1498,6 +1498,7 @@ impl SctkEvent {
|
|||
display,
|
||||
} => {
|
||||
let CommonSurface::Subsurface {
|
||||
parent: _,
|
||||
wl_surface,
|
||||
wl_subsurface,
|
||||
} = &common_surface
|
||||
|
|
@ -1515,7 +1516,7 @@ impl SctkEvent {
|
|||
));
|
||||
}
|
||||
|
||||
let wrapper = SurfaceIdWrapper::Popup(surface_id);
|
||||
let wrapper = SurfaceIdWrapper::Subsurface(surface_id);
|
||||
_ = surface_ids.insert(wl_surface.id(), wrapper.clone());
|
||||
let sctk_winit = SctkWinitWindow::new(
|
||||
sctk_tx.clone(),
|
||||
|
|
@ -1542,10 +1543,25 @@ impl SctkEvent {
|
|||
},
|
||||
);
|
||||
}
|
||||
let Some(compositor) = compositor.as_mut() else {
|
||||
log::error!("compositor missing");
|
||||
return;
|
||||
};
|
||||
if compositor.is_none() {
|
||||
match create_compositor(
|
||||
sctk_winit.clone(),
|
||||
create_compositor_data,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(c) => *compositor = Some(c),
|
||||
Err(error) => {
|
||||
control_sender
|
||||
.start_send(Control::Crash(
|
||||
Error::GraphicsCreationFailed(error),
|
||||
))
|
||||
.expect("Send control message");
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
let compositor = compositor.as_mut().unwrap();
|
||||
|
||||
let window = window_manager.insert(
|
||||
surface_id,
|
||||
|
|
|
|||
|
|
@ -747,6 +747,14 @@ pub(crate) fn take_subsurfaces() -> Vec<SubsurfaceInfo> {
|
|||
SUBSURFACES.with(|subsurfaces| mem::take(&mut *subsurfaces.borrow_mut()))
|
||||
}
|
||||
|
||||
pub(crate) fn is_subsurface(id: WindowId) -> bool {
|
||||
ICED_SUBSURFACES.with(|subsurfaces| {
|
||||
subsurfaces.borrow_mut().iter().any(|s| {
|
||||
winit::window::WindowId::from_raw(s.4.id().as_ptr() as usize) == id
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn subsurface_ids(parent: WindowId) -> Vec<WindowId> {
|
||||
ICED_SUBSURFACES.with(|subsurfaces| {
|
||||
subsurfaces
|
||||
|
|
|
|||
|
|
@ -67,7 +67,11 @@ impl winit::window::Window for SctkWinitWindow {
|
|||
}
|
||||
|
||||
fn request_redraw(&self) {
|
||||
if let CommonSurface::Subsurface { parent, .. } = &self.surface {
|
||||
_ = self.tx.send(Action::RequestRedraw(parent.id()));
|
||||
}
|
||||
let surface = self.surface.wl_surface();
|
||||
|
||||
_ = self.tx.send(Action::RequestRedraw(surface.id()));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue