subsurface_widget: Sort parent WlSurface, not ObjectId
This commit is contained in:
parent
9f07d15617
commit
02bd5d17ef
5 changed files with 18 additions and 19 deletions
|
|
@ -132,7 +132,7 @@ impl SctkEventLoop {
|
|||
.enumerate()
|
||||
.filter_map(|(i, s)| {
|
||||
(winit::window::WindowId::from_raw(
|
||||
s.instance.parent.as_ptr()
|
||||
s.instance.parent.id().as_ptr()
|
||||
as usize,
|
||||
) == w.window.id())
|
||||
.then_some(i)
|
||||
|
|
|
|||
|
|
@ -1016,7 +1016,7 @@ impl SctkState {
|
|||
.subsurfaces
|
||||
.drain(..)
|
||||
.partition(|s| {
|
||||
s.instance.parent == l.surface.wl_surface().id()
|
||||
s.instance.parent == *l.surface.wl_surface()
|
||||
});
|
||||
|
||||
self.subsurfaces = remaining;
|
||||
|
|
@ -1244,7 +1244,7 @@ impl SctkState {
|
|||
.subsurfaces
|
||||
.drain(..)
|
||||
.partition(|s| {
|
||||
s.instance.parent == popup.popup.wl_surface().id()
|
||||
s.instance.parent == *popup.popup.wl_surface()
|
||||
});
|
||||
|
||||
self.subsurfaces = remaining;
|
||||
|
|
@ -1365,7 +1365,7 @@ impl SctkState {
|
|||
.subsurfaces
|
||||
.drain(..)
|
||||
.partition(|s| {
|
||||
s.instance.parent == surface.session_lock_surface.wl_surface().id()
|
||||
s.instance.parent == *surface.session_lock_surface.wl_surface()
|
||||
});
|
||||
|
||||
self.subsurfaces = remaining;
|
||||
|
|
@ -1443,7 +1443,7 @@ impl SctkState {
|
|||
for (destroyed, parent) in destroyed {
|
||||
if let Some((wl_surface, f)) = self.seats.iter_mut().find(|f| {
|
||||
f.kbd_focus.as_ref().is_some_and(|f| *f == destroyed)
|
||||
}).and_then(|f| WlSurface::from_id(&self.connection, parent).ok().map(|wl| (wl, &mut f.kbd_focus))) {
|
||||
}).and_then(|f| Some((parent, &mut f.kbd_focus))) {
|
||||
*f = Some(wl_surface);
|
||||
}
|
||||
}
|
||||
|
|
@ -1610,7 +1610,7 @@ impl SctkState {
|
|||
transform:
|
||||
cctk::wayland_client::protocol::wl_output::Transform::Normal,
|
||||
z: settings.z,
|
||||
parent: parent_wl_surface.id(),
|
||||
parent: parent_wl_surface.clone(),
|
||||
};
|
||||
common.wp_viewport = Some(wp_viewport);
|
||||
let common = Arc::new(Mutex::new(common));
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ impl KeyboardHandler for SctkState {
|
|||
|
||||
let surface = if let Some(subsurface) =
|
||||
self.subsurfaces.iter().find(|s| {
|
||||
s.steals_keyboard_focus && s.instance.parent == surface.id()
|
||||
s.steals_keyboard_focus && s.instance.parent == *surface
|
||||
}) {
|
||||
&subsurface.instance.wl_surface
|
||||
} else {
|
||||
|
|
@ -53,7 +53,7 @@ impl KeyboardHandler for SctkState {
|
|||
self.request_redraw(&surface);
|
||||
|
||||
let surfaces = self.subsurfaces.iter().filter_map(|s| {
|
||||
(s.instance.parent == surface.id()).then(|| &s.instance.wl_surface)
|
||||
(s.instance.parent == *surface).then(|| &s.instance.wl_surface)
|
||||
});
|
||||
for surface in surfaces.chain(std::iter::once(surface)) {
|
||||
if is_active {
|
||||
|
|
@ -104,7 +104,7 @@ impl KeyboardHandler for SctkState {
|
|||
(is_active, seat, kbd)
|
||||
};
|
||||
let surfaces = self.subsurfaces.iter().filter_map(|s| {
|
||||
(s.instance.parent == surface.id()).then(|| &s.instance.wl_surface)
|
||||
(s.instance.parent == *surface).then(|| &s.instance.wl_surface)
|
||||
});
|
||||
for surface in surfaces.chain(std::iter::once(surface)) {
|
||||
if is_active {
|
||||
|
|
@ -169,7 +169,7 @@ impl KeyboardHandler for SctkState {
|
|||
if let Some(surface) = my_seat.kbd_focus.clone() {
|
||||
self.request_redraw(&surface);
|
||||
let surfaces = self.subsurfaces.iter().filter_map(|s| {
|
||||
(s.instance.parent == surface.id())
|
||||
(s.instance.parent == surface)
|
||||
.then(|| &s.instance.wl_surface)
|
||||
});
|
||||
for surface in surfaces.chain(std::iter::once(&surface)) {
|
||||
|
|
@ -210,7 +210,7 @@ impl KeyboardHandler for SctkState {
|
|||
if let Some(surface) = my_seat.kbd_focus.clone() {
|
||||
self.request_redraw(&surface);
|
||||
let surfaces = self.subsurfaces.iter().filter_map(|s| {
|
||||
(s.instance.parent == surface.id())
|
||||
(s.instance.parent == surface)
|
||||
.then(|| &s.instance.wl_surface)
|
||||
});
|
||||
for surface in surfaces.chain(std::iter::once(&surface)) {
|
||||
|
|
@ -252,7 +252,7 @@ impl KeyboardHandler for SctkState {
|
|||
if let Some(surface) = my_seat.kbd_focus.clone() {
|
||||
self.request_redraw(&surface);
|
||||
let surfaces = self.subsurfaces.iter().filter_map(|s| {
|
||||
(s.instance.parent == surface.id())
|
||||
(s.instance.parent == surface)
|
||||
.then(|| &s.instance.wl_surface)
|
||||
});
|
||||
for surface in surfaces.chain(std::iter::once(&surface)) {
|
||||
|
|
|
|||
|
|
@ -1462,7 +1462,7 @@ impl SctkEvent {
|
|||
if let Some(subsurface_state) = subsurface_state.as_mut() {
|
||||
subsurface_state.new_iced_subsurfaces.push((
|
||||
parent_id,
|
||||
parent.id(),
|
||||
parent,
|
||||
surface_id,
|
||||
wl_subsurface.clone(),
|
||||
wl_surface.clone(),
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ use cctk::sctk::{
|
|||
shm::slot::SlotPool,
|
||||
};
|
||||
use iced_futures::core::window;
|
||||
use wayland_backend::client::ObjectId;
|
||||
use wayland_protocols::wp::{
|
||||
alpha_modifier::v1::client::{
|
||||
wp_alpha_modifier_surface_v1::WpAlphaModifierSurfaceV1,
|
||||
|
|
@ -370,7 +369,7 @@ pub struct SubsurfaceState {
|
|||
pub(crate) unmapped_subsurfaces: Vec<SubsurfaceInstance>,
|
||||
pub new_iced_subsurfaces: Vec<(
|
||||
window::Id,
|
||||
ObjectId,
|
||||
WlSurface,
|
||||
window::Id,
|
||||
WlSubsurface,
|
||||
WlSurface,
|
||||
|
|
@ -459,7 +458,7 @@ impl SubsurfaceState {
|
|||
wp_fractional_scale: None,
|
||||
transform: wl_output::Transform::Normal,
|
||||
z: 0,
|
||||
parent: parent.id(),
|
||||
parent: parent.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -622,7 +621,7 @@ pub(crate) struct SubsurfaceInstance {
|
|||
pub(crate) bounds: Option<Rectangle<f32>>,
|
||||
pub(crate) transform: wl_output::Transform,
|
||||
pub(crate) z: u32,
|
||||
pub parent: ObjectId,
|
||||
pub parent: WlSurface,
|
||||
}
|
||||
|
||||
impl SubsurfaceInstance {
|
||||
|
|
@ -729,7 +728,7 @@ pub(crate) struct SubsurfaceInfo {
|
|||
|
||||
thread_local! {
|
||||
static SUBSURFACES: RefCell<Vec<SubsurfaceInfo>> = RefCell::new(Vec::new());
|
||||
static ICED_SUBSURFACES: RefCell<Vec<(window::Id, ObjectId, window::Id, WlSubsurface, WlSurface, u32)>> = RefCell::new(Vec::new());
|
||||
static ICED_SUBSURFACES: RefCell<Vec<(window::Id, WlSurface, window::Id, WlSubsurface, WlSurface, u32)>> = RefCell::new(Vec::new());
|
||||
}
|
||||
|
||||
pub(crate) fn take_subsurfaces() -> Vec<SubsurfaceInfo> {
|
||||
|
|
@ -742,7 +741,7 @@ pub(crate) fn subsurface_ids(parent: WindowId) -> Vec<WindowId> {
|
|||
.borrow_mut()
|
||||
.iter()
|
||||
.filter_map(|s| {
|
||||
if winit::window::WindowId::from_raw(s.1.as_ptr() as usize)
|
||||
if winit::window::WindowId::from_raw(s.1.id().as_ptr() as usize)
|
||||
== parent
|
||||
{
|
||||
Some(winit::window::WindowId::from_raw(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue