get_parent grab popups fix head thingy popup list feat: remove set_active feat(wayland): commit_popup feat(wayland): cleanup moar changess actually fix the problem with everything oh my god proper popup state fix: multi thread event loop fix: match popup surface ID make wayland input system go over surfaces instead of toplevels feat: massive refactor of all wayland things
42 lines
1.0 KiB
Rust
42 lines
1.0 KiB
Rust
use crate::wayland::surface::CoreSurface;
|
|
|
|
use super::state::WaylandState;
|
|
use portable_atomic::{AtomicU32, Ordering};
|
|
use smithay::{
|
|
delegate_compositor,
|
|
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
|
wayland::compositor::{self, CompositorHandler, CompositorState},
|
|
};
|
|
use std::sync::Arc;
|
|
use tracing::debug;
|
|
|
|
impl CompositorHandler for WaylandState {
|
|
fn compositor_state(&mut self) -> &mut CompositorState {
|
|
&mut self.compositor_state
|
|
}
|
|
|
|
fn commit(&mut self, surface: &WlSurface) {
|
|
debug!(?surface, "Surface commit");
|
|
let mut count = 0;
|
|
let core_surface = compositor::with_states(surface, |data| {
|
|
let count_new = data
|
|
.data_map
|
|
.insert_if_missing_threadsafe(|| AtomicU32::new(0));
|
|
if !count_new {
|
|
count = data
|
|
.data_map
|
|
.get::<AtomicU32>()
|
|
.unwrap()
|
|
.fetch_add(1, Ordering::Relaxed);
|
|
}
|
|
|
|
data.data_map.get::<Arc<CoreSurface>>().cloned()
|
|
});
|
|
if let Some(core_surface) = core_surface {
|
|
core_surface.commit(count);
|
|
}
|
|
}
|
|
}
|
|
|
|
delegate_compositor!(WaylandState);
|