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, surface::Surface,
}; };
use crate::{ use crate::{
nodes::items::panel::{Geometry, PanelItem}, nodes::items::panel::{Geometry, PanelItem, SurfaceId},
wayland::util::DoubleBuffer, wayland::util::DoubleBuffer,
}; };
use parking_lot::Mutex; use parking_lot::Mutex;
use std::sync::{Arc, Weak, atomic::AtomicBool}; use rand::Rng;
use std::{
sync::{Arc, Weak, atomic::AtomicBool},
u64,
};
use waynest::{ use waynest::{
server::{Client, Dispatcher, Result, protocol::stable::xdg_shell::xdg_popup::XdgPopup}, server::{Client, Dispatcher, Result, protocol::stable::xdg_shell::xdg_popup::XdgPopup},
wire::ObjectId, wire::ObjectId,
@@ -18,7 +22,8 @@ use waynest::{
pub struct Popup { pub struct Popup {
id: ObjectId, id: ObjectId,
version: u32, version: u32,
parent: Weak<Surface>, surface_id: SurfaceId,
parent: Arc<Surface>,
surface: Weak<Surface>, surface: Weak<Surface>,
pub panel_item: Weak<PanelItem<XdgBackend>>, pub panel_item: Weak<PanelItem<XdgBackend>>,
positioner_data: Mutex<PositionerData>, positioner_data: Mutex<PositionerData>,
@@ -29,7 +34,7 @@ impl Popup {
pub fn new( pub fn new(
id: ObjectId, id: ObjectId,
version: u32, version: u32,
parent: &Arc<Surface>, parent: Arc<Surface>,
panel_item: &Arc<PanelItem<XdgBackend>>, panel_item: &Arc<PanelItem<XdgBackend>>,
xdg_surface: &Arc<Surface>, xdg_surface: &Arc<Surface>,
positioner: &Positioner, positioner: &Positioner,
@@ -38,7 +43,8 @@ impl Popup {
Self { Self {
id, id,
version, version,
parent: Arc::downgrade(parent), surface_id: SurfaceId::Child(rand::thread_rng().gen_range(0..u64::MAX)),
parent,
surface: Arc::downgrade(xdg_surface), surface: Arc::downgrade(xdg_surface),
panel_item: Arc::downgrade(panel_item), panel_item: Arc::downgrade(panel_item),
positioner_data: Mutex::new(positioner_data), positioner_data: Mutex::new(positioner_data),

View File

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