Skip to content

Commit

Permalink
Add all the new protocols + some missing ones
Browse files Browse the repository at this point in the history
  • Loading branch information
morr0ne committed Jan 15, 2025
1 parent 2daa887 commit ac69d07
Show file tree
Hide file tree
Showing 7 changed files with 12,613 additions and 11,409 deletions.
27 changes: 15 additions & 12 deletions gen/src/protocols.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"protocols/wayland-protocols/staging/xdg-dialog/xdg-dialog-v1.xml",
"protocols/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml",
"protocols/wayland-protocols/staging/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml",
"protocols/wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml"
"protocols/wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml",
"protocols/wayland-protocols/staging/xwayland-shell/xwayland-shell-v1.xml"
],

"unstable": [
Expand Down Expand Up @@ -78,11 +79,23 @@
"protocols/plasma-wayland-protocols/src/protocols/appmenu.xml",
"protocols/plasma-wayland-protocols/src/protocols/blur.xml",
"protocols/plasma-wayland-protocols/src/protocols/contrast.xml",
"protocols/plasma-wayland-protocols/src/protocols/dpms.xml",
"protocols/plasma-wayland-protocols/src/protocols/fake-input.xml",
"protocols/plasma-wayland-protocols/src/protocols/fullscreen-shell.xml",
"protocols/plasma-wayland-protocols/src/protocols/idle.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-external-brightness-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-lockscreen-overlay-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-device-v2.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-management-v2.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-order-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-primary-output-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-screen-edge-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/keystate.xml",
"protocols/plasma-wayland-protocols/src/protocols/org-kde-plasma-virtual-desktop.xml",
"protocols/plasma-wayland-protocols/src/protocols/output-management.xml",
"protocols/plasma-wayland-protocols/src/protocols/outputdevice.xml",
"protocols/plasma-wayland-protocols/src/protocols/plasma-shell.xml",
"protocols/plasma-wayland-protocols/src/protocols/plasma-window-management.xml",
"protocols/plasma-wayland-protocols/src/protocols/remote-access.xml",
"protocols/plasma-wayland-protocols/src/protocols/server-decoration-palette.xml",
"protocols/plasma-wayland-protocols/src/protocols/server-decoration.xml",
Expand All @@ -92,17 +105,6 @@
"protocols/plasma-wayland-protocols/src/protocols/text-input-unstable-v2.xml",
"protocols/plasma-wayland-protocols/src/protocols/text-input.xml",
"protocols/plasma-wayland-protocols/src/protocols/wayland-eglstream-controller.xml",
"protocols/plasma-wayland-protocols/src/protocols/dpms.xml",
"protocols/plasma-wayland-protocols/src/protocols/fake-input.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-lockscreen-overlay-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-device-v2.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-management-v2.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-output-order-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-primary-output-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/kde-screen-edge-v1.xml",
"protocols/plasma-wayland-protocols/src/protocols/org-kde-plasma-virtual-desktop.xml",
"protocols/plasma-wayland-protocols/src/protocols/plasma-shell.xml",
"protocols/plasma-wayland-protocols/src/protocols/plasma-window-management.xml",
"protocols/plasma-wayland-protocols/src/protocols/zkde-screencast-unstable-v1.xml"
],

