Feature: WIP implementation of wp-importer #51
@@ -6,6 +6,7 @@ mod presentation;
|
||||
mod registry;
|
||||
mod util;
|
||||
mod vulkano_data;
|
||||
mod viewporter;
|
||||
mod xdg;
|
||||
|
||||
use crate::core::registry::OwnedRegistry;
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::wayland::{
|
||||
dmabuf::Dmabuf,
|
||||
mesa_drm::MesaDrm,
|
||||
presentation::Presentation,
|
||||
viewporter::Viewporter,
|
||||
util::ClientExt,
|
||||
xdg::wm_base::{WmBase, XdgWmBase},
|
||||
};
|
||||
@@ -20,7 +21,7 @@ use waynest::{
|
||||
external::drm::wl_drm::WlDrm,
|
||||
stable::{
|
||||
linux_dmabuf_v1::zwp_linux_dmabuf_v1::ZwpLinuxDmabufV1,
|
||||
presentation_time::wp_presentation::WpPresentation,
|
||||
presentation_time::wp_presentation::WpPresentation, viewporter::wp_viewporter::WpViewporter,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -38,6 +39,7 @@ impl RegistryGlobals {
|
||||
pub const DMABUF: u32 = 6;
|
||||
pub const WL_DRM: u32 = 7;
|
||||
pub const PRESENTATION: u32 = 8;
|
||||
pub const VIEWPORTER: u32 = 9;
|
||||
}
|
||||
|
||||
#[derive(Debug, Dispatcher, Default)]
|
||||
@@ -126,6 +128,15 @@ impl Registry {
|
||||
)
|
||||
.await?;
|
||||
|
||||
self.global(
|
||||
client,
|
||||
sender_id,
|
||||
RegistryGlobals::VIEWPORTER,
|
||||
Viewporter::INTERFACE.to_string(),
|
||||
Viewporter::VERSION,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -198,6 +209,11 @@ impl WlRegistry for Registry {
|
||||
|
||||
client.insert(new_id.object_id, Presentation);
|
||||
}
|
||||
RegistryGlobals::VIEWPORTER => {
|
||||
tracing::info!("Binding wp_viewporter");
|
||||
|
||||
client.insert(new_id.object_id, Viewporter::default());
|
||||
}
|
||||
id => {
|
||||
tracing::error!(id, "Wayland: failed to bind to registry global");
|
||||
return Err(Error::MissingObject(unsafe { ObjectId::from_raw(name) }));
|
||||
|
||||
70
src/wayland/viewporter.rs
Normal file
70
src/wayland/viewporter.rs
Normal file
@@ -0,0 +1,70 @@
|
||||
use waynest::{
|
||||
server::{Client, Dispatcher, Result},
|
||||
wire::{ObjectId, Fixed},
|
||||
};
|
||||
|
||||
pub use waynest::server::protocol::stable::viewporter::wp_viewport::*;
|
||||
pub use waynest::server::protocol::stable::viewporter::wp_viewporter::*;
|
||||
|
||||
// This is a barebones/stub no-op implementation of wp_viewporter to make xwayland apps work
|
||||
|
||||
#[derive(Debug, Dispatcher, Default)]
|
||||
pub struct Viewporter;
|
||||
|
||||
impl WpViewporter for Viewporter {
|
||||
async fn destroy(&self, _client: &mut Client, _sender_id: ObjectId) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn get_viewport(
|
||||
&self,
|
||||
client: &mut Client,
|
||||
_sender_id: ObjectId,
|
||||
id: ObjectId,
|
||||
surface_id: ObjectId,
|
||||
) -> Result<()> {
|
||||
let viewport = Viewport::new(id, surface_id);
|
||||
client.insert(id, viewport);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Dispatcher)]
|
||||
pub struct Viewport {
|
||||
id: ObjectId,
|
||||
surface_id: ObjectId,
|
||||
}
|
||||
|
||||
impl Viewport {
|
||||
pub fn new(id: ObjectId, surface_id: ObjectId) -> Self {
|
||||
Self { id, surface_id }
|
||||
}
|
||||
}
|
||||
|
||||
impl WpViewport for Viewport {
|
||||
async fn destroy(&self, _client: &mut Client, _sender_id: ObjectId) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn set_source(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
_sender_id: ObjectId,
|
||||
_x: Fixed,
|
||||
_y: Fixed,
|
||||
_width: Fixed,
|
||||
_height: Fixed,
|
||||
) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn set_destination(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
_sender_id: ObjectId,
|
||||
_width: i32,
|
||||
_height: i32,
|
||||
) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user