Skip to content

Commit

Permalink
window_identifier: Update for return value nullability changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainBlasted authored and bilelmoussaoui committed Jan 1, 2022
1 parent a088678 commit a39721b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/window_identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,8 @@ impl WindowIdentifier {
/// **Note** the function has to be async as the Wayland handle retrieval
/// API is async as well.
pub async fn from_native<W: glib::IsA<gtk4::Native>>(native: &W) -> Self {
let surface = native.surface().unwrap();
let backend = surface
.display()
.expect("Surface has to be attached to a display")
.backend();
let surface = native.surface();
let backend = surface.display().backend();
let handle = if backend.is_wayland() {
let (sender, receiver) = futures::channel::oneshot::channel::<String>();
let sender = Arc::new(Mutex::new(Some(sender)));
Expand Down Expand Up @@ -257,8 +254,8 @@ impl Drop for WindowIdentifier {
let ctx = glib::MainContext::default();
ctx.spawn_local(clone!(@strong native => async move {
let native = native.lock().await;
let surface = native.surface().unwrap();
if surface.display().unwrap().backend().is_wayland()
let surface = native.surface();
if surface.display().backend().is_wayland()
{
let top_level = surface.downcast_ref::<gdk4wayland::WaylandToplevel>().unwrap();
top_level.unexport_handle();
Expand Down

0 comments on commit a39721b

Please sign in to comment.