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