Skip to main content

UntypedOwnedProxy

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/get-registry/../common/protocols/tablet_v2/zwp_tablet_seat_v2.rs (lines 269-273)
251    unsafe fn handle_event(
252        &self,
253        queue: &Queue,
254        data: *mut u8,
255        slf: &UntypedBorrowedProxy,
256        opcode: u32,
257        args: *mut wl_argument,
258    ) {
259        // SAFETY: This function requires that slf has the interface INTERFACE
260        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletSeatV2Ref>(slf) };
261        match opcode {
262            0 => {
263                // SAFETY: INTERFACE requires that there are 1 arguments
264                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
265                // SAFETY: - INTERFACE requires that args[0] contains an object
266                //         - ownership is transferred to this function
267                //         - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
268                let arg0 = unsafe {
269                    UntypedOwnedProxy::from_plain_wl_proxy(
270                        queue,
271                        NonNull::new_unchecked(args[0].o.cast()),
272                        ZwpTabletV2::WL_INTERFACE,
273                    )
274                };
275                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
276                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletV2>(arg0) };
277                self.0.tablet_added(slf, arg0);
278            }
279            1 => {
280                // SAFETY: INTERFACE requires that there are 1 arguments
281                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
282                // SAFETY: - INTERFACE requires that args[0] contains an object
283                //         - ownership is transferred to this function
284                //         - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
285                let arg0 = unsafe {
286                    UntypedOwnedProxy::from_plain_wl_proxy(
287                        queue,
288                        NonNull::new_unchecked(args[0].o.cast()),
289                        ZwpTabletToolV2::WL_INTERFACE,
290                    )
291                };
292                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
293                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletToolV2>(arg0) };
294                self.0.tool_added(slf, arg0);
295            }
296            2 => {
297                // SAFETY: INTERFACE requires that there are 1 arguments
298                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
299                // SAFETY: - INTERFACE requires that args[0] contains an object
300                //         - ownership is transferred to this function
301                //         - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
302                let arg0 = unsafe {
303                    UntypedOwnedProxy::from_plain_wl_proxy(
304                        queue,
305                        NonNull::new_unchecked(args[0].o.cast()),
306                        ZwpTabletPadV2::WL_INTERFACE,
307                    )
308                };
309                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
310                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadV2>(arg0) };
311                self.0.pad_added(slf, arg0);
312            }
313            _ => {
314                invalid_opcode("zwp_tablet_seat_v2", opcode);
315            }
316        }
317    }
More examples
Hide additional examples
examples/get-registry/../common/protocols_data/tablet_v2/zwp_tablet_seat_v2.rs (lines 285-289)
263    unsafe fn handle_event(
264        &self,
265        queue: &Queue,
266        data: *mut u8,
267        slf: &UntypedBorrowedProxy,
268        opcode: u32,
269        args: *mut wl_argument,
270    ) {
271        // SAFETY: This function requires that slf has the interface INTERFACE
272        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletSeatV2Ref>(slf) };
273        // SAFETY: This function requires that data is `&mut T` where `T`
274        //         has the type id returned by `Self::mutable_type`, i.e.,
275        //         `T = H::Data`.
276        let data: &mut H::Data = unsafe { &mut *data.cast() };
277        match opcode {
278            0 => {
279                // SAFETY: INTERFACE requires that there are 1 arguments
280                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
281                // SAFETY: - INTERFACE requires that args[0] contains an object
282                //         - ownership is transferred to this function
283                //         - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
284                let arg0 = unsafe {
285                    UntypedOwnedProxy::from_plain_wl_proxy(
286                        queue,
287                        NonNull::new_unchecked(args[0].o.cast()),
288                        ZwpTabletV2::WL_INTERFACE,
289                    )
290                };
291                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
292                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletV2>(arg0) };
293                self.0.tablet_added(data, slf, arg0);
294            }
295            1 => {
296                // SAFETY: INTERFACE requires that there are 1 arguments
297                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
298                // SAFETY: - INTERFACE requires that args[0] contains an object
299                //         - ownership is transferred to this function
300                //         - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
301                let arg0 = unsafe {
302                    UntypedOwnedProxy::from_plain_wl_proxy(
303                        queue,
304                        NonNull::new_unchecked(args[0].o.cast()),
305                        ZwpTabletToolV2::WL_INTERFACE,
306                    )
307                };
308                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
309                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletToolV2>(arg0) };
310                self.0.tool_added(data, slf, arg0);
311            }
312            2 => {
313                // SAFETY: INTERFACE requires that there are 1 arguments
314                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
315                // SAFETY: - INTERFACE requires that args[0] contains an object
316                //         - ownership is transferred to this function
317                //         - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
318                let arg0 = unsafe {
319                    UntypedOwnedProxy::from_plain_wl_proxy(
320                        queue,
321                        NonNull::new_unchecked(args[0].o.cast()),
322                        ZwpTabletPadV2::WL_INTERFACE,
323                    )
324                };
325                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
326                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadV2>(arg0) };
327                self.0.pad_added(data, slf, arg0);
328            }
329            _ => {
330                invalid_opcode("zwp_tablet_seat_v2", opcode);
331            }
332        }
333    }
examples/get-registry/../common/protocols/tablet_v2/zwp_tablet_pad_group_v2.rs (lines 410-414)
382    unsafe fn handle_event(
383        &self,
384        queue: &Queue,
385        data: *mut u8,
386        slf: &UntypedBorrowedProxy,
387        opcode: u32,
388        args: *mut wl_argument,
389    ) {
390        // SAFETY: This function requires that slf has the interface INTERFACE
391        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadGroupV2Ref>(slf) };
392        match opcode {
393            0 => {
394                // SAFETY: INTERFACE requires that there are 1 arguments
395                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
396                // SAFETY: - INTERFACE requires that args[0] contains an array
397                let arg0 = unsafe {
398                    let a = &*args[0].a;
399                    std::slice::from_raw_parts(a.data.cast(), a.size)
400                };
401                self.0.buttons(slf, arg0);
402            }
403            1 => {
404                // SAFETY: INTERFACE requires that there are 1 arguments
405                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
406                // SAFETY: - INTERFACE requires that args[0] contains an object
407                //         - ownership is transferred to this function
408                //         - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
409                let arg0 = unsafe {
410                    UntypedOwnedProxy::from_plain_wl_proxy(
411                        queue,
412                        NonNull::new_unchecked(args[0].o.cast()),
413                        ZwpTabletPadRingV2::WL_INTERFACE,
414                    )
415                };
416                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
417                let arg0 =
418                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadRingV2>(arg0) };
419                self.0.ring(slf, arg0);
420            }
421            2 => {
422                // SAFETY: INTERFACE requires that there are 1 arguments
423                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
424                // SAFETY: - INTERFACE requires that args[0] contains an object
425                //         - ownership is transferred to this function
426                //         - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
427                let arg0 = unsafe {
428                    UntypedOwnedProxy::from_plain_wl_proxy(
429                        queue,
430                        NonNull::new_unchecked(args[0].o.cast()),
431                        ZwpTabletPadStripV2::WL_INTERFACE,
432                    )
433                };
434                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
435                let arg0 =
436                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadStripV2>(arg0) };
437                self.0.strip(slf, arg0);
438            }
439            3 => {
440                // SAFETY: INTERFACE requires that there are 1 arguments
441                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
442                // SAFETY: - INTERFACE requires that args[0] contains a uint
443                let arg0 = unsafe { args[0].u };
444                self.0.modes(slf, arg0);
445            }
446            4 => {
447                self.0.done(slf);
448            }
449            5 => {
450                // SAFETY: INTERFACE requires that there are 3 arguments
451                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
452                // SAFETY: - INTERFACE requires that args[0] contains a uint
453                let arg0 = unsafe { args[0].u };
454                // SAFETY: - INTERFACE requires that args[1] contains a uint
455                let arg1 = unsafe { args[1].u };
456                // SAFETY: - INTERFACE requires that args[2] contains a uint
457                let arg2 = unsafe { args[2].u };
458                self.0.mode_switch(slf, arg0, arg1, arg2);
459            }
460            _ => {
461                invalid_opcode("zwp_tablet_pad_group_v2", opcode);
462            }
463        }
464    }
examples/get-registry/../common/protocols_data/tablet_v2/zwp_tablet_pad_group_v2.rs (lines 443-447)
411    unsafe fn handle_event(
412        &self,
413        queue: &Queue,
414        data: *mut u8,
415        slf: &UntypedBorrowedProxy,
416        opcode: u32,
417        args: *mut wl_argument,
418    ) {
419        // SAFETY: This function requires that slf has the interface INTERFACE
420        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadGroupV2Ref>(slf) };
421        // SAFETY: This function requires that data is `&mut T` where `T`
422        //         has the type id returned by `Self::mutable_type`, i.e.,
423        //         `T = H::Data`.
424        let data: &mut H::Data = unsafe { &mut *data.cast() };
425        match opcode {
426            0 => {
427                // SAFETY: INTERFACE requires that there are 1 arguments
428                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
429                // SAFETY: - INTERFACE requires that args[0] contains an array
430                let arg0 = unsafe {
431                    let a = &*args[0].a;
432                    std::slice::from_raw_parts(a.data.cast(), a.size)
433                };
434                self.0.buttons(data, slf, arg0);
435            }
436            1 => {
437                // SAFETY: INTERFACE requires that there are 1 arguments
438                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
439                // SAFETY: - INTERFACE requires that args[0] contains an object
440                //         - ownership is transferred to this function
441                //         - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
442                let arg0 = unsafe {
443                    UntypedOwnedProxy::from_plain_wl_proxy(
444                        queue,
445                        NonNull::new_unchecked(args[0].o.cast()),
446                        ZwpTabletPadRingV2::WL_INTERFACE,
447                    )
448                };
449                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
450                let arg0 =
451                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadRingV2>(arg0) };
452                self.0.ring(data, slf, arg0);
453            }
454            2 => {
455                // SAFETY: INTERFACE requires that there are 1 arguments
456                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
457                // SAFETY: - INTERFACE requires that args[0] contains an object
458                //         - ownership is transferred to this function
459                //         - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
460                let arg0 = unsafe {
461                    UntypedOwnedProxy::from_plain_wl_proxy(
462                        queue,
463                        NonNull::new_unchecked(args[0].o.cast()),
464                        ZwpTabletPadStripV2::WL_INTERFACE,
465                    )
466                };
467                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
468                let arg0 =
469                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadStripV2>(arg0) };
470                self.0.strip(data, slf, arg0);
471            }
472            3 => {
473                // SAFETY: INTERFACE requires that there are 1 arguments
474                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
475                // SAFETY: - INTERFACE requires that args[0] contains a uint
476                let arg0 = unsafe { args[0].u };
477                self.0.modes(data, slf, arg0);
478            }
479            4 => {
480                self.0.done(data, slf);
481            }
482            5 => {
483                // SAFETY: INTERFACE requires that there are 3 arguments
484                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
485                // SAFETY: - INTERFACE requires that args[0] contains a uint
486                let arg0 = unsafe { args[0].u };
487                // SAFETY: - INTERFACE requires that args[1] contains a uint
488                let arg1 = unsafe { args[1].u };
489                // SAFETY: - INTERFACE requires that args[2] contains a uint
490                let arg2 = unsafe { args[2].u };
491                self.0.mode_switch(data, slf, arg0, arg1, arg2);
492            }
493            _ => {
494                invalid_opcode("zwp_tablet_pad_group_v2", opcode);
495            }
496        }
497    }
examples/get-registry/../common/protocols/wayland/wl_data_device.rs (lines 520-524)
502    unsafe fn handle_event(
503        &self,
504        queue: &Queue,
505        data: *mut u8,
506        slf: &UntypedBorrowedProxy,
507        opcode: u32,
508        args: *mut wl_argument,
509    ) {
510        // SAFETY: This function requires that slf has the interface INTERFACE
511        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
512        match opcode {
513            0 => {
514                // SAFETY: INTERFACE requires that there are 1 arguments
515                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
516                // SAFETY: - INTERFACE requires that args[0] contains an object
517                //         - ownership is transferred to this function
518                //         - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
519                let arg0 = unsafe {
520                    UntypedOwnedProxy::from_plain_wl_proxy(
521                        queue,
522                        NonNull::new_unchecked(args[0].o.cast()),
523                        WlDataOffer::WL_INTERFACE,
524                    )
525                };
526                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
527                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
528                self.0.data_offer(slf, arg0);
529            }
530            1 => {
531                // SAFETY: INTERFACE requires that there are 5 arguments
532                let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
533                // SAFETY: - INTERFACE requires that args[0] contains a uint
534                let arg0 = unsafe { args[0].u };
535                // SAFETY: - INTERFACE requires that args[1] contains an object
536                let arg1 = unsafe {
537                    if let Some(p) = NonNull::new(args[1].o.cast()) {
538                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
539                    } else {
540                        None
541                    }
542                };
543                // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
544                let arg1 = arg1.as_ref().map(|arg1| unsafe {
545                    proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
546                });
547                // SAFETY: - INTERFACE requires that args[2] contains a fixed
548                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
549                // SAFETY: - INTERFACE requires that args[3] contains a fixed
550                let arg3 = unsafe { Fixed::from_wire(args[3].f) };
551                // SAFETY: - INTERFACE requires that args[4] contains an object
552                let arg4 = unsafe {
553                    if let Some(p) = NonNull::new(args[4].o.cast()) {
554                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
555                    } else {
556                        None
557                    }
558                };
559                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
560                let arg4 = arg4.as_ref().map(|arg4| unsafe {
561                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
562                });
563                self.0.enter(slf, arg0, arg1, arg2, arg3, arg4);
564            }
565            2 => {
566                self.0.leave(slf);
567            }
568            3 => {
569                // SAFETY: INTERFACE requires that there are 3 arguments
570                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
571                // SAFETY: - INTERFACE requires that args[0] contains a uint
572                let arg0 = unsafe { args[0].u };
573                // SAFETY: - INTERFACE requires that args[1] contains a fixed
574                let arg1 = unsafe { Fixed::from_wire(args[1].f) };
575                // SAFETY: - INTERFACE requires that args[2] contains a fixed
576                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
577                self.0.motion(slf, arg0, arg1, arg2);
578            }
579            4 => {
580                self.0.drop(slf);
581            }
582            5 => {
583                // SAFETY: INTERFACE requires that there are 1 arguments
584                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
585                // SAFETY: - INTERFACE requires that args[0] contains an object
586                let arg0 = unsafe {
587                    if let Some(p) = NonNull::new(args[0].o.cast()) {
588                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
589                    } else {
590                        None
591                    }
592                };
593                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
594                let arg0 = arg0.as_ref().map(|arg0| unsafe {
595                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
596                });
597                self.0.selection(slf, arg0);
598            }
599            _ => {
600                invalid_opcode("wl_data_device", opcode);
601            }
602        }
603    }
examples/get-registry/../common/protocols_data/wayland/wl_data_device.rs (lines 549-553)
527    unsafe fn handle_event(
528        &self,
529        queue: &Queue,
530        data: *mut u8,
531        slf: &UntypedBorrowedProxy,
532        opcode: u32,
533        args: *mut wl_argument,
534    ) {
535        // SAFETY: This function requires that slf has the interface INTERFACE
536        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
537        // SAFETY: This function requires that data is `&mut T` where `T`
538        //         has the type id returned by `Self::mutable_type`, i.e.,
539        //         `T = H::Data`.
540        let data: &mut H::Data = unsafe { &mut *data.cast() };
541        match opcode {
542            0 => {
543                // SAFETY: INTERFACE requires that there are 1 arguments
544                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
545                // SAFETY: - INTERFACE requires that args[0] contains an object
546                //         - ownership is transferred to this function
547                //         - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
548                let arg0 = unsafe {
549                    UntypedOwnedProxy::from_plain_wl_proxy(
550                        queue,
551                        NonNull::new_unchecked(args[0].o.cast()),
552                        WlDataOffer::WL_INTERFACE,
553                    )
554                };
555                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
556                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
557                self.0.data_offer(data, slf, arg0);
558            }
559            1 => {
560                // SAFETY: INTERFACE requires that there are 5 arguments
561                let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
562                // SAFETY: - INTERFACE requires that args[0] contains a uint
563                let arg0 = unsafe { args[0].u };
564                // SAFETY: - INTERFACE requires that args[1] contains an object
565                let arg1 = unsafe {
566                    if let Some(p) = NonNull::new(args[1].o.cast()) {
567                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
568                    } else {
569                        None
570                    }
571                };
572                // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
573                let arg1 = arg1.as_ref().map(|arg1| unsafe {
574                    proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
575                });
576                // SAFETY: - INTERFACE requires that args[2] contains a fixed
577                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
578                // SAFETY: - INTERFACE requires that args[3] contains a fixed
579                let arg3 = unsafe { Fixed::from_wire(args[3].f) };
580                // SAFETY: - INTERFACE requires that args[4] contains an object
581                let arg4 = unsafe {
582                    if let Some(p) = NonNull::new(args[4].o.cast()) {
583                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
584                    } else {
585                        None
586                    }
587                };
588                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
589                let arg4 = arg4.as_ref().map(|arg4| unsafe {
590                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
591                });
592                self.0.enter(data, slf, arg0, arg1, arg2, arg3, arg4);
593            }
594            2 => {
595                self.0.leave(data, slf);
596            }
597            3 => {
598                // SAFETY: INTERFACE requires that there are 3 arguments
599                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
600                // SAFETY: - INTERFACE requires that args[0] contains a uint
601                let arg0 = unsafe { args[0].u };
602                // SAFETY: - INTERFACE requires that args[1] contains a fixed
603                let arg1 = unsafe { Fixed::from_wire(args[1].f) };
604                // SAFETY: - INTERFACE requires that args[2] contains a fixed
605                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
606                self.0.motion(data, slf, arg0, arg1, arg2);
607            }
608            4 => {
609                self.0.drop(data, slf);
610            }
611            5 => {
612                // SAFETY: INTERFACE requires that there are 1 arguments
613                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
614                // SAFETY: - INTERFACE requires that args[0] contains an object
615                let arg0 = unsafe {
616                    if let Some(p) = NonNull::new(args[0].o.cast()) {
617                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
618                    } else {
619                        None
620                    }
621                };
622                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
623                let arg0 = arg0.as_ref().map(|arg0| unsafe {
624                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
625                });
626                self.0.selection(data, slf, arg0);
627            }
628            _ => {
629                invalid_opcode("wl_data_device", opcode);
630            }
631        }
632    }
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/get-registry/../common/protocols/cursor_shape_v1/wp_cursor_shape_device_v1.rs (line 149)
143    pub fn destroy(&self) {
144        let mut args = [];
145        // SAFETY: - self.proxy has the interface INTERFACE
146        //         - 0 < INTERFACE.method_count = 2
147        //         - the request signature is ``
148        unsafe {
149            self.proxy.send_destructor(0, &mut args);
150        }
151    }
More examples
Hide additional examples
examples/get-registry/../common/protocols/cursor_shape_v1/wp_cursor_shape_manager_v1.rs (line 172)
166    pub fn destroy(&self) {
167        let mut args = [];
168        // SAFETY: - self.proxy has the interface INTERFACE
169        //         - 0 < INTERFACE.method_count = 3
170        //         - the request signature is ``
171        unsafe {
172            self.proxy.send_destructor(0, &mut args);
173        }
174    }
examples/get-registry/../common/protocols/tablet_v2/zwp_tablet_manager_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/get-registry/../common/protocols/tablet_v2/zwp_tablet_pad_group_v2.rs (line 208)
202    pub fn destroy(&self) {
203        let mut args = [];
204        // SAFETY: - self.proxy has the interface INTERFACE
205        //         - 0 < INTERFACE.method_count = 1
206        //         - the request signature is ``
207        unsafe {
208            self.proxy.send_destructor(0, &mut args);
209        }
210    }
examples/get-registry/../common/protocols/tablet_v2/zwp_tablet_pad_ring_v2.rs (line 187)
181    pub fn destroy(&self) {
182        let mut args = [];
183        // SAFETY: - self.proxy has the interface INTERFACE
184        //         - 1 < INTERFACE.method_count = 2
185        //         - the request signature is ``
186        unsafe {
187            self.proxy.send_destructor(1, &mut args);
188        }
189    }
examples/get-registry/../common/protocols/tablet_v2/zwp_tablet_pad_strip_v2.rs (line 187)
181    pub fn destroy(&self) {
182        let mut args = [];
183        // SAFETY: - self.proxy has the interface INTERFACE
184        //         - 1 < INTERFACE.method_count = 2
185        //         - the request signature is ``
186        unsafe {
187            self.proxy.send_destructor(1, &mut args);
188        }
189    }
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/get-registry/../common/protocols/wayland/wl_display.rs (line 182)
174    pub fn sync(&self) -> WlCallback {
175        let mut args = [wl_argument { n: 0 }];
176        // SAFETY: - self.proxy has the interface INTERFACE
177        //         - 0 < INTERFACE.method_count = 2
178        //         - the request signature is `n`
179        //         - OwnedProxy::WL_INTERFACE is always a valid interface
180        let data = unsafe {
181            self.proxy
182                .send_constructor::<false>(0, &mut args, WlCallback::WL_INTERFACE, None)
183        };
184        // SAFETY: data has the interface WlCallback::WL_INTERFACE
185        unsafe { proxy::low_level::from_untyped_owned(data) }
186    }
187
188    /// get global registry object
189    ///
190    /// This request creates a registry object that allows the client
191    /// to list and bind the global objects available from the
192    /// compositor.
193    ///
194    /// It should be noted that the server side resources consumed in
195    /// response to a get_registry request can only be released when the
196    /// client disconnects, not when the client side proxy is destroyed.
197    /// Therefore, clients should invoke get_registry as infrequently as
198    /// possible to avoid wasting memory.
199    #[inline]
200    pub fn get_registry(&self) -> WlRegistry {
201        let mut args = [wl_argument { n: 0 }];
202        // SAFETY: - self.proxy has the interface INTERFACE
203        //         - 1 < INTERFACE.method_count = 2
204        //         - the request signature is `n`
205        //         - OwnedProxy::WL_INTERFACE is always a valid interface
206        let data = unsafe {
207            self.proxy
208                .send_constructor::<false>(1, &mut args, WlRegistry::WL_INTERFACE, None)
209        };
210        // SAFETY: data has the interface WlRegistry::WL_INTERFACE
211        unsafe { proxy::low_level::from_untyped_owned(data) }
212    }
More examples
Hide additional examples
examples/get-registry/../common/protocols_data/wayland/wl_display.rs (line 182)
174    pub fn sync(&self) -> WlCallback {
175        let mut args = [wl_argument { n: 0 }];
176        // SAFETY: - self.proxy has the interface INTERFACE
177        //         - 0 < INTERFACE.method_count = 2
178        //         - the request signature is `n`
179        //         - OwnedProxy::WL_INTERFACE is always a valid interface
180        let data = unsafe {
181            self.proxy
182                .send_constructor::<false>(0, &mut args, WlCallback::WL_INTERFACE, None)
183        };
184        // SAFETY: data has the interface WlCallback::WL_INTERFACE
185        unsafe { proxy::low_level::from_untyped_owned(data) }
186    }
187
188    /// get global registry object
189    ///
190    /// This request creates a registry object that allows the client
191    /// to list and bind the global objects available from the
192    /// compositor.
193    ///
194    /// It should be noted that the server side resources consumed in
195    /// response to a get_registry request can only be released when the
196    /// client disconnects, not when the client side proxy is destroyed.
197    /// Therefore, clients should invoke get_registry as infrequently as
198    /// possible to avoid wasting memory.
199    #[inline]
200    pub fn get_registry(&self) -> WlRegistry {
201        let mut args = [wl_argument { n: 0 }];
202        // SAFETY: - self.proxy has the interface INTERFACE
203        //         - 1 < INTERFACE.method_count = 2
204        //         - the request signature is `n`
205        //         - OwnedProxy::WL_INTERFACE is always a valid interface
206        let data = unsafe {
207            self.proxy
208                .send_constructor::<false>(1, &mut args, WlRegistry::WL_INTERFACE, None)
209        };
210        // SAFETY: data has the interface WlRegistry::WL_INTERFACE
211        unsafe { proxy::low_level::from_untyped_owned(data) }
212    }
examples/get-registry/../common/protocols/wayland/wl_surface.rs (line 385)
377    pub fn frame(&self) -> WlCallback {
378        let mut args = [wl_argument { n: 0 }];
379        // SAFETY: - self.proxy has the interface INTERFACE
380        //         - 3 < INTERFACE.method_count = 11
381        //         - the request signature is `n`
382        //         - OwnedProxy::WL_INTERFACE is always a valid interface
383        let data = unsafe {
384            self.proxy
385                .send_constructor::<false>(3, &mut args, WlCallback::WL_INTERFACE, None)
386        };
387        // SAFETY: data has the interface WlCallback::WL_INTERFACE
388        unsafe { proxy::low_level::from_untyped_owned(data) }
389    }
examples/get-registry/../common/protocols_data/wayland/wl_surface.rs (line 385)
377    pub fn frame(&self) -> WlCallback {
378        let mut args = [wl_argument { n: 0 }];
379        // SAFETY: - self.proxy has the interface INTERFACE
380        //         - 3 < INTERFACE.method_count = 11
381        //         - the request signature is `n`
382        //         - OwnedProxy::WL_INTERFACE is always a valid interface
383        let data = unsafe {
384            self.proxy
385                .send_constructor::<false>(3, &mut args, WlCallback::WL_INTERFACE, None)
386        };
387        // SAFETY: data has the interface WlCallback::WL_INTERFACE
388        unsafe { proxy::low_level::from_untyped_owned(data) }
389    }
examples/get-registry/../common/protocols/wayland/wl_seat.rs (line 206)
198    pub fn get_pointer(&self) -> WlPointer {
199        let mut args = [wl_argument { n: 0 }];
200        // SAFETY: - self.proxy has the interface INTERFACE
201        //         - 0 < INTERFACE.method_count = 4
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::<false>(0, &mut args, WlPointer::WL_INTERFACE, None)
207        };
208        // SAFETY: data has the interface WlPointer::WL_INTERFACE
209        unsafe { proxy::low_level::from_untyped_owned(data) }
210    }
211
212    /// return keyboard object
213    ///
214    /// The ID provided will be initialized to the wl_keyboard interface
215    /// for this seat.
216    ///
217    /// This request only takes effect if the seat has the keyboard
218    /// capability, or has had the keyboard capability in the past.
219    /// It is a protocol violation to issue this request on a seat that has
220    /// never had the keyboard capability. The missing_capability error will
221    /// be sent in this case.
222    #[inline]
223    pub fn get_keyboard(&self) -> WlKeyboard {
224        let mut args = [wl_argument { n: 0 }];
225        // SAFETY: - self.proxy has the interface INTERFACE
226        //         - 1 < INTERFACE.method_count = 4
227        //         - the request signature is `n`
228        //         - OwnedProxy::WL_INTERFACE is always a valid interface
229        let data = unsafe {
230            self.proxy
231                .send_constructor::<false>(1, &mut args, WlKeyboard::WL_INTERFACE, None)
232        };
233        // SAFETY: data has the interface WlKeyboard::WL_INTERFACE
234        unsafe { proxy::low_level::from_untyped_owned(data) }
235    }
236
237    /// return touch object
238    ///
239    /// The ID provided will be initialized to the wl_touch interface
240    /// for this seat.
241    ///
242    /// This request only takes effect if the seat has the touch
243    /// capability, or has had the touch capability in the past.
244    /// It is a protocol violation to issue this request on a seat that has
245    /// never had the touch capability. The missing_capability error will
246    /// be sent in this case.
247    #[inline]
248    pub fn get_touch(&self) -> WlTouch {
249        let mut args = [wl_argument { n: 0 }];
250        // SAFETY: - self.proxy has the interface INTERFACE
251        //         - 2 < INTERFACE.method_count = 4
252        //         - the request signature is `n`
253        //         - OwnedProxy::WL_INTERFACE is always a valid interface
254        let data = unsafe {
255            self.proxy
256                .send_constructor::<false>(2, &mut args, WlTouch::WL_INTERFACE, None)
257        };
258        // SAFETY: data has the interface WlTouch::WL_INTERFACE
259        unsafe { proxy::low_level::from_untyped_owned(data) }
260    }
examples/get-registry/../common/protocols_data/wayland/wl_seat.rs (line 206)
198    pub fn get_pointer(&self) -> WlPointer {
199        let mut args = [wl_argument { n: 0 }];
200        // SAFETY: - self.proxy has the interface INTERFACE
201        //         - 0 < INTERFACE.method_count = 4
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::<false>(0, &mut args, WlPointer::WL_INTERFACE, None)
207        };
208        // SAFETY: data has the interface WlPointer::WL_INTERFACE
209        unsafe { proxy::low_level::from_untyped_owned(data) }
210    }
211
212    /// return keyboard object
213    ///
214    /// The ID provided will be initialized to the wl_keyboard interface
215    /// for this seat.
216    ///
217    /// This request only takes effect if the seat has the keyboard
218    /// capability, or has had the keyboard capability in the past.
219    /// It is a protocol violation to issue this request on a seat that has
220    /// never had the keyboard capability. The missing_capability error will
221    /// be sent in this case.
222    #[inline]
223    pub fn get_keyboard(&self) -> WlKeyboard {
224        let mut args = [wl_argument { n: 0 }];
225        // SAFETY: - self.proxy has the interface INTERFACE
226        //         - 1 < INTERFACE.method_count = 4
227        //         - the request signature is `n`
228        //         - OwnedProxy::WL_INTERFACE is always a valid interface
229        let data = unsafe {
230            self.proxy
231                .send_constructor::<false>(1, &mut args, WlKeyboard::WL_INTERFACE, None)
232        };
233        // SAFETY: data has the interface WlKeyboard::WL_INTERFACE
234        unsafe { proxy::low_level::from_untyped_owned(data) }
235    }
236
237    /// return touch object
238    ///
239    /// The ID provided will be initialized to the wl_touch interface
240    /// for this seat.
241    ///
242    /// This request only takes effect if the seat has the touch
243    /// capability, or has had the touch capability in the past.
244    /// It is a protocol violation to issue this request on a seat that has
245    /// never had the touch capability. The missing_capability error will
246    /// be sent in this case.
247    #[inline]
248    pub fn get_touch(&self) -> WlTouch {
249        let mut args = [wl_argument { n: 0 }];
250        // SAFETY: - self.proxy has the interface INTERFACE
251        //         - 2 < INTERFACE.method_count = 4
252        //         - the request signature is `n`
253        //         - OwnedProxy::WL_INTERFACE is always a valid interface
254        let data = unsafe {
255            self.proxy
256                .send_constructor::<false>(2, &mut args, WlTouch::WL_INTERFACE, None)
257        };
258        // SAFETY: data has the interface WlTouch::WL_INTERFACE
259        unsafe { proxy::low_level::from_untyped_owned(data) }
260    }
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/get-registry/../common/protocols/wayland/wl_shm.rs (line 121)
120    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
121        write!(f, "wl_shm#{}", self.proxy.id())
122    }
123}
124
125impl Debug for WlShmRef {
126    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
127        write!(f, "wl_shm#{}", self.proxy.id())
128    }
More examples
Hide additional examples
examples/get-registry/../common/protocols_data/wayland/wl_shm.rs (line 121)
120    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
121        write!(f, "wl_shm#{}", self.proxy.id())
122    }
123}
124
125impl Debug for WlShmRef {
126    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
127        write!(f, "wl_shm#{}", self.proxy.id())
128    }
examples/get-registry/../common/protocols/wayland/wl_seat.rs (line 144)
143    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
144        write!(f, "wl_seat#{}", self.proxy.id())
145    }
146}
147
148impl Debug for WlSeatRef {
149    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
150        write!(f, "wl_seat#{}", self.proxy.id())
151    }
examples/get-registry/../common/protocols_data/wayland/wl_seat.rs (line 144)
143    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
144        write!(f, "wl_seat#{}", self.proxy.id())
145    }
146}
147
148impl Debug for WlSeatRef {
149    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
150        write!(f, "wl_seat#{}", self.proxy.id())
151    }
examples/get-registry/../common/protocols/wayland/wl_fixes.rs (line 104)
103    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
104        write!(f, "wl_fixes#{}", self.proxy.id())
105    }
106}
107
108impl Debug for WlFixesRef {
109    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
110        write!(f, "wl_fixes#{}", self.proxy.id())
111    }
examples/get-registry/../common/protocols/wayland/wl_shell.rs (line 103)
102    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
103        write!(f, "wl_shell#{}", self.proxy.id())
104    }
105}
106
107impl Debug for WlShellRef {
108    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
109        write!(f, "wl_shell#{}", self.proxy.id())
110    }
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/get-registry/../common/protocols/wayland/wl_shm_pool.rs (line 305)
298    pub fn resize(&self, size: i32) {
299        let (arg0,) = (size,);
300        let mut args = [wl_argument { i: arg0 }];
301        // SAFETY: - self.proxy has the interface INTERFACE
302        //         - 2 < INTERFACE.method_count = 3
303        //         - the request signature is `i`
304        unsafe {
305            self.proxy.send_request(2, &mut args);
306        }
307    }
More examples
Hide additional examples
examples/get-registry/../common/protocols_data/wayland/wl_shm_pool.rs (line 305)
298    pub fn resize(&self, size: i32) {
299        let (arg0,) = (size,);
300        let mut args = [wl_argument { i: arg0 }];
301        // SAFETY: - self.proxy has the interface INTERFACE
302        //         - 2 < INTERFACE.method_count = 3
303        //         - the request signature is `i`
304        unsafe {
305            self.proxy.send_request(2, &mut args);
306        }
307    }
examples/get-registry/../common/protocols/xdg_shell/xdg_wm_base.rs (line 336)
329    pub fn pong(&self, serial: u32) {
330        let (arg0,) = (serial,);
331        let mut args = [wl_argument { u: arg0 }];
332        // SAFETY: - self.proxy has the interface INTERFACE
333        //         - 3 < INTERFACE.method_count = 4
334        //         - the request signature is `u`
335        unsafe {
336            self.proxy.send_request(3, &mut args);
337        }
338    }
examples/get-registry/../common/protocols_data/xdg_shell/xdg_wm_base.rs (line 336)
329    pub fn pong(&self, serial: u32) {
330        let (arg0,) = (serial,);
331        let mut args = [wl_argument { u: arg0 }];
332        // SAFETY: - self.proxy has the interface INTERFACE
333        //         - 3 < INTERFACE.method_count = 4
334        //         - the request signature is `u`
335        unsafe {
336            self.proxy.send_request(3, &mut args);
337        }
338    }
examples/get-registry/../common/protocols/wayland/wl_shell_surface.rs (line 299)
292    pub fn pong(&self, serial: u32) {
293        let (arg0,) = (serial,);
294        let mut args = [wl_argument { u: arg0 }];
295        // SAFETY: - self.proxy has the interface INTERFACE
296        //         - 0 < INTERFACE.method_count = 10
297        //         - the request signature is `u`
298        unsafe {
299            self.proxy.send_request(0, &mut args);
300        }
301    }
302
303    /// start an interactive move
304    ///
305    /// Start a pointer-driven move of the surface.
306    ///
307    /// This request must be used in response to a button press event.
308    /// The server may ignore move requests depending on the state of
309    /// the surface (e.g. fullscreen or maximized).
310    ///
311    /// # Arguments
312    ///
313    /// - `seat`: seat whose pointer is used
314    /// - `serial`: serial number of the implicit grab on the pointer
315    #[inline]
316    pub fn r#move(&self, seat: &WlSeatRef, serial: u32) {
317        let (arg0, arg1) = (seat, serial);
318        let obj0_lock = proxy::lock(arg0);
319        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
320        let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
321        // SAFETY: - self.proxy has the interface INTERFACE
322        //         - 1 < INTERFACE.method_count = 10
323        //         - the request signature is `ou`
324        unsafe {
325            self.proxy.send_request(1, &mut args);
326        }
327    }
328
329    /// start an interactive resize
330    ///
331    /// Start a pointer-driven resizing of the surface.
332    ///
333    /// This request must be used in response to a button press event.
334    /// The server may ignore resize requests depending on the state of
335    /// the surface (e.g. fullscreen or maximized).
336    ///
337    /// # Arguments
338    ///
339    /// - `seat`: seat whose pointer is used
340    /// - `serial`: serial number of the implicit grab on the pointer
341    /// - `edges`: which edge or corner is being dragged
342    #[inline]
343    pub fn resize(&self, seat: &WlSeatRef, serial: u32, edges: WlShellSurfaceResize) {
344        let (arg0, arg1, arg2) = (seat, serial, edges);
345        let obj0_lock = proxy::lock(arg0);
346        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
347        let mut args = [
348            wl_argument { o: obj0 },
349            wl_argument { u: arg1 },
350            wl_argument { u: arg2.0 },
351        ];
352        // SAFETY: - self.proxy has the interface INTERFACE
353        //         - 2 < INTERFACE.method_count = 10
354        //         - the request signature is `ouu`
355        unsafe {
356            self.proxy.send_request(2, &mut args);
357        }
358    }
359
360    /// make the surface a toplevel surface
361    ///
362    /// Map the surface as a toplevel surface.
363    ///
364    /// A toplevel surface is not fullscreen, maximized or transient.
365    #[inline]
366    pub fn set_toplevel(&self) {
367        let mut args = [];
368        // SAFETY: - self.proxy has the interface INTERFACE
369        //         - 3 < INTERFACE.method_count = 10
370        //         - the request signature is ``
371        unsafe {
372            self.proxy.send_request(3, &mut args);
373        }
374    }
375
376    /// make the surface a transient surface
377    ///
378    /// Map the surface relative to an existing surface.
379    ///
380    /// The x and y arguments specify the location of the upper left
381    /// corner of the surface relative to the upper left corner of the
382    /// parent surface, in surface-local coordinates.
383    ///
384    /// The flags argument controls details of the transient behaviour.
385    ///
386    /// # Arguments
387    ///
388    /// - `parent`: parent surface
389    /// - `x`: surface-local x coordinate
390    /// - `y`: surface-local y coordinate
391    /// - `flags`: transient surface behavior
392    #[inline]
393    pub fn set_transient(
394        &self,
395        parent: &WlSurfaceRef,
396        x: i32,
397        y: i32,
398        flags: WlShellSurfaceTransient,
399    ) {
400        let (arg0, arg1, arg2, arg3) = (parent, x, y, flags);
401        let obj0_lock = proxy::lock(arg0);
402        let obj0 = check_argument_proxy("parent", obj0_lock.wl_proxy());
403        let mut args = [
404            wl_argument { o: obj0 },
405            wl_argument { i: arg1 },
406            wl_argument { i: arg2 },
407            wl_argument { u: arg3.0 },
408        ];
409        // SAFETY: - self.proxy has the interface INTERFACE
410        //         - 4 < INTERFACE.method_count = 10
411        //         - the request signature is `oiiu`
412        unsafe {
413            self.proxy.send_request(4, &mut args);
414        }
415    }
416
417    /// make the surface a fullscreen surface
418    ///
419    /// Map the surface as a fullscreen surface.
420    ///
421    /// If an output parameter is given then the surface will be made
422    /// fullscreen on that output. If the client does not specify the
423    /// output then the compositor will apply its policy - usually
424    /// choosing the output on which the surface has the biggest surface
425    /// area.
426    ///
427    /// The client may specify a method to resolve a size conflict
428    /// between the output size and the surface size - this is provided
429    /// through the method parameter.
430    ///
431    /// The framerate parameter is used only when the method is set
432    /// to "driver", to indicate the preferred framerate. A value of 0
433    /// indicates that the client does not care about framerate.  The
434    /// framerate is specified in mHz, that is framerate of 60000 is 60Hz.
435    ///
436    /// A method of "scale" or "driver" implies a scaling operation of
437    /// the surface, either via a direct scaling operation or a change of
438    /// the output mode. This will override any kind of output scaling, so
439    /// that mapping a surface with a buffer size equal to the mode can
440    /// fill the screen independent of buffer_scale.
441    ///
442    /// A method of "fill" means we don't scale up the buffer, however
443    /// any output scale is applied. This means that you may run into
444    /// an edge case where the application maps a buffer with the same
445    /// size of the output mode but buffer_scale 1 (thus making a
446    /// surface larger than the output). In this case it is allowed to
447    /// downscale the results to fit the screen.
448    ///
449    /// The compositor must reply to this request with a configure event
450    /// with the dimensions for the output on which the surface will
451    /// be made fullscreen.
452    ///
453    /// # Arguments
454    ///
455    /// - `method`: method for resolving size conflict
456    /// - `framerate`: framerate in mHz
457    /// - `output`: output on which the surface is to be fullscreen
458    #[inline]
459    pub fn set_fullscreen(
460        &self,
461        method: WlShellSurfaceFullscreenMethod,
462        framerate: u32,
463        output: Option<&WlOutputRef>,
464    ) {
465        let (arg0, arg1, arg2) = (method, framerate, output);
466        let obj2_lock = arg2.map(|arg2| proxy::lock(arg2));
467        let obj2 = obj2_lock
468            .map(|obj2_lock| check_argument_proxy("output", obj2_lock.wl_proxy()))
469            .unwrap_or(ptr::null_mut());
470        let mut args = [
471            wl_argument { u: arg0.0 },
472            wl_argument { u: arg1 },
473            wl_argument { o: obj2 },
474        ];
475        // SAFETY: - self.proxy has the interface INTERFACE
476        //         - 5 < INTERFACE.method_count = 10
477        //         - the request signature is `uu?o`
478        unsafe {
479            self.proxy.send_request(5, &mut args);
480        }
481    }
482
483    /// make the surface a popup surface
484    ///
485    /// Map the surface as a popup.
486    ///
487    /// A popup surface is a transient surface with an added pointer
488    /// grab.
489    ///
490    /// An existing implicit grab will be changed to owner-events mode,
491    /// and the popup grab will continue after the implicit grab ends
492    /// (i.e. releasing the mouse button does not cause the popup to
493    /// be unmapped).
494    ///
495    /// The popup grab continues until the window is destroyed or a
496    /// mouse button is pressed in any other client's window. A click
497    /// in any of the client's surfaces is reported as normal, however,
498    /// clicks in other clients' surfaces will be discarded and trigger
499    /// the callback.
500    ///
501    /// The x and y arguments specify the location of the upper left
502    /// corner of the surface relative to the upper left corner of the
503    /// parent surface, in surface-local coordinates.
504    ///
505    /// # Arguments
506    ///
507    /// - `seat`: seat whose pointer is used
508    /// - `serial`: serial number of the implicit grab on the pointer
509    /// - `parent`: parent surface
510    /// - `x`: surface-local x coordinate
511    /// - `y`: surface-local y coordinate
512    /// - `flags`: transient surface behavior
513    #[inline]
514    pub fn set_popup(
515        &self,
516        seat: &WlSeatRef,
517        serial: u32,
518        parent: &WlSurfaceRef,
519        x: i32,
520        y: i32,
521        flags: WlShellSurfaceTransient,
522    ) {
523        let (arg0, arg1, arg2, arg3, arg4, arg5) = (seat, serial, parent, x, y, flags);
524        let obj0_lock = proxy::lock(arg0);
525        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
526        let obj2_lock = proxy::lock(arg2);
527        let obj2 = check_argument_proxy("parent", obj2_lock.wl_proxy());
528        let mut args = [
529            wl_argument { o: obj0 },
530            wl_argument { u: arg1 },
531            wl_argument { o: obj2 },
532            wl_argument { i: arg3 },
533            wl_argument { i: arg4 },
534            wl_argument { u: arg5.0 },
535        ];
536        // SAFETY: - self.proxy has the interface INTERFACE
537        //         - 6 < INTERFACE.method_count = 10
538        //         - the request signature is `ouoiiu`
539        unsafe {
540            self.proxy.send_request(6, &mut args);
541        }
542    }
543
544    /// make the surface a maximized surface
545    ///
546    /// Map the surface as a maximized surface.
547    ///
548    /// If an output parameter is given then the surface will be
549    /// maximized on that output. If the client does not specify the
550    /// output then the compositor will apply its policy - usually
551    /// choosing the output on which the surface has the biggest surface
552    /// area.
553    ///
554    /// The compositor will reply with a configure event telling
555    /// the expected new surface size. The operation is completed
556    /// on the next buffer attach to this surface.
557    ///
558    /// A maximized surface typically fills the entire output it is
559    /// bound to, except for desktop elements such as panels. This is
560    /// the main difference between a maximized shell surface and a
561    /// fullscreen shell surface.
562    ///
563    /// The details depend on the compositor implementation.
564    ///
565    /// # Arguments
566    ///
567    /// - `output`: output on which the surface is to be maximized
568    #[inline]
569    pub fn set_maximized(&self, output: Option<&WlOutputRef>) {
570        let (arg0,) = (output,);
571        let obj0_lock = arg0.map(|arg0| proxy::lock(arg0));
572        let obj0 = obj0_lock
573            .map(|obj0_lock| check_argument_proxy("output", obj0_lock.wl_proxy()))
574            .unwrap_or(ptr::null_mut());
575        let mut args = [wl_argument { o: obj0 }];
576        // SAFETY: - self.proxy has the interface INTERFACE
577        //         - 7 < INTERFACE.method_count = 10
578        //         - the request signature is `?o`
579        unsafe {
580            self.proxy.send_request(7, &mut args);
581        }
582    }
583
584    /// set surface title
585    ///
586    /// Set a short title for the surface.
587    ///
588    /// This string may be used to identify the surface in a task bar,
589    /// window list, or other user interface elements provided by the
590    /// compositor.
591    ///
592    /// The string must be encoded in UTF-8.
593    ///
594    /// # Arguments
595    ///
596    /// - `title`: surface title
597    #[inline]
598    pub fn set_title(&self, title: &str) {
599        let (arg0,) = (title,);
600        with_cstr_cache(|cache| {
601            let str0_offset = cache.len();
602            cache.extend_from_slice(arg0.as_bytes());
603            cache.push(0);
604            let str0 = cache[str0_offset..].as_ptr().cast();
605            let mut args = [wl_argument { s: str0 }];
606            // SAFETY: - self.proxy has the interface INTERFACE
607            //         - 8 < INTERFACE.method_count = 10
608            //         - the request signature is `s`
609            unsafe {
610                self.proxy.send_request(8, &mut args);
611            }
612        })
613    }
614
615    /// set surface class
616    ///
617    /// Set a class for the surface.
618    ///
619    /// The surface class identifies the general class of applications
620    /// to which the surface belongs. A common convention is to use the
621    /// file name (or the full path if it is a non-standard location) of
622    /// the application's .desktop file as the class.
623    ///
624    /// # Arguments
625    ///
626    /// - `class_`: surface class
627    #[inline]
628    pub fn set_class(&self, class_: &str) {
629        let (arg0,) = (class_,);
630        with_cstr_cache(|cache| {
631            let str0_offset = cache.len();
632            cache.extend_from_slice(arg0.as_bytes());
633            cache.push(0);
634            let str0 = cache[str0_offset..].as_ptr().cast();
635            let mut args = [wl_argument { s: str0 }];
636            // SAFETY: - self.proxy has the interface INTERFACE
637            //         - 9 < INTERFACE.method_count = 10
638            //         - the request signature is `s`
639            unsafe {
640                self.proxy.send_request(9, &mut args);
641            }
642        })
643    }
examples/get-registry/../common/protocols_data/wayland/wl_shell_surface.rs (line 299)
292    pub fn pong(&self, serial: u32) {
293        let (arg0,) = (serial,);
294        let mut args = [wl_argument { u: arg0 }];
295        // SAFETY: - self.proxy has the interface INTERFACE
296        //         - 0 < INTERFACE.method_count = 10
297        //         - the request signature is `u`
298        unsafe {
299            self.proxy.send_request(0, &mut args);
300        }
301    }
302
303    /// start an interactive move
304    ///
305    /// Start a pointer-driven move of the surface.
306    ///
307    /// This request must be used in response to a button press event.
308    /// The server may ignore move requests depending on the state of
309    /// the surface (e.g. fullscreen or maximized).
310    ///
311    /// # Arguments
312    ///
313    /// - `seat`: seat whose pointer is used
314    /// - `serial`: serial number of the implicit grab on the pointer
315    #[inline]
316    pub fn r#move(&self, seat: &WlSeatRef, serial: u32) {
317        let (arg0, arg1) = (seat, serial);
318        let obj0_lock = proxy::lock(arg0);
319        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
320        let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
321        // SAFETY: - self.proxy has the interface INTERFACE
322        //         - 1 < INTERFACE.method_count = 10
323        //         - the request signature is `ou`
324        unsafe {
325            self.proxy.send_request(1, &mut args);
326        }
327    }
328
329    /// start an interactive resize
330    ///
331    /// Start a pointer-driven resizing of the surface.
332    ///
333    /// This request must be used in response to a button press event.
334    /// The server may ignore resize requests depending on the state of
335    /// the surface (e.g. fullscreen or maximized).
336    ///
337    /// # Arguments
338    ///
339    /// - `seat`: seat whose pointer is used
340    /// - `serial`: serial number of the implicit grab on the pointer
341    /// - `edges`: which edge or corner is being dragged
342    #[inline]
343    pub fn resize(&self, seat: &WlSeatRef, serial: u32, edges: WlShellSurfaceResize) {
344        let (arg0, arg1, arg2) = (seat, serial, edges);
345        let obj0_lock = proxy::lock(arg0);
346        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
347        let mut args = [
348            wl_argument { o: obj0 },
349            wl_argument { u: arg1 },
350            wl_argument { u: arg2.0 },
351        ];
352        // SAFETY: - self.proxy has the interface INTERFACE
353        //         - 2 < INTERFACE.method_count = 10
354        //         - the request signature is `ouu`
355        unsafe {
356            self.proxy.send_request(2, &mut args);
357        }
358    }
359
360    /// make the surface a toplevel surface
361    ///
362    /// Map the surface as a toplevel surface.
363    ///
364    /// A toplevel surface is not fullscreen, maximized or transient.
365    #[inline]
366    pub fn set_toplevel(&self) {
367        let mut args = [];
368        // SAFETY: - self.proxy has the interface INTERFACE
369        //         - 3 < INTERFACE.method_count = 10
370        //         - the request signature is ``
371        unsafe {
372            self.proxy.send_request(3, &mut args);
373        }
374    }
375
376    /// make the surface a transient surface
377    ///
378    /// Map the surface relative to an existing surface.
379    ///
380    /// The x and y arguments specify the location of the upper left
381    /// corner of the surface relative to the upper left corner of the
382    /// parent surface, in surface-local coordinates.
383    ///
384    /// The flags argument controls details of the transient behaviour.
385    ///
386    /// # Arguments
387    ///
388    /// - `parent`: parent surface
389    /// - `x`: surface-local x coordinate
390    /// - `y`: surface-local y coordinate
391    /// - `flags`: transient surface behavior
392    #[inline]
393    pub fn set_transient(
394        &self,
395        parent: &WlSurfaceRef,
396        x: i32,
397        y: i32,
398        flags: WlShellSurfaceTransient,
399    ) {
400        let (arg0, arg1, arg2, arg3) = (parent, x, y, flags);
401        let obj0_lock = proxy::lock(arg0);
402        let obj0 = check_argument_proxy("parent", obj0_lock.wl_proxy());
403        let mut args = [
404            wl_argument { o: obj0 },
405            wl_argument { i: arg1 },
406            wl_argument { i: arg2 },
407            wl_argument { u: arg3.0 },
408        ];
409        // SAFETY: - self.proxy has the interface INTERFACE
410        //         - 4 < INTERFACE.method_count = 10
411        //         - the request signature is `oiiu`
412        unsafe {
413            self.proxy.send_request(4, &mut args);
414        }
415    }
416
417    /// make the surface a fullscreen surface
418    ///
419    /// Map the surface as a fullscreen surface.
420    ///
421    /// If an output parameter is given then the surface will be made
422    /// fullscreen on that output. If the client does not specify the
423    /// output then the compositor will apply its policy - usually
424    /// choosing the output on which the surface has the biggest surface
425    /// area.
426    ///
427    /// The client may specify a method to resolve a size conflict
428    /// between the output size and the surface size - this is provided
429    /// through the method parameter.
430    ///
431    /// The framerate parameter is used only when the method is set
432    /// to "driver", to indicate the preferred framerate. A value of 0
433    /// indicates that the client does not care about framerate.  The
434    /// framerate is specified in mHz, that is framerate of 60000 is 60Hz.
435    ///
436    /// A method of "scale" or "driver" implies a scaling operation of
437    /// the surface, either via a direct scaling operation or a change of
438    /// the output mode. This will override any kind of output scaling, so
439    /// that mapping a surface with a buffer size equal to the mode can
440    /// fill the screen independent of buffer_scale.
441    ///
442    /// A method of "fill" means we don't scale up the buffer, however
443    /// any output scale is applied. This means that you may run into
444    /// an edge case where the application maps a buffer with the same
445    /// size of the output mode but buffer_scale 1 (thus making a
446    /// surface larger than the output). In this case it is allowed to
447    /// downscale the results to fit the screen.
448    ///
449    /// The compositor must reply to this request with a configure event
450    /// with the dimensions for the output on which the surface will
451    /// be made fullscreen.
452    ///
453    /// # Arguments
454    ///
455    /// - `method`: method for resolving size conflict
456    /// - `framerate`: framerate in mHz
457    /// - `output`: output on which the surface is to be fullscreen
458    #[inline]
459    pub fn set_fullscreen(
460        &self,
461        method: WlShellSurfaceFullscreenMethod,
462        framerate: u32,
463        output: Option<&WlOutputRef>,
464    ) {
465        let (arg0, arg1, arg2) = (method, framerate, output);
466        let obj2_lock = arg2.map(|arg2| proxy::lock(arg2));
467        let obj2 = obj2_lock
468            .map(|obj2_lock| check_argument_proxy("output", obj2_lock.wl_proxy()))
469            .unwrap_or(ptr::null_mut());
470        let mut args = [
471            wl_argument { u: arg0.0 },
472            wl_argument { u: arg1 },
473            wl_argument { o: obj2 },
474        ];
475        // SAFETY: - self.proxy has the interface INTERFACE
476        //         - 5 < INTERFACE.method_count = 10
477        //         - the request signature is `uu?o`
478        unsafe {
479            self.proxy.send_request(5, &mut args);
480        }
481    }
482
483    /// make the surface a popup surface
484    ///
485    /// Map the surface as a popup.
486    ///
487    /// A popup surface is a transient surface with an added pointer
488    /// grab.
489    ///
490    /// An existing implicit grab will be changed to owner-events mode,
491    /// and the popup grab will continue after the implicit grab ends
492    /// (i.e. releasing the mouse button does not cause the popup to
493    /// be unmapped).
494    ///
495    /// The popup grab continues until the window is destroyed or a
496    /// mouse button is pressed in any other client's window. A click
497    /// in any of the client's surfaces is reported as normal, however,
498    /// clicks in other clients' surfaces will be discarded and trigger
499    /// the callback.
500    ///
501    /// The x and y arguments specify the location of the upper left
502    /// corner of the surface relative to the upper left corner of the
503    /// parent surface, in surface-local coordinates.
504    ///
505    /// # Arguments
506    ///
507    /// - `seat`: seat whose pointer is used
508    /// - `serial`: serial number of the implicit grab on the pointer
509    /// - `parent`: parent surface
510    /// - `x`: surface-local x coordinate
511    /// - `y`: surface-local y coordinate
512    /// - `flags`: transient surface behavior
513    #[inline]
514    pub fn set_popup(
515        &self,
516        seat: &WlSeatRef,
517        serial: u32,
518        parent: &WlSurfaceRef,
519        x: i32,
520        y: i32,
521        flags: WlShellSurfaceTransient,
522    ) {
523        let (arg0, arg1, arg2, arg3, arg4, arg5) = (seat, serial, parent, x, y, flags);
524        let obj0_lock = proxy::lock(arg0);
525        let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
526        let obj2_lock = proxy::lock(arg2);
527        let obj2 = check_argument_proxy("parent", obj2_lock.wl_proxy());
528        let mut args = [
529            wl_argument { o: obj0 },
530            wl_argument { u: arg1 },
531            wl_argument { o: obj2 },
532            wl_argument { i: arg3 },
533            wl_argument { i: arg4 },
534            wl_argument { u: arg5.0 },
535        ];
536        // SAFETY: - self.proxy has the interface INTERFACE
537        //         - 6 < INTERFACE.method_count = 10
538        //         - the request signature is `ouoiiu`
539        unsafe {
540            self.proxy.send_request(6, &mut args);
541        }
542    }
543
544    /// make the surface a maximized surface
545    ///
546    /// Map the surface as a maximized surface.
547    ///
548    /// If an output parameter is given then the surface will be
549    /// maximized on that output. If the client does not specify the
550    /// output then the compositor will apply its policy - usually
551    /// choosing the output on which the surface has the biggest surface
552    /// area.
553    ///
554    /// The compositor will reply with a configure event telling
555    /// the expected new surface size. The operation is completed
556    /// on the next buffer attach to this surface.
557    ///
558    /// A maximized surface typically fills the entire output it is
559    /// bound to, except for desktop elements such as panels. This is
560    /// the main difference between a maximized shell surface and a
561    /// fullscreen shell surface.
562    ///
563    /// The details depend on the compositor implementation.
564    ///
565    /// # Arguments
566    ///
567    /// - `output`: output on which the surface is to be maximized
568    #[inline]
569    pub fn set_maximized(&self, output: Option<&WlOutputRef>) {
570        let (arg0,) = (output,);
571        let obj0_lock = arg0.map(|arg0| proxy::lock(arg0));
572        let obj0 = obj0_lock
573            .map(|obj0_lock| check_argument_proxy("output", obj0_lock.wl_proxy()))
574            .unwrap_or(ptr::null_mut());
575        let mut args = [wl_argument { o: obj0 }];
576        // SAFETY: - self.proxy has the interface INTERFACE
577        //         - 7 < INTERFACE.method_count = 10
578        //         - the request signature is `?o`
579        unsafe {
580            self.proxy.send_request(7, &mut args);
581        }
582    }
583
584    /// set surface title
585    ///
586    /// Set a short title for the surface.
587    ///
588    /// This string may be used to identify the surface in a task bar,
589    /// window list, or other user interface elements provided by the
590    /// compositor.
591    ///
592    /// The string must be encoded in UTF-8.
593    ///
594    /// # Arguments
595    ///
596    /// - `title`: surface title
597    #[inline]
598    pub fn set_title(&self, title: &str) {
599        let (arg0,) = (title,);
600        with_cstr_cache(|cache| {
601            let str0_offset = cache.len();
602            cache.extend_from_slice(arg0.as_bytes());
603            cache.push(0);
604            let str0 = cache[str0_offset..].as_ptr().cast();
605            let mut args = [wl_argument { s: str0 }];
606            // SAFETY: - self.proxy has the interface INTERFACE
607            //         - 8 < INTERFACE.method_count = 10
608            //         - the request signature is `s`
609            unsafe {
610                self.proxy.send_request(8, &mut args);
611            }
612        })
613    }
614
615    /// set surface class
616    ///
617    /// Set a class for the surface.
618    ///
619    /// The surface class identifies the general class of applications
620    /// to which the surface belongs. A common convention is to use the
621    /// file name (or the full path if it is a non-standard location) of
622    /// the application's .desktop file as the class.
623    ///
624    /// # Arguments
625    ///
626    /// - `class_`: surface class
627    #[inline]
628    pub fn set_class(&self, class_: &str) {
629        let (arg0,) = (class_,);
630        with_cstr_cache(|cache| {
631            let str0_offset = cache.len();
632            cache.extend_from_slice(arg0.as_bytes());
633            cache.push(0);
634            let str0 = cache[str0_offset..].as_ptr().cast();
635            let mut args = [wl_argument { s: str0 }];
636            // SAFETY: - self.proxy has the interface INTERFACE
637            //         - 9 < INTERFACE.method_count = 10
638            //         - the request signature is `s`
639            unsafe {
640                self.proxy.send_request(9, &mut args);
641            }
642        })
643    }
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/get-registry/../common/protocols/wayland/wl_display.rs (line 243)
235    pub fn sync(&self, _queue: &Queue) -> WlCallback {
236        let mut args = [wl_argument { n: 0 }];
237        // SAFETY: - self.proxy has the interface INTERFACE
238        //         - 0 < INTERFACE.method_count = 2
239        //         - the request signature is `n`
240        //         - OwnedProxy::WL_INTERFACE is always a valid interface
241        let data = unsafe {
242            self.proxy
243                .send_constructor(_queue, 0, &mut args, WlCallback::WL_INTERFACE, None)
244        };
245        // SAFETY: data has the interface WlCallback::WL_INTERFACE
246        unsafe { proxy::low_level::from_untyped_owned(data) }
247    }
248
249    /// get global registry object
250    ///
251    /// This request creates a registry object that allows the client
252    /// to list and bind the global objects available from the
253    /// compositor.
254    ///
255    /// It should be noted that the server side resources consumed in
256    /// response to a get_registry request can only be released when the
257    /// client disconnects, not when the client side proxy is destroyed.
258    /// Therefore, clients should invoke get_registry as infrequently as
259    /// possible to avoid wasting memory.
260    ///
261    /// # Arguments
262    ///
263    /// - `_queue`: The queue that the returned proxy is assigned to.
264    #[inline]
265    pub fn get_registry(&self, _queue: &Queue) -> WlRegistry {
266        let mut args = [wl_argument { n: 0 }];
267        // SAFETY: - self.proxy has the interface INTERFACE
268        //         - 1 < INTERFACE.method_count = 2
269        //         - the request signature is `n`
270        //         - OwnedProxy::WL_INTERFACE is always a valid interface
271        let data = unsafe {
272            self.proxy
273                .send_constructor(_queue, 1, &mut args, WlRegistry::WL_INTERFACE, None)
274        };
275        // SAFETY: data has the interface WlRegistry::WL_INTERFACE
276        unsafe { proxy::low_level::from_untyped_owned(data) }
277    }
More examples
Hide additional examples
examples/get-registry/../common/protocols_data/wayland/wl_display.rs (line 243)
235    pub fn sync(&self, _queue: &Queue) -> WlCallback {
236        let mut args = [wl_argument { n: 0 }];
237        // SAFETY: - self.proxy has the interface INTERFACE
238        //         - 0 < INTERFACE.method_count = 2
239        //         - the request signature is `n`
240        //         - OwnedProxy::WL_INTERFACE is always a valid interface
241        let data = unsafe {
242            self.proxy
243                .send_constructor(_queue, 0, &mut args, WlCallback::WL_INTERFACE, None)
244        };
245        // SAFETY: data has the interface WlCallback::WL_INTERFACE
246        unsafe { proxy::low_level::from_untyped_owned(data) }
247    }
248
249    /// get global registry object
250    ///
251    /// This request creates a registry object that allows the client
252    /// to list and bind the global objects available from the
253    /// compositor.
254    ///
255    /// It should be noted that the server side resources consumed in
256    /// response to a get_registry request can only be released when the
257    /// client disconnects, not when the client side proxy is destroyed.
258    /// Therefore, clients should invoke get_registry as infrequently as
259    /// possible to avoid wasting memory.
260    ///
261    /// # Arguments
262    ///
263    /// - `_queue`: The queue that the returned proxy is assigned to.
264    #[inline]
265    pub fn get_registry(&self, _queue: &Queue) -> WlRegistry {
266        let mut args = [wl_argument { n: 0 }];
267        // SAFETY: - self.proxy has the interface INTERFACE
268        //         - 1 < INTERFACE.method_count = 2
269        //         - the request signature is `n`
270        //         - OwnedProxy::WL_INTERFACE is always a valid interface
271        let data = unsafe {
272            self.proxy
273                .send_constructor(_queue, 1, &mut args, WlRegistry::WL_INTERFACE, None)
274        };
275        // SAFETY: data has the interface WlRegistry::WL_INTERFACE
276        unsafe { proxy::low_level::from_untyped_owned(data) }
277    }
examples/get-registry/../common/protocols/wayland/wl_surface.rs (line 580)
572    pub fn frame(&self, _queue: &Queue) -> WlCallback {
573        let mut args = [wl_argument { n: 0 }];
574        // SAFETY: - self.proxy has the interface INTERFACE
575        //         - 3 < INTERFACE.method_count = 11
576        //         - the request signature is `n`
577        //         - OwnedProxy::WL_INTERFACE is always a valid interface
578        let data = unsafe {
579            self.proxy
580                .send_constructor(_queue, 3, &mut args, WlCallback::WL_INTERFACE, None)
581        };
582        // SAFETY: data has the interface WlCallback::WL_INTERFACE
583        unsafe { proxy::low_level::from_untyped_owned(data) }
584    }
examples/get-registry/../common/protocols_data/wayland/wl_surface.rs (line 580)
572    pub fn frame(&self, _queue: &Queue) -> WlCallback {
573        let mut args = [wl_argument { n: 0 }];
574        // SAFETY: - self.proxy has the interface INTERFACE
575        //         - 3 < INTERFACE.method_count = 11
576        //         - the request signature is `n`
577        //         - OwnedProxy::WL_INTERFACE is always a valid interface
578        let data = unsafe {
579            self.proxy
580                .send_constructor(_queue, 3, &mut args, WlCallback::WL_INTERFACE, None)
581        };
582        // SAFETY: data has the interface WlCallback::WL_INTERFACE
583        unsafe { proxy::low_level::from_untyped_owned(data) }
584    }
examples/get-registry/../common/protocols/wayland/wl_seat.rs (line 303)
295    pub fn get_pointer(&self, _queue: &Queue) -> WlPointer {
296        let mut args = [wl_argument { n: 0 }];
297        // SAFETY: - self.proxy has the interface INTERFACE
298        //         - 0 < INTERFACE.method_count = 4
299        //         - the request signature is `n`
300        //         - OwnedProxy::WL_INTERFACE is always a valid interface
301        let data = unsafe {
302            self.proxy
303                .send_constructor(_queue, 0, &mut args, WlPointer::WL_INTERFACE, None)
304        };
305        // SAFETY: data has the interface WlPointer::WL_INTERFACE
306        unsafe { proxy::low_level::from_untyped_owned(data) }
307    }
308
309    /// return keyboard object
310    ///
311    /// The ID provided will be initialized to the wl_keyboard interface
312    /// for this seat.
313    ///
314    /// This request only takes effect if the seat has the keyboard
315    /// capability, or has had the keyboard capability in the past.
316    /// It is a protocol violation to issue this request on a seat that has
317    /// never had the keyboard capability. The missing_capability error will
318    /// be sent in this case.
319    ///
320    /// # Arguments
321    ///
322    /// - `_queue`: The queue that the returned proxy is assigned to.
323    #[inline]
324    pub fn get_keyboard(&self, _queue: &Queue) -> WlKeyboard {
325        let mut args = [wl_argument { n: 0 }];
326        // SAFETY: - self.proxy has the interface INTERFACE
327        //         - 1 < INTERFACE.method_count = 4
328        //         - the request signature is `n`
329        //         - OwnedProxy::WL_INTERFACE is always a valid interface
330        let data = unsafe {
331            self.proxy
332                .send_constructor(_queue, 1, &mut args, WlKeyboard::WL_INTERFACE, None)
333        };
334        // SAFETY: data has the interface WlKeyboard::WL_INTERFACE
335        unsafe { proxy::low_level::from_untyped_owned(data) }
336    }
337
338    /// return touch object
339    ///
340    /// The ID provided will be initialized to the wl_touch interface
341    /// for this seat.
342    ///
343    /// This request only takes effect if the seat has the touch
344    /// capability, or has had the touch capability in the past.
345    /// It is a protocol violation to issue this request on a seat that has
346    /// never had the touch capability. The missing_capability error will
347    /// be sent in this case.
348    ///
349    /// # Arguments
350    ///
351    /// - `_queue`: The queue that the returned proxy is assigned to.
352    #[inline]
353    pub fn get_touch(&self, _queue: &Queue) -> WlTouch {
354        let mut args = [wl_argument { n: 0 }];
355        // SAFETY: - self.proxy has the interface INTERFACE
356        //         - 2 < INTERFACE.method_count = 4
357        //         - the request signature is `n`
358        //         - OwnedProxy::WL_INTERFACE is always a valid interface
359        let data = unsafe {
360            self.proxy
361                .send_constructor(_queue, 2, &mut args, WlTouch::WL_INTERFACE, None)
362        };
363        // SAFETY: data has the interface WlTouch::WL_INTERFACE
364        unsafe { proxy::low_level::from_untyped_owned(data) }
365    }
examples/get-registry/../common/protocols_data/wayland/wl_seat.rs (line 303)
295    pub fn get_pointer(&self, _queue: &Queue) -> WlPointer {
296        let mut args = [wl_argument { n: 0 }];
297        // SAFETY: - self.proxy has the interface INTERFACE
298        //         - 0 < INTERFACE.method_count = 4
299        //         - the request signature is `n`
300        //         - OwnedProxy::WL_INTERFACE is always a valid interface
301        let data = unsafe {
302            self.proxy
303                .send_constructor(_queue, 0, &mut args, WlPointer::WL_INTERFACE, None)
304        };
305        // SAFETY: data has the interface WlPointer::WL_INTERFACE
306        unsafe { proxy::low_level::from_untyped_owned(data) }
307    }
308
309    /// return keyboard object
310    ///
311    /// The ID provided will be initialized to the wl_keyboard interface
312    /// for this seat.
313    ///
314    /// This request only takes effect if the seat has the keyboard
315    /// capability, or has had the keyboard capability in the past.
316    /// It is a protocol violation to issue this request on a seat that has
317    /// never had the keyboard capability. The missing_capability error will
318    /// be sent in this case.
319    ///
320    /// # Arguments
321    ///
322    /// - `_queue`: The queue that the returned proxy is assigned to.
323    #[inline]
324    pub fn get_keyboard(&self, _queue: &Queue) -> WlKeyboard {
325        let mut args = [wl_argument { n: 0 }];
326        // SAFETY: - self.proxy has the interface INTERFACE
327        //         - 1 < INTERFACE.method_count = 4
328        //         - the request signature is `n`
329        //         - OwnedProxy::WL_INTERFACE is always a valid interface
330        let data = unsafe {
331            self.proxy
332                .send_constructor(_queue, 1, &mut args, WlKeyboard::WL_INTERFACE, None)
333        };
334        // SAFETY: data has the interface WlKeyboard::WL_INTERFACE
335        unsafe { proxy::low_level::from_untyped_owned(data) }
336    }
337
338    /// return touch object
339    ///
340    /// The ID provided will be initialized to the wl_touch interface
341    /// for this seat.
342    ///
343    /// This request only takes effect if the seat has the touch
344    /// capability, or has had the touch capability in the past.
345    /// It is a protocol violation to issue this request on a seat that has
346    /// never had the touch capability. The missing_capability error will
347    /// be sent in this case.
348    ///
349    /// # Arguments
350    ///
351    /// - `_queue`: The queue that the returned proxy is assigned to.
352    #[inline]
353    pub fn get_touch(&self, _queue: &Queue) -> WlTouch {
354        let mut args = [wl_argument { n: 0 }];
355        // SAFETY: - self.proxy has the interface INTERFACE
356        //         - 2 < INTERFACE.method_count = 4
357        //         - the request signature is `n`
358        //         - OwnedProxy::WL_INTERFACE is always a valid interface
359        let data = unsafe {
360            self.proxy
361                .send_constructor(_queue, 2, &mut args, WlTouch::WL_INTERFACE, None)
362        };
363        // SAFETY: data has the interface WlTouch::WL_INTERFACE
364        unsafe { proxy::low_level::from_untyped_owned(data) }
365    }
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 duplicate of the value. Read more
1.0.0 (const: unstable) · 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§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Eq for UntypedOwnedProxy

Source§

impl PartialEq for UntypedOwnedProxy

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialEq<UntypedBorrowedProxy> for UntypedOwnedProxy

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialEq<UntypedOwnedProxy> for UntypedBorrowedProxy

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UntypedOwnedProxy

Source§

impl UntypedOwnedProxyWrapper for UntypedOwnedProxy

Auto Trait Implementations§

§

impl !RefUnwindSafe for UntypedOwnedProxy

§

impl !UnwindSafe for UntypedOwnedProxy

§

impl Forget for UntypedOwnedProxy

§

impl Freeze for UntypedOwnedProxy
where *const UntypedOwnedProxyData is !null: Freeze,

§

impl Move for UntypedOwnedProxy

§

impl Send for UntypedOwnedProxy
where SyncNonNull<UntypedOwnedProxyData>: Send,

§

impl Sync for UntypedOwnedProxy
where SyncNonNull<UntypedOwnedProxyData>: Sync,

§

impl Unpin for UntypedOwnedProxy
where *const UntypedOwnedProxyData is !null: Unpin,

§

impl UnsafeUnpin for UntypedOwnedProxy
where *const UntypedOwnedProxyData is !null: UnsafeUnpin,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.