Skip to content

Commit

Permalink
Remove duplicate protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
morr0ne committed Sep 4, 2024
1 parent eca3767 commit ca9c1e3
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 408 deletions.
1 change: 0 additions & 1 deletion gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const PROTOCOLS: &[&str] = &[
"wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml",
"wayland-protocols/staging/xdg-dialog/xdg-dialog-v1.xml",
"wayland-protocols/staging/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml",
"wayland-protocols/staging/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml",
"wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml",

// Unstable protocols
Expand Down
2 changes: 1 addition & 1 deletion gen/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use serde::{Deserialize, Serialize};

use crate::utils::{find_enum, make_ident};
use crate::utils::make_ident;

#[derive(Debug, Deserialize, Serialize, Clone)]
#[serde(deny_unknown_fields)]
Expand Down
196 changes: 0 additions & 196 deletions src/client/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10284,202 +10284,6 @@ pub mod xdg_toplevel_drag_v1 {
}
}
}
pub mod xdg_toplevel_drag_v1 {
#[doc = "This protocol enhances normal drag and drop with the ability to move a"]
#[doc = "window at the same time. This allows having detachable parts of a window"]
#[doc = "that when dragged out of it become a new window and can be dragged over"]
#[doc = "an existing window to be reattached."]
#[doc = ""]
#[doc = "A typical workflow would be when the user starts dragging on top of a"]
#[doc = "detachable part of a window, the client would create a wl_data_source and"]
#[doc = "a xdg_toplevel_drag_v1 object and start the drag as normal via"]
#[doc = "wl_data_device.start_drag. Once the client determines that the detachable"]
#[doc = "window contents should be detached from the originating window, it creates"]
#[doc = "a new xdg_toplevel with these contents and issues a"]
#[doc = "xdg_toplevel_drag_v1.attach request before mapping it. From now on the new"]
#[doc = "window is moved by the compositor during the drag as if the client called"]
#[doc = "xdg_toplevel.move."]
#[doc = ""]
#[doc = "Dragging an existing window is similar. The client creates a"]
#[doc = "xdg_toplevel_drag_v1 object and attaches the existing toplevel before"]
#[doc = "starting the drag."]
#[doc = ""]
#[doc = "Clients use the existing drag and drop mechanism to detect when a window"]
#[doc = "can be docked or undocked. If the client wants to snap a window into a"]
#[doc = "parent window it should delete or unmap the dragged top-level. If the"]
#[doc = "contents should be detached again it attaches a new toplevel as described"]
#[doc = "above. If a drag operation is cancelled without being dropped, clients"]
#[doc = "should revert to the previous state, deleting any newly created windows"]
#[doc = "as appropriate. When a drag operation ends as indicated by"]
#[doc = "wl_data_source.dnd_drop_performed the dragged toplevel window's final"]
#[doc = "position is determined as if a xdg_toplevel_move operation ended."]
#[doc = ""]
#[doc = "Warning! The protocol described in this file is currently in the testing"]
#[doc = "phase. Backward compatible changes may be added together with the"]
#[doc = "corresponding interface version bump. Backward incompatible changes can"]
#[doc = "only be done by creating a new major version of the extension."]
pub mod xdg_toplevel_drag_manager_v1 {
use futures_util::SinkExt;
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
pub enum Error {
#[doc = "data_source already used for toplevel drag"]
InvalidSource = 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::InvalidSource),
_ => Err(crate::wire::DecodeError::MalformedPayload),
}
}
}
#[doc = "Trait to implement the xdg_toplevel_drag_manager_v1 interface. See the module level documentation for more info"]
pub trait XdgToplevelDragManagerV1 {
const INTERFACE: &'static str = "xdg_toplevel_drag_manager_v1";
const VERSION: u32 = 1u32;
async fn handle_event(
&self,
message: &mut crate::wire::Message,
) -> crate::client::Result<()> {
match message.opcode {
_ => Err(crate::client::Error::UnknownOpcode),
}
}
#[doc = "Destroy this xdg_toplevel_drag_manager_v1 object. Other objects,"]
#[doc = "including xdg_toplevel_drag_v1 objects created by this factory, are not"]
#[doc = "affected by this request."]
async fn destroy(
&self,
socket: &mut crate::wire::Socket,
object_id: crate::wire::ObjectId,
) -> crate::client::Result<()> {
tracing::debug!("-> xdg_toplevel_drag_manager_v1#{}.destroy()", object_id);
let (payload, fds) = crate::wire::PayloadBuilder::new().build();
socket
.send(crate::wire::Message::new(object_id, 0u16, payload, fds))
.await
.map_err(crate::client::Error::IoError)
}
#[doc = "Create an xdg_toplevel_drag for a drag and drop operation that is going"]
#[doc = "to be started with data_source."]
#[doc = ""]
#[doc = "This request can only be made on sources used in drag-and-drop, so it"]
#[doc = "must be performed before wl_data_device.start_drag. Attempting to use"]
#[doc = "the source other than for drag-and-drop such as in"]
#[doc = "wl_data_device.set_selection will raise an invalid_source error."]
#[doc = ""]
#[doc = "Destroying data_source while a toplevel is attached to the"]
#[doc = "xdg_toplevel_drag is undefined."]
async fn get_xdg_toplevel_drag(
&self,
socket: &mut crate::wire::Socket,
object_id: crate::wire::ObjectId,
id: crate::wire::ObjectId,
data_source: crate::wire::ObjectId,
) -> crate::client::Result<()> {
tracing::debug!(
"-> xdg_toplevel_drag_manager_v1#{}.get_xdg_toplevel_drag()",
object_id
);
let (payload, fds) = crate::wire::PayloadBuilder::new()
.put_object(Some(id))
.put_object(Some(data_source))
.build();
socket
.send(crate::wire::Message::new(object_id, 1u16, payload, fds))
.await
.map_err(crate::client::Error::IoError)
}
}
}
pub mod xdg_toplevel_drag_v1 {
use futures_util::SinkExt;
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
pub enum Error {
#[doc = "valid toplevel already attached"]
ToplevelAttached = 0u32,
#[doc = "drag has not ended"]
OngoingDrag = 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::ToplevelAttached),
1u32 => Ok(Self::OngoingDrag),
_ => Err(crate::wire::DecodeError::MalformedPayload),
}
}
}
#[doc = "Trait to implement the xdg_toplevel_drag_v1 interface. See the module level documentation for more info"]
pub trait XdgToplevelDragV1 {
const INTERFACE: &'static str = "xdg_toplevel_drag_v1";
const VERSION: u32 = 1u32;
async fn handle_event(
&self,
message: &mut crate::wire::Message,
) -> crate::client::Result<()> {
match message.opcode {
_ => Err(crate::client::Error::UnknownOpcode),
}
}
#[doc = "Destroy this xdg_toplevel_drag_v1 object. This request must only be"]
#[doc = "called after the underlying wl_data_source drag has ended, as indicated"]
#[doc = "by the dnd_drop_performed or cancelled events. In any other case an"]
#[doc = "ongoing_drag error is raised."]
async fn destroy(
&self,
socket: &mut crate::wire::Socket,
object_id: crate::wire::ObjectId,
) -> crate::client::Result<()> {
tracing::debug!("-> xdg_toplevel_drag_v1#{}.destroy()", object_id);
let (payload, fds) = crate::wire::PayloadBuilder::new().build();
socket
.send(crate::wire::Message::new(object_id, 0u16, payload, fds))
.await
.map_err(crate::client::Error::IoError)
}
#[doc = "Request that the window will be moved with the cursor during the drag"]
#[doc = "operation. The offset is a hint to the compositor how the toplevel"]
#[doc = "should be positioned relative to the cursor hotspot in surface local"]
#[doc = "coordinates. For example it might only be used when an unmapped window"]
#[doc = "is attached. The attached window does not participate in the selection"]
#[doc = "of the drag target."]
#[doc = ""]
#[doc = "If the toplevel is unmapped while it is attached, it is automatically"]
#[doc = "detached from the drag. In this case this request has to be called again"]
#[doc = "if the window should be attached after it is remapped."]
#[doc = ""]
#[doc = "This request can be called multiple times but issuing it while a"]
#[doc = "toplevel with an active role is attached raises a toplevel_attached"]
#[doc = "error."]
async fn attach(
&self,
socket: &mut crate::wire::Socket,
object_id: crate::wire::ObjectId,
toplevel: crate::wire::ObjectId,
x_offset: i32,
y_offset: i32,
) -> crate::client::Result<()> {
tracing::debug!("-> xdg_toplevel_drag_v1#{}.attach()", object_id);
let (payload, fds) = crate::wire::PayloadBuilder::new()
.put_object(Some(toplevel))
.put_int(x_offset)
.put_int(y_offset)
.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 set icons for their toplevel surfaces"]
#[doc = "either via the XDG icon stock (using an icon name), or from pixel data."]
#[doc = ""]
Expand Down
Loading

0 comments on commit ca9c1e3

Please sign in to comment.