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/simple-window/../common/protocols/tablet_v2/zwp_tablet_seat_v2.rs (lines 265-269)
247    unsafe fn handle_event(
248        &self,
249        queue: &Queue,
250        data: *mut u8,
251        slf: &UntypedBorrowedProxy,
252        opcode: u32,
253        args: *mut wl_argument,
254    ) {
255        // SAFETY: This function requires that slf has the interface INTERFACE
256        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletSeatV2Ref>(slf) };
257        match opcode {
258            0 => {
259                // SAFETY: INTERFACE requires that there are 1 arguments
260                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
261                // SAFETY: - INTERFACE requires that args[0] contains an object
262                //         - ownership is transferred to this function
263                //         - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
264                let arg0 = unsafe {
265                    UntypedOwnedProxy::from_plain_wl_proxy(
266                        queue,
267                        NonNull::new_unchecked(args[0].o.cast()),
268                        ZwpTabletV2::WL_INTERFACE,
269                    )
270                };
271                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
272                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletV2>(arg0) };
273                self.0.tablet_added(slf, arg0);
274            }
275            1 => {
276                // SAFETY: INTERFACE requires that there are 1 arguments
277                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
278                // SAFETY: - INTERFACE requires that args[0] contains an object
279                //         - ownership is transferred to this function
280                //         - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
281                let arg0 = unsafe {
282                    UntypedOwnedProxy::from_plain_wl_proxy(
283                        queue,
284                        NonNull::new_unchecked(args[0].o.cast()),
285                        ZwpTabletToolV2::WL_INTERFACE,
286                    )
287                };
288                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
289                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletToolV2>(arg0) };
290                self.0.tool_added(slf, arg0);
291            }
292            2 => {
293                // SAFETY: INTERFACE requires that there are 1 arguments
294                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
295                // SAFETY: - INTERFACE requires that args[0] contains an object
296                //         - ownership is transferred to this function
297                //         - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
298                let arg0 = unsafe {
299                    UntypedOwnedProxy::from_plain_wl_proxy(
300                        queue,
301                        NonNull::new_unchecked(args[0].o.cast()),
302                        ZwpTabletPadV2::WL_INTERFACE,
303                    )
304                };
305                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
306                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadV2>(arg0) };
307                self.0.pad_added(slf, arg0);
308            }
309            _ => {
310                invalid_opcode("zwp_tablet_seat_v2", opcode);
311            }
312        }
313    }
More examples
Hide additional examples
examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_seat_v2.rs (lines 281-285)
259    unsafe fn handle_event(
260        &self,
261        queue: &Queue,
262        data: *mut u8,
263        slf: &UntypedBorrowedProxy,
264        opcode: u32,
265        args: *mut wl_argument,
266    ) {
267        // SAFETY: This function requires that slf has the interface INTERFACE
268        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletSeatV2Ref>(slf) };
269        // SAFETY: This function requires that data is `&mut T` where `T`
270        //         has the type id returned by `Self::mutable_type`, i.e.,
271        //         `T = H::Data`.
272        let data: &mut H::Data = unsafe { &mut *data.cast() };
273        match opcode {
274            0 => {
275                // SAFETY: INTERFACE requires that there are 1 arguments
276                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
277                // SAFETY: - INTERFACE requires that args[0] contains an object
278                //         - ownership is transferred to this function
279                //         - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
280                let arg0 = unsafe {
281                    UntypedOwnedProxy::from_plain_wl_proxy(
282                        queue,
283                        NonNull::new_unchecked(args[0].o.cast()),
284                        ZwpTabletV2::WL_INTERFACE,
285                    )
286                };
287                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletV2::WL_INTERFACE
288                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletV2>(arg0) };
289                self.0.tablet_added(data, slf, arg0);
290            }
291            1 => {
292                // SAFETY: INTERFACE requires that there are 1 arguments
293                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
294                // SAFETY: - INTERFACE requires that args[0] contains an object
295                //         - ownership is transferred to this function
296                //         - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
297                let arg0 = unsafe {
298                    UntypedOwnedProxy::from_plain_wl_proxy(
299                        queue,
300                        NonNull::new_unchecked(args[0].o.cast()),
301                        ZwpTabletToolV2::WL_INTERFACE,
302                    )
303                };
304                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletToolV2::WL_INTERFACE
305                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletToolV2>(arg0) };
306                self.0.tool_added(data, slf, arg0);
307            }
308            2 => {
309                // SAFETY: INTERFACE requires that there are 1 arguments
310                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
311                // SAFETY: - INTERFACE requires that args[0] contains an object
312                //         - ownership is transferred to this function
313                //         - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
314                let arg0 = unsafe {
315                    UntypedOwnedProxy::from_plain_wl_proxy(
316                        queue,
317                        NonNull::new_unchecked(args[0].o.cast()),
318                        ZwpTabletPadV2::WL_INTERFACE,
319                    )
320                };
321                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadV2::WL_INTERFACE
322                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadV2>(arg0) };
323                self.0.pad_added(data, slf, arg0);
324            }
325            _ => {
326                invalid_opcode("zwp_tablet_seat_v2", opcode);
327            }
328        }
329    }
examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_group_v2.rs (lines 406-410)
378    unsafe fn handle_event(
379        &self,
380        queue: &Queue,
381        data: *mut u8,
382        slf: &UntypedBorrowedProxy,
383        opcode: u32,
384        args: *mut wl_argument,
385    ) {
386        // SAFETY: This function requires that slf has the interface INTERFACE
387        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadGroupV2Ref>(slf) };
388        match opcode {
389            0 => {
390                // SAFETY: INTERFACE requires that there are 1 arguments
391                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
392                // SAFETY: - INTERFACE requires that args[0] contains an array
393                let arg0 = unsafe {
394                    let a = &*args[0].a;
395                    std::slice::from_raw_parts(a.data.cast(), a.size)
396                };
397                self.0.buttons(slf, arg0);
398            }
399            1 => {
400                // SAFETY: INTERFACE requires that there are 1 arguments
401                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
402                // SAFETY: - INTERFACE requires that args[0] contains an object
403                //         - ownership is transferred to this function
404                //         - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
405                let arg0 = unsafe {
406                    UntypedOwnedProxy::from_plain_wl_proxy(
407                        queue,
408                        NonNull::new_unchecked(args[0].o.cast()),
409                        ZwpTabletPadRingV2::WL_INTERFACE,
410                    )
411                };
412                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
413                let arg0 =
414                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadRingV2>(arg0) };
415                self.0.ring(slf, arg0);
416            }
417            2 => {
418                // SAFETY: INTERFACE requires that there are 1 arguments
419                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
420                // SAFETY: - INTERFACE requires that args[0] contains an object
421                //         - ownership is transferred to this function
422                //         - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
423                let arg0 = unsafe {
424                    UntypedOwnedProxy::from_plain_wl_proxy(
425                        queue,
426                        NonNull::new_unchecked(args[0].o.cast()),
427                        ZwpTabletPadStripV2::WL_INTERFACE,
428                    )
429                };
430                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
431                let arg0 =
432                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadStripV2>(arg0) };
433                self.0.strip(slf, arg0);
434            }
435            3 => {
436                // SAFETY: INTERFACE requires that there are 1 arguments
437                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
438                // SAFETY: - INTERFACE requires that args[0] contains a uint
439                let arg0 = unsafe { args[0].u };
440                self.0.modes(slf, arg0);
441            }
442            4 => {
443                self.0.done(slf);
444            }
445            5 => {
446                // SAFETY: INTERFACE requires that there are 3 arguments
447                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
448                // SAFETY: - INTERFACE requires that args[0] contains a uint
449                let arg0 = unsafe { args[0].u };
450                // SAFETY: - INTERFACE requires that args[1] contains a uint
451                let arg1 = unsafe { args[1].u };
452                // SAFETY: - INTERFACE requires that args[2] contains a uint
453                let arg2 = unsafe { args[2].u };
454                self.0.mode_switch(slf, arg0, arg1, arg2);
455            }
456            _ => {
457                invalid_opcode("zwp_tablet_pad_group_v2", opcode);
458            }
459        }
460    }
examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_group_v2.rs (lines 439-443)
407    unsafe fn handle_event(
408        &self,
409        queue: &Queue,
410        data: *mut u8,
411        slf: &UntypedBorrowedProxy,
412        opcode: u32,
413        args: *mut wl_argument,
414    ) {
415        // SAFETY: This function requires that slf has the interface INTERFACE
416        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadGroupV2Ref>(slf) };
417        // SAFETY: This function requires that data is `&mut T` where `T`
418        //         has the type id returned by `Self::mutable_type`, i.e.,
419        //         `T = H::Data`.
420        let data: &mut H::Data = unsafe { &mut *data.cast() };
421        match opcode {
422            0 => {
423                // SAFETY: INTERFACE requires that there are 1 arguments
424                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
425                // SAFETY: - INTERFACE requires that args[0] contains an array
426                let arg0 = unsafe {
427                    let a = &*args[0].a;
428                    std::slice::from_raw_parts(a.data.cast(), a.size)
429                };
430                self.0.buttons(data, slf, arg0);
431            }
432            1 => {
433                // SAFETY: INTERFACE requires that there are 1 arguments
434                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
435                // SAFETY: - INTERFACE requires that args[0] contains an object
436                //         - ownership is transferred to this function
437                //         - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
438                let arg0 = unsafe {
439                    UntypedOwnedProxy::from_plain_wl_proxy(
440                        queue,
441                        NonNull::new_unchecked(args[0].o.cast()),
442                        ZwpTabletPadRingV2::WL_INTERFACE,
443                    )
444                };
445                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadRingV2::WL_INTERFACE
446                let arg0 =
447                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadRingV2>(arg0) };
448                self.0.ring(data, slf, arg0);
449            }
450            2 => {
451                // SAFETY: INTERFACE requires that there are 1 arguments
452                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
453                // SAFETY: - INTERFACE requires that args[0] contains an object
454                //         - ownership is transferred to this function
455                //         - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
456                let arg0 = unsafe {
457                    UntypedOwnedProxy::from_plain_wl_proxy(
458                        queue,
459                        NonNull::new_unchecked(args[0].o.cast()),
460                        ZwpTabletPadStripV2::WL_INTERFACE,
461                    )
462                };
463                // SAFETY: - INTERFACE requires that the object has the interface ZwpTabletPadStripV2::WL_INTERFACE
464                let arg0 =
465                    unsafe { proxy::low_level::from_untyped_owned::<ZwpTabletPadStripV2>(arg0) };
466                self.0.strip(data, slf, arg0);
467            }
468            3 => {
469                // SAFETY: INTERFACE requires that there are 1 arguments
470                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
471                // SAFETY: - INTERFACE requires that args[0] contains a uint
472                let arg0 = unsafe { args[0].u };
473                self.0.modes(data, slf, arg0);
474            }
475            4 => {
476                self.0.done(data, slf);
477            }
478            5 => {
479                // SAFETY: INTERFACE requires that there are 3 arguments
480                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
481                // SAFETY: - INTERFACE requires that args[0] contains a uint
482                let arg0 = unsafe { args[0].u };
483                // SAFETY: - INTERFACE requires that args[1] contains a uint
484                let arg1 = unsafe { args[1].u };
485                // SAFETY: - INTERFACE requires that args[2] contains a uint
486                let arg2 = unsafe { args[2].u };
487                self.0.mode_switch(data, slf, arg0, arg1, arg2);
488            }
489            _ => {
490                invalid_opcode("zwp_tablet_pad_group_v2", opcode);
491            }
492        }
493    }
examples/simple-window/../common/protocols/wayland/wl_data_device.rs (lines 508-512)
490    unsafe fn handle_event(
491        &self,
492        queue: &Queue,
493        data: *mut u8,
494        slf: &UntypedBorrowedProxy,
495        opcode: u32,
496        args: *mut wl_argument,
497    ) {
498        // SAFETY: This function requires that slf has the interface INTERFACE
499        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
500        match opcode {
501            0 => {
502                // SAFETY: INTERFACE requires that there are 1 arguments
503                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
504                // SAFETY: - INTERFACE requires that args[0] contains an object
505                //         - ownership is transferred to this function
506                //         - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
507                let arg0 = unsafe {
508                    UntypedOwnedProxy::from_plain_wl_proxy(
509                        queue,
510                        NonNull::new_unchecked(args[0].o.cast()),
511                        WlDataOffer::WL_INTERFACE,
512                    )
513                };
514                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
515                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
516                self.0.data_offer(slf, arg0);
517            }
518            1 => {
519                // SAFETY: INTERFACE requires that there are 5 arguments
520                let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
521                // SAFETY: - INTERFACE requires that args[0] contains a uint
522                let arg0 = unsafe { args[0].u };
523                // SAFETY: - INTERFACE requires that args[1] contains an object
524                let arg1 = unsafe {
525                    if let Some(p) = NonNull::new(args[1].o.cast()) {
526                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
527                    } else {
528                        None
529                    }
530                };
531                // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
532                let arg1 = arg1.as_ref().map(|arg1| unsafe {
533                    proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
534                });
535                // SAFETY: - INTERFACE requires that args[2] contains a fixed
536                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
537                // SAFETY: - INTERFACE requires that args[3] contains a fixed
538                let arg3 = unsafe { Fixed::from_wire(args[3].f) };
539                // SAFETY: - INTERFACE requires that args[4] contains an object
540                let arg4 = unsafe {
541                    if let Some(p) = NonNull::new(args[4].o.cast()) {
542                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
543                    } else {
544                        None
545                    }
546                };
547                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
548                let arg4 = arg4.as_ref().map(|arg4| unsafe {
549                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
550                });
551                self.0.enter(slf, arg0, arg1, arg2, arg3, arg4);
552            }
553            2 => {
554                self.0.leave(slf);
555            }
556            3 => {
557                // SAFETY: INTERFACE requires that there are 3 arguments
558                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
559                // SAFETY: - INTERFACE requires that args[0] contains a uint
560                let arg0 = unsafe { args[0].u };
561                // SAFETY: - INTERFACE requires that args[1] contains a fixed
562                let arg1 = unsafe { Fixed::from_wire(args[1].f) };
563                // SAFETY: - INTERFACE requires that args[2] contains a fixed
564                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
565                self.0.motion(slf, arg0, arg1, arg2);
566            }
567            4 => {
568                self.0.drop(slf);
569            }
570            5 => {
571                // SAFETY: INTERFACE requires that there are 1 arguments
572                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
573                // SAFETY: - INTERFACE requires that args[0] contains an object
574                let arg0 = unsafe {
575                    if let Some(p) = NonNull::new(args[0].o.cast()) {
576                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
577                    } else {
578                        None
579                    }
580                };
581                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
582                let arg0 = arg0.as_ref().map(|arg0| unsafe {
583                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
584                });
585                self.0.selection(slf, arg0);
586            }
587            _ => {
588                invalid_opcode("wl_data_device", opcode);
589            }
590        }
591    }
examples/simple-window/../common/protocols_data/wayland/wl_data_device.rs (lines 537-541)
515    unsafe fn handle_event(
516        &self,
517        queue: &Queue,
518        data: *mut u8,
519        slf: &UntypedBorrowedProxy,
520        opcode: u32,
521        args: *mut wl_argument,
522    ) {
523        // SAFETY: This function requires that slf has the interface INTERFACE
524        let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
525        // SAFETY: This function requires that data is `&mut T` where `T`
526        //         has the type id returned by `Self::mutable_type`, i.e.,
527        //         `T = H::Data`.
528        let data: &mut H::Data = unsafe { &mut *data.cast() };
529        match opcode {
530            0 => {
531                // SAFETY: INTERFACE requires that there are 1 arguments
532                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
533                // SAFETY: - INTERFACE requires that args[0] contains an object
534                //         - ownership is transferred to this function
535                //         - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
536                let arg0 = unsafe {
537                    UntypedOwnedProxy::from_plain_wl_proxy(
538                        queue,
539                        NonNull::new_unchecked(args[0].o.cast()),
540                        WlDataOffer::WL_INTERFACE,
541                    )
542                };
543                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
544                let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
545                self.0.data_offer(data, slf, arg0);
546            }
547            1 => {
548                // SAFETY: INTERFACE requires that there are 5 arguments
549                let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
550                // SAFETY: - INTERFACE requires that args[0] contains a uint
551                let arg0 = unsafe { args[0].u };
552                // SAFETY: - INTERFACE requires that args[1] contains an object
553                let arg1 = unsafe {
554                    if let Some(p) = NonNull::new(args[1].o.cast()) {
555                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
556                    } else {
557                        None
558                    }
559                };
560                // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
561                let arg1 = arg1.as_ref().map(|arg1| unsafe {
562                    proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
563                });
564                // SAFETY: - INTERFACE requires that args[2] contains a fixed
565                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
566                // SAFETY: - INTERFACE requires that args[3] contains a fixed
567                let arg3 = unsafe { Fixed::from_wire(args[3].f) };
568                // SAFETY: - INTERFACE requires that args[4] contains an object
569                let arg4 = unsafe {
570                    if let Some(p) = NonNull::new(args[4].o.cast()) {
571                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
572                    } else {
573                        None
574                    }
575                };
576                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
577                let arg4 = arg4.as_ref().map(|arg4| unsafe {
578                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
579                });
580                self.0.enter(data, slf, arg0, arg1, arg2, arg3, arg4);
581            }
582            2 => {
583                self.0.leave(data, slf);
584            }
585            3 => {
586                // SAFETY: INTERFACE requires that there are 3 arguments
587                let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
588                // SAFETY: - INTERFACE requires that args[0] contains a uint
589                let arg0 = unsafe { args[0].u };
590                // SAFETY: - INTERFACE requires that args[1] contains a fixed
591                let arg1 = unsafe { Fixed::from_wire(args[1].f) };
592                // SAFETY: - INTERFACE requires that args[2] contains a fixed
593                let arg2 = unsafe { Fixed::from_wire(args[2].f) };
594                self.0.motion(data, slf, arg0, arg1, arg2);
595            }
596            4 => {
597                self.0.drop(data, slf);
598            }
599            5 => {
600                // SAFETY: INTERFACE requires that there are 1 arguments
601                let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
602                // SAFETY: - INTERFACE requires that args[0] contains an object
603                let arg0 = unsafe {
604                    if let Some(p) = NonNull::new(args[0].o.cast()) {
605                        Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
606                    } else {
607                        None
608                    }
609                };
610                // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
611                let arg0 = arg0.as_ref().map(|arg0| unsafe {
612                    proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
613                });
614                self.0.selection(data, slf, arg0);
615            }
616            _ => {
617                invalid_opcode("wl_data_device", opcode);
618            }
619        }
620    }
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/simple-window/../common/protocols/cursor_shape_v1/wp_cursor_shape_device_v1.rs (line 141)
135    pub fn destroy(&self) {
136        let mut args = [];
137        // SAFETY: - self.proxy has the interface INTERFACE
138        //         - 0 < INTERFACE.method_count = 2
139        //         - the request signature is ``
140        unsafe {
141            self.proxy.send_destructor(0, &mut args);
142        }
143    }
More examples
Hide additional examples
examples/simple-window/../common/protocols/cursor_shape_v1/wp_cursor_shape_manager_v1.rs (line 160)
154    pub fn destroy(&self) {
155        let mut args = [];
156        // SAFETY: - self.proxy has the interface INTERFACE
157        //         - 0 < INTERFACE.method_count = 3
158        //         - the request signature is ``
159        unsafe {
160            self.proxy.send_destructor(0, &mut args);
161        }
162    }
examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_manager_v2.rs (line 175)
169    pub fn destroy(&self) {
170        let mut args = [];
171        // SAFETY: - self.proxy has the interface INTERFACE
172        //         - 1 < INTERFACE.method_count = 2
173        //         - the request signature is ``
174        unsafe {
175            self.proxy.send_destructor(1, &mut args);
176        }
177    }
examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_group_v2.rs (line 204)
198    pub fn destroy(&self) {
199        let mut args = [];
200        // SAFETY: - self.proxy has the interface INTERFACE
201        //         - 0 < INTERFACE.method_count = 1
202        //         - the request signature is ``
203        unsafe {
204            self.proxy.send_destructor(0, &mut args);
205        }
206    }
examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_ring_v2.rs (line 179)
173    pub fn destroy(&self) {
174        let mut args = [];
175        // SAFETY: - self.proxy has the interface INTERFACE
176        //         - 1 < INTERFACE.method_count = 2
177        //         - the request signature is ``
178        unsafe {
179            self.proxy.send_destructor(1, &mut args);
180        }
181    }
examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_strip_v2.rs (line 179)
173    pub fn destroy(&self) {
174        let mut args = [];
175        // SAFETY: - self.proxy has the interface INTERFACE
176        //         - 1 < INTERFACE.method_count = 2
177        //         - the request signature is ``
178        unsafe {
179            self.proxy.send_destructor(1, &mut args);
180        }
181    }
Source

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

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

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

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

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

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

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

Performs copy-assignment from source. Read more
Source§

impl Deref for UntypedOwnedProxy

Source§

type Target = UntypedBorrowedProxy

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl Drop for UntypedOwnedProxy

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq<UntypedBorrowedProxy> for UntypedOwnedProxy

Source§

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

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

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

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

impl PartialEq<UntypedOwnedProxy> for UntypedBorrowedProxy

Source§

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

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

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

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

impl PartialEq for UntypedOwnedProxy

Source§

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

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

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

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

impl Eq for UntypedOwnedProxy

Source§

impl StructuralPartialEq for UntypedOwnedProxy

Source§

impl UntypedOwnedProxyWrapper for UntypedOwnedProxy

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

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

The negation of eq
Source§

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

The negation of ne
Source§

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

Source§

type Target = T

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

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.