fix(wayland): popup

This commit is contained in:
Nova
2025-08-11 19:06:20 -07:00
parent 565cb29b85
commit 76d58fe2f5
2 changed files with 12 additions and 6 deletions

View File

@@ -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>,
surface_id: SurfaceId,
parent: Arc<Surface>,
surface: Weak<Surface>,
pub panel_item: Weak<PanelItem<XdgBackend>>,
positioner_data: Mutex<PositionerData>,
@@ -29,7 +34,7 @@ impl Popup {
pub fn new(
id: ObjectId,
version: u32,
parent: &Arc<Surface>,
parent: Arc<Surface>,
panel_item: &Arc<PanelItem<XdgBackend>>,
xdg_surface: &Arc<Surface>,
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),

View File

@@ -136,7 +136,7 @@ impl XdgSurface for Surface {
Popup::new(
popup_id,
self.version,
&parent,
parent,
&panel_item,
&surface,
&positioner,