fix: always submit output enter event
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
use super::surface::WL_SURFACE_REGISTRY;
|
use super::surface::WL_SURFACE_REGISTRY;
|
||||||
use crate::wayland::core::surface::Surface;
|
use crate::wayland::{core::surface::Surface, util::ClientExt};
|
||||||
pub use waynest::server::protocol::core::wayland::wl_compositor::*;
|
pub use waynest::server::protocol::core::wayland::wl_compositor::*;
|
||||||
use waynest::{
|
use waynest::{
|
||||||
server::{Client, Dispatcher, Result, protocol::core::wayland::wl_region::WlRegion},
|
server::{
|
||||||
|
Client, Dispatcher, Result,
|
||||||
|
protocol::core::wayland::{wl_region::WlRegion, wl_surface::WlSurface},
|
||||||
|
},
|
||||||
wire::ObjectId,
|
wire::ObjectId,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -17,6 +20,9 @@ impl WlCompositor for Compositor {
|
|||||||
id: ObjectId,
|
id: ObjectId,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let surface = client.insert(id, Surface::new(client, id));
|
let surface = client.insert(id, Surface::new(client, id));
|
||||||
|
if let Some(output) = client.display().output.get() {
|
||||||
|
surface.enter(client, id, output.0).await?;
|
||||||
|
}
|
||||||
WL_SURFACE_REGISTRY.add_raw(&surface);
|
WL_SURFACE_REGISTRY.add_raw(&surface);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use crate::wayland::{
|
|||||||
MessageSink,
|
MessageSink,
|
||||||
core::{
|
core::{
|
||||||
callback::{Callback, WlCallback},
|
callback::{Callback, WlCallback},
|
||||||
|
output::Output,
|
||||||
seat::Seat,
|
seat::Seat,
|
||||||
},
|
},
|
||||||
registry::Registry,
|
registry::Registry,
|
||||||
@@ -24,6 +25,7 @@ pub struct Display {
|
|||||||
pub message_sink: MessageSink,
|
pub message_sink: MessageSink,
|
||||||
pub pid: Option<i32>,
|
pub pid: Option<i32>,
|
||||||
pub seat: OnceLock<Arc<Seat>>,
|
pub seat: OnceLock<Arc<Seat>>,
|
||||||
|
pub output: OnceLock<Arc<Output>>,
|
||||||
id_counter: CounterU32,
|
id_counter: CounterU32,
|
||||||
pub creation_time: Instant,
|
pub creation_time: Instant,
|
||||||
}
|
}
|
||||||
@@ -33,6 +35,7 @@ impl Display {
|
|||||||
message_sink,
|
message_sink,
|
||||||
pid,
|
pid,
|
||||||
seat: OnceLock::new(),
|
seat: OnceLock::new(),
|
||||||
|
output: OnceLock::new(),
|
||||||
id_counter: CounterU32::new(0xff000000), // Start at 0xff000000 to avoid conflicts with client-generated IDs
|
id_counter: CounterU32::new(0xff000000), // Start at 0xff000000 to avoid conflicts with client-generated IDs
|
||||||
creation_time: Instant::now(),
|
creation_time: Instant::now(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ use crate::wayland::{
|
|||||||
seat::{Seat, WlSeat},
|
seat::{Seat, WlSeat},
|
||||||
shm::{Shm, WlShm},
|
shm::{Shm, WlShm},
|
||||||
},
|
},
|
||||||
display::Display,
|
|
||||||
dmabuf::Dmabuf,
|
dmabuf::Dmabuf,
|
||||||
mesa_drm::MesaDrm,
|
mesa_drm::MesaDrm,
|
||||||
|
util::ClientExt,
|
||||||
xdg::wm_base::{WmBase, XdgWmBase},
|
xdg::wm_base::{WmBase, XdgWmBase},
|
||||||
};
|
};
|
||||||
use waynest::{
|
use waynest::{
|
||||||
@@ -141,13 +141,7 @@ impl WlRegistry for Registry {
|
|||||||
RegistryGlobals::SEAT => {
|
RegistryGlobals::SEAT => {
|
||||||
tracing::info!("Binding seat with id {}", new_id.object_id);
|
tracing::info!("Binding seat with id {}", new_id.object_id);
|
||||||
let seat = client.insert(new_id.object_id, Seat::new());
|
let seat = client.insert(new_id.object_id, Seat::new());
|
||||||
if let Some(display) = client.get::<Display>(ObjectId::DISPLAY) {
|
let _ = client.display().seat.set(seat.clone());
|
||||||
tracing::info!("Setting seat in display");
|
|
||||||
let _ = display.seat.set(seat.clone());
|
|
||||||
tracing::info!("Seat set successfully");
|
|
||||||
} else {
|
|
||||||
tracing::warn!("No display found to set seat");
|
|
||||||
}
|
|
||||||
seat.name(client, new_id.object_id, "theonlyseat".into())
|
seat.name(client, new_id.object_id, "theonlyseat".into())
|
||||||
.await?;
|
.await?;
|
||||||
seat.advertise_capabilities(client, new_id.object_id)
|
seat.advertise_capabilities(client, new_id.object_id)
|
||||||
@@ -161,6 +155,7 @@ impl WlRegistry for Registry {
|
|||||||
RegistryGlobals::OUTPUT => {
|
RegistryGlobals::OUTPUT => {
|
||||||
tracing::info!("Binding output");
|
tracing::info!("Binding output");
|
||||||
let output = client.insert(new_id.object_id, Output(new_id.object_id));
|
let output = client.insert(new_id.object_id, Output(new_id.object_id));
|
||||||
|
let _ = client.display().output.set(output.clone());
|
||||||
output.advertise_outputs(client).await?;
|
output.advertise_outputs(client).await?;
|
||||||
}
|
}
|
||||||
RegistryGlobals::DMABUF => {
|
RegistryGlobals::DMABUF => {
|
||||||
|
|||||||
Reference in New Issue
Block a user