fix(wayland): popup
This commit is contained in:
@@ -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),
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user