Skip to content

Commit

Permalink
fix: insert user interfaces for popup and lock surfaces on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Sep 23, 2024
1 parent f9a9f38 commit bb860f4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
2 changes: 0 additions & 2 deletions winit/src/platform_specific/wayland/event_loop/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,6 @@ impl SctkState {
} => {
let title = builder.namespace.clone();
if let Ok((id, wl_surface, common)) = self.get_layer_surface(builder) {
let object_id = wl_surface.id();
// TODO Ashley: all surfaces should probably have an optional title for a11y if nothing else
send_event(&self.events_sender,
SctkEvent::LayerSurfaceEvent {
Expand All @@ -810,7 +809,6 @@ impl SctkState {
} => {
if let Some(layer_surface) = self.layer_surfaces.iter_mut().find(|l| l.id == id) {
layer_surface.set_size(width, height);
// pending_redraws.push(layer_surface.surface.wl_surface().id());
let wl_surface = layer_surface.surface.wl_surface();

if let Some(mut prev_configure) = layer_surface.last_configure.clone() {
Expand Down
42 changes: 38 additions & 4 deletions winit/src/platform_specific/wayland/sctk_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ impl SctkEvent {
iced_runtime::core::Event::Keyboard(
keyboard::Event::KeyReleased {
key: k,
location: location,
location,
modifiers: modifiers_to_native(*modifiers),
},
),
Expand Down Expand Up @@ -955,11 +955,27 @@ impl SctkEvent {
);
}

_ = window_manager.insert(
let window = window_manager.insert(
surface_id, sctk_winit, program, compositor,
false, // TODO do we want to get this value here?
0,
);
let logical_size = window.size();

let _ = user_interfaces.insert(
surface_id,
crate::program::build_user_interface(
program,
user_interface::Cache::default(),
&mut window.renderer,
logical_size,
debug,
surface_id,
window.raw.clone(),
window.prev_dnd_destination_rectangles_count,
clipboard,
),
);
}
PopupEventVariant::Configure(_, _, _) => {} // TODO
PopupEventVariant::RepositionionedPopup { token: _ } => {}
Expand Down Expand Up @@ -1021,8 +1037,9 @@ impl SctkEvent {
common,
display,
} => {
let object_id = surface.id().clone();
let wrapper = SurfaceIdWrapper::SessionLock(surface_id.clone());
_ = surface_ids.insert(surface.id().clone(), wrapper.clone());
_ = surface_ids.insert(object_id.clone(), wrapper.clone());
let sctk_winit = SctkWinitWindow::new(
sctk_tx.clone(),
common,
Expand Down Expand Up @@ -1077,11 +1094,28 @@ impl SctkEvent {
);
}

_ = window_manager.insert(
let window = window_manager.insert(
surface_id, sctk_winit, program, compositor,
false, // TODO do we want to get this value here?
0,
);
_ = surface_ids.insert(object_id, wrapper.clone());
let logical_size = window.size();

let _ = user_interfaces.insert(
surface_id,
crate::program::build_user_interface(
program,
user_interface::Cache::default(),
&mut window.renderer,
logical_size,
debug,
surface_id,
window.raw.clone(),
window.prev_dnd_destination_rectangles_count,
clipboard,
),
);
}
SctkEvent::SessionLockSurfaceConfigure { .. } => {}
SctkEvent::SessionLockSurfaceDone { surface } => {
Expand Down

0 comments on commit bb860f4

Please sign in to comment.