use {super::super::all_types::*, ::wl_client::builder::prelude::*};
static INTERFACE: wl_interface = wl_interface {
name: c"wl_shell_surface".as_ptr(),
version: 1,
method_count: 10,
methods: {
static MESSAGES: [wl_message; 10] = [
wl_message {
name: c"pong".as_ptr(),
signature: c"u".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 1] = [None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"move".as_ptr(),
signature: c"ou".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 2] =
[Some(WlSeat::WL_INTERFACE), None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"resize".as_ptr(),
signature: c"ouu".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 3] =
[Some(WlSeat::WL_INTERFACE), None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"set_toplevel".as_ptr(),
signature: c"".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 0] = [];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"set_transient".as_ptr(),
signature: c"oiiu".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 4] =
[Some(WlSurface::WL_INTERFACE), None, None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"set_fullscreen".as_ptr(),
signature: c"uu?o".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 3] =
[None, None, Some(WlOutput::WL_INTERFACE)];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"set_popup".as_ptr(),
signature: c"ouoiiu".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 6] = [
Some(WlSeat::WL_INTERFACE),
None,
Some(WlSurface::WL_INTERFACE),
None,
None,
None,
];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"set_maximized".as_ptr(),
signature: c"?o".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 1] =
[Some(WlOutput::WL_INTERFACE)];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"set_title".as_ptr(),
signature: c"s".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 1] = [None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"set_class".as_ptr(),
signature: c"s".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 1] = [None];
TYPES.as_ptr().cast()
},
},
];
MESSAGES.as_ptr()
},
event_count: 3,
events: {
static MESSAGES: [wl_message; 3] = [
wl_message {
name: c"ping".as_ptr(),
signature: c"u".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 1] = [None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"configure".as_ptr(),
signature: c"uii".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 3] = [None, None, None];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"popup_done".as_ptr(),
signature: c"".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 0] = [];
TYPES.as_ptr().cast()
},
},
];
MESSAGES.as_ptr()
},
};
#[derive(Clone, Eq, PartialEq)]
#[repr(transparent)]
pub struct WlShellSurface {
proxy: UntypedOwnedProxy,
}
#[derive(Eq, PartialEq)]
#[repr(transparent)]
pub struct WlShellSurfaceRef {
proxy: UntypedBorrowedProxy,
}
unsafe impl UntypedOwnedProxyWrapper for WlShellSurface {}
unsafe impl OwnedProxy for WlShellSurface {
const INTERFACE: &'static str = "wl_shell_surface";
const WL_INTERFACE: &'static wl_interface = &INTERFACE;
const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
private::EventHandler(private::NoOpEventHandler);
const MAX_VERSION: u32 = 1;
type Borrowed = WlShellSurfaceRef;
type Api = private::ProxyApi;
type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
}
unsafe impl UntypedBorrowedProxyWrapper for WlShellSurfaceRef {}
unsafe impl BorrowedProxy for WlShellSurfaceRef {
type Owned = WlShellSurface;
}
impl Deref for WlShellSurface {
type Target = WlShellSurfaceRef;
fn deref(&self) -> &Self::Target {
proxy::low_level::deref(self)
}
}
mod private {
pub struct ProxyApi;
#[allow(dead_code)]
pub struct EventHandler<H>(pub(super) H);
#[allow(dead_code)]
pub struct NoOpEventHandler;
}
impl Debug for WlShellSurface {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "wl_shell_surface#{}", self.proxy.id())
}
}
impl Debug for WlShellSurfaceRef {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "wl_shell_surface#{}", self.proxy.id())
}
}
impl PartialEq<WlShellSurfaceRef> for WlShellSurface {
fn eq(&self, other: &WlShellSurfaceRef) -> bool {
self.proxy == other.proxy
}
}
impl PartialEq<WlShellSurface> for WlShellSurfaceRef {
fn eq(&self, other: &WlShellSurface) -> bool {
self.proxy == other.proxy
}
}
#[allow(dead_code)]
impl WlShellSurfaceRef {
#[inline]
pub fn pong(&self, serial: u32) {
let (arg0,) = (serial,);
let mut args = [wl_argument { u: arg0 }];
unsafe {
self.proxy.send_request(0, &mut args);
}
}
#[inline]
pub fn r#move(&self, seat: &WlSeatRef, serial: u32) {
let (arg0, arg1) = (seat, serial);
let obj0_lock = proxy::lock(arg0);
let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
unsafe {
self.proxy.send_request(1, &mut args);
}
}
#[inline]
pub fn resize(&self, seat: &WlSeatRef, serial: u32, edges: WlShellSurfaceResize) {
let (arg0, arg1, arg2) = (seat, serial, edges);
let obj0_lock = proxy::lock(arg0);
let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
let mut args = [
wl_argument { o: obj0 },
wl_argument { u: arg1 },
wl_argument { u: arg2.0 },
];
unsafe {
self.proxy.send_request(2, &mut args);
}
}
#[inline]
pub fn set_toplevel(&self) {
let mut args = [];
unsafe {
self.proxy.send_request(3, &mut args);
}
}
#[inline]
pub fn set_transient(
&self,
parent: &WlSurfaceRef,
x: i32,
y: i32,
flags: WlShellSurfaceTransient,
) {
let (arg0, arg1, arg2, arg3) = (parent, x, y, flags);
let obj0_lock = proxy::lock(arg0);
let obj0 = check_argument_proxy("parent", obj0_lock.wl_proxy());
let mut args = [
wl_argument { o: obj0 },
wl_argument { i: arg1 },
wl_argument { i: arg2 },
wl_argument { u: arg3.0 },
];
unsafe {
self.proxy.send_request(4, &mut args);
}
}
#[inline]
pub fn set_fullscreen(
&self,
method: WlShellSurfaceFullscreenMethod,
framerate: u32,
output: Option<&WlOutputRef>,
) {
let (arg0, arg1, arg2) = (method, framerate, output);
let obj2_lock = arg2.map(|arg2| proxy::lock(arg2));
let obj2 = obj2_lock
.map(|obj2_lock| check_argument_proxy("output", obj2_lock.wl_proxy()))
.unwrap_or(ptr::null_mut());
let mut args = [
wl_argument { u: arg0.0 },
wl_argument { u: arg1 },
wl_argument { o: obj2 },
];
unsafe {
self.proxy.send_request(5, &mut args);
}
}
#[inline]
pub fn set_popup(
&self,
seat: &WlSeatRef,
serial: u32,
parent: &WlSurfaceRef,
x: i32,
y: i32,
flags: WlShellSurfaceTransient,
) {
let (arg0, arg1, arg2, arg3, arg4, arg5) = (seat, serial, parent, x, y, flags);
let obj0_lock = proxy::lock(arg0);
let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
let obj2_lock = proxy::lock(arg2);
let obj2 = check_argument_proxy("parent", obj2_lock.wl_proxy());
let mut args = [
wl_argument { o: obj0 },
wl_argument { u: arg1 },
wl_argument { o: obj2 },
wl_argument { i: arg3 },
wl_argument { i: arg4 },
wl_argument { u: arg5.0 },
];
unsafe {
self.proxy.send_request(6, &mut args);
}
}
#[inline]
pub fn set_maximized(&self, output: Option<&WlOutputRef>) {
let (arg0,) = (output,);
let obj0_lock = arg0.map(|arg0| proxy::lock(arg0));
let obj0 = obj0_lock
.map(|obj0_lock| check_argument_proxy("output", obj0_lock.wl_proxy()))
.unwrap_or(ptr::null_mut());
let mut args = [wl_argument { o: obj0 }];
unsafe {
self.proxy.send_request(7, &mut args);
}
}
#[inline]
pub fn set_title(&self, title: &str) {
let (arg0,) = (title,);
with_cstr_cache(|cache| {
let str0_offset = cache.len();
cache.extend_from_slice(arg0.as_bytes());
cache.push(0);
let str0 = cache[str0_offset..].as_ptr().cast();
let mut args = [wl_argument { s: str0 }];
unsafe {
self.proxy.send_request(8, &mut args);
}
})
}
#[inline]
pub fn set_class(&self, class_: &str) {
let (arg0,) = (class_,);
with_cstr_cache(|cache| {
let str0_offset = cache.len();
cache.extend_from_slice(arg0.as_bytes());
cache.push(0);
let str0 = cache[str0_offset..].as_ptr().cast();
let mut args = [wl_argument { s: str0 }];
unsafe {
self.proxy.send_request(9, &mut args);
}
})
}
}
impl WlShellSurface {
#[allow(dead_code)]
pub const EVT__PING__SINCE: u32 = 1;
#[allow(dead_code)]
pub const EVT__CONFIGURE__SINCE: u32 = 1;
#[allow(dead_code)]
pub const EVT__POPUP_DONE__SINCE: u32 = 1;
}
#[allow(dead_code)]
pub trait WlShellSurfaceEventHandler {
type Data: 'static;
#[inline]
fn ping(&self, _data: &mut Self::Data, _slf: &WlShellSurfaceRef, serial: u32) {
let _ = serial;
}
#[inline]
fn configure(
&self,
_data: &mut Self::Data,
_slf: &WlShellSurfaceRef,
edges: WlShellSurfaceResize,
width: i32,
height: i32,
) {
let _ = edges;
let _ = width;
let _ = height;
}
#[inline]
fn popup_done(&self, _data: &mut Self::Data, _slf: &WlShellSurfaceRef) {}
}
impl WlShellSurfaceEventHandler for private::NoOpEventHandler {
type Data = ();
}
unsafe impl<H> EventHandler for private::EventHandler<H>
where
H: WlShellSurfaceEventHandler,
{
const WL_INTERFACE: &'static wl_interface = &INTERFACE;
#[inline]
fn mutable_type() -> Option<(TypeId, &'static str)> {
let id = TypeId::of::<H::Data>();
let name = std::any::type_name::<H::Data>();
Some((id, name))
}
#[allow(unused_variables)]
unsafe fn handle_event(
&self,
queue: &Queue,
data: *mut u8,
slf: &UntypedBorrowedProxy,
opcode: u32,
args: *mut wl_argument,
) {
let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlShellSurfaceRef>(slf) };
let data: &mut H::Data = unsafe { &mut *data.cast() };
match opcode {
0 => {
let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
let arg0 = unsafe { args[0].u };
self.0.ping(data, slf, arg0);
}
1 => {
let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
let arg0 = unsafe { WlShellSurfaceResize(args[0].u) };
let arg1 = unsafe { args[1].i };
let arg2 = unsafe { args[2].i };
self.0.configure(data, slf, arg0, arg1, arg2);
}
2 => {
self.0.popup_done(data, slf);
}
_ => {
invalid_opcode("wl_shell_surface", opcode);
}
}
}
}
impl<H> CreateEventHandler<H> for private::ProxyApi
where
H: WlShellSurfaceEventHandler,
{
type EventHandler = private::EventHandler<H>;
#[inline]
fn create_event_handler(handler: H) -> Self::EventHandler {
private::EventHandler(handler)
}
}
impl WlShellSurface {
#[allow(dead_code)]
pub const ENM__RESIZE_NONE__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__RESIZE_TOP__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__RESIZE_BOTTOM__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__RESIZE_LEFT__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__RESIZE_TOP_LEFT__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__RESIZE_BOTTOM_LEFT__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__RESIZE_RIGHT__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__RESIZE_TOP_RIGHT__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__RESIZE_BOTTOM_RIGHT__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__TRANSIENT_INACTIVE__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__FULLSCREEN_METHOD_DEFAULT__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__FULLSCREEN_METHOD_SCALE__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__FULLSCREEN_METHOD_DRIVER__SINCE: u32 = 1;
#[allow(dead_code)]
pub const ENM__FULLSCREEN_METHOD_FILL__SINCE: u32 = 1;
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default)]
#[allow(dead_code)]
pub struct WlShellSurfaceResize(pub u32);
#[derive(Clone, Debug)]
pub struct WlShellSurfaceResizeIter(pub u32);
impl WlShellSurfaceResize {
#[allow(dead_code)]
pub const NONE: Self = Self(0);
#[allow(dead_code)]
pub const TOP: Self = Self(1);
#[allow(dead_code)]
pub const BOTTOM: Self = Self(2);
#[allow(dead_code)]
pub const LEFT: Self = Self(4);
#[allow(dead_code)]
pub const TOP_LEFT: Self = Self(5);
#[allow(dead_code)]
pub const BOTTOM_LEFT: Self = Self(6);
#[allow(dead_code)]
pub const RIGHT: Self = Self(8);
#[allow(dead_code)]
pub const TOP_RIGHT: Self = Self(9);
#[allow(dead_code)]
pub const BOTTOM_RIGHT: Self = Self(10);
}
#[allow(dead_code)]
impl WlShellSurfaceResize {
#[inline]
pub const fn empty() -> Self {
Self(0)
}
#[inline]
#[must_use]
pub const fn is_empty(self) -> bool {
self.0 == 0
}
#[inline]
#[must_use]
pub const fn contains(self, other: Self) -> bool {
self.0 & other.0 == other.0
}
#[inline]
#[must_use]
pub const fn intersects(self, other: Self) -> bool {
self.0 & other.0 != 0
}
#[inline]
pub const fn insert(&mut self, other: Self) {
*self = self.union(other);
}
#[inline]
pub const fn remove(&mut self, other: Self) {
*self = self.difference(other);
}
#[inline]
pub const fn toggle(&mut self, other: Self) {
*self = self.symmetric_difference(other);
}
#[inline]
pub const fn set(&mut self, other: Self, value: bool) {
if value {
self.insert(other);
} else {
self.remove(other);
}
}
#[inline]
#[must_use]
pub const fn intersection(self, other: Self) -> Self {
Self(self.0 & other.0)
}
#[inline]
#[must_use]
pub const fn union(self, other: Self) -> Self {
Self(self.0 | other.0)
}
#[inline]
#[must_use]
pub const fn difference(self, other: Self) -> Self {
Self(self.0 & !other.0)
}
#[inline]
#[must_use]
pub const fn complement(self) -> Self {
Self(!self.0)
}
#[inline]
#[must_use]
pub const fn symmetric_difference(self, other: Self) -> Self {
Self(self.0 ^ other.0)
}
#[inline]
pub const fn all_known() -> Self {
#[allow(clippy::eq_op, clippy::identity_op)]
Self(0 | 0 | 1 | 2 | 4 | 5 | 6 | 8 | 9 | 10)
}
}
impl Iterator for WlShellSurfaceResizeIter {
type Item = WlShellSurfaceResize;
fn next(&mut self) -> Option<Self::Item> {
if self.0 == 0 {
return None;
}
let bit = 1 << self.0.trailing_zeros();
self.0 &= !bit;
Some(WlShellSurfaceResize(bit))
}
}
impl IntoIterator for WlShellSurfaceResize {
type Item = WlShellSurfaceResize;
type IntoIter = WlShellSurfaceResizeIter;
fn into_iter(self) -> Self::IntoIter {
WlShellSurfaceResizeIter(self.0)
}
}
impl BitAnd for WlShellSurfaceResize {
type Output = Self;
fn bitand(self, rhs: Self) -> Self::Output {
self.intersection(rhs)
}
}
impl BitAndAssign for WlShellSurfaceResize {
fn bitand_assign(&mut self, rhs: Self) {
*self = self.intersection(rhs);
}
}
impl BitOr for WlShellSurfaceResize {
type Output = Self;
fn bitor(self, rhs: Self) -> Self::Output {
self.union(rhs)
}
}
impl BitOrAssign for WlShellSurfaceResize {
fn bitor_assign(&mut self, rhs: Self) {
*self = self.union(rhs);
}
}
impl BitXor for WlShellSurfaceResize {
type Output = Self;
fn bitxor(self, rhs: Self) -> Self::Output {
self.symmetric_difference(rhs)
}
}
impl BitXorAssign for WlShellSurfaceResize {
fn bitxor_assign(&mut self, rhs: Self) {
*self = self.symmetric_difference(rhs);
}
}
impl Sub for WlShellSurfaceResize {
type Output = Self;
fn sub(self, rhs: Self) -> Self::Output {
self.difference(rhs)
}
}
impl SubAssign for WlShellSurfaceResize {
fn sub_assign(&mut self, rhs: Self) {
*self = self.difference(rhs);
}
}
impl Not for WlShellSurfaceResize {
type Output = Self;
fn not(self) -> Self::Output {
self.complement()
}
}
impl Debug for WlShellSurfaceResize {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut v = self.0;
let mut first = true;
if v & 1 == 1 {
v &= !1;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("TOP")?;
}
if v & 2 == 2 {
v &= !2;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("BOTTOM")?;
}
if v & 4 == 4 {
v &= !4;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("LEFT")?;
}
if v & 5 == 5 {
v &= !5;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("TOP_LEFT")?;
}
if v & 6 == 6 {
v &= !6;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("BOTTOM_LEFT")?;
}
if v & 8 == 8 {
v &= !8;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("RIGHT")?;
}
if v & 9 == 9 {
v &= !9;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("TOP_RIGHT")?;
}
if v & 10 == 10 {
v &= !10;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("BOTTOM_RIGHT")?;
}
if v != 0 {
if first {
first = false;
} else {
f.write_str(" | ")?;
}
write!(f, "0x{v:032x}")?;
}
if first {
f.write_str("NONE")?;
}
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default)]
#[allow(dead_code)]
pub struct WlShellSurfaceTransient(pub u32);
#[derive(Clone, Debug)]
pub struct WlShellSurfaceTransientIter(pub u32);
impl WlShellSurfaceTransient {
#[allow(dead_code)]
pub const INACTIVE: Self = Self(0x1);
}
#[allow(dead_code)]
impl WlShellSurfaceTransient {
#[inline]
pub const fn empty() -> Self {
Self(0)
}
#[inline]
#[must_use]
pub const fn is_empty(self) -> bool {
self.0 == 0
}
#[inline]
#[must_use]
pub const fn contains(self, other: Self) -> bool {
self.0 & other.0 == other.0
}
#[inline]
#[must_use]
pub const fn intersects(self, other: Self) -> bool {
self.0 & other.0 != 0
}
#[inline]
pub const fn insert(&mut self, other: Self) {
*self = self.union(other);
}
#[inline]
pub const fn remove(&mut self, other: Self) {
*self = self.difference(other);
}
#[inline]
pub const fn toggle(&mut self, other: Self) {
*self = self.symmetric_difference(other);
}
#[inline]
pub const fn set(&mut self, other: Self, value: bool) {
if value {
self.insert(other);
} else {
self.remove(other);
}
}
#[inline]
#[must_use]
pub const fn intersection(self, other: Self) -> Self {
Self(self.0 & other.0)
}
#[inline]
#[must_use]
pub const fn union(self, other: Self) -> Self {
Self(self.0 | other.0)
}
#[inline]
#[must_use]
pub const fn difference(self, other: Self) -> Self {
Self(self.0 & !other.0)
}
#[inline]
#[must_use]
pub const fn complement(self) -> Self {
Self(!self.0)
}
#[inline]
#[must_use]
pub const fn symmetric_difference(self, other: Self) -> Self {
Self(self.0 ^ other.0)
}
#[inline]
pub const fn all_known() -> Self {
#[allow(clippy::eq_op, clippy::identity_op)]
Self(0 | 0x1)
}
}
impl Iterator for WlShellSurfaceTransientIter {
type Item = WlShellSurfaceTransient;
fn next(&mut self) -> Option<Self::Item> {
if self.0 == 0 {
return None;
}
let bit = 1 << self.0.trailing_zeros();
self.0 &= !bit;
Some(WlShellSurfaceTransient(bit))
}
}
impl IntoIterator for WlShellSurfaceTransient {
type Item = WlShellSurfaceTransient;
type IntoIter = WlShellSurfaceTransientIter;
fn into_iter(self) -> Self::IntoIter {
WlShellSurfaceTransientIter(self.0)
}
}
impl BitAnd for WlShellSurfaceTransient {
type Output = Self;
fn bitand(self, rhs: Self) -> Self::Output {
self.intersection(rhs)
}
}
impl BitAndAssign for WlShellSurfaceTransient {
fn bitand_assign(&mut self, rhs: Self) {
*self = self.intersection(rhs);
}
}
impl BitOr for WlShellSurfaceTransient {
type Output = Self;
fn bitor(self, rhs: Self) -> Self::Output {
self.union(rhs)
}
}
impl BitOrAssign for WlShellSurfaceTransient {
fn bitor_assign(&mut self, rhs: Self) {
*self = self.union(rhs);
}
}
impl BitXor for WlShellSurfaceTransient {
type Output = Self;
fn bitxor(self, rhs: Self) -> Self::Output {
self.symmetric_difference(rhs)
}
}
impl BitXorAssign for WlShellSurfaceTransient {
fn bitxor_assign(&mut self, rhs: Self) {
*self = self.symmetric_difference(rhs);
}
}
impl Sub for WlShellSurfaceTransient {
type Output = Self;
fn sub(self, rhs: Self) -> Self::Output {
self.difference(rhs)
}
}
impl SubAssign for WlShellSurfaceTransient {
fn sub_assign(&mut self, rhs: Self) {
*self = self.difference(rhs);
}
}
impl Not for WlShellSurfaceTransient {
type Output = Self;
fn not(self) -> Self::Output {
self.complement()
}
}
impl Debug for WlShellSurfaceTransient {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut v = self.0;
let mut first = true;
if v & 0x1 == 0x1 {
v &= !0x1;
if first {
first = false;
} else {
f.write_str(" | ")?;
}
f.write_str("INACTIVE")?;
}
if v != 0 {
if first {
first = false;
} else {
f.write_str(" | ")?;
}
write!(f, "0x{v:032x}")?;
}
if first {
f.write_str("0")?;
}
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(dead_code)]
pub struct WlShellSurfaceFullscreenMethod(pub u32);
impl WlShellSurfaceFullscreenMethod {
#[allow(dead_code)]
pub const DEFAULT: Self = Self(0);
#[allow(dead_code)]
pub const SCALE: Self = Self(1);
#[allow(dead_code)]
pub const DRIVER: Self = Self(2);
#[allow(dead_code)]
pub const FILL: Self = Self(3);
}
impl Debug for WlShellSurfaceFullscreenMethod {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match *self {
Self::DEFAULT => "DEFAULT",
Self::SCALE => "SCALE",
Self::DRIVER => "DRIVER",
Self::FILL => "FILL",
_ => return Debug::fmt(&self.0, f),
};
f.write_str(name)
}
}
pub mod event_handlers {
use super::*;
pub struct Ping<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlShellSurfaceEventHandler for Ping<T, F>
where
T: 'static,
F: Fn(&mut T, &WlShellSurfaceRef, u32),
{
type Data = T;
#[inline]
fn ping(&self, _data: &mut T, _slf: &WlShellSurfaceRef, serial: u32) {
self.0(_data, _slf, serial)
}
}
pub struct Configure<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlShellSurfaceEventHandler for Configure<T, F>
where
T: 'static,
F: Fn(&mut T, &WlShellSurfaceRef, WlShellSurfaceResize, i32, i32),
{
type Data = T;
#[inline]
fn configure(
&self,
_data: &mut T,
_slf: &WlShellSurfaceRef,
edges: WlShellSurfaceResize,
width: i32,
height: i32,
) {
self.0(_data, _slf, edges, width, height)
}
}
pub struct PopupDone<T, F>(F, PhantomData<fn(&mut T)>);
impl<T, F> WlShellSurfaceEventHandler for PopupDone<T, F>
where
T: 'static,
F: Fn(&mut T, &WlShellSurfaceRef),
{
type Data = T;
#[inline]
fn popup_done(&self, _data: &mut T, _slf: &WlShellSurfaceRef) {
self.0(_data, _slf)
}
}
impl WlShellSurface {
#[allow(dead_code)]
pub fn on_ping<T, F>(f: F) -> Ping<T, F>
where
T: 'static,
F: Fn(&mut T, &WlShellSurfaceRef, u32),
{
Ping(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_configure<T, F>(f: F) -> Configure<T, F>
where
T: 'static,
F: Fn(&mut T, &WlShellSurfaceRef, WlShellSurfaceResize, i32, i32),
{
Configure(f, PhantomData)
}
#[allow(dead_code)]
pub fn on_popup_done<T, F>(f: F) -> PopupDone<T, F>
where
T: 'static,
F: Fn(&mut T, &WlShellSurfaceRef),
{
PopupDone(f, PhantomData)
}
}
}