Expand Down Expand Up @@ -145,6 +147,7 @@
"protocols/hyprland-protocols/protocols/hyprland-ctm-control-v1.xml",
"protocols/hyprland-protocols/protocols/hyprland-focus-grab-v1.xml",
"protocols/hyprland-protocols/protocols/hyprland-global-shortcuts-v1.xml",
"protocols/hyprland-protocols/protocols/hyprland-surface-v1.xml",
"protocols/hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml"
]
}
164 changes: 164 additions & 0 deletions src/client/protocol/hyprland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,170 @@ pub mod hyprland_global_shortcuts_v1 {
}
}
}
#[doc = "This protocol exposes hyprland-specific wl_surface properties."]
#[allow(clippy::module_inception)]
pub mod hyprland_surface_v1 {
#[doc = "This interface allows a client to create hyprland surface objects."]
#[allow(clippy::too_many_arguments)]
pub mod hyprland_surface_manager_v1 {
use futures_util::SinkExt;
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
pub enum Error {
#[doc = "wl_surface already has a hyprland surface object"]
AlreadyConstructed = 0u32,
}
impl TryFrom<u32> for Error {
type Error = crate::wire::DecodeError;
fn try_from(v: u32) -> Result<Self, Self::Error> {
match v {
0u32 => Ok(Self::AlreadyConstructed),
_ => Err(crate::wire::DecodeError::MalformedPayload),
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
(*self as u32).fmt(f)
}
}
#[doc = "Trait to implement the hyprland_surface_manager_v1 interface. See the module level documentation for more info"]
pub trait HyprlandSurfaceManagerV1 {
const INTERFACE: &'static str = "hyprland_surface_manager_v1";
const VERSION: u32 = 1u32;
async fn handle_event(
&self,
message: &mut crate::wire::Message,
) -> crate::client::Result<()> {
#[allow(clippy::match_single_binding)]
match message.opcode {
_ => Err(crate::client::Error::UnknownOpcode),
}
}
#[doc = "Create a hyprland surface object for the given wayland surface."]
#[doc = ""]
#[doc = "If the wl_surface already has an associated hyprland_surface_v1 object,"]
#[doc = "even from a different manager, creation is a protocol error."]
async fn get_hyprland_surface(
&self,
socket: &mut crate::wire::Socket,
object_id: crate::wire::ObjectId,
id: crate::wire::ObjectId,
surface: crate::wire::ObjectId,
) -> crate::client::Result<()> {
tracing::debug!(
"-> hyprland_surface_manager_v1#{}.get_hyprland_surface()",
object_id
);
let (payload, fds) = crate::wire::PayloadBuilder::new()
.put_object(Some(id))
.put_object(Some(surface))
.build();
socket
.send(crate::wire::Message::new(object_id, 0u16, payload, fds))
.await
.map_err(crate::client::Error::IoError)
}
#[doc = "Destroy the surface manager."]
#[doc = "This does not destroy existing surface objects."]
async fn destroy(
&self,
socket: &mut crate::wire::Socket,
object_id: crate::wire::ObjectId,
) -> crate::client::Result<()> {
tracing::debug!("-> hyprland_surface_manager_v1#{}.destroy()", object_id);
let (payload, fds) = crate::wire::PayloadBuilder::new().build();
socket
.send(crate::wire::Message::new(object_id, 1u16, payload, fds))
.await
.map_err(crate::client::Error::IoError)
}
}
}
#[doc = "This interface allows access to hyprland-specific properties of a wl_surface."]
#[doc = ""]
#[doc = "Once the wl_surface has been destroyed, the hyprland surface object must be"]
#[doc = "destroyed as well. All other operations are a protocol error."]
#[allow(clippy::too_many_arguments)]
pub mod hyprland_surface_v1 {
use futures_util::SinkExt;
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
pub enum Error {
#[doc = "wl_surface was destroyed"]
NoSurface = 0u32,
#[doc = "given opacity was not in the range 0.0 - 1.0 (inclusive)"]
OutOfRange = 1u32,
}
impl TryFrom<u32> for Error {
type Error = crate::wire::DecodeError;
fn try_from(v: u32) -> Result<Self, Self::Error> {
match v {
0u32 => Ok(Self::NoSurface),
1u32 => Ok(Self::OutOfRange),
_ => Err(crate::wire::DecodeError::MalformedPayload),
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
(*self as u32).fmt(f)
}
}
#[doc = "Trait to implement the hyprland_surface_v1 interface. See the module level documentation for more info"]
pub trait HyprlandSurfaceV1 {
const INTERFACE: &'static str = "hyprland_surface_v1";
const VERSION: u32 = 1u32;
async fn handle_event(
&self,
message: &mut crate::wire::Message,
) -> crate::client::Result<()> {
#[allow(clippy::match_single_binding)]
match message.opcode {
_ => Err(crate::client::Error::UnknownOpcode),
}
}
#[doc = "Sets a multiplier for the overall opacity of the surface."]
#[doc = "This multiplier applies to visual effects such as blur behind the surface"]
#[doc = "in addition to the surface's content."]
#[doc = ""]
#[doc = "The default value is 1.0."]
#[doc = "Setting a value outside of the range 0.0 - 1.0 (inclusive) is a protocol error."]
#[doc = "Does not take effect until wl_surface.commit is called."]
async fn set_opacity(
&self,
socket: &mut crate::wire::Socket,
object_id: crate::wire::ObjectId,
opacity: crate::wire::Fixed,
) -> crate::client::Result<()> {
tracing::debug!("-> hyprland_surface_v1#{}.set_opacity()", object_id);
let (payload, fds) = crate::wire::PayloadBuilder::new()
.put_fixed(opacity)
.build();
socket
.send(crate::wire::Message::new(object_id, 0u16, payload, fds))
.await
.map_err(crate::client::Error::IoError)
}
#[doc = "Destroy the hyprland surface object, resetting properties provided"]
#[doc = "by this interface to their default values on the next wl_surface.commit."]
async fn destroy(
&self,
socket: &mut crate::wire::Socket,
object_id: crate::wire::ObjectId,
) -> crate::client::Result<()> {
tracing::debug!("-> hyprland_surface_v1#{}.destroy()", object_id);
let (payload, fds) = crate::wire::PayloadBuilder::new().build();
socket
.send(crate::wire::Message::new(object_id, 1u16, payload, fds))
.await
.map_err(crate::client::Error::IoError)
}
}
}
}
#[doc = "This protocol allows clients to ask for exporting another toplevel's"]
#[doc = "surface(s) to a buffer."]
#[doc = ""]
Expand Down
Loading

0 comments on commit ac69d07

Please sign in to comment.