Skip to content

Commit

Permalink
fix: connect clipboard if disconnected on layer surface or popup crea…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
wash2 committed Sep 21, 2024
1 parent 9f9469d commit 90f2470
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 1 addition & 4 deletions examples/sctk_drag/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,7 @@ impl DndTest {
state,
)
})
.drag_content(move || {
dbg!("hi");
MyDndString(s2.clone())
})
.drag_content(move || { MyDndString(s2.clone()) })
]
.width(Length::Fill)
.into()
Expand Down
18 changes: 18 additions & 0 deletions winit/src/platform_specific/wayland/sctk_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,15 @@ impl SctkEvent {
_ = surface_ids.insert(object_id, wrapper.clone());
let logical_size = window.size();

if clipboard.window_id().is_none() {
*clipboard = Clipboard::connect(
window.raw.clone(),
crate::clipboard::ControlSender(
control_sender.clone(),
),
);
}

let _ = user_interfaces.insert(
surface_id,
crate::program::build_user_interface(
Expand Down Expand Up @@ -937,6 +946,15 @@ impl SctkEvent {
);
}

if clipboard.window_id().is_none() {
*clipboard = Clipboard::connect(
sctk_winit.clone(),
crate::clipboard::ControlSender(
control_sender.clone(),
),
);
}

_ = window_manager.insert(
surface_id, sctk_winit, program, compositor,
false, // TODO do we want to get this value here?
Expand Down

0 comments on commit 90f2470

Please sign in to comment.