use {super::super::all_types::*, ::wl_client::builder::prelude::*};
static INTERFACE: wl_interface = wl_interface {
name: c"wp_viewporter".as_ptr(),
version: 1,
method_count: 2,
methods: {
static MESSAGES: [wl_message; 2] = [
wl_message {
name: c"destroy".as_ptr(),
signature: c"".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 0] = [];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"get_viewport".as_ptr(),
signature: c"no".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 2] = [
Some(WpViewport::WL_INTERFACE),
Some(WlSurface::WL_INTERFACE),
];
TYPES.as_ptr().cast()
},
},
];
MESSAGES.as_ptr()
},
event_count: 0,
events: ptr::null(),
};
#[derive(Clone, Eq, PartialEq)]
#[repr(transparent)]
pub struct WpViewporter {
proxy: UntypedOwnedProxy,
}
#[derive(Eq, PartialEq)]
#[repr(transparent)]
pub struct WpViewporterRef {
proxy: UntypedBorrowedProxy,
}
unsafe impl UntypedOwnedProxyWrapper for WpViewporter {}
unsafe impl OwnedProxy for WpViewporter {
const INTERFACE: &'static str = "wp_viewporter";
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 = WpViewporterRef;
type Api = private::ProxyApi;
type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
}
unsafe impl UntypedBorrowedProxyWrapper for WpViewporterRef {}
unsafe impl BorrowedProxy for WpViewporterRef {
type Owned = WpViewporter;
}
impl Deref for WpViewporter {
type Target = WpViewporterRef;
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 WpViewporter {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "wp_viewporter#{}", self.proxy.id())
}
}
impl Debug for WpViewporterRef {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "wp_viewporter#{}", self.proxy.id())
}
}
impl PartialEq<WpViewporterRef> for WpViewporter {
fn eq(&self, other: &WpViewporterRef) -> bool {
self.proxy == other.proxy
}
}
impl PartialEq<WpViewporter> for WpViewporterRef {
fn eq(&self, other: &WpViewporter) -> bool {
self.proxy == other.proxy
}
}
#[allow(dead_code)]
impl WpViewporter {
#[allow(dead_code)]
pub const REQ__DESTROY__SINCE: u32 = 1;
#[inline]
pub fn destroy(&self) {
let mut args = [];
unsafe {
self.proxy.send_destructor(0, &mut args);
}
}
#[allow(dead_code)]
pub const REQ__GET_VIEWPORT__SINCE: u32 = 1;
#[inline]
pub fn get_viewport(&self, surface: &WlSurfaceRef) -> WpViewport {
let (arg1,) = (surface,);
let obj1_lock = proxy::lock(arg1);
let obj1 = check_argument_proxy("surface", obj1_lock.wl_proxy());
let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
let data = unsafe {
self.proxy
.send_constructor::<false>(1, &mut args, WpViewport::WL_INTERFACE, None)
};
unsafe { proxy::low_level::from_untyped_owned(data) }
}
}
#[allow(dead_code)]
impl WpViewporterRef {
#[inline]
pub fn get_viewport(&self, _queue: &Queue, surface: &WlSurfaceRef) -> WpViewport {
let (arg1,) = (surface,);
let obj1_lock = proxy::lock(arg1);
let obj1 = check_argument_proxy("surface", obj1_lock.wl_proxy());
let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
let data = unsafe {
self.proxy
.send_constructor(_queue, 1, &mut args, WpViewport::WL_INTERFACE, None)
};
unsafe { proxy::low_level::from_untyped_owned(data) }
}
}
#[allow(dead_code)]
pub trait WpViewporterEventHandler {
type Data: 'static;
}
impl WpViewporterEventHandler for private::NoOpEventHandler {
type Data = ();
}
unsafe impl<H> EventHandler for private::EventHandler<H>
where
H: WpViewporterEventHandler,
{
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,
) {
invalid_opcode("wp_viewporter", opcode);
}
}
impl<H> CreateEventHandler<H> for private::ProxyApi
where
H: WpViewporterEventHandler,
{
type EventHandler = private::EventHandler<H>;
#[inline]
fn create_event_handler(handler: H) -> Self::EventHandler {
private::EventHandler(handler)
}
}
impl WpViewporter {
#[allow(dead_code)]
pub const ENM__ERROR_VIEWPORT_EXISTS__SINCE: u32 = 1;
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(dead_code)]
pub struct WpViewporterError(pub u32);
impl WpViewporterError {
#[allow(dead_code)]
pub const VIEWPORT_EXISTS: Self = Self(0);
}
impl Debug for WpViewporterError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let name = match *self {
Self::VIEWPORT_EXISTS => "VIEWPORT_EXISTS",
_ => return Debug::fmt(&self.0, f),
};
f.write_str(name)
}
}
pub mod event_handlers {
use super::*;
impl WpViewporter {}
}