fix(wayland/xdg_shell): proper versioning
This commit is contained in:
@@ -150,7 +150,12 @@ impl WlRegistry for Registry {
|
||||
}
|
||||
RegistryGlobals::WM_BASE => {
|
||||
tracing::info!("Binding WM_BASE");
|
||||
client.insert(new_id.object_id, WmBase);
|
||||
client.insert(
|
||||
new_id.object_id,
|
||||
WmBase {
|
||||
version: new_id.version,
|
||||
},
|
||||
);
|
||||
}
|
||||
RegistryGlobals::SEAT => {
|
||||
tracing::info!("Binding seat with id {}", new_id.object_id);
|
||||
|
||||
@@ -17,6 +17,7 @@ use waynest::{
|
||||
#[derive(Debug, Dispatcher)]
|
||||
pub struct Popup {
|
||||
id: ObjectId,
|
||||
version: u32,
|
||||
parent: Weak<Surface>,
|
||||
surface: Weak<Surface>,
|
||||
pub panel_item: Weak<PanelItem<XdgBackend>>,
|
||||
@@ -27,6 +28,7 @@ pub struct Popup {
|
||||
impl Popup {
|
||||
pub fn new(
|
||||
id: ObjectId,
|
||||
version: u32,
|
||||
parent: &Arc<Surface>,
|
||||
panel_item: &Arc<PanelItem<XdgBackend>>,
|
||||
xdg_surface: &Arc<Surface>,
|
||||
@@ -35,6 +37,7 @@ impl Popup {
|
||||
let positioner_data = positioner.data();
|
||||
Self {
|
||||
id,
|
||||
version,
|
||||
parent: Arc::downgrade(parent),
|
||||
surface: Arc::downgrade(xdg_surface),
|
||||
panel_item: Arc::downgrade(panel_item),
|
||||
@@ -67,7 +70,9 @@ impl XdgPopup for Popup {
|
||||
let positioner = client.get::<Positioner>(positioner).unwrap();
|
||||
let positioner_data = positioner.data();
|
||||
*self.positioner_data.lock() = positioner_data;
|
||||
self.repositioned(client, sender_id, token).await?;
|
||||
if self.version >= 5 {
|
||||
self.repositioned(client, sender_id, token).await?;
|
||||
}
|
||||
let geometry = positioner_data.infinite_geometry();
|
||||
self.configure(
|
||||
client,
|
||||
|
||||
@@ -11,13 +11,19 @@ use waynest::{
|
||||
#[derive(Debug, Dispatcher)]
|
||||
pub struct Surface {
|
||||
id: ObjectId,
|
||||
version: u32,
|
||||
wl_surface: Weak<crate::wayland::core::surface::Surface>,
|
||||
configured: Arc<std::sync::atomic::AtomicBool>,
|
||||
}
|
||||
impl Surface {
|
||||
pub fn new(id: ObjectId, wl_surface: Arc<crate::wayland::core::surface::Surface>) -> Self {
|
||||
pub fn new(
|
||||
id: ObjectId,
|
||||
version: u32,
|
||||
wl_surface: Arc<crate::wayland::core::surface::Surface>,
|
||||
) -> Self {
|
||||
Self {
|
||||
id,
|
||||
version,
|
||||
wl_surface: Arc::downgrade(&wl_surface),
|
||||
configured: Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
||||
}
|
||||
@@ -127,7 +133,14 @@ impl XdgSurface for Surface {
|
||||
|
||||
let popup = client.insert(
|
||||
popup_id,
|
||||
Popup::new(popup_id, &parent, &panel_item, &surface, &positioner),
|
||||
Popup::new(
|
||||
popup_id,
|
||||
self.version,
|
||||
&parent,
|
||||
&panel_item,
|
||||
&surface,
|
||||
&positioner,
|
||||
),
|
||||
);
|
||||
|
||||
{
|
||||
|
||||
@@ -8,7 +8,9 @@ use waynest::{
|
||||
use super::positioner::Positioner;
|
||||
|
||||
#[derive(Debug, Dispatcher, Default)]
|
||||
pub struct WmBase;
|
||||
pub struct WmBase {
|
||||
pub version: u32,
|
||||
}
|
||||
impl XdgWmBase for WmBase {
|
||||
async fn destroy(&self, _client: &mut Client, _sender_id: ObjectId) -> Result<()> {
|
||||
Ok(())
|
||||
@@ -36,7 +38,7 @@ impl XdgWmBase for WmBase {
|
||||
.ok_or(waynest::server::Error::Custom(
|
||||
"can't get wayland surface id".to_string(),
|
||||
))?;
|
||||
let xdg_surface = Surface::new(xdg_surface_id, wl_surface);
|
||||
let xdg_surface = Surface::new(xdg_surface_id, self.version, wl_surface);
|
||||
client.insert(xdg_surface_id, xdg_surface);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user