subsurface_widget: Remove subsurface_ids
This was previously needed, but should be redundant now that an empty input region is set for the subsurface. With that, the subsurface should never get input events, so mapping them isn't needed.
This commit is contained in:
parent
dd9576d94e
commit
18f0521357
3 changed files with 4 additions and 39 deletions
|
|
@ -63,7 +63,6 @@ pub(crate) struct WaylandSpecific {
|
|||
modifiers: Modifiers,
|
||||
surface_ids: HashMap<ObjectId, SurfaceIdWrapper>,
|
||||
destroyed_surface_ids: HashMap<ObjectId, SurfaceIdWrapper>,
|
||||
subsurface_ids: HashMap<ObjectId, (i32, i32, window::Id)>,
|
||||
subsurface_state: Option<SubsurfaceState>,
|
||||
surface_subsurfaces: HashMap<window::Id, Vec<SubsurfaceInstance>>,
|
||||
}
|
||||
|
|
@ -139,7 +138,6 @@ impl WaylandSpecific {
|
|||
display_handle,
|
||||
surface_ids,
|
||||
destroyed_surface_ids,
|
||||
subsurface_ids,
|
||||
modifiers,
|
||||
subsurface_state,
|
||||
surface_subsurfaces,
|
||||
|
|
@ -166,7 +164,6 @@ impl WaylandSpecific {
|
|||
compositor,
|
||||
window_manager,
|
||||
surface_ids,
|
||||
subsurface_ids,
|
||||
sender,
|
||||
event_sender,
|
||||
proxy,
|
||||
|
|
@ -198,8 +195,6 @@ impl WaylandSpecific {
|
|||
};
|
||||
|
||||
subsurface_state.update_subsurfaces(
|
||||
id,
|
||||
&mut self.subsurface_ids,
|
||||
wl_surface,
|
||||
surface_subsurfaces,
|
||||
&subsurfaces,
|
||||
|
|
|
|||
|
|
@ -323,7 +323,6 @@ impl SctkEvent {
|
|||
<<P as Program>::Renderer as compositor::Default>::Compositor,
|
||||
>,
|
||||
surface_ids: &mut HashMap<ObjectId, SurfaceIdWrapper>,
|
||||
subsurface_ids: &mut HashMap<ObjectId, (i32, i32, window::Id)>,
|
||||
sctk_tx: &channel::Sender<super::Action>,
|
||||
control_sender: &mpsc::UnboundedSender<Control>,
|
||||
proxy: &EventLoopProxy,
|
||||
|
|
@ -357,13 +356,6 @@ impl SctkEvent {
|
|||
iced_runtime::core::Event::Mouse(mouse::Event::CursorLeft),
|
||||
)),
|
||||
PointerEventKind::Motion { .. } => {
|
||||
let offset = if let Some((x_offset, y_offset, _)) =
|
||||
subsurface_ids.get(&variant.surface.id())
|
||||
{
|
||||
(*x_offset, *y_offset)
|
||||
} else {
|
||||
(0, 0)
|
||||
};
|
||||
let id = surface_ids
|
||||
.get(&variant.surface.id())
|
||||
.map(|id| id.inner());
|
||||
|
|
@ -371,11 +363,7 @@ impl SctkEvent {
|
|||
id.clone().and_then(|id| window_manager.get_mut(id))
|
||||
{
|
||||
w.state.set_logical_cursor_pos(
|
||||
(
|
||||
variant.position.0 + offset.0 as f64,
|
||||
variant.position.1 + offset.1 as f64,
|
||||
)
|
||||
.into(),
|
||||
(variant.position.0, variant.position.1).into(),
|
||||
)
|
||||
}
|
||||
events.push((
|
||||
|
|
@ -383,8 +371,8 @@ impl SctkEvent {
|
|||
iced_runtime::core::Event::Mouse(
|
||||
mouse::Event::CursorMoved {
|
||||
position: Point::new(
|
||||
variant.position.0 as f32 + offset.0 as f32,
|
||||
variant.position.1 as f32 + offset.1 as f32,
|
||||
variant.position.0 as f32,
|
||||
variant.position.1 as f32,
|
||||
),
|
||||
},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -367,8 +367,6 @@ impl SubsurfaceState {
|
|||
// Update `subsurfaces` from `view_subsurfaces`
|
||||
pub(crate) fn update_subsurfaces(
|
||||
&mut self,
|
||||
parent_id: window::Id,
|
||||
subsurface_ids: &mut HashMap<ObjectId, (i32, i32, window::Id)>,
|
||||
parent: &WlSurface,
|
||||
subsurfaces: &mut Vec<SubsurfaceInstance>,
|
||||
view_subsurfaces: &[SubsurfaceInfo],
|
||||
|
|
@ -404,16 +402,7 @@ impl SubsurfaceState {
|
|||
for (subsurface_data, subsurface) in
|
||||
view_subsurfaces.iter().zip(subsurfaces.iter_mut())
|
||||
{
|
||||
subsurface.attach_and_commit(
|
||||
parent_id,
|
||||
subsurface_ids,
|
||||
subsurface_data,
|
||||
self,
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(backend) = parent.backend().upgrade() {
|
||||
subsurface_ids.retain(|k, _| backend.info(k.clone()).is_ok());
|
||||
subsurface.attach_and_commit(subsurface_data, self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -477,8 +466,6 @@ impl SubsurfaceInstance {
|
|||
// TODO correct damage? no damage/commit if unchanged?
|
||||
fn attach_and_commit(
|
||||
&mut self,
|
||||
parent_id: window::Id,
|
||||
subsurface_ids: &mut HashMap<ObjectId, (i32, i32, window::Id)>,
|
||||
info: &SubsurfaceInfo,
|
||||
state: &mut SubsurfaceState,
|
||||
) {
|
||||
|
|
@ -541,11 +528,6 @@ impl SubsurfaceInstance {
|
|||
wp_alpha_modifier_surface.set_multiplier(alpha);
|
||||
}
|
||||
|
||||
_ = subsurface_ids.insert(
|
||||
self.wl_surface.id(),
|
||||
(info.bounds.x as i32, info.bounds.y as i32, parent_id),
|
||||
);
|
||||
|
||||
self.wl_buffer = Some(buffer);
|
||||
self.bounds = Some(info.bounds);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue