wayland: remove Object::num_requests
This commit is contained in:
parent
19bd17c7dc
commit
0ac1bb8507
76 changed files with 168 additions and 486 deletions
|
|
@ -55,10 +55,6 @@ async fn receive(data: Rc<Client>) {
|
|||
}
|
||||
};
|
||||
// log::trace!("obj: {}, request: {}, len: {}", obj_id, request, len);
|
||||
if request >= obj.num_requests() {
|
||||
data.invalid_request(&*obj, request);
|
||||
return Err(ClientError::InvalidMethod);
|
||||
}
|
||||
if len < 8 {
|
||||
return Err(ClientError::MessageSizeTooSmall);
|
||||
}
|
||||
|
|
@ -76,6 +72,12 @@ async fn receive(data: Rc<Client>) {
|
|||
// log::trace!("{:x?}", data_buf);
|
||||
let parser = MsgParser::new(&mut buf, &data_buf[..]);
|
||||
if let Err(e) = obj.handle_request(request, parser) {
|
||||
if let ClientError::InvalidMethod = e {
|
||||
if let Ok(obj) = data.objects.get_obj(obj_id) {
|
||||
data.invalid_request(&*obj, request);
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
return Err(ClientError::RequestError(Box::new(e)));
|
||||
}
|
||||
// data.flush();
|
||||
|
|
|
|||
|
|
@ -104,17 +104,13 @@ impl Global for ExtSessionLockManagerV1Global {
|
|||
simple_add_global!(ExtSessionLockManagerV1Global);
|
||||
|
||||
object_base! {
|
||||
ExtSessionLockManagerV1;
|
||||
self = ExtSessionLockManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
LOCK => lock,
|
||||
}
|
||||
|
||||
impl Object for ExtSessionLockManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
LOCK + 1
|
||||
}
|
||||
}
|
||||
impl Object for ExtSessionLockManagerV1 {}
|
||||
|
||||
simple_add_obj!(ExtSessionLockManagerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ impl ExtSessionLockV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ExtSessionLockV1;
|
||||
self = ExtSessionLockV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_LOCK_SURFACE => get_lock_surface,
|
||||
|
|
@ -106,10 +106,6 @@ object_base! {
|
|||
}
|
||||
|
||||
impl Object for ExtSessionLockV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
UNLOCK_AND_DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
if !self.finished.get() {
|
||||
self.client.state.lock.lock.take();
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ impl IpcVtable for ClipboardIpc {
|
|||
}
|
||||
|
||||
fn create_xwm_source(client: &Rc<Client>) -> Self::Source {
|
||||
WlDataSource::new(WlDataSourceId::NONE, client, true)
|
||||
WlDataSource::new(WlDataSourceId::NONE, client, true, 3)
|
||||
}
|
||||
|
||||
fn set_seat_selection(
|
||||
|
|
@ -287,18 +287,14 @@ impl IpcVtable for ClipboardIpc {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataDevice;
|
||||
self = WlDataDevice;
|
||||
|
||||
START_DRAG => start_drag,
|
||||
SET_SELECTION => set_selection,
|
||||
RELEASE => release,
|
||||
RELEASE => release if self.version >= 2,
|
||||
}
|
||||
|
||||
impl Object for WlDataDevice {
|
||||
fn num_requests(&self) -> u32 {
|
||||
RELEASE + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
break_device_loops::<ClipboardIpc>(self);
|
||||
self.seat.remove_data_device(self);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ impl WlDataDeviceManager {
|
|||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), WlDataDeviceManagerError> {
|
||||
let req: CreateDataSource = self.client.parse(self, parser)?;
|
||||
let res = Rc::new(WlDataSource::new(req.id, &self.client, false));
|
||||
let res = Rc::new(WlDataSource::new(req.id, &self.client, false, self.version));
|
||||
track!(self.client, res);
|
||||
self.client.add_client_obj(&res)?;
|
||||
Ok(())
|
||||
|
|
@ -106,17 +106,13 @@ impl Global for WlDataDeviceManagerGlobal {
|
|||
simple_add_global!(WlDataDeviceManagerGlobal);
|
||||
|
||||
object_base! {
|
||||
WlDataDeviceManager;
|
||||
self = WlDataDeviceManager;
|
||||
|
||||
CREATE_DATA_SOURCE => create_data_source,
|
||||
GET_DATA_DEVICE => get_data_device,
|
||||
}
|
||||
|
||||
impl Object for WlDataDeviceManager {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_DATA_DEVICE + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlDataDeviceManager {}
|
||||
|
||||
simple_add_obj!(WlDataDeviceManager);
|
||||
|
||||
|
|
|
|||
|
|
@ -168,20 +168,16 @@ impl WlDataOffer {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataOffer;
|
||||
self = WlDataOffer;
|
||||
|
||||
ACCEPT => accept,
|
||||
RECEIVE => receive,
|
||||
DESTROY => destroy,
|
||||
FINISH => finish,
|
||||
SET_ACTIONS => set_actions,
|
||||
FINISH => finish if self.device.version >= 3,
|
||||
SET_ACTIONS => set_actions if self.device.version >= 3,
|
||||
}
|
||||
|
||||
impl Object for WlDataOffer {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_ACTIONS + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
break_offer_loops::<ClipboardIpc>(self);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,15 +30,17 @@ const INVALID_SOURCE: u32 = 1;
|
|||
pub struct WlDataSource {
|
||||
pub id: WlDataSourceId,
|
||||
pub data: SourceData<ClipboardIpc>,
|
||||
pub version: u32,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlDataSource {
|
||||
pub fn new(id: WlDataSourceId, client: &Rc<Client>, is_xwm: bool) -> Self {
|
||||
pub fn new(id: WlDataSourceId, client: &Rc<Client>, is_xwm: bool, version: u32) -> Self {
|
||||
Self {
|
||||
id,
|
||||
tracker: Default::default(),
|
||||
data: SourceData::new(client, is_xwm),
|
||||
version,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,18 +198,14 @@ impl WlDataSource {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataSource;
|
||||
self = WlDataSource;
|
||||
|
||||
OFFER => offer,
|
||||
DESTROY => destroy,
|
||||
SET_ACTIONS => set_actions,
|
||||
SET_ACTIONS => set_actions if self.version >= 3,
|
||||
}
|
||||
|
||||
impl Object for WlDataSource {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_ACTIONS + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
break_source_loops::<ClipboardIpc>(self);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,18 +113,14 @@ impl Global for ZwpPrimarySelectionDeviceManagerV1Global {
|
|||
simple_add_global!(ZwpPrimarySelectionDeviceManagerV1Global);
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionDeviceManagerV1;
|
||||
self = ZwpPrimarySelectionDeviceManagerV1;
|
||||
|
||||
CREATE_SOURCE => create_source,
|
||||
GET_DEVICE => get_data_device,
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for ZwpPrimarySelectionDeviceManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwpPrimarySelectionDeviceManagerV1 {}
|
||||
|
||||
simple_add_obj!(ZwpPrimarySelectionDeviceManagerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -231,17 +231,13 @@ impl IpcVtable for PrimarySelectionIpc {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionDeviceV1;
|
||||
self = ZwpPrimarySelectionDeviceV1;
|
||||
|
||||
SET_SELECTION => set_selection,
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for ZwpPrimarySelectionDeviceV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
break_device_loops::<PrimarySelectionIpc>(self);
|
||||
self.seat.remove_primary_selection_device(self);
|
||||
|
|
|
|||
|
|
@ -63,17 +63,13 @@ impl ZwpPrimarySelectionOfferV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionOfferV1;
|
||||
self = ZwpPrimarySelectionOfferV1;
|
||||
|
||||
RECEIVE => receive,
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for ZwpPrimarySelectionOfferV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
break_offer_loops::<PrimarySelectionIpc>(self);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,17 +80,13 @@ impl ZwpPrimarySelectionSourceV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionSourceV1;
|
||||
self = ZwpPrimarySelectionSourceV1;
|
||||
|
||||
OFFER => offer,
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for ZwpPrimarySelectionSourceV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
break_source_loops::<PrimarySelectionIpc>(self);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ impl JayCompositor {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayCompositor;
|
||||
self = JayCompositor;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_LOG_FILE => get_log_file,
|
||||
|
|
@ -330,11 +330,7 @@ object_base! {
|
|||
CREATE_SCREENCAST => create_screencast,
|
||||
}
|
||||
|
||||
impl Object for JayCompositor {
|
||||
fn num_requests(&self) -> u32 {
|
||||
CREATE_SCREENCAST + 1
|
||||
}
|
||||
}
|
||||
impl Object for JayCompositor {}
|
||||
|
||||
simple_add_obj!(JayCompositor);
|
||||
|
||||
|
|
|
|||
|
|
@ -58,17 +58,13 @@ impl JayIdle {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayIdle;
|
||||
self = JayIdle;
|
||||
|
||||
GET_STATUS => get_status,
|
||||
SET_INTERVAL => set_interval,
|
||||
}
|
||||
|
||||
impl Object for JayIdle {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_INTERVAL + 1
|
||||
}
|
||||
}
|
||||
impl Object for JayIdle {}
|
||||
|
||||
simple_add_obj!(JayIdle);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,16 +41,12 @@ impl JayLogFile {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayLogFile;
|
||||
self = JayLogFile;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for JayLogFile {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for JayLogFile {}
|
||||
|
||||
simple_add_obj!(JayLogFile);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,16 +50,12 @@ impl JayOutput {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayOutput;
|
||||
self = JayOutput;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for JayOutput {
|
||||
fn num_requests(&self) -> u32 {
|
||||
1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.remove_from_node();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,17 +49,13 @@ impl JayPointer {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayPointer;
|
||||
self = JayPointer;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_KNOWN_CURSOR => set_known_cursor,
|
||||
}
|
||||
|
||||
impl Object for JayPointer {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_KNOWN_CURSOR + 1
|
||||
}
|
||||
}
|
||||
impl Object for JayPointer {}
|
||||
|
||||
simple_add_obj!(JayPointer);
|
||||
|
||||
|
|
|
|||
|
|
@ -58,16 +58,12 @@ impl JayRenderCtx {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayRenderCtx;
|
||||
self = JayRenderCtx;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for JayRenderCtx {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.remove_from_state();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ impl JayScreencast {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayScreencast;
|
||||
self = JayScreencast;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_OUTPUT => set_output,
|
||||
|
|
@ -424,10 +424,6 @@ object_base! {
|
|||
}
|
||||
|
||||
impl Object for JayScreencast {
|
||||
fn num_requests(&self) -> u32 {
|
||||
RELEASE_BUFFER + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.detach();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,13 +45,9 @@ impl JayScreenshot {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayScreenshot;
|
||||
self = JayScreenshot;
|
||||
}
|
||||
|
||||
impl Object for JayScreenshot {
|
||||
fn num_requests(&self) -> u32 {
|
||||
0
|
||||
}
|
||||
}
|
||||
impl Object for JayScreenshot {}
|
||||
|
||||
simple_add_obj!(JayScreenshot);
|
||||
|
|
|
|||
|
|
@ -125,14 +125,10 @@ impl JaySeatEvents {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JaySeatEvents;
|
||||
self = JaySeatEvents;
|
||||
}
|
||||
|
||||
impl Object for JaySeatEvents {
|
||||
fn num_requests(&self) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.client
|
||||
.state
|
||||
|
|
|
|||
|
|
@ -73,16 +73,12 @@ impl JayWorkspace {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayWorkspace;
|
||||
self = JayWorkspace;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for JayWorkspace {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.remove_from_node();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,16 +63,12 @@ impl JayWorkspaceWatcher {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayWorkspaceWatcher;
|
||||
self = JayWorkspaceWatcher;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for JayWorkspaceWatcher {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.remove_from_state();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,17 +65,13 @@ impl OrgKdeKwinServerDecoration {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
OrgKdeKwinServerDecoration;
|
||||
self = OrgKdeKwinServerDecoration;
|
||||
|
||||
RELEASE => release,
|
||||
REQUEST_MODE => request_mode,
|
||||
}
|
||||
|
||||
impl Object for OrgKdeKwinServerDecoration {
|
||||
fn num_requests(&self) -> u32 {
|
||||
REQUEST_MODE + 1
|
||||
}
|
||||
}
|
||||
impl Object for OrgKdeKwinServerDecoration {}
|
||||
|
||||
simple_add_obj!(OrgKdeKwinServerDecoration);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,16 +92,12 @@ impl OrgKdeKwinServerDecorationManager {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
OrgKdeKwinServerDecorationManager;
|
||||
self = OrgKdeKwinServerDecorationManager;
|
||||
|
||||
CREATE => create,
|
||||
}
|
||||
|
||||
impl Object for OrgKdeKwinServerDecorationManager {
|
||||
fn num_requests(&self) -> u32 {
|
||||
CREATE + 1
|
||||
}
|
||||
}
|
||||
impl Object for OrgKdeKwinServerDecorationManager {}
|
||||
|
||||
simple_add_obj!(OrgKdeKwinServerDecorationManager);
|
||||
|
||||
|
|
|
|||
|
|
@ -204,16 +204,12 @@ impl WlBuffer {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlBuffer;
|
||||
self = WlBuffer;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for WlBuffer {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlBuffer {}
|
||||
|
||||
dedicated_add_obj!(WlBuffer, WlBufferId, buffers);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,14 +33,10 @@ impl WlCallback {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlCallback;
|
||||
self = WlCallback;
|
||||
}
|
||||
|
||||
impl Object for WlCallback {
|
||||
fn num_requests(&self) -> u32 {
|
||||
0
|
||||
}
|
||||
}
|
||||
impl Object for WlCallback {}
|
||||
|
||||
simple_add_obj!(WlCallback);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,17 +87,13 @@ impl Global for WlCompositorGlobal {
|
|||
simple_add_global!(WlCompositorGlobal);
|
||||
|
||||
object_base! {
|
||||
WlCompositor;
|
||||
self = WlCompositor;
|
||||
|
||||
CREATE_SURFACE => create_surface,
|
||||
CREATE_REGION => create_region,
|
||||
}
|
||||
|
||||
impl Object for WlCompositor {
|
||||
fn num_requests(&self) -> u32 {
|
||||
CREATE_REGION + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlCompositor {}
|
||||
|
||||
simple_add_obj!(WlCompositor);
|
||||
|
||||
|
|
|
|||
|
|
@ -89,17 +89,13 @@ impl WlDisplay {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDisplay;
|
||||
self = WlDisplay;
|
||||
|
||||
SYNC => sync,
|
||||
GET_REGISTRY => get_registry,
|
||||
}
|
||||
|
||||
impl Object for WlDisplay {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_REGISTRY + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlDisplay {}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlDisplayError {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ impl WlDrmGlobal {
|
|||
let obj = Rc::new(WlDrm {
|
||||
id,
|
||||
client: client.clone(),
|
||||
_version: version,
|
||||
version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
|
|
@ -68,7 +68,7 @@ simple_add_global!(WlDrmGlobal);
|
|||
pub struct WlDrm {
|
||||
id: WlDrmId,
|
||||
pub client: Rc<Client>,
|
||||
_version: u32,
|
||||
version: u32,
|
||||
tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
|
|
@ -161,19 +161,15 @@ impl WlDrm {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDrm;
|
||||
self = WlDrm;
|
||||
|
||||
AUTHENTICATE => authenticate,
|
||||
CREATE_BUFFER => create_buffer,
|
||||
CREATE_PLANAR_BUFFER => create_planar_buffer,
|
||||
CREATE_PRIME_BUFFER => create_prime_buffer,
|
||||
CREATE_PRIME_BUFFER => create_prime_buffer if self.version >= 2,
|
||||
}
|
||||
|
||||
impl Object for WlDrm {
|
||||
fn num_requests(&self) -> u32 {
|
||||
CREATE_PRIME_BUFFER + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlDrm {}
|
||||
|
||||
simple_add_obj!(WlDrm);
|
||||
|
||||
|
|
|
|||
|
|
@ -362,20 +362,12 @@ impl WlOutput {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlOutput;
|
||||
self = WlOutput;
|
||||
|
||||
RELEASE => release,
|
||||
RELEASE => release if self.version >= 3,
|
||||
}
|
||||
|
||||
impl Object for WlOutput {
|
||||
fn num_requests(&self) -> u32 {
|
||||
if self.version < 3 {
|
||||
0
|
||||
} else {
|
||||
RELEASE + 1
|
||||
}
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.xdg_outputs.clear();
|
||||
self.remove_binding();
|
||||
|
|
|
|||
|
|
@ -60,18 +60,14 @@ impl WlRegion {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlRegion;
|
||||
self = WlRegion;
|
||||
|
||||
DESTROY => destroy,
|
||||
ADD => add,
|
||||
SUBTRACT => subtract,
|
||||
}
|
||||
|
||||
impl Object for WlRegion {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SUBTRACT + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlRegion {}
|
||||
|
||||
dedicated_add_obj!(WlRegion, WlRegionId, regions);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,16 +68,12 @@ impl WlRegistry {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlRegistry;
|
||||
self = WlRegistry;
|
||||
|
||||
BIND => bind,
|
||||
}
|
||||
|
||||
impl Object for WlRegistry {
|
||||
fn num_requests(&self) -> u32 {
|
||||
BIND + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlRegistry {}
|
||||
|
||||
dedicated_add_obj!(WlRegistry, WlRegistryId, registries);
|
||||
|
||||
|
|
|
|||
|
|
@ -1020,23 +1020,15 @@ impl WlSeat {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlSeat;
|
||||
self = WlSeat;
|
||||
|
||||
GET_POINTER => get_pointer,
|
||||
GET_KEYBOARD => get_keyboard,
|
||||
GET_TOUCH => get_touch,
|
||||
RELEASE => release,
|
||||
RELEASE => release if self.version >= 5,
|
||||
}
|
||||
|
||||
impl Object for WlSeat {
|
||||
fn num_requests(&self) -> u32 {
|
||||
if self.version < 5 {
|
||||
GET_TOUCH + 1
|
||||
} else {
|
||||
RELEASE + 1
|
||||
}
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
{
|
||||
let mut bindings = self.global.bindings.borrow_mut();
|
||||
|
|
|
|||
|
|
@ -110,16 +110,12 @@ impl WlKeyboard {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlKeyboard;
|
||||
self = WlKeyboard;
|
||||
|
||||
RELEASE => release,
|
||||
RELEASE => release if self.seat.version >= 3,
|
||||
}
|
||||
|
||||
impl Object for WlKeyboard {
|
||||
fn num_requests(&self) -> u32 {
|
||||
RELEASE + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlKeyboard {}
|
||||
|
||||
simple_add_obj!(WlKeyboard);
|
||||
|
||||
|
|
|
|||
|
|
@ -214,17 +214,13 @@ impl WlPointer {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlPointer;
|
||||
self = WlPointer;
|
||||
|
||||
SET_CURSOR => set_cursor,
|
||||
RELEASE => release,
|
||||
RELEASE => release if self.seat.version >= 3,
|
||||
}
|
||||
|
||||
impl Object for WlPointer {
|
||||
fn num_requests(&self) -> u32 {
|
||||
RELEASE + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlPointer {}
|
||||
|
||||
dedicated_add_obj!(WlPointer, WlPointerId, pointers);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,16 +49,12 @@ impl WlTouch {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlTouch;
|
||||
self = WlTouch;
|
||||
|
||||
RELEASE => release,
|
||||
RELEASE => release if self.seat.version >= 3,
|
||||
}
|
||||
|
||||
impl Object for WlTouch {
|
||||
fn num_requests(&self) -> u32 {
|
||||
RELEASE + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlTouch {}
|
||||
|
||||
simple_add_obj!(WlTouch);
|
||||
|
||||
|
|
|
|||
|
|
@ -278,18 +278,14 @@ impl Global for ZwpPointerConstraintsV1Global {
|
|||
simple_add_global!(ZwpPointerConstraintsV1Global);
|
||||
|
||||
object_base! {
|
||||
ZwpPointerConstraintsV1;
|
||||
self = ZwpPointerConstraintsV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
LOCK_POINTER => lock_pointer,
|
||||
CONFINE_POINTER => confine_pointer,
|
||||
}
|
||||
|
||||
impl Object for ZwpPointerConstraintsV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
CONFINE_POINTER + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwpPointerConstraintsV1 {}
|
||||
|
||||
simple_add_obj!(ZwpPointerConstraintsV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,17 +47,13 @@ impl ConstraintOwner for ZwpConfinedPointerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpConfinedPointerV1;
|
||||
self = ZwpConfinedPointerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_REGION => set_region,
|
||||
}
|
||||
|
||||
impl Object for ZwpConfinedPointerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_REGION + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.constraint.detach();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ impl ConstraintOwner for ZwpLockedPointerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpLockedPointerV1;
|
||||
self = ZwpLockedPointerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_CURSOR_POSITION_HINT => set_cursor_position_hint,
|
||||
|
|
@ -61,10 +61,6 @@ object_base! {
|
|||
}
|
||||
|
||||
impl Object for ZwpLockedPointerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_REGION + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.constraint.detach();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,17 +89,13 @@ impl ZwpRelativePointerManagerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpRelativePointerManagerV1;
|
||||
self = ZwpRelativePointerManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_RELATIVE_POINTER => get_relative_pointer,
|
||||
}
|
||||
|
||||
impl Object for ZwpRelativePointerManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_RELATIVE_POINTER + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwpRelativePointerManagerV1 {}
|
||||
|
||||
simple_add_obj!(ZwpRelativePointerManagerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,16 +48,12 @@ impl ZwpRelativePointerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpRelativePointerV1;
|
||||
self = ZwpRelativePointerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for ZwpRelativePointerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwpRelativePointerV1 {}
|
||||
|
||||
simple_add_obj!(ZwpRelativePointerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ pub struct WlShm {
|
|||
_global: Rc<WlShmGlobal>,
|
||||
id: WlShmId,
|
||||
client: Rc<Client>,
|
||||
version: u32,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
|
|
@ -33,12 +34,13 @@ impl WlShmGlobal {
|
|||
self: Rc<Self>,
|
||||
id: WlShmId,
|
||||
client: &Rc<Client>,
|
||||
_version: u32,
|
||||
version: u32,
|
||||
) -> Result<(), WlShmError> {
|
||||
let obj = Rc::new(WlShm {
|
||||
_global: self,
|
||||
id,
|
||||
client: client.clone(),
|
||||
version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
|
|
@ -94,17 +96,13 @@ impl Global for WlShmGlobal {
|
|||
simple_add_global!(WlShmGlobal);
|
||||
|
||||
object_base! {
|
||||
WlShm;
|
||||
self = WlShm;
|
||||
|
||||
CREATE_POOL => create_pool,
|
||||
RELEASE => release,
|
||||
RELEASE => release if self.version >= 2,
|
||||
}
|
||||
|
||||
impl Object for WlShm {
|
||||
fn num_requests(&self) -> u32 {
|
||||
RELEASE + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlShm {}
|
||||
|
||||
simple_add_obj!(WlShm);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,18 +87,14 @@ impl WlShmPool {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlShmPool;
|
||||
self = WlShmPool;
|
||||
|
||||
CREATE_BUFFER => create_buffer,
|
||||
DESTROY => destroy,
|
||||
RESIZE => resize,
|
||||
}
|
||||
|
||||
impl Object for WlShmPool {
|
||||
fn num_requests(&self) -> u32 {
|
||||
RESIZE + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlShmPool {}
|
||||
|
||||
simple_add_obj!(WlShmPool);
|
||||
|
||||
|
|
|
|||
|
|
@ -81,17 +81,13 @@ impl Global for WlSubcompositorGlobal {
|
|||
simple_add_global!(WlSubcompositorGlobal);
|
||||
|
||||
object_base! {
|
||||
WlSubcompositor;
|
||||
self = WlSubcompositor;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_SUBSURFACE => get_subsurface,
|
||||
}
|
||||
|
||||
impl Object for WlSubcompositor {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_SUBSURFACE + 1
|
||||
}
|
||||
}
|
||||
impl Object for WlSubcompositor {}
|
||||
|
||||
simple_add_obj!(WlSubcompositor);
|
||||
|
||||
|
|
|
|||
|
|
@ -1049,7 +1049,7 @@ impl WlSurface {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlSurface;
|
||||
self = WlSurface;
|
||||
|
||||
DESTROY => destroy,
|
||||
ATTACH => attach,
|
||||
|
|
@ -1058,17 +1058,13 @@ object_base! {
|
|||
SET_OPAQUE_REGION => set_opaque_region,
|
||||
SET_INPUT_REGION => set_input_region,
|
||||
COMMIT => commit,
|
||||
SET_BUFFER_TRANSFORM => set_buffer_transform,
|
||||
SET_BUFFER_SCALE => set_buffer_scale,
|
||||
DAMAGE_BUFFER => damage_buffer,
|
||||
OFFSET => offset,
|
||||
SET_BUFFER_TRANSFORM => set_buffer_transform if self.version >= 2,
|
||||
SET_BUFFER_SCALE => set_buffer_scale if self.version >= 3,
|
||||
DAMAGE_BUFFER => damage_buffer if self.version >= 4,
|
||||
OFFSET => offset if self.version >= 5,
|
||||
}
|
||||
|
||||
impl Object for WlSurface {
|
||||
fn num_requests(&self) -> u32 {
|
||||
OFFSET + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.unset_dnd_icons();
|
||||
self.unset_cursors();
|
||||
|
|
|
|||
|
|
@ -130,17 +130,13 @@ impl Node for ExtSessionLockSurfaceV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ExtSessionLockSurfaceV1;
|
||||
self = ExtSessionLockSurfaceV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
ACK_CONFIGURE => ack_configure,
|
||||
}
|
||||
|
||||
impl Object for ExtSessionLockSurfaceV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
ACK_CONFIGURE + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ impl WlSubsurface {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlSubsurface;
|
||||
self = WlSubsurface;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_POSITION => set_position,
|
||||
|
|
@ -255,10 +255,6 @@ object_base! {
|
|||
}
|
||||
|
||||
impl Object for WlSubsurface {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_DESYNC + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
*self.pending.node.borrow_mut() = None;
|
||||
*self.node.borrow_mut() = None;
|
||||
|
|
|
|||
|
|
@ -52,16 +52,12 @@ impl WpFractionalScaleV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WpFractionalScaleV1;
|
||||
self = WpFractionalScaleV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for WpFractionalScaleV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for WpFractionalScaleV1 {}
|
||||
|
||||
simple_add_obj!(WpFractionalScaleV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,17 +53,13 @@ impl WpTearingControlV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WpTearingControlV1;
|
||||
self = WpTearingControlV1;
|
||||
|
||||
SET_PRESENTATION_HINT => set_presentation_hint,
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for WpTearingControlV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for WpTearingControlV1 {}
|
||||
|
||||
simple_add_obj!(WpTearingControlV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,18 +75,14 @@ impl WpViewport {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WpViewport;
|
||||
self = WpViewport;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_SOURCE => set_source,
|
||||
SET_DESTINATION => set_destination,
|
||||
}
|
||||
|
||||
impl Object for WpViewport {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_DESTINATION + 1
|
||||
}
|
||||
}
|
||||
impl Object for WpViewport {}
|
||||
|
||||
simple_add_obj!(WpViewport);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,17 +42,13 @@ impl XwaylandSurfaceV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
XwaylandSurfaceV1;
|
||||
self = XwaylandSurfaceV1;
|
||||
|
||||
SET_SERIAL => set_serial,
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for XwaylandSurfaceV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.x.xwayland_surface.set(None);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ impl XdgSurface {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
XdgSurface;
|
||||
self = XdgSurface;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_TOPLEVEL => get_toplevel,
|
||||
|
|
@ -324,10 +324,6 @@ object_base! {
|
|||
}
|
||||
|
||||
impl Object for XdgSurface {
|
||||
fn num_requests(&self) -> u32 {
|
||||
ACK_CONFIGURE + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.ext.take();
|
||||
self.popups.clear();
|
||||
|
|
|
|||
|
|
@ -253,22 +253,14 @@ impl XdgPopup {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
XdgPopup;
|
||||
self = XdgPopup;
|
||||
|
||||
DESTROY => destroy,
|
||||
GRAB => grab,
|
||||
REPOSITION => reposition,
|
||||
REPOSITION => reposition if self.xdg.base.version >= 3,
|
||||
}
|
||||
|
||||
impl Object for XdgPopup {
|
||||
fn num_requests(&self) -> u32 {
|
||||
let last_req = match self.xdg.base.version {
|
||||
0..=2 => GRAB,
|
||||
_ => REPOSITION,
|
||||
};
|
||||
last_req + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node();
|
||||
self.parent.set(None);
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ impl XdgToplevel {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
XdgToplevel;
|
||||
self = XdgToplevel;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_PARENT => set_parent,
|
||||
|
|
@ -379,10 +379,6 @@ object_base! {
|
|||
}
|
||||
|
||||
impl Object for XdgToplevel {
|
||||
fn num_requests(&self) -> u32 {
|
||||
SET_MINIMIZED + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.tl_destroy();
|
||||
self.parent.set(None);
|
||||
|
|
|
|||
|
|
@ -91,17 +91,13 @@ impl Global for XwaylandShellV1Global {
|
|||
simple_add_global!(XwaylandShellV1Global);
|
||||
|
||||
object_base! {
|
||||
XwaylandShellV1;
|
||||
self = XwaylandShellV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_XWAYLAND_SURFACE => get_xwayland_surface,
|
||||
}
|
||||
|
||||
impl Object for XwaylandShellV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_XWAYLAND_SURFACE + 1
|
||||
}
|
||||
}
|
||||
impl Object for XwaylandShellV1 {}
|
||||
|
||||
simple_add_obj!(XwaylandShellV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ impl Node for ZwlrLayerSurfaceV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwlrLayerSurfaceV1;
|
||||
self = ZwlrLayerSurfaceV1;
|
||||
|
||||
SET_SIZE => set_size,
|
||||
SET_ANCHOR => set_anchor,
|
||||
|
|
@ -417,18 +417,10 @@ object_base! {
|
|||
GET_POPUP => get_popup,
|
||||
ACK_CONFIGURE => ack_configure,
|
||||
DESTROY => destroy,
|
||||
SET_LAYER => set_layer,
|
||||
SET_LAYER => set_layer if self.shell.version >= 2,
|
||||
}
|
||||
|
||||
impl Object for ZwlrLayerSurfaceV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
let last_req = match self.shell.version {
|
||||
0..=1 => DESTROY,
|
||||
_ => SET_LAYER,
|
||||
};
|
||||
last_req + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node();
|
||||
self.link.set(None);
|
||||
|
|
|
|||
|
|
@ -49,16 +49,12 @@ impl ZwpIdleInhibitorV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpIdleInhibitorV1;
|
||||
self = ZwpIdleInhibitorV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for ZwpIdleInhibitorV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.deactivate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,17 +85,13 @@ impl WpFractionalScaleManagerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WpFractionalScaleManagerV1;
|
||||
self = WpFractionalScaleManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_FRACTIONAL_SCALE => get_fractional_scale,
|
||||
}
|
||||
|
||||
impl Object for WpFractionalScaleManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_FRACTIONAL_SCALE + 1
|
||||
}
|
||||
}
|
||||
impl Object for WpFractionalScaleManagerV1 {}
|
||||
|
||||
simple_add_obj!(WpFractionalScaleManagerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -91,17 +91,13 @@ impl WpPresentation {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WpPresentation;
|
||||
self = WpPresentation;
|
||||
|
||||
DESTROY => destroy,
|
||||
FEEDBACK => feedback,
|
||||
}
|
||||
|
||||
impl Object for WpPresentation {
|
||||
fn num_requests(&self) -> u32 {
|
||||
FEEDBACK + 1
|
||||
}
|
||||
}
|
||||
impl Object for WpPresentation {}
|
||||
|
||||
simple_add_obj!(WpPresentation);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,14 +51,10 @@ impl WpPresentationFeedback {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WpPresentationFeedback;
|
||||
self = WpPresentationFeedback;
|
||||
}
|
||||
|
||||
impl Object for WpPresentationFeedback {
|
||||
fn num_requests(&self) -> u32 {
|
||||
0
|
||||
}
|
||||
}
|
||||
impl Object for WpPresentationFeedback {}
|
||||
|
||||
simple_add_obj!(WpPresentationFeedback);
|
||||
|
||||
|
|
|
|||
|
|
@ -91,17 +91,13 @@ impl WpTearingControlManagerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WpTearingControlManagerV1;
|
||||
self = WpTearingControlManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_TEARING_CONTROL => get_tearing_control,
|
||||
}
|
||||
|
||||
impl Object for WpTearingControlManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_TEARING_CONTROL + 1
|
||||
}
|
||||
}
|
||||
impl Object for WpTearingControlManagerV1 {}
|
||||
|
||||
simple_add_obj!(WpTearingControlManagerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -77,17 +77,13 @@ impl WpViewporter {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WpViewporter;
|
||||
self = WpViewporter;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_VIEWPORT => get_viewport,
|
||||
}
|
||||
|
||||
impl Object for WpViewporter {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_VIEWPORT + 1
|
||||
}
|
||||
}
|
||||
impl Object for WpViewporter {}
|
||||
|
||||
simple_add_obj!(WpViewporter);
|
||||
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ impl XdgPositioner {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
XdgPositioner;
|
||||
self = XdgPositioner;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_SIZE => set_size,
|
||||
|
|
@ -273,20 +273,12 @@ object_base! {
|
|||
SET_GRAVITY => set_gravity,
|
||||
SET_CONSTRAINT_ADJUSTMENT => set_constraint_adjustment,
|
||||
SET_OFFSET => set_offset,
|
||||
SET_REACTIVE => set_reactive,
|
||||
SET_PARENT_SIZE => set_parent_size,
|
||||
SET_PARENT_CONFIGURE => set_parent_configure,
|
||||
SET_REACTIVE => set_reactive if self.base.version >= 3,
|
||||
SET_PARENT_SIZE => set_parent_size if self.base.version >= 3,
|
||||
SET_PARENT_CONFIGURE => set_parent_configure if self.base.version >= 3,
|
||||
}
|
||||
|
||||
impl Object for XdgPositioner {
|
||||
fn num_requests(&self) -> u32 {
|
||||
if self.base.version < 3 {
|
||||
SET_OFFSET + 1
|
||||
} else {
|
||||
SET_PARENT_CONFIGURE + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Object for XdgPositioner {}
|
||||
|
||||
dedicated_add_obj!(XdgPositioner, XdgPositionerId, xdg_positioners);
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ impl Global for XdgWmBaseGlobal {
|
|||
simple_add_global!(XdgWmBaseGlobal);
|
||||
|
||||
object_base! {
|
||||
XdgWmBase;
|
||||
self = XdgWmBase;
|
||||
|
||||
DESTROY => destroy,
|
||||
CREATE_POSITIONER => create_positioner,
|
||||
|
|
@ -135,10 +135,6 @@ object_base! {
|
|||
dedicated_add_obj!(XdgWmBase, XdgWmBaseId, xdg_wm_bases);
|
||||
|
||||
impl Object for XdgWmBase {
|
||||
fn num_requests(&self) -> u32 {
|
||||
PONG + 1
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.surfaces.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,26 +118,15 @@ impl Global for ZwlrLayerShellV1Global {
|
|||
simple_add_global!(ZwlrLayerShellV1Global);
|
||||
|
||||
object_base! {
|
||||
ZwlrLayerShellV1;
|
||||
self = ZwlrLayerShellV1;
|
||||
|
||||
GET_LAYER_SURFACE => get_layer_surface,
|
||||
DESTROY => destroy,
|
||||
DESTROY => destroy if self.version >= 3,
|
||||
}
|
||||
|
||||
simple_add_obj!(ZwlrLayerShellV1);
|
||||
|
||||
impl Object for ZwlrLayerShellV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
// todo
|
||||
// let last_request = if self.version >= 3 {
|
||||
// DESTROY
|
||||
// } else {
|
||||
// GET_LAYER_SURFACE
|
||||
// };
|
||||
// last_request + 1
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwlrLayerShellV1 {}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwlrLayerShellV1Error {
|
||||
|
|
|
|||
|
|
@ -151,24 +151,16 @@ impl ZwlrScreencopyFrameV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwlrScreencopyFrameV1;
|
||||
self = ZwlrScreencopyFrameV1;
|
||||
|
||||
COPY => copy,
|
||||
DESTROY => destroy,
|
||||
COPY_WITH_DAMAGE => copy_with_damage,
|
||||
COPY_WITH_DAMAGE => copy_with_damage if self.version >= 2,
|
||||
}
|
||||
|
||||
simple_add_obj!(ZwlrScreencopyFrameV1);
|
||||
|
||||
impl Object for ZwlrScreencopyFrameV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
if self.version >= 2 {
|
||||
COPY_WITH_DAMAGE + 1
|
||||
} else {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.output_link.take();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,18 +135,14 @@ impl ZwlrScreencopyManagerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwlrScreencopyManagerV1;
|
||||
self = ZwlrScreencopyManagerV1;
|
||||
|
||||
CAPTURE_OUTPUT => capture_output,
|
||||
CAPTURE_OUTPUT_REGION => capture_output_region,
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for ZwlrScreencopyManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwlrScreencopyManagerV1 {}
|
||||
|
||||
simple_add_obj!(ZwlrScreencopyManagerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -95,17 +95,13 @@ impl ZwpIdleInhibitManagerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpIdleInhibitManagerV1;
|
||||
self = ZwpIdleInhibitManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
CREATE_INHIBITOR => create_inhibitor,
|
||||
}
|
||||
|
||||
impl Object for ZwpIdleInhibitManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
CREATE_INHIBITOR + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwpIdleInhibitManagerV1 {}
|
||||
|
||||
simple_add_obj!(ZwpIdleInhibitManagerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -187,19 +187,15 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpLinuxBufferParamsV1;
|
||||
self = ZwpLinuxBufferParamsV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
ADD => add,
|
||||
CREATE => create,
|
||||
CREATE_IMMED => create_immed,
|
||||
CREATE_IMMED => create_immed if self.parent.version >= 2,
|
||||
}
|
||||
|
||||
impl Object for ZwpLinuxBufferParamsV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
CREATE_IMMED + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwpLinuxBufferParamsV1 {}
|
||||
|
||||
simple_add_obj!(ZwpLinuxBufferParamsV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ impl ZwpLinuxDmabufV1Global {
|
|||
let obj = Rc::new(ZwpLinuxDmabufV1 {
|
||||
id,
|
||||
client: client.clone(),
|
||||
_version: version,
|
||||
version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
|
|
@ -79,7 +79,7 @@ simple_add_global!(ZwpLinuxDmabufV1Global);
|
|||
pub struct ZwpLinuxDmabufV1 {
|
||||
id: ZwpLinuxDmabufV1Id,
|
||||
pub client: Rc<Client>,
|
||||
_version: u32,
|
||||
pub version: u32,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
|
|
@ -119,17 +119,13 @@ impl ZwpLinuxDmabufV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpLinuxDmabufV1;
|
||||
self = ZwpLinuxDmabufV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
CREATE_PARAMS => create_params,
|
||||
}
|
||||
|
||||
impl Object for ZwpLinuxDmabufV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
CREATE_PARAMS + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZwpLinuxDmabufV1 {}
|
||||
|
||||
simple_add_obj!(ZwpLinuxDmabufV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -86,17 +86,13 @@ impl ZxdgDecorationManagerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZxdgDecorationManagerV1;
|
||||
self = ZxdgDecorationManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_TOPLEVEL_DECORATION => get_toplevel_decoration,
|
||||
}
|
||||
|
||||
impl Object for ZxdgDecorationManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_TOPLEVEL_DECORATION + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZxdgDecorationManagerV1 {}
|
||||
|
||||
simple_add_obj!(ZxdgDecorationManagerV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ impl Global for ZxdgOutputManagerV1Global {
|
|||
simple_add_global!(ZxdgOutputManagerV1Global);
|
||||
|
||||
object_base! {
|
||||
ZxdgOutputManagerV1;
|
||||
self = ZxdgOutputManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_XDG_OUTPUT => get_xdg_output,
|
||||
|
|
@ -101,11 +101,7 @@ object_base! {
|
|||
|
||||
simple_add_obj!(ZxdgOutputManagerV1);
|
||||
|
||||
impl Object for ZxdgOutputManagerV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
GET_XDG_OUTPUT + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZxdgOutputManagerV1 {}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZxdgOutputManagerV1Error {
|
||||
|
|
|
|||
|
|
@ -85,16 +85,12 @@ impl ZxdgOutputV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZxdgOutputV1;
|
||||
self = ZxdgOutputV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
||||
impl Object for ZxdgOutputV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
DESTROY + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZxdgOutputV1 {}
|
||||
|
||||
simple_add_obj!(ZxdgOutputV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -77,18 +77,14 @@ impl ZxdgToplevelDecorationV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZxdgToplevelDecorationV1;
|
||||
self = ZxdgToplevelDecorationV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_MODE => set_mode,
|
||||
UNSET_MODE => unset_mode,
|
||||
}
|
||||
|
||||
impl Object for ZxdgToplevelDecorationV1 {
|
||||
fn num_requests(&self) -> u32 {
|
||||
UNSET_MODE + 1
|
||||
}
|
||||
}
|
||||
impl Object for ZxdgToplevelDecorationV1 {}
|
||||
|
||||
simple_add_obj!(ZxdgToplevelDecorationV1);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,30 +52,30 @@ macro_rules! usr_object_base {
|
|||
}
|
||||
|
||||
macro_rules! object_base {
|
||||
($oname:ident; $($code:ident => $f:ident,)*) => {
|
||||
($self:ident = $oname:ident; $($code:ident => $f:ident $(if $cond:expr)?,)*) => {
|
||||
impl crate::object::ObjectBase for $oname {
|
||||
fn id(&self) -> crate::object::ObjectId {
|
||||
self.id.into()
|
||||
fn id(&$self) -> crate::object::ObjectId {
|
||||
$self.id.into()
|
||||
}
|
||||
|
||||
fn into_any(self: std::rc::Rc<Self>) -> std::rc::Rc<dyn std::any::Any> {
|
||||
self
|
||||
fn into_any($self: std::rc::Rc<Self>) -> std::rc::Rc<dyn std::any::Any> {
|
||||
$self
|
||||
}
|
||||
|
||||
#[allow(unused_variables, unreachable_code)]
|
||||
fn handle_request(
|
||||
self: std::rc::Rc<Self>,
|
||||
$self: std::rc::Rc<Self>,
|
||||
request: u32,
|
||||
parser: crate::utils::buffd::MsgParser<'_, '_>,
|
||||
) -> Result<(), crate::client::ClientError> {
|
||||
let res: Result<(), crate::client::MethodError> = match request {
|
||||
$(
|
||||
$code => $oname::$f(&self, parser).map_err(|e| crate::client::MethodError {
|
||||
$code $(if $cond)? => $oname::$f(&$self, parser).map_err(|e| crate::client::MethodError {
|
||||
method: stringify!($f),
|
||||
error: Box::new(e),
|
||||
}),
|
||||
)*
|
||||
_ => unreachable!(),
|
||||
_ => return Err(crate::client::ClientError::InvalidMethod),
|
||||
};
|
||||
if let Err(e) = res {
|
||||
return Err(crate::client::ClientError::ObjectError(crate::client::ObjectError {
|
||||
|
|
@ -86,7 +86,7 @@ macro_rules! object_base {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn interface(&self) -> crate::object::Interface {
|
||||
fn interface(&$self) -> crate::object::Interface {
|
||||
crate::wire::$oname
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ pub trait ObjectBase {
|
|||
}
|
||||
|
||||
pub trait Object: ObjectBase + 'static {
|
||||
fn num_requests(&self) -> u32;
|
||||
fn break_loops(&self) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue