Struct UntypedOwnedProxy

Source
pub struct UntypedOwnedProxy { /* private fields */ }
Expand description

A owned wl_proxy pointer.

Most of the time you will not work with this type directly and instead use one of the types generated by wl-client-builder.

Implementations§

Source§

impl UntypedOwnedProxy

Source

pub unsafe fn from_plain_wl_proxy( queue: &Queue, proxy: NonNull<wl_proxy>, interface: &'static wl_interface, ) -> Self

Creates a new UntypedOwnedProxy from a plain wl_proxy.

§Safety
  • proxy must be a valid pointer to a plain wl_proxy.
  • proxy must remain valid for the lifetime of this object and its clones.
  • proxy must not have an event handler or dispatcher assigned.
  • queue must be the queue of the proxy.
  • interface must be the interface of the proxy.
Examples found in repository?
examples/poll-integration/../common/protocols/tablet_v2/zwp_tablet_seat_v2.rs (lines 264-268)
247    unsafe fn handle_event(
248        &self,
249        queue: &Queue,
250        slf: &UntypedBorrowedProxy,
251        opcode: u32,
252        args: *mut wl_argument,
253    ) {
254        // SAFETY: This function required that slf has the interface INTERFACE
255        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletSeatV2Ref>(slf) };
256        match opcode {
257            0 => {
258                // SAFETY: INTERFACE requires that there are 1 arguments
259                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
260                // SAFETY: - INTERFACE requires that args[0] contains an object
261                //         - ownership is transferred to this function
262                //         - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
263                let arg0 = unsafe {
264                    UntypedOwnedProxy::from_plain_wl_proxy(
265                        queue,
266                        NonNull::new_unchecked(args[0].o.cast()),
267                        ZwpTabletV2::WL_INTERFACE,
268                    )
269                };
270                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
271                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletV2>(arg0) };
272                self.0.tablet_added(slf, arg0);
273            }
274            1 => {
275                // SAFETY: INTERFACE requires that there are 1 arguments
276                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
277                // SAFETY: - INTERFACE requires that args[0] contains an object
278                //         - ownership is transferred to this function
279                //         - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
280                let arg0 = unsafe {
281                    UntypedOwnedProxy::from_plain_wl_proxy(
282                        queue,
283                        NonNull::new_unchecked(args[0].o.cast()),
284                        ZwpTabletToolV2::WL_INTERFACE,
285                    )
286                };
287                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
288                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletToolV2>(arg0) };
289                self.0.tool_added(slf, arg0);
290            }
291            2 => {
292                // SAFETY: INTERFACE requires that there are 1 arguments
293                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
294                // SAFETY: - INTERFACE requires that args[0] contains an object
295                //         - ownership is transferred to this function
296                //         - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
297                let arg0 = unsafe {
298                    UntypedOwnedProxy::from_plain_wl_proxy(
299                        queue,
300                        NonNull::new_unchecked(args[0].o.cast()),
301                        ZwpTabletPadV2::WL_INTERFACE,
302                    )
303                };
304                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
305                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadV2>(arg0) };
306                self.0.pad_added(slf, arg0);
307            }
308            _ => {
309                invalid_opcode("zwp_tablet_seat_v2", opcode);
310            }
311        }
312    }
More examples
Hide additional examples
examples/poll-integration/../common/protocols/tablet_v2/zwp_tablet_pad_group_v2.rs (lines 405-409)
378    unsafe fn handle_event(
379        &self,
380        queue: &Queue,
381        slf: &UntypedBorrowedProxy,
382        opcode: u32,
383        args: *mut wl_argument,
384    ) {
385        // SAFETY: This function required that slf has the interface INTERFACE
386        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadGroupV2Ref>(slf) };
387        match opcode {
388            0 => {
389                // SAFETY: INTERFACE requires that there are 1 arguments
390                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
391                // SAFETY: - INTERFACE requires that args[0] contains an array
392                let arg0 = unsafe {
393                    let a = &*args[0].a;
394                    std::slice::from_raw_parts(a.data.cast(), a.size)
395                };
396                self.0.buttons(slf, arg0);
397            }
398            1 => {
399                // SAFETY: INTERFACE requires that there are 1 arguments
400                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
401                // SAFETY: - INTERFACE requires that args[0] contains an object
402                //         - ownership is transferred to this function
403                //         - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
404                let arg0 = unsafe {
405                    UntypedOwnedProxy::from_plain_wl_proxy(
406                        queue,
407                        NonNull::new_unchecked(args[0].o.cast()),
408                        ZwpTabletPadRingV2::WL_INTERFACE,
409                    )
410                };
411                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
412                let arg0 =
413                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadRingV2>(arg0) };
414                self.0.ring(slf, arg0);
415            }
416            2 => {
417                // SAFETY: INTERFACE requires that there are 1 arguments
418                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
419                // SAFETY: - INTERFACE requires that args[0] contains an object
420                //         - ownership is transferred to this function
421                //         - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
422                let arg0 = unsafe {
423                    UntypedOwnedProxy::from_plain_wl_proxy(
424                        queue,
425                        NonNull::new_unchecked(args[0].o.cast()),
426                        ZwpTabletPadStripV2::WL_INTERFACE,
427                    )
428                };
429                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
430                let arg0 =
431                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadStripV2>(arg0) };
432                self.0.strip(slf, arg0);
433            }
434            3 => {
435                // SAFETY: INTERFACE requires that there are 1 arguments
436                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
437                // SAFETY: - INTERFACE requires that args[0] contains a uint
438                let arg0 = unsafe { args[0].u };
439                self.0.modes(slf, arg0);
440            }
441            4 => {
442                self.0.done(slf);
443            }
444            5 => {
445                // SAFETY: INTERFACE requires that there are 3 arguments
446                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
447                // SAFETY: - INTERFACE requires that args[0] contains a uint
448                let arg0 = unsafe { args[0].u };
449                // SAFETY: - INTERFACE requires that args[1] contains a uint
450                let arg1 = unsafe { args[1].u };
451                // SAFETY: - INTERFACE requires that args[2] contains a uint
452                let arg2 = unsafe { args[2].u };
453                self.0.mode_switch(slf, arg0, arg1, arg2);
454            }
455            _ => {
456                invalid_opcode("zwp_tablet_pad_group_v2", opcode);
457            }
458        }
459    }
examples/poll-integration/../common/protocols/wayland/wl_data_device.rs (lines 507-511)
490    unsafe fn handle_event(
491        &self,
492        queue: &Queue,
493        slf: &UntypedBorrowedProxy,
494        opcode: u32,
495        args: *mut wl_argument,
496    ) {
497        // SAFETY: This function required that slf has the interface INTERFACE
498        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
499        match opcode {
500            0 => {
501                // SAFETY: INTERFACE requires that there are 1 arguments
502                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
503                // SAFETY: - INTERFACE requires that args[0] contains an object
504                //         - ownership is transferred to this function
505                //         - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
506                let arg0 = unsafe {
507                    UntypedOwnedProxy::from_plain_wl_proxy(
508                        queue,
509                        NonNull::new_unchecked(args[0].o.cast()),
510                        WlDataOffer::WL_INTERFACE,
511                    )
512                };
513                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
514                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
515                self.0.data_offer(slf, arg0);
516            }
517            1 => {
518                // SAFETY: INTERFACE requires that there are 5 arguments
519                let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
520                // SAFETY: - INTERFACE requires that args[0] contains a uint
521                let arg0 = unsafe { args[0].u };
522                // SAFETY: - INTERFACE requires that args[1] contains an object
523                let arg1 = unsafe {
524                    if let Some(p) = NonNull::new(args[1].o.cast()) {
525                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
526                    } else {
527                        None
528                    }
529                };
530                // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
531                let arg1 = arg1.as_ref().map(|arg1| unsafe {
532                    proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
533                });
534                // SAFETY: - INTERFACE requires that args[2] contains a fixed
535                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
536                // SAFETY: - INTERFACE requires that args[3] contains a fixed
537                let arg3 = unsafe { Fixed::from_wire(args[3].f) };
538                // SAFETY: - INTERFACE requires that args[4] contains an object
539                let arg4 = unsafe {
540                    if let Some(p) = NonNull::new(args[4].o.cast()) {
541                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
542                    } else {
543                        None
544                    }
545                };
546                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
547                let arg4 = arg4.as_ref().map(|arg4| unsafe {
548                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
549                });
550                self.0.enter(slf, arg0, arg1, arg2, arg3, arg4);
551            }
552            2 => {
553                self.0.leave(slf);
554            }
555            3 => {
556                // SAFETY: INTERFACE requires that there are 3 arguments
557                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
558                // SAFETY: - INTERFACE requires that args[0] contains a uint
559                let arg0 = unsafe { args[0].u };
560                // SAFETY: - INTERFACE requires that args[1] contains a fixed
561                let arg1 = unsafe { Fixed::from_wire(args[1].f) };
562                // SAFETY: - INTERFACE requires that args[2] contains a fixed
563                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
564                self.0.motion(slf, arg0, arg1, arg2);
565            }
566            4 => {
567                self.0.drop(slf);
568            }
569            5 => {
570                // SAFETY: INTERFACE requires that there are 1 arguments
571                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
572                // SAFETY: - INTERFACE requires that args[0] contains an object
573                let arg0 = unsafe {
574                    if let Some(p) = NonNull::new(args[0].o.cast()) {
575                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
576                    } else {
577                        None
578                    }
579                };
580                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
581                let arg0 = arg0.as_ref().map(|arg0| unsafe {
582                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
583                });
584                self.0.selection(slf, arg0);
585            }
586            _ => {
587                invalid_opcode("wl_data_device", opcode);
588            }
589        }
590    }
examples/poll-integration/../common/protocols/tablet_v2/zwp_tablet_pad_v2.rs (lines 500-504)
483    unsafe fn handle_event(
484        &self,
485        queue: &Queue,
486        slf: &UntypedBorrowedProxy,
487        opcode: u32,
488        args: *mut wl_argument,
489    ) {
490        // SAFETY: This function required that slf has the interface INTERFACE
491        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadV2Ref>(slf) };
492        match opcode {
493            0 => {
494                // SAFETY: INTERFACE requires that there are 1 arguments
495                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
496                // SAFETY: - INTERFACE requires that args[0] contains an object
497                //         - ownership is transferred to this function
498                //         - INTERFACE requires that the object has the interface ZwpTabletPadGroupV2::WL_INTERFACE
499                let arg0 = unsafe {
500                    UntypedOwnedProxy::from_plain_wl_proxy(
501                        queue,
502                        NonNull::new_unchecked(args[0].o.cast()),
503                        ZwpTabletPadGroupV2::WL_INTERFACE,
504                    )
505                };
506                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadGroupV2::WL_INTERFACE
507                let arg0 =
508                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadGroupV2>(arg0) };
509                self.0.group(slf, arg0);
510            }
511            1 => {
512                // SAFETY: INTERFACE requires that there are 1 arguments
513                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
514                // SAFETY: - INTERFACE requires that args[0] contains a string
515                //         - if the pointer is not null, then it is a c string
516                let arg0 = unsafe { convert_string_arg("zwp_tablet_pad_v2", "path", args[0].s) };
517                self.0.path(slf, arg0);
518            }
519            2 => {
520                // SAFETY: INTERFACE requires that there are 1 arguments
521                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
522                // SAFETY: - INTERFACE requires that args[0] contains a uint
523                let arg0 = unsafe { args[0].u };
524                self.0.buttons(slf, arg0);
525            }
526            3 => {
527                self.0.done(slf);
528            }
529            4 => {
530                // SAFETY: INTERFACE requires that there are 3 arguments
531                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
532                // SAFETY: - INTERFACE requires that args[0] contains a uint
533                let arg0 = unsafe { args[0].u };
534                // SAFETY: - INTERFACE requires that args[1] contains a uint
535                let arg1 = unsafe { args[1].u };
536                // SAFETY: - INTERFACE requires that args[2] contains a uint
537                let arg2 = unsafe { ZwpTabletPadV2ButtonState(args[2].u) };
538                self.0.button(slf, arg0, arg1, arg2);
539            }
540            5 => {
541                // SAFETY: INTERFACE requires that there are 3 arguments
542                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
543                // SAFETY: - INTERFACE requires that args[0] contains a uint
544                let arg0 = unsafe { args[0].u };
545                // SAFETY: - INTERFACE requires that args[1] contains an object
546                let arg1 = unsafe {
547                    if let Some(p) = NonNull::new(args[1].o.cast()) {
548                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
549                    } else {
550                        None
551                    }
552                };
553                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
554                let arg1 = arg1.as_ref().map(|arg1| unsafe {
555                    proxy::low_level::from_untyped_borrowed::<ZwpTabletV2Ref>(arg1)
556                });
557                // SAFETY: - INTERFACE requires that args[2] contains an object
558                let arg2 = unsafe {
559                    if let Some(p) = NonNull::new(args[2].o.cast()) {
560                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
561                    } else {
562                        None
563                    }
564                };
565                // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
566                let arg2 = arg2.as_ref().map(|arg2| unsafe {
567                    proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg2)
568                });
569                self.0.enter(slf, arg0, arg1, arg2);
570            }
571            6 => {
572                // SAFETY: INTERFACE requires that there are 2 arguments
573                let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
574                // SAFETY: - INTERFACE requires that args[0] contains a uint
575                let arg0 = unsafe { args[0].u };
576                // SAFETY: - INTERFACE requires that args[1] contains an object
577                let arg1 = unsafe {
578                    if let Some(p) = NonNull::new(args[1].o.cast()) {
579                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
580                    } else {
581                        None
582                    }
583                };
584                // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
585                let arg1 = arg1.as_ref().map(|arg1| unsafe {
586                    proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
587                });
588                self.0.leave(slf, arg0, arg1);
589            }
590            7 => {
591                self.0.removed(slf);
592            }
593            _ => {
594                invalid_opcode("zwp_tablet_pad_v2", opcode);
595            }
596        }
597    }
Source

pub unsafe fn from_wrapper_wl_proxy( queue: &Queue, proxy: NonNull<wl_proxy>, ) -> Self

Creates a new UntypedOwnedProxy from a wrapper wl_proxy.

§Safety
  • proxy must be a valid pointer to a wrapper wl_proxy.
  • proxy must remain valid for the lifetime of this object and its clones.
  • queue must be the queue of the proxy.
Source

pub unsafe fn send_destructor(&self, opcode: u32, args: &mut [wl_argument])

Destroys this object by sending a request on this proxy.

After this function returns, the underlying wl_proxy has been destroyed.

This function cannot be used if the request creates a new object. Use UntypedOwnedProxy::send_constructor for that purpose.

This function cannot be used if this is a wrapper.

§Panic
  • This function panics if this proxy has already been destroyed.
  • This function might panic if the proxy is attached to a local queue and the current thread is not the thread in which the queue was created.
  • This function panics if this proxy is a wrapper.
§Safety
  • opcode must be a valid request opcode for the interface of the proxy.
  • args must conform to the interface + opcode of the proxy.
  • args must not contain any new_id element.
Examples found in repository?
examples/poll-integration/../common/protocols/cursor_shape_v1/wp_cursor_shape_device_v1.rs (line 141)
135    pub fn destroy(&self) {
136        let mut args = [];
137        // SAFETY: - self.proxy has the interface INTERFACE
138        //         - 0 < INTERFACE.method_count = 2
139        //         - the request signature is ``
140        unsafe {
141            self.proxy.send_destructor(0, &mut args);
142        }
143    }
More examples
Hide additional examples
examples/poll-integration/../common/protocols/cursor_shape_v1/wp_cursor_shape_manager_v1.rs (line 160)
154    pub fn destroy(&self) {
155        let mut args = [];
156        // SAFETY: - self.proxy has the interface INTERFACE
157        //         - 0 < INTERFACE.method_count = 3
158        //         - the request signature is ``
159        unsafe {
160            self.proxy.send_destructor(0, &mut args);
161        }
162    }
examples/poll-integration/../common/protocols/tablet_v2/zwp_tablet_manager_v2.rs (line 175)
169    pub fn destroy(&self) {
170        let mut args = [];
171        // SAFETY: - self.proxy has the interface INTERFACE
172        //         - 1 < INTERFACE.method_count = 2
173        //         - the request signature is ``
174        unsafe {
175            self.proxy.send_destructor(1, &mut args);
176        }
177    }
examples/poll-integration/../common/protocols/tablet_v2/zwp_tablet_pad_group_v2.rs (line 204)
198    pub fn destroy(&self) {
199        let mut args = [];
200        // SAFETY: - self.proxy has the interface INTERFACE
201        //         - 0 < INTERFACE.method_count = 1
202        //         - the request signature is ``
203        unsafe {
204            self.proxy.send_destructor(0, &mut args);
205        }
206    }
examples/poll-integration/../common/protocols/tablet_v2/zwp_tablet_pad_ring_v2.rs (line 179)
173    pub fn destroy(&self) {
174        let mut args = [];
175        // SAFETY: - self.proxy has the interface INTERFACE
176        //         - 1 < INTERFACE.method_count = 2
177        //         - the request signature is ``
178        unsafe {
179            self.proxy.send_destructor(1, &mut args);
180        }
181    }
examples/poll-integration/../common/protocols/tablet_v2/zwp_tablet_pad_strip_v2.rs (line 179)
173    pub fn destroy(&self) {
174        let mut args = [];
175        // SAFETY: - self.proxy has the interface INTERFACE
176        //         - 1 < INTERFACE.method_count = 2
177        //         - the request signature is ``
178        unsafe {
179            self.proxy.send_destructor(1, &mut args);
180        }
181    }
Source

pub unsafe fn send_constructor<const DESTROY: bool>( &self, opcode: u32, args: &mut [wl_argument], interface: &'static wl_interface, version: Option<u32>, ) -> Self

Creates a new object by sending a request on this proxy.

If DESTROY=true, then the underlying wl_proxy has been destroyed after this function returns.

This function can only be used if the request creates a new object. Use UntypedOwnedProxy::send_destructor or UntypedBorrowedProxy::send_request otherwise.

The new object will be attached to the queue of this proxy.

§Panic
  • This function panics if this proxy has already been destroyed.
  • If DESTROY=true, then this function might panic if the proxy is attached to a local queue and the current thread is not the thread in which the queue was created.
  • If DESTROY=true, then this function panics if this proxy is a wrapper.
§Safety
  • opcode must be a valid request opcode for the interface of the proxy.
  • args must conform to the interface + opcode of the proxy.
  • args must contain exactly one new_id element.
  • interface must be a valid wl_interface.
Examples found in repository?
examples/poll-integration/../common/protocols/wayland/wl_display.rs (line 174)
166    pub fn sync(&self) -> WlCallback {
167        let mut args = [wl_argument { n: 0 }];
168        // SAFETY: - self.proxy has the interface INTERFACE
169        //         - 0 < INTERFACE.method_count = 2
170        //         - the request signature is `n`
171        //         - OwnedProxy::WL_INTERFACE is always a valid interface
172        let data = unsafe {
173            self.proxy
174                .send_constructor::<false>(0, &mut args, WlCallback::WL_INTERFACE, None)
175        };
176        // SAFETY: data has the interface WlCallback::WL_INTERFACE
177        unsafe { proxy::low_level::from_untyped_owned(data) }
178    }
179
180    /// Since when the get_registry request is available.
181    #[allow(dead_code)]
182    pub const REQ__GET_REGISTRY__SINCE: u32 = 1;
183
184    /// get global registry object
185    ///
186    /// This request creates a registry object that allows the client
187    /// to list and bind the global objects available from the
188    /// compositor.
189    ///
190    /// It should be noted that the server side resources consumed in
191    /// response to a get_registry request can only be released when the
192    /// client disconnects, not when the client side proxy is destroyed.
193    /// Therefore, clients should invoke get_registry as infrequently as
194    /// possible to avoid wasting memory.
195    #[inline]
196    pub fn get_registry(&self) -> WlRegistry {
197        let mut args = [wl_argument { n: 0 }];
198        // SAFETY: - self.proxy has the interface INTERFACE
199        //         - 1 < INTERFACE.method_count = 2
200        //         - the request signature is `n`
201        //         - OwnedProxy::WL_INTERFACE is always a valid interface
202        let data = unsafe {
203            self.proxy
204                .send_constructor::<false>(1, &mut args, WlRegistry::WL_INTERFACE, None)
205        };
206        // SAFETY: data has the interface WlRegistry::WL_INTERFACE
207        unsafe { proxy::low_level::from_untyped_owned(data) }
208    }
More examples
Hide additional examples
examples/poll-integration/../common/protocols/wayland/wl_surface.rs (line 345)
337    pub fn frame(&self) -> WlCallback {
338        let mut args = [wl_argument { n: 0 }];
339        // SAFETY: - self.proxy has the interface INTERFACE
340        //         - 3 < INTERFACE.method_count = 11
341        //         - the request signature is `n`
342        //         - OwnedProxy::WL_INTERFACE is always a valid interface
343        let data = unsafe {
344            self.proxy
345                .send_constructor::<false>(3, &mut args, WlCallback::WL_INTERFACE, None)
346        };
347        // SAFETY: data has the interface WlCallback::WL_INTERFACE
348        unsafe { proxy::low_level::from_untyped_owned(data) }
349    }
examples/poll-integration/../common/protocols/wayland/wl_seat.rs (line 190)
182    pub fn get_pointer(&self) -> WlPointer {
183        let mut args = [wl_argument { n: 0 }];
184        // SAFETY: - self.proxy has the interface INTERFACE
185        //         - 0 < INTERFACE.method_count = 4
186        //         - the request signature is `n`
187        //         - OwnedProxy::WL_INTERFACE is always a valid interface
188        let data = unsafe {
189            self.proxy
190                .send_constructor::<false>(0, &mut args, WlPointer::WL_INTERFACE, None)
191        };
192        // SAFETY: data has the interface WlPointer::WL_INTERFACE
193        unsafe { proxy::low_level::from_untyped_owned(data) }
194    }
195
196    /// Since when the get_keyboard request is available.
197    #[allow(dead_code)]
198    pub const REQ__GET_KEYBOARD__SINCE: u32 = 1;
199
200    /// return keyboard object
201    ///
202    /// The ID provided will be initialized to the wl_keyboard interface
203    /// for this seat.
204    ///
205    /// This request only takes effect if the seat has the keyboard
206    /// capability, or has had the keyboard capability in the past.
207    /// It is a protocol violation to issue this request on a seat that has
208    /// never had the keyboard capability. The missing_capability error will
209    /// be sent in this case.
210    #[inline]
211    pub fn get_keyboard(&self) -> WlKeyboard {
212        let mut args = [wl_argument { n: 0 }];
213        // SAFETY: - self.proxy has the interface INTERFACE
214        //         - 1 < INTERFACE.method_count = 4
215        //         - the request signature is `n`
216        //         - OwnedProxy::WL_INTERFACE is always a valid interface
217        let data = unsafe {
218            self.proxy
219                .send_constructor::<false>(1, &mut args, WlKeyboard::WL_INTERFACE, None)
220        };
221        // SAFETY: data has the interface WlKeyboard::WL_INTERFACE
222        unsafe { proxy::low_level::from_untyped_owned(data) }
223    }
224
225    /// Since when the get_touch request is available.
226    #[allow(dead_code)]
227    pub const REQ__GET_TOUCH__SINCE: u32 = 1;
228
229    /// return touch object
230    ///
231    /// The ID provided will be initialized to the wl_touch interface
232    /// for this seat.
233    ///
234    /// This request only takes effect if the seat has the touch
235    /// capability, or has had the touch capability in the past.
236    /// It is a protocol violation to issue this request on a seat that has
237    /// never had the touch capability. The missing_capability error will
238    /// be sent in this case.
239    #[inline]
240    pub fn get_touch(&self) -> WlTouch {
241        let mut args = [wl_argument { n: 0 }];
242        // SAFETY: - self.proxy has the interface INTERFACE
243        //         - 2 < INTERFACE.method_count = 4
244        //         - the request signature is `n`
245        //         - OwnedProxy::WL_INTERFACE is always a valid interface
246        let data = unsafe {
247            self.proxy
248                .send_constructor::<false>(2, &mut args, WlTouch::WL_INTERFACE, None)
249        };
250        // SAFETY: data has the interface WlTouch::WL_INTERFACE
251        unsafe { proxy::low_level::from_untyped_owned(data) }
252    }
examples/poll-integration/../common/protocols/wayland/wl_compositor.rs (line 145)
137    pub fn create_surface(&self) -> WlSurface {
138        let mut args = [wl_argument { n: 0 }];
139        // SAFETY: - self.proxy has the interface INTERFACE
140        //         - 0 < INTERFACE.method_count = 2
141        //         - the request signature is `n`
142        //         - OwnedProxy::WL_INTERFACE is always a valid interface
143        let data = unsafe {
144            self.proxy
145                .send_constructor::<false>(0, &mut args, WlSurface::WL_INTERFACE, None)
146        };
147        // SAFETY: data has the interface WlSurface::WL_INTERFACE
148        unsafe { proxy::low_level::from_untyped_owned(data) }
149    }
150
151    /// Since when the create_region request is available.
152    #[allow(dead_code)]
153    pub const REQ__CREATE_REGION__SINCE: u32 = 1;
154
155    /// create new region
156    ///
157    /// Ask the compositor to create a new region.
158    #[inline]
159    pub fn create_region(&self) -> WlRegion {
160        let mut args = [wl_argument { n: 0 }];
161        // SAFETY: - self.proxy has the interface INTERFACE
162        //         - 1 < INTERFACE.method_count = 2
163        //         - the request signature is `n`
164        //         - OwnedProxy::WL_INTERFACE is always a valid interface
165        let data = unsafe {
166            self.proxy
167                .send_constructor::<false>(1, &mut args, WlRegion::WL_INTERFACE, None)
168        };
169        // SAFETY: data has the interface WlRegion::WL_INTERFACE
170        unsafe { proxy::low_level::from_untyped_owned(data) }
171    }
examples/poll-integration/../common/protocols/xdg_shell/xdg_surface.rs (line 251)
243    pub fn get_toplevel(&self) -> XdgToplevel {
244        let mut args = [wl_argument { n: 0 }];
245        // SAFETY: - self.proxy has the interface INTERFACE
246        //         - 1 < INTERFACE.method_count = 5
247        //         - the request signature is `n`
248        //         - OwnedProxy::WL_INTERFACE is always a valid interface
249        let data = unsafe {
250            self.proxy
251                .send_constructor::<false>(1, &mut args, XdgToplevel::WL_INTERFACE, None)
252        };
253        // SAFETY: data has the interface XdgToplevel::WL_INTERFACE
254        unsafe { proxy::low_level::from_untyped_owned(data) }
255    }
256
257    /// Since when the get_popup request is available.
258    #[allow(dead_code)]
259    pub const REQ__GET_POPUP__SINCE: u32 = 1;
260
261    /// assign the xdg_popup surface role
262    ///
263    /// This creates an xdg_popup object for the given xdg_surface and gives
264    /// the associated wl_surface the xdg_popup role.
265    ///
266    /// If null is passed as a parent, a parent surface must be specified using
267    /// some other protocol, before committing the initial state.
268    ///
269    /// See the documentation of xdg_popup for more details about what an
270    /// xdg_popup is and how it is used.
271    ///
272    /// # Arguments
273    ///
274    /// - `parent`:
275    /// - `positioner`:
276    #[inline]
277    pub fn get_popup(
278        &self,
279        parent: Option<&XdgSurfaceRef>,
280        positioner: &XdgPositionerRef,
281    ) -> XdgPopup {
282        let (arg1, arg2) = (parent, positioner);
283        let obj1_lock = arg1.map(|arg1| proxy::lock(arg1));
284        let obj1 = obj1_lock
285            .map(|obj1_lock| check_argument_proxy("parent", obj1_lock.wl_proxy()))
286            .unwrap_or(ptr::null_mut());
287        let obj2_lock = proxy::lock(arg2);
288        let obj2 = check_argument_proxy("positioner", obj2_lock.wl_proxy());
289        let mut args = [
290            wl_argument { n: 0 },
291            wl_argument { o: obj1 },
292            wl_argument { o: obj2 },
293        ];
294        // SAFETY: - self.proxy has the interface INTERFACE
295        //         - 2 < INTERFACE.method_count = 5
296        //         - the request signature is `n?oo`
297        //         - OwnedProxy::WL_INTERFACE is always a valid interface
298        let data = unsafe {
299            self.proxy
300                .send_constructor::<false>(2, &mut args, XdgPopup::WL_INTERFACE, None)
301        };
302        // SAFETY: data has the interface XdgPopup::WL_INTERFACE
303        unsafe { proxy::low_level::from_untyped_owned(data) }
304    }
examples/poll-integration/../common/protocols/wayland/wl_data_device_manager.rs (line 152)
144    pub fn create_data_source(&self) -> WlDataSource {
145        let mut args = [wl_argument { n: 0 }];
146        // SAFETY: - self.proxy has the interface INTERFACE
147        //         - 0 < INTERFACE.method_count = 2
148        //         - the request signature is `n`
149        //         - OwnedProxy::WL_INTERFACE is always a valid interface
150        let data = unsafe {
151            self.proxy
152                .send_constructor::<false>(0, &mut args, WlDataSource::WL_INTERFACE, None)
153        };
154        // SAFETY: data has the interface WlDataSource::WL_INTERFACE
155        unsafe { proxy::low_level::from_untyped_owned(data) }
156    }
157
158    /// Since when the get_data_device request is available.
159    #[allow(dead_code)]
160    pub const REQ__GET_DATA_DEVICE__SINCE: u32 = 1;
161
162    /// create a new data device
163    ///
164    /// Create a new data device for a given seat.
165    ///
166    /// # Arguments
167    ///
168    /// - `seat`: seat associated with the data device
169    #[inline]
170    pub fn get_data_device(&self, seat: &WlSeatRef) -> WlDataDevice {
171        let (arg1,) = (seat,);
172        let obj1_lock = proxy::lock(arg1);
173        let obj1 = check_argument_proxy("seat", obj1_lock.wl_proxy());
174        let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
175        // SAFETY: - self.proxy has the interface INTERFACE
176        //         - 1 < INTERFACE.method_count = 2
177        //         - the request signature is `no`
178        //         - OwnedProxy::WL_INTERFACE is always a valid interface
179        let data = unsafe {
180            self.proxy
181                .send_constructor::<false>(1, &mut args, WlDataDevice::WL_INTERFACE, None)
182        };
183        // SAFETY: data has the interface WlDataDevice::WL_INTERFACE
184        unsafe { proxy::low_level::from_untyped_owned(data) }
185    }
Source

pub fn queue(&self) -> &Queue

Returns the queue of this proxy.

This is the same queue that was passed into the constructor of this object.

Source

pub fn destroy(&self)

Destroys a proxy without sending a wayland message.

This function only destroys the proxy in libwayland without sending a message to the compositor.

§Panic

This function might panic if the proxy is attached to a local queue and the current thread is not the thread in which the queue was created.

Methods from Deref<Target = UntypedBorrowedProxy>§

Source

pub fn lock(&self) -> BorrowedProxyLock<'_>

Locks the wl_proxy pointer in this object.

While the pointer is locked, it does not change. Given the invariants of this type, this implies that the pointer will either stay the same, valid pointer, or the pointer will be the null pointer.

This lock can be acquired multiple times concurrently.

Trying to destroy the proxy while holding a lock will deadlock.

Source

pub fn wl_proxy(&self) -> Option<NonNull<wl_proxy>>

Retrieve the wl_proxy pointer backing this object.

In a multi-threaded application, the pointer can get invalidated at any time. To prevent this, you might want to use UntypedBorrowedProxy::lock instead.

Source

pub fn id(&self) -> u32

Returns the wayland object ID of this proxy.

If the proxy has already been destroyed, this function returns either the original ID or 0.

Examples found in repository?
examples/poll-integration/../common/protocols/wayland/wl_shm.rs (line 120)
119    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
120        write!(f, "wl_shm#{}", self.proxy.id())
121    }
122}
123
124impl Debug for WlShmRef {
125    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
126        write!(f, "wl_shm#{}", self.proxy.id())
127    }
More examples
Hide additional examples
examples/poll-integration/../common/protocols/wayland/wl_seat.rs (line 143)
142    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
143        write!(f, "wl_seat#{}", self.proxy.id())
144    }
145}
146
147impl Debug for WlSeatRef {
148    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
149        write!(f, "wl_seat#{}", self.proxy.id())
150    }
examples/poll-integration/../common/protocols/wayland/wl_fixes.rs (line 103)
102    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
103        write!(f, "wl_fixes#{}", self.proxy.id())
104    }
105}
106
107impl Debug for WlFixesRef {
108    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
109        write!(f, "wl_fixes#{}", self.proxy.id())
110    }
examples/poll-integration/../common/protocols/wayland/wl_shell.rs (line 102)
101    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
102        write!(f, "wl_shell#{}", self.proxy.id())
103    }
104}
105
106impl Debug for WlShellRef {
107    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
108        write!(f, "wl_shell#{}", self.proxy.id())
109    }
examples/poll-integration/../common/protocols/wayland/wl_touch.rs (line 159)
158    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
159        write!(f, "wl_touch#{}", self.proxy.id())
160    }
161}
162
163impl Debug for WlTouchRef {
164    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
165        write!(f, "wl_touch#{}", self.proxy.id())
166    }
examples/poll-integration/../common/protocols/wayland/wl_buffer.rs (line 115)
114    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
115        write!(f, "wl_buffer#{}", self.proxy.id())
116    }
117}
118
119impl Debug for WlBufferRef {
120    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
121        write!(f, "wl_buffer#{}", self.proxy.id())
122    }
Source

pub unsafe fn send_request(&self, opcode: u32, args: &mut [wl_argument])

Sends a request on this proxy.

This function cannot be used if the request creates a new object. Use UntypedBorrowedProxy::send_constructor for that purpose.

§Panic

Panics if this proxy has already been destroyed.

§Safety
  • opcode must be a valid request opcode for the interface of the proxy.
  • args must conform to the interface + opcode of the proxy.
  • args must not contain any new_id element.
Examples found in repository?
examples/poll-integration/../common/protocols/wayland/wl_shm_pool.rs (line 297)
290    pub fn resize(&self, size: i32) {
291        let (arg0,) = (size,);
292        let mut args = [wl_argument { i: arg0 }];
293        // SAFETY: - self.proxy has the interface INTERFACE
294        //         - 2 < INTERFACE.method_count = 3
295        //         - the request signature is `i`
296        unsafe {
297            self.proxy.send_request(2, &mut args);
298        }
299    }
More examples
Hide additional examples
examples/poll-integration/../common/protocols/xdg_shell/xdg_wm_base.rs (line 328)
321    pub fn pong(&self, serial: u32) {
322        let (arg0,) = (serial,);
323        let mut args = [wl_argument { u: arg0 }];
324        // SAFETY: - self.proxy has the interface INTERFACE
325        //         - 3 < INTERFACE.method_count = 4
326        //         - the request signature is `u`
327        unsafe {
328            self.proxy.send_request(3, &mut args);
329        }
330    }
examples/poll-integration/../common/protocols/wayland/wl_shell_surface.rs (line 255)
248    pub fn pong(&self, serial: u32) {
249        let (arg0,) = (serial,);
250        let mut args = [wl_argument { u: arg0 }];
251        // SAFETY: - self.proxy has the interface INTERFACE
252        //         - 0 < INTERFACE.method_count = 10
253        //         - the request signature is `u`
254        unsafe {
255            self.proxy.send_request(0, &mut args);
256        }
257    }
258
259    /// start an interactive move
260    ///
261    /// Start a pointer-driven move of the surface.
262    ///
263    /// This request must be used in response to a button press event.
264    /// The server may ignore move requests depending on the state of
265    /// the surface (e.g. fullscreen or maximized).
266    ///
267    /// # Arguments
268    ///
269    /// - `seat`: seat whose pointer is used
270    /// - `serial`: serial number of the implicit grab on the pointer
271    #[inline]
272    pub fn r#move(&self, seat: &WlSeatRef, serial: u32) {
273        let (arg0, arg1) = (seat, serial);
274        let obj0_lock = proxy::lock(arg0);
275        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
276        let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
277        // SAFETY: - self.proxy has the interface INTERFACE
278        //         - 1 < INTERFACE.method_count = 10
279        //         - the request signature is `ou`
280        unsafe {
281            self.proxy.send_request(1, &mut args);
282        }
283    }
284
285    /// start an interactive resize
286    ///
287    /// Start a pointer-driven resizing of the surface.
288    ///
289    /// This request must be used in response to a button press event.
290    /// The server may ignore resize requests depending on the state of
291    /// the surface (e.g. fullscreen or maximized).
292    ///
293    /// # Arguments
294    ///
295    /// - `seat`: seat whose pointer is used
296    /// - `serial`: serial number of the implicit grab on the pointer
297    /// - `edges`: which edge or corner is being dragged
298    #[inline]
299    pub fn resize(&self, seat: &WlSeatRef, serial: u32, edges: WlShellSurfaceResize) {
300        let (arg0, arg1, arg2) = (seat, serial, edges);
301        let obj0_lock = proxy::lock(arg0);
302        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
303        let mut args = [
304            wl_argument { o: obj0 },
305            wl_argument { u: arg1 },
306            wl_argument { u: arg2.0 },
307        ];
308        // SAFETY: - self.proxy has the interface INTERFACE
309        //         - 2 < INTERFACE.method_count = 10
310        //         - the request signature is `ouu`
311        unsafe {
312            self.proxy.send_request(2, &mut args);
313        }
314    }
315
316    /// make the surface a toplevel surface
317    ///
318    /// Map the surface as a toplevel surface.
319    ///
320    /// A toplevel surface is not fullscreen, maximized or transient.
321    #[inline]
322    pub fn set_toplevel(&self) {
323        let mut args = [];
324        // SAFETY: - self.proxy has the interface INTERFACE
325        //         - 3 < INTERFACE.method_count = 10
326        //         - the request signature is ``
327        unsafe {
328            self.proxy.send_request(3, &mut args);
329        }
330    }
331
332    /// make the surface a transient surface
333    ///
334    /// Map the surface relative to an existing surface.
335    ///
336    /// The x and y arguments specify the location of the upper left
337    /// corner of the surface relative to the upper left corner of the
338    /// parent surface, in surface-local coordinates.
339    ///
340    /// The flags argument controls details of the transient behaviour.
341    ///
342    /// # Arguments
343    ///
344    /// - `parent`: parent surface
345    /// - `x`: surface-local x coordinate
346    /// - `y`: surface-local y coordinate
347    /// - `flags`: transient surface behavior
348    #[inline]
349    pub fn set_transient(
350        &self,
351        parent: &WlSurfaceRef,
352        x: i32,
353        y: i32,
354        flags: WlShellSurfaceTransient,
355    ) {
356        let (arg0, arg1, arg2, arg3) = (parent, x, y, flags);
357        let obj0_lock = proxy::lock(arg0);
358        let obj0 = check_argument_proxy("parent", obj0_lock.wl_proxy());
359        let mut args = [
360            wl_argument { o: obj0 },
361            wl_argument { i: arg1 },
362            wl_argument { i: arg2 },
363            wl_argument { u: arg3.0 },
364        ];
365        // SAFETY: - self.proxy has the interface INTERFACE
366        //         - 4 < INTERFACE.method_count = 10
367        //         - the request signature is `oiiu`
368        unsafe {
369            self.proxy.send_request(4, &mut args);
370        }
371    }
372
373    /// make the surface a fullscreen surface
374    ///
375    /// Map the surface as a fullscreen surface.
376    ///
377    /// If an output parameter is given then the surface will be made
378    /// fullscreen on that output. If the client does not specify the
379    /// output then the compositor will apply its policy - usually
380    /// choosing the output on which the surface has the biggest surface
381    /// area.
382    ///
383    /// The client may specify a method to resolve a size conflict
384    /// between the output size and the surface size - this is provided
385    /// through the method parameter.
386    ///
387    /// The framerate parameter is used only when the method is set
388    /// to "driver", to indicate the preferred framerate. A value of 0
389    /// indicates that the client does not care about framerate.  The
390    /// framerate is specified in mHz, that is framerate of 60000 is 60Hz.
391    ///
392    /// A method of "scale" or "driver" implies a scaling operation of
393    /// the surface, either via a direct scaling operation or a change of
394    /// the output mode. This will override any kind of output scaling, so
395    /// that mapping a surface with a buffer size equal to the mode can
396    /// fill the screen independent of buffer_scale.
397    ///
398    /// A method of "fill" means we don't scale up the buffer, however
399    /// any output scale is applied. This means that you may run into
400    /// an edge case where the application maps a buffer with the same
401    /// size of the output mode but buffer_scale 1 (thus making a
402    /// surface larger than the output). In this case it is allowed to
403    /// downscale the results to fit the screen.
404    ///
405    /// The compositor must reply to this request with a configure event
406    /// with the dimensions for the output on which the surface will
407    /// be made fullscreen.
408    ///
409    /// # Arguments
410    ///
411    /// - `method`: method for resolving size conflict
412    /// - `framerate`: framerate in mHz
413    /// - `output`: output on which the surface is to be fullscreen
414    #[inline]
415    pub fn set_fullscreen(
416        &self,
417        method: WlShellSurfaceFullscreenMethod,
418        framerate: u32,
419        output: Option<&WlOutputRef>,
420    ) {
421        let (arg0, arg1, arg2) = (method, framerate, output);
422        let obj2_lock = arg2.map(|arg2| proxy::lock(arg2));
423        let obj2 = obj2_lock
424            .map(|obj2_lock| check_argument_proxy("output", obj2_lock.wl_proxy()))
425            .unwrap_or(ptr::null_mut());
426        let mut args = [
427            wl_argument { u: arg0.0 },
428            wl_argument { u: arg1 },
429            wl_argument { o: obj2 },
430        ];
431        // SAFETY: - self.proxy has the interface INTERFACE
432        //         - 5 < INTERFACE.method_count = 10
433        //         - the request signature is `uu?o`
434        unsafe {
435            self.proxy.send_request(5, &mut args);
436        }
437    }
438
439    /// make the surface a popup surface
440    ///
441    /// Map the surface as a popup.
442    ///
443    /// A popup surface is a transient surface with an added pointer
444    /// grab.
445    ///
446    /// An existing implicit grab will be changed to owner-events mode,
447    /// and the popup grab will continue after the implicit grab ends
448    /// (i.e. releasing the mouse button does not cause the popup to
449    /// be unmapped).
450    ///
451    /// The popup grab continues until the window is destroyed or a
452    /// mouse button is pressed in any other client's window. A click
453    /// in any of the client's surfaces is reported as normal, however,
454    /// clicks in other clients' surfaces will be discarded and trigger
455    /// the callback.
456    ///
457    /// The x and y arguments specify the location of the upper left
458    /// corner of the surface relative to the upper left corner of the
459    /// parent surface, in surface-local coordinates.
460    ///
461    /// # Arguments
462    ///
463    /// - `seat`: seat whose pointer is used
464    /// - `serial`: serial number of the implicit grab on the pointer
465    /// - `parent`: parent surface
466    /// - `x`: surface-local x coordinate
467    /// - `y`: surface-local y coordinate
468    /// - `flags`: transient surface behavior
469    #[inline]
470    pub fn set_popup(
471        &self,
472        seat: &WlSeatRef,
473        serial: u32,
474        parent: &WlSurfaceRef,
475        x: i32,
476        y: i32,
477        flags: WlShellSurfaceTransient,
478    ) {
479        let (arg0, arg1, arg2, arg3, arg4, arg5) = (seat, serial, parent, x, y, flags);
480        let obj0_lock = proxy::lock(arg0);
481        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
482        let obj2_lock = proxy::lock(arg2);
483        let obj2 = check_argument_proxy("parent", obj2_lock.wl_proxy());
484        let mut args = [
485            wl_argument { o: obj0 },
486            wl_argument { u: arg1 },
487            wl_argument { o: obj2 },
488            wl_argument { i: arg3 },
489            wl_argument { i: arg4 },
490            wl_argument { u: arg5.0 },
491        ];
492        // SAFETY: - self.proxy has the interface INTERFACE
493        //         - 6 < INTERFACE.method_count = 10
494        //         - the request signature is `ouoiiu`
495        unsafe {
496            self.proxy.send_request(6, &mut args);
497        }
498    }
499
500    /// make the surface a maximized surface
501    ///
502    /// Map the surface as a maximized surface.
503    ///
504    /// If an output parameter is given then the surface will be
505    /// maximized on that output. If the client does not specify the
506    /// output then the compositor will apply its policy - usually
507    /// choosing the output on which the surface has the biggest surface
508    /// area.
509    ///
510    /// The compositor will reply with a configure event telling
511    /// the expected new surface size. The operation is completed
512    /// on the next buffer attach to this surface.
513    ///
514    /// A maximized surface typically fills the entire output it is
515    /// bound to, except for desktop elements such as panels. This is
516    /// the main difference between a maximized shell surface and a
517    /// fullscreen shell surface.
518    ///
519    /// The details depend on the compositor implementation.
520    ///
521    /// # Arguments
522    ///
523    /// - `output`: output on which the surface is to be maximized
524    #[inline]
525    pub fn set_maximized(&self, output: Option<&WlOutputRef>) {
526        let (arg0,) = (output,);
527        let obj0_lock = arg0.map(|arg0| proxy::lock(arg0));
528        let obj0 = obj0_lock
529            .map(|obj0_lock| check_argument_proxy("output", obj0_lock.wl_proxy()))
530            .unwrap_or(ptr::null_mut());
531        let mut args = [wl_argument { o: obj0 }];
532        // SAFETY: - self.proxy has the interface INTERFACE
533        //         - 7 < INTERFACE.method_count = 10
534        //         - the request signature is `?o`
535        unsafe {
536            self.proxy.send_request(7, &mut args);
537        }
538    }
539
540    /// set surface title
541    ///
542    /// Set a short title for the surface.
543    ///
544    /// This string may be used to identify the surface in a task bar,
545    /// window list, or other user interface elements provided by the
546    /// compositor.
547    ///
548    /// The string must be encoded in UTF-8.
549    ///
550    /// # Arguments
551    ///
552    /// - `title`: surface title
553    #[inline]
554    pub fn set_title(&self, title: &str) {
555        let (arg0,) = (title,);
556        with_cstr_cache(|cache| {
557            let str0_offset = cache.len();
558            cache.extend_from_slice(arg0.as_bytes());
559            cache.push(0);
560            let str0 = cache[str0_offset..].as_ptr().cast();
561            let mut args = [wl_argument { s: str0 }];
562            // SAFETY: - self.proxy has the interface INTERFACE
563            //         - 8 < INTERFACE.method_count = 10
564            //         - the request signature is `s`
565            unsafe {
566                self.proxy.send_request(8, &mut args);
567            }
568        })
569    }
570
571    /// set surface class
572    ///
573    /// Set a class for the surface.
574    ///
575    /// The surface class identifies the general class of applications
576    /// to which the surface belongs. A common convention is to use the
577    /// file name (or the full path if it is a non-standard location) of
578    /// the application's .desktop file as the class.
579    ///
580    /// # Arguments
581    ///
582    /// - `class_`: surface class
583    #[inline]
584    pub fn set_class(&self, class_: &str) {
585        let (arg0,) = (class_,);
586        with_cstr_cache(|cache| {
587            let str0_offset = cache.len();
588            cache.extend_from_slice(arg0.as_bytes());
589            cache.push(0);
590            let str0 = cache[str0_offset..].as_ptr().cast();
591            let mut args = [wl_argument { s: str0 }];
592            // SAFETY: - self.proxy has the interface INTERFACE
593            //         - 9 < INTERFACE.method_count = 10
594            //         - the request signature is `s`
595            unsafe {
596                self.proxy.send_request(9, &mut args);
597            }
598        })
599    }
examples/poll-integration/../common/protocols/wayland/wl_subsurface.rs (line 263)
256    pub fn set_position(&self, x: i32, y: i32) {
257        let (arg0, arg1) = (x, y);
258        let mut args = [wl_argument { i: arg0 }, wl_argument { i: arg1 }];
259        // SAFETY: - self.proxy has the interface INTERFACE
260        //         - 1 < INTERFACE.method_count = 6
261        //         - the request signature is `ii`
262        unsafe {
263            self.proxy.send_request(1, &mut args);
264        }
265    }
266
267    /// restack the sub-surface
268    ///
269    /// This sub-surface is taken from the stack, and put back just
270    /// above the reference surface, changing the z-order of the sub-surfaces.
271    /// The reference surface must be one of the sibling surfaces, or the
272    /// parent surface. Using any other surface, including this sub-surface,
273    /// will cause a protocol error.
274    ///
275    /// The z-order is double-buffered. Requests are handled in order and
276    /// applied immediately to a pending state. The final pending state is
277    /// copied to the active state the next time the state of the parent
278    /// surface is applied.
279    ///
280    /// A new sub-surface is initially added as the top-most in the stack
281    /// of its siblings and parent.
282    ///
283    /// # Arguments
284    ///
285    /// - `sibling`: the reference surface
286    #[inline]
287    pub fn place_above(&self, sibling: &WlSurfaceRef) {
288        let (arg0,) = (sibling,);
289        let obj0_lock = proxy::lock(arg0);
290        let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
291        let mut args = [wl_argument { o: obj0 }];
292        // SAFETY: - self.proxy has the interface INTERFACE
293        //         - 2 < INTERFACE.method_count = 6
294        //         - the request signature is `o`
295        unsafe {
296            self.proxy.send_request(2, &mut args);
297        }
298    }
299
300    /// restack the sub-surface
301    ///
302    /// The sub-surface is placed just below the reference surface.
303    /// See wl_subsurface.place_above.
304    ///
305    /// # Arguments
306    ///
307    /// - `sibling`: the reference surface
308    #[inline]
309    pub fn place_below(&self, sibling: &WlSurfaceRef) {
310        let (arg0,) = (sibling,);
311        let obj0_lock = proxy::lock(arg0);
312        let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
313        let mut args = [wl_argument { o: obj0 }];
314        // SAFETY: - self.proxy has the interface INTERFACE
315        //         - 3 < INTERFACE.method_count = 6
316        //         - the request signature is `o`
317        unsafe {
318            self.proxy.send_request(3, &mut args);
319        }
320    }
321
322    /// set sub-surface to synchronized mode
323    ///
324    /// Change the commit behaviour of the sub-surface to synchronized
325    /// mode, also described as the parent dependent mode.
326    ///
327    /// In synchronized mode, wl_surface.commit on a sub-surface will
328    /// accumulate the committed state in a cache, but the state will
329    /// not be applied and hence will not change the compositor output.
330    /// The cached state is applied to the sub-surface immediately after
331    /// the parent surface's state is applied. This ensures atomic
332    /// updates of the parent and all its synchronized sub-surfaces.
333    /// Applying the cached state will invalidate the cache, so further
334    /// parent surface commits do not (re-)apply old state.
335    ///
336    /// See wl_subsurface for the recursive effect of this mode.
337    #[inline]
338    pub fn set_sync(&self) {
339        let mut args = [];
340        // SAFETY: - self.proxy has the interface INTERFACE
341        //         - 4 < INTERFACE.method_count = 6
342        //         - the request signature is ``
343        unsafe {
344            self.proxy.send_request(4, &mut args);
345        }
346    }
347
348    /// set sub-surface to desynchronized mode
349    ///
350    /// Change the commit behaviour of the sub-surface to desynchronized
351    /// mode, also described as independent or freely running mode.
352    ///
353    /// In desynchronized mode, wl_surface.commit on a sub-surface will
354    /// apply the pending state directly, without caching, as happens
355    /// normally with a wl_surface. Calling wl_surface.commit on the
356    /// parent surface has no effect on the sub-surface's wl_surface
357    /// state. This mode allows a sub-surface to be updated on its own.
358    ///
359    /// If cached state exists when wl_surface.commit is called in
360    /// desynchronized mode, the pending state is added to the cached
361    /// state, and applied as a whole. This invalidates the cache.
362    ///
363    /// Note: even if a sub-surface is set to desynchronized, a parent
364    /// sub-surface may override it to behave as synchronized. For details,
365    /// see wl_subsurface.
366    ///
367    /// If a surface's parent surface behaves as desynchronized, then
368    /// the cached state is applied on set_desync.
369    #[inline]
370    pub fn set_desync(&self) {
371        let mut args = [];
372        // SAFETY: - self.proxy has the interface INTERFACE
373        //         - 5 < INTERFACE.method_count = 6
374        //         - the request signature is ``
375        unsafe {
376            self.proxy.send_request(5, &mut args);
377        }
378    }
examples/poll-integration/../common/protocols/xdg_shell/xdg_positioner.rs (line 248)
241    pub fn set_size(&self, width: i32, height: i32) {
242        let (arg0, arg1) = (width, height);
243        let mut args = [wl_argument { i: arg0 }, wl_argument { i: arg1 }];
244        // SAFETY: - self.proxy has the interface INTERFACE
245        //         - 1 < INTERFACE.method_count = 10
246        //         - the request signature is `ii`
247        unsafe {
248            self.proxy.send_request(1, &mut args);
249        }
250    }
251
252    /// set the anchor rectangle within the parent surface
253    ///
254    /// Specify the anchor rectangle within the parent surface that the child
255    /// surface will be placed relative to. The rectangle is relative to the
256    /// window geometry as defined by xdg_surface.set_window_geometry of the
257    /// parent surface.
258    ///
259    /// When the xdg_positioner object is used to position a child surface, the
260    /// anchor rectangle may not extend outside the window geometry of the
261    /// positioned child's parent surface.
262    ///
263    /// If a negative size is set the invalid_input error is raised.
264    ///
265    /// # Arguments
266    ///
267    /// - `x`: x position of anchor rectangle
268    /// - `y`: y position of anchor rectangle
269    /// - `width`: width of anchor rectangle
270    /// - `height`: height of anchor rectangle
271    #[inline]
272    pub fn set_anchor_rect(&self, x: i32, y: i32, width: i32, height: i32) {
273        let (arg0, arg1, arg2, arg3) = (x, y, width, height);
274        let mut args = [
275            wl_argument { i: arg0 },
276            wl_argument { i: arg1 },
277            wl_argument { i: arg2 },
278            wl_argument { i: arg3 },
279        ];
280        // SAFETY: - self.proxy has the interface INTERFACE
281        //         - 2 < INTERFACE.method_count = 10
282        //         - the request signature is `iiii`
283        unsafe {
284            self.proxy.send_request(2, &mut args);
285        }
286    }
287
288    /// set anchor rectangle anchor
289    ///
290    /// Defines the anchor point for the anchor rectangle. The specified anchor
291    /// is used derive an anchor point that the child surface will be
292    /// positioned relative to. If a corner anchor is set (e.g. 'top_left' or
293    /// 'bottom_right'), the anchor point will be at the specified corner;
294    /// otherwise, the derived anchor point will be centered on the specified
295    /// edge, or in the center of the anchor rectangle if no edge is specified.
296    ///
297    /// # Arguments
298    ///
299    /// - `anchor`: anchor
300    #[inline]
301    pub fn set_anchor(&self, anchor: XdgPositionerAnchor) {
302        let (arg0,) = (anchor,);
303        let mut args = [wl_argument { u: arg0.0 }];
304        // SAFETY: - self.proxy has the interface INTERFACE
305        //         - 3 < INTERFACE.method_count = 10
306        //         - the request signature is `u`
307        unsafe {
308            self.proxy.send_request(3, &mut args);
309        }
310    }
311
312    /// set child surface gravity
313    ///
314    /// Defines in what direction a surface should be positioned, relative to
315    /// the anchor point of the parent surface. If a corner gravity is
316    /// specified (e.g. 'bottom_right' or 'top_left'), then the child surface
317    /// will be placed towards the specified gravity; otherwise, the child
318    /// surface will be centered over the anchor point on any axis that had no
319    /// gravity specified. If the gravity is not in the ‘gravity’ enum, an
320    /// invalid_input error is raised.
321    ///
322    /// # Arguments
323    ///
324    /// - `gravity`: gravity direction
325    #[inline]
326    pub fn set_gravity(&self, gravity: XdgPositionerGravity) {
327        let (arg0,) = (gravity,);
328        let mut args = [wl_argument { u: arg0.0 }];
329        // SAFETY: - self.proxy has the interface INTERFACE
330        //         - 4 < INTERFACE.method_count = 10
331        //         - the request signature is `u`
332        unsafe {
333            self.proxy.send_request(4, &mut args);
334        }
335    }
336
337    /// set the adjustment to be done when constrained
338    ///
339    /// Specify how the window should be positioned if the originally intended
340    /// position caused the surface to be constrained, meaning at least
341    /// partially outside positioning boundaries set by the compositor. The
342    /// adjustment is set by constructing a bitmask describing the adjustment to
343    /// be made when the surface is constrained on that axis.
344    ///
345    /// If no bit for one axis is set, the compositor will assume that the child
346    /// surface should not change its position on that axis when constrained.
347    ///
348    /// If more than one bit for one axis is set, the order of how adjustments
349    /// are applied is specified in the corresponding adjustment descriptions.
350    ///
351    /// The default adjustment is none.
352    ///
353    /// # Arguments
354    ///
355    /// - `constraint_adjustment`: bit mask of constraint adjustments
356    #[inline]
357    pub fn set_constraint_adjustment(
358        &self,
359        constraint_adjustment: XdgPositionerConstraintAdjustment,
360    ) {
361        let (arg0,) = (constraint_adjustment,);
362        let mut args = [wl_argument { u: arg0.0 }];
363        // SAFETY: - self.proxy has the interface INTERFACE
364        //         - 5 < INTERFACE.method_count = 10
365        //         - the request signature is `u`
366        unsafe {
367            self.proxy.send_request(5, &mut args);
368        }
369    }
370
371    /// set surface position offset
372    ///
373    /// Specify the surface position offset relative to the position of the
374    /// anchor on the anchor rectangle and the anchor on the surface. For
375    /// example if the anchor of the anchor rectangle is at (x, y), the surface
376    /// has the gravity bottom|right, and the offset is (ox, oy), the calculated
377    /// surface position will be (x + ox, y + oy). The offset position of the
378    /// surface is the one used for constraint testing. See
379    /// set_constraint_adjustment.
380    ///
381    /// An example use case is placing a popup menu on top of a user interface
382    /// element, while aligning the user interface element of the parent surface
383    /// with some user interface element placed somewhere in the popup surface.
384    ///
385    /// # Arguments
386    ///
387    /// - `x`: surface position x offset
388    /// - `y`: surface position y offset
389    #[inline]
390    pub fn set_offset(&self, x: i32, y: i32) {
391        let (arg0, arg1) = (x, y);
392        let mut args = [wl_argument { i: arg0 }, wl_argument { i: arg1 }];
393        // SAFETY: - self.proxy has the interface INTERFACE
394        //         - 6 < INTERFACE.method_count = 10
395        //         - the request signature is `ii`
396        unsafe {
397            self.proxy.send_request(6, &mut args);
398        }
399    }
400
401    /// continuously reconstrain the surface
402    ///
403    /// When set reactive, the surface is reconstrained if the conditions used
404    /// for constraining changed, e.g. the parent window moved.
405    ///
406    /// If the conditions changed and the popup was reconstrained, an
407    /// xdg_popup.configure event is sent with updated geometry, followed by an
408    /// xdg_surface.configure event.
409    #[inline]
410    pub fn set_reactive(&self) {
411        let mut args = [];
412        // SAFETY: - self.proxy has the interface INTERFACE
413        //         - 7 < INTERFACE.method_count = 10
414        //         - the request signature is ``
415        unsafe {
416            self.proxy.send_request(7, &mut args);
417        }
418    }
419
420    ///
421    /// Set the parent window geometry the compositor should use when
422    /// positioning the popup. The compositor may use this information to
423    /// determine the future state the popup should be constrained using. If
424    /// this doesn't match the dimension of the parent the popup is eventually
425    /// positioned against, the behavior is undefined.
426    ///
427    /// The arguments are given in the surface-local coordinate space.
428    ///
429    /// # Arguments
430    ///
431    /// - `parent_width`: future window geometry width of parent
432    /// - `parent_height`: future window geometry height of parent
433    #[inline]
434    pub fn set_parent_size(&self, parent_width: i32, parent_height: i32) {
435        let (arg0, arg1) = (parent_width, parent_height);
436        let mut args = [wl_argument { i: arg0 }, wl_argument { i: arg1 }];
437        // SAFETY: - self.proxy has the interface INTERFACE
438        //         - 8 < INTERFACE.method_count = 10
439        //         - the request signature is `ii`
440        unsafe {
441            self.proxy.send_request(8, &mut args);
442        }
443    }
444
445    /// set parent configure this is a response to
446    ///
447    /// Set the serial of an xdg_surface.configure event this positioner will be
448    /// used in response to. The compositor may use this information together
449    /// with set_parent_size to determine what future state the popup should be
450    /// constrained using.
451    ///
452    /// # Arguments
453    ///
454    /// - `serial`: serial of parent configure event
455    #[inline]
456    pub fn set_parent_configure(&self, serial: u32) {
457        let (arg0,) = (serial,);
458        let mut args = [wl_argument { u: arg0 }];
459        // SAFETY: - self.proxy has the interface INTERFACE
460        //         - 9 < INTERFACE.method_count = 10
461        //         - the request signature is `u`
462        unsafe {
463            self.proxy.send_request(9, &mut args);
464        }
465    }
examples/poll-integration/../common/protocols/cursor_shape_v1/wp_cursor_shape_device_v1.rs (line 181)
174    pub fn set_shape(&self, serial: u32, shape: WpCursorShapeDeviceV1Shape) {
175        let (arg0, arg1) = (serial, shape);
176        let mut args = [wl_argument { u: arg0 }, wl_argument { u: arg1.0 }];
177        // SAFETY: - self.proxy has the interface INTERFACE
178        //         - 1 < INTERFACE.method_count = 2
179        //         - the request signature is `uu`
180        unsafe {
181            self.proxy.send_request(1, &mut args);
182        }
183    }
Source

pub unsafe fn send_constructor( &self, queue: &Queue, opcode: u32, args: &mut [wl_argument], interface: &'static wl_interface, version: Option<u32>, ) -> UntypedOwnedProxy

Creates a new object by sending a request on this proxy.

This function can only be used if the request creates a new object. Use Self::send_request otherwise.

The new object will be attached to the given queue.

§Panic

This function panics if

  • this proxy has already been destroyed, or
  • the queue and this proxy don’t belong to the same display.
§Safety
  • opcode must be a valid request opcode for the interface of the proxy.
  • args must conform to the interface + opcode of the proxy.
  • args must contain exactly one new_id element.
  • interface must be a valid wl_interface.
Examples found in repository?
examples/poll-integration/../common/protocols/wayland/wl_display.rs (line 239)
231    pub fn sync(&self, _queue: &Queue) -> WlCallback {
232        let mut args = [wl_argument { n: 0 }];
233        // SAFETY: - self.proxy has the interface INTERFACE
234        //         - 0 < INTERFACE.method_count = 2
235        //         - the request signature is `n`
236        //         - OwnedProxy::WL_INTERFACE is always a valid interface
237        let data = unsafe {
238            self.proxy
239                .send_constructor(_queue, 0, &mut args, WlCallback::WL_INTERFACE, None)
240        };
241        // SAFETY: data has the interface WlCallback::WL_INTERFACE
242        unsafe { proxy::low_level::from_untyped_owned(data) }
243    }
244
245    /// get global registry object
246    ///
247    /// This request creates a registry object that allows the client
248    /// to list and bind the global objects available from the
249    /// compositor.
250    ///
251    /// It should be noted that the server side resources consumed in
252    /// response to a get_registry request can only be released when the
253    /// client disconnects, not when the client side proxy is destroyed.
254    /// Therefore, clients should invoke get_registry as infrequently as
255    /// possible to avoid wasting memory.
256    ///
257    /// # Arguments
258    ///
259    /// - `_queue`: The queue that the returned proxy is assigned to.
260    #[inline]
261    pub fn get_registry(&self, _queue: &Queue) -> WlRegistry {
262        let mut args = [wl_argument { n: 0 }];
263        // SAFETY: - self.proxy has the interface INTERFACE
264        //         - 1 < INTERFACE.method_count = 2
265        //         - the request signature is `n`
266        //         - OwnedProxy::WL_INTERFACE is always a valid interface
267        let data = unsafe {
268            self.proxy
269                .send_constructor(_queue, 1, &mut args, WlRegistry::WL_INTERFACE, None)
270        };
271        // SAFETY: data has the interface WlRegistry::WL_INTERFACE
272        unsafe { proxy::low_level::from_untyped_owned(data) }
273    }
More examples
Hide additional examples
examples/poll-integration/../common/protocols/wayland/wl_surface.rs (line 540)
532    pub fn frame(&self, _queue: &Queue) -> WlCallback {
533        let mut args = [wl_argument { n: 0 }];
534        // SAFETY: - self.proxy has the interface INTERFACE
535        //         - 3 < INTERFACE.method_count = 11
536        //         - the request signature is `n`
537        //         - OwnedProxy::WL_INTERFACE is always a valid interface
538        let data = unsafe {
539            self.proxy
540                .send_constructor(_queue, 3, &mut args, WlCallback::WL_INTERFACE, None)
541        };
542        // SAFETY: data has the interface WlCallback::WL_INTERFACE
543        unsafe { proxy::low_level::from_untyped_owned(data) }
544    }
examples/poll-integration/../common/protocols/wayland/wl_seat.rs (line 299)
291    pub fn get_pointer(&self, _queue: &Queue) -> WlPointer {
292        let mut args = [wl_argument { n: 0 }];
293        // SAFETY: - self.proxy has the interface INTERFACE
294        //         - 0 < INTERFACE.method_count = 4
295        //         - the request signature is `n`
296        //         - OwnedProxy::WL_INTERFACE is always a valid interface
297        let data = unsafe {
298            self.proxy
299                .send_constructor(_queue, 0, &mut args, WlPointer::WL_INTERFACE, None)
300        };
301        // SAFETY: data has the interface WlPointer::WL_INTERFACE
302        unsafe { proxy::low_level::from_untyped_owned(data) }
303    }
304
305    /// return keyboard object
306    ///
307    /// The ID provided will be initialized to the wl_keyboard interface
308    /// for this seat.
309    ///
310    /// This request only takes effect if the seat has the keyboard
311    /// capability, or has had the keyboard capability in the past.
312    /// It is a protocol violation to issue this request on a seat that has
313    /// never had the keyboard capability. The missing_capability error will
314    /// be sent in this case.
315    ///
316    /// # Arguments
317    ///
318    /// - `_queue`: The queue that the returned proxy is assigned to.
319    #[inline]
320    pub fn get_keyboard(&self, _queue: &Queue) -> WlKeyboard {
321        let mut args = [wl_argument { n: 0 }];
322        // SAFETY: - self.proxy has the interface INTERFACE
323        //         - 1 < INTERFACE.method_count = 4
324        //         - the request signature is `n`
325        //         - OwnedProxy::WL_INTERFACE is always a valid interface
326        let data = unsafe {
327            self.proxy
328                .send_constructor(_queue, 1, &mut args, WlKeyboard::WL_INTERFACE, None)
329        };
330        // SAFETY: data has the interface WlKeyboard::WL_INTERFACE
331        unsafe { proxy::low_level::from_untyped_owned(data) }
332    }
333
334    /// return touch object
335    ///
336    /// The ID provided will be initialized to the wl_touch interface
337    /// for this seat.
338    ///
339    /// This request only takes effect if the seat has the touch
340    /// capability, or has had the touch capability in the past.
341    /// It is a protocol violation to issue this request on a seat that has
342    /// never had the touch capability. The missing_capability error will
343    /// be sent in this case.
344    ///
345    /// # Arguments
346    ///
347    /// - `_queue`: The queue that the returned proxy is assigned to.
348    #[inline]
349    pub fn get_touch(&self, _queue: &Queue) -> WlTouch {
350        let mut args = [wl_argument { n: 0 }];
351        // SAFETY: - self.proxy has the interface INTERFACE
352        //         - 2 < INTERFACE.method_count = 4
353        //         - the request signature is `n`
354        //         - OwnedProxy::WL_INTERFACE is always a valid interface
355        let data = unsafe {
356            self.proxy
357                .send_constructor(_queue, 2, &mut args, WlTouch::WL_INTERFACE, None)
358        };
359        // SAFETY: data has the interface WlTouch::WL_INTERFACE
360        unsafe { proxy::low_level::from_untyped_owned(data) }
361    }
examples/poll-integration/../common/protocols/wayland/wl_compositor.rs (line 192)
184    pub fn create_surface(&self, _queue: &Queue) -> WlSurface {
185        let mut args = [wl_argument { n: 0 }];
186        // SAFETY: - self.proxy has the interface INTERFACE
187        //         - 0 < INTERFACE.method_count = 2
188        //         - the request signature is `n`
189        //         - OwnedProxy::WL_INTERFACE is always a valid interface
190        let data = unsafe {
191            self.proxy
192                .send_constructor(_queue, 0, &mut args, WlSurface::WL_INTERFACE, None)
193        };
194        // SAFETY: data has the interface WlSurface::WL_INTERFACE
195        unsafe { proxy::low_level::from_untyped_owned(data) }
196    }
197
198    /// create new region
199    ///
200    /// Ask the compositor to create a new region.
201    ///
202    /// # Arguments
203    ///
204    /// - `_queue`: The queue that the returned proxy is assigned to.
205    #[inline]
206    pub fn create_region(&self, _queue: &Queue) -> WlRegion {
207        let mut args = [wl_argument { n: 0 }];
208        // SAFETY: - self.proxy has the interface INTERFACE
209        //         - 1 < INTERFACE.method_count = 2
210        //         - the request signature is `n`
211        //         - OwnedProxy::WL_INTERFACE is always a valid interface
212        let data = unsafe {
213            self.proxy
214                .send_constructor(_queue, 1, &mut args, WlRegion::WL_INTERFACE, None)
215        };
216        // SAFETY: data has the interface WlRegion::WL_INTERFACE
217        unsafe { proxy::low_level::from_untyped_owned(data) }
218    }
examples/poll-integration/../common/protocols/xdg_shell/xdg_surface.rs (line 329)
321    pub fn get_toplevel(&self, _queue: &Queue) -> XdgToplevel {
322        let mut args = [wl_argument { n: 0 }];
323        // SAFETY: - self.proxy has the interface INTERFACE
324        //         - 1 < INTERFACE.method_count = 5
325        //         - the request signature is `n`
326        //         - OwnedProxy::WL_INTERFACE is always a valid interface
327        let data = unsafe {
328            self.proxy
329                .send_constructor(_queue, 1, &mut args, XdgToplevel::WL_INTERFACE, None)
330        };
331        // SAFETY: data has the interface XdgToplevel::WL_INTERFACE
332        unsafe { proxy::low_level::from_untyped_owned(data) }
333    }
334
335    /// assign the xdg_popup surface role
336    ///
337    /// This creates an xdg_popup object for the given xdg_surface and gives
338    /// the associated wl_surface the xdg_popup role.
339    ///
340    /// If null is passed as a parent, a parent surface must be specified using
341    /// some other protocol, before committing the initial state.
342    ///
343    /// See the documentation of xdg_popup for more details about what an
344    /// xdg_popup is and how it is used.
345    ///
346    /// # Arguments
347    ///
348    /// - `_queue`: The queue that the returned proxy is assigned to.
349    /// - `parent`:
350    /// - `positioner`:
351    #[inline]
352    pub fn get_popup(
353        &self,
354        _queue: &Queue,
355        parent: Option<&XdgSurfaceRef>,
356        positioner: &XdgPositionerRef,
357    ) -> XdgPopup {
358        let (arg1, arg2) = (parent, positioner);
359        let obj1_lock = arg1.map(|arg1| proxy::lock(arg1));
360        let obj1 = obj1_lock
361            .map(|obj1_lock| check_argument_proxy("parent", obj1_lock.wl_proxy()))
362            .unwrap_or(ptr::null_mut());
363        let obj2_lock = proxy::lock(arg2);
364        let obj2 = check_argument_proxy("positioner", obj2_lock.wl_proxy());
365        let mut args = [
366            wl_argument { n: 0 },
367            wl_argument { o: obj1 },
368            wl_argument { o: obj2 },
369        ];
370        // SAFETY: - self.proxy has the interface INTERFACE
371        //         - 2 < INTERFACE.method_count = 5
372        //         - the request signature is `n?oo`
373        //         - OwnedProxy::WL_INTERFACE is always a valid interface
374        let data = unsafe {
375            self.proxy
376                .send_constructor(_queue, 2, &mut args, XdgPopup::WL_INTERFACE, None)
377        };
378        // SAFETY: data has the interface XdgPopup::WL_INTERFACE
379        unsafe { proxy::low_level::from_untyped_owned(data) }
380    }
examples/poll-integration/../common/protocols/wayland/wl_data_device_manager.rs (line 206)
198    pub fn create_data_source(&self, _queue: &Queue) -> WlDataSource {
199        let mut args = [wl_argument { n: 0 }];
200        // SAFETY: - self.proxy has the interface INTERFACE
201        //         - 0 < INTERFACE.method_count = 2
202        //         - the request signature is `n`
203        //         - OwnedProxy::WL_INTERFACE is always a valid interface
204        let data = unsafe {
205            self.proxy
206                .send_constructor(_queue, 0, &mut args, WlDataSource::WL_INTERFACE, None)
207        };
208        // SAFETY: data has the interface WlDataSource::WL_INTERFACE
209        unsafe { proxy::low_level::from_untyped_owned(data) }
210    }
211
212    /// create a new data device
213    ///
214    /// Create a new data device for a given seat.
215    ///
216    /// # Arguments
217    ///
218    /// - `_queue`: The queue that the returned proxy is assigned to.
219    /// - `seat`: seat associated with the data device
220    #[inline]
221    pub fn get_data_device(&self, _queue: &Queue, seat: &WlSeatRef) -> WlDataDevice {
222        let (arg1,) = (seat,);
223        let obj1_lock = proxy::lock(arg1);
224        let obj1 = check_argument_proxy("seat", obj1_lock.wl_proxy());
225        let mut args = [wl_argument { n: 0 }, wl_argument { o: obj1 }];
226        // SAFETY: - self.proxy has the interface INTERFACE
227        //         - 1 < INTERFACE.method_count = 2
228        //         - the request signature is `no`
229        //         - OwnedProxy::WL_INTERFACE is always a valid interface
230        let data = unsafe {
231            self.proxy
232                .send_constructor(_queue, 1, &mut args, WlDataDevice::WL_INTERFACE, None)
233        };
234        // SAFETY: data has the interface WlDataDevice::WL_INTERFACE
235        unsafe { proxy::low_level::from_untyped_owned(data) }
236    }
Source

pub fn version(&self) -> u32

Returns the version of this proxy object.

The version of the display object is always 0.

§Panic

Panics if the proxy is already destroyed.

Trait Implementations§

Source§

impl Clone for UntypedOwnedProxy

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for UntypedOwnedProxy

Source§

type Target = UntypedBorrowedProxy

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Drop for UntypedOwnedProxy

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq<UntypedBorrowedProxy> for UntypedOwnedProxy

Source§

fn eq(&self, other: &UntypedBorrowedProxy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<UntypedOwnedProxy> for UntypedBorrowedProxy

Source§

fn eq(&self, other: &UntypedOwnedProxy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for UntypedOwnedProxy

Source§

fn eq(&self, other: &UntypedOwnedProxy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for UntypedOwnedProxy

Source§

impl StructuralPartialEq for UntypedOwnedProxy

Source§

impl UntypedOwnedProxyWrapper for UntypedOwnedProxy

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Lhs, Rhs> IsntPartialEqExt<Lhs, Rhs> for Lhs
where Lhs: PartialEq<Rhs> + ?Sized, Rhs: ?Sized,

Source§

fn not_eq(&self, other: &Rhs) -> bool

The negation of eq
Source§

fn not_ne(&self, other: &Rhs) -> bool

The negation of ne
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.