diff --git a/src/wayland/xdg/popup.rs b/src/wayland/xdg/popup.rs index b63a9dd..a05248b 100644 --- a/src/wayland/xdg/popup.rs +++ b/src/wayland/xdg/popup.rs @@ -4,11 +4,15 @@ use super::{ surface::Surface, }; use crate::{ - nodes::items::panel::{Geometry, PanelItem}, + nodes::items::panel::{Geometry, PanelItem, SurfaceId}, wayland::util::DoubleBuffer, }; use parking_lot::Mutex; -use std::sync::{Arc, Weak, atomic::AtomicBool}; +use rand::Rng; +use std::{ + sync::{Arc, Weak, atomic::AtomicBool}, + u64, +}; use waynest::{ server::{Client, Dispatcher, Result, protocol::stable::xdg_shell::xdg_popup::XdgPopup}, wire::ObjectId, @@ -18,7 +22,8 @@ use waynest::{ pub struct Popup { id: ObjectId, version: u32, - parent: Weak, + surface_id: SurfaceId, + parent: Arc, surface: Weak, pub panel_item: Weak>, positioner_data: Mutex, @@ -29,7 +34,7 @@ impl Popup { pub fn new( id: ObjectId, version: u32, - parent: &Arc, + parent: Arc, panel_item: &Arc>, xdg_surface: &Arc, positioner: &Positioner, @@ -38,7 +43,8 @@ impl Popup { Self { id, version, - parent: Arc::downgrade(parent), + surface_id: SurfaceId::Child(rand::thread_rng().gen_range(0..u64::MAX)), + parent, surface: Arc::downgrade(xdg_surface), panel_item: Arc::downgrade(panel_item), positioner_data: Mutex::new(positioner_data), diff --git a/src/wayland/xdg/surface.rs b/src/wayland/xdg/surface.rs index cef2cd2..4676bd3 100644 --- a/src/wayland/xdg/surface.rs +++ b/src/wayland/xdg/surface.rs @@ -136,7 +136,7 @@ impl XdgSurface for Surface { Popup::new( popup_id, self.version, - &parent, + parent, &panel_item, &surface, &positioner,