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
impl UntypedOwnedProxy
Sourcepub unsafe fn from_plain_wl_proxy(
queue: &Queue,
proxy: NonNull<wl_proxy>,
interface: &'static wl_interface,
) -> Self
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
proxymust be a valid pointer to a plainwl_proxy.proxymust remain valid for the lifetime of this object and its clones.proxymust not have an event handler or dispatcher assigned.queuemust be the queue of the proxy.interfacemust be the interface of the proxy.
Examples found in repository?
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
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 }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 }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 }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 }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 }Sourcepub unsafe fn from_wrapper_wl_proxy(
queue: &Queue,
proxy: NonNull<wl_proxy>,
) -> Self
pub unsafe fn from_wrapper_wl_proxy( queue: &Queue, proxy: NonNull<wl_proxy>, ) -> Self
Creates a new UntypedOwnedProxy from a wrapper wl_proxy.
§Safety
proxymust be a valid pointer to a wrapperwl_proxy.proxymust remain valid for the lifetime of this object and its clones.queuemust be the queue of the proxy.
Sourcepub unsafe fn send_destructor(&self, opcode: u32, args: &mut [wl_argument])
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
opcodemust be a valid request opcode for the interface of the proxy.argsmust conform to the interface + opcode of the proxy.argsmust not contain anynew_idelement.
Examples found in repository?
More examples
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_seat_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_tool_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_v2.rs
- examples/simple-window/../common/protocols/viewporter/wp_viewport.rs
- examples/simple-window/../common/protocols/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols/wayland/wl_buffer.rs
- examples/simple-window/../common/protocols/wayland/wl_data_device.rs
- examples/simple-window/../common/protocols/wayland/wl_data_offer.rs
- examples/simple-window/../common/protocols/wayland/wl_data_source.rs
- examples/simple-window/../common/protocols/wayland/wl_fixes.rs
- examples/simple-window/../common/protocols/wayland/wl_keyboard.rs
- examples/simple-window/../common/protocols/wayland/wl_output.rs
- examples/simple-window/../common/protocols/wayland/wl_pointer.rs
- examples/simple-window/../common/protocols/wayland/wl_region.rs
- examples/simple-window/../common/protocols/wayland/wl_seat.rs
- examples/simple-window/../common/protocols/wayland/wl_shm.rs
- examples/simple-window/../common/protocols/wayland/wl_shm_pool.rs
- examples/simple-window/../common/protocols/wayland/wl_subcompositor.rs
- examples/simple-window/../common/protocols/wayland/wl_subsurface.rs
- examples/simple-window/../common/protocols/wayland/wl_touch.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_popup.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_wm_base.rs
- examples/simple-window/../common/protocols_data/cursor_shape_v1/wp_cursor_shape_device_v1.rs
- examples/simple-window/../common/protocols_data/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_manager_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_group_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_ring_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_strip_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_seat_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_tool_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_v2.rs
- examples/simple-window/../common/protocols_data/viewporter/wp_viewport.rs
- examples/simple-window/../common/protocols_data/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols_data/wayland/wl_buffer.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_device.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_offer.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_source.rs
- examples/simple-window/../common/protocols_data/wayland/wl_fixes.rs
- examples/simple-window/../common/protocols_data/wayland/wl_keyboard.rs
- examples/simple-window/../common/protocols_data/wayland/wl_output.rs
- examples/simple-window/../common/protocols_data/wayland/wl_pointer.rs
- examples/simple-window/../common/protocols_data/wayland/wl_region.rs
- examples/simple-window/../common/protocols_data/wayland/wl_seat.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shm.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shm_pool.rs
- examples/simple-window/../common/protocols_data/wayland/wl_subcompositor.rs
- examples/simple-window/../common/protocols_data/wayland/wl_subsurface.rs
- examples/simple-window/../common/protocols_data/wayland/wl_touch.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_popup.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_wm_base.rs
- examples/simple-window/../common/protocols/wayland/wl_surface.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_positioner.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_toplevel.rs
- examples/simple-window/../common/protocols_data/wayland/wl_surface.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_positioner.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_toplevel.rs
Sourcepub unsafe fn send_constructor<const DESTROY: bool>(
&self,
opcode: u32,
args: &mut [wl_argument],
interface: &'static wl_interface,
version: Option<u32>,
) -> Self
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
opcodemust be a valid request opcode for the interface of the proxy.argsmust conform to the interface + opcode of the proxy.argsmust contain exactly onenew_idelement.interfacemust be a validwl_interface.
Examples found in repository?
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
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 }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 }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 }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 }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/wayland/wl_compositor.rs
- examples/simple-window/../common/protocols_data/wayland/wl_compositor.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols/wayland/wl_data_device_manager.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_device_manager.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_wm_base.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_wm_base.rs
- examples/simple-window/../common/protocols/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols_data/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols/wayland/wl_shm.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shm.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_manager_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_manager_v2.rs
- examples/simple-window/../common/protocols/wayland/wl_shell.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shell.rs
- examples/simple-window/../common/protocols/wayland/wl_registry.rs
- examples/simple-window/../common/protocols_data/wayland/wl_registry.rs
- examples/simple-window/../common/protocols/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
- examples/simple-window/../common/protocols_data/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
- examples/simple-window/../common/protocols/wayland/wl_shm_pool.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shm_pool.rs
- examples/simple-window/../common/protocols/wayland/wl_subcompositor.rs
- examples/simple-window/../common/protocols_data/wayland/wl_subcompositor.rs
Sourcepub fn queue(&self) -> &Queue
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.
Sourcepub fn destroy(&self)
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>§
Sourcepub fn lock(&self) -> BorrowedProxyLock<'_>
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.
Sourcepub fn wl_proxy(&self) -> Option<NonNull<wl_proxy>>
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.
Sourcepub fn id(&self) -> u32
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?
More examples
- examples/simple-window/../common/protocols/wayland/wl_touch.rs
- examples/simple-window/../common/protocols_data/wayland/wl_fixes.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shell.rs
- examples/simple-window/../common/protocols_data/wayland/wl_touch.rs
- examples/simple-window/../common/protocols/wayland/wl_buffer.rs
- examples/simple-window/../common/protocols/wayland/wl_output.rs
- examples/simple-window/../common/protocols/wayland/wl_region.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_popup.rs
- examples/simple-window/../common/protocols_data/wayland/wl_buffer.rs
- examples/simple-window/../common/protocols_data/wayland/wl_output.rs
- examples/simple-window/../common/protocols_data/wayland/wl_region.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_popup.rs
- examples/simple-window/../common/protocols/wayland/wl_display.rs
- examples/simple-window/../common/protocols/wayland/wl_pointer.rs
- examples/simple-window/../common/protocols/wayland/wl_surface.rs
- examples/simple-window/../common/protocols_data/wayland/wl_display.rs
- examples/simple-window/../common/protocols_data/wayland/wl_pointer.rs
- examples/simple-window/../common/protocols_data/wayland/wl_surface.rs
- examples/simple-window/../common/protocols/viewporter/wp_viewport.rs
- examples/simple-window/../common/protocols/wayland/wl_callback.rs
- examples/simple-window/../common/protocols/wayland/wl_keyboard.rs
- examples/simple-window/../common/protocols/wayland/wl_registry.rs
- examples/simple-window/../common/protocols/wayland/wl_shm_pool.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_wm_base.rs
- examples/simple-window/../common/protocols_data/viewporter/wp_viewport.rs
- examples/simple-window/../common/protocols_data/wayland/wl_callback.rs
- examples/simple-window/../common/protocols_data/wayland/wl_keyboard.rs
- examples/simple-window/../common/protocols_data/wayland/wl_registry.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shm_pool.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_wm_base.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_toplevel.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_toplevel.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_v2.rs
- examples/simple-window/../common/protocols/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols/wayland/wl_compositor.rs
- examples/simple-window/../common/protocols/wayland/wl_data_offer.rs
- examples/simple-window/../common/protocols/wayland/wl_subsurface.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_v2.rs
- examples/simple-window/../common/protocols_data/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols_data/wayland/wl_compositor.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_offer.rs
- examples/simple-window/../common/protocols_data/wayland/wl_subsurface.rs
- examples/simple-window/../common/protocols/wayland/wl_data_device.rs
- examples/simple-window/../common/protocols/wayland/wl_data_source.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_positioner.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_device.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_source.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_positioner.rs
- examples/simple-window/../common/protocols/wayland/wl_shell_surface.rs
- examples/simple-window/../common/protocols/wayland/wl_subcompositor.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shell_surface.rs
- examples/simple-window/../common/protocols_data/wayland/wl_subcompositor.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_seat_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_tool_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_seat_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_tool_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_manager_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_manager_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_ring_v2.rs
- examples/simple-window/../common/protocols/wayland/wl_data_device_manager.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_ring_v2.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_device_manager.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_group_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_strip_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_group_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_strip_v2.rs
- examples/simple-window/../common/protocols/cursor_shape_v1/wp_cursor_shape_device_v1.rs
- examples/simple-window/../common/protocols_data/cursor_shape_v1/wp_cursor_shape_device_v1.rs
- examples/simple-window/../common/protocols/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
- examples/simple-window/../common/protocols_data/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
Sourcepub unsafe fn send_request(&self, opcode: u32, args: &mut [wl_argument])
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
opcodemust be a valid request opcode for the interface of the proxy.argsmust conform to the interface + opcode of the proxy.argsmust not contain anynew_idelement.
Examples found in repository?
More examples
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 }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/wayland/wl_subsurface.rs
- examples/simple-window/../common/protocols_data/wayland/wl_subsurface.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_positioner.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_positioner.rs
- examples/simple-window/../common/protocols/cursor_shape_v1/wp_cursor_shape_device_v1.rs
- examples/simple-window/../common/protocols_data/cursor_shape_v1/wp_cursor_shape_device_v1.rs
- examples/simple-window/../common/protocols/wayland/wl_fixes.rs
- examples/simple-window/../common/protocols_data/wayland/wl_fixes.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_popup.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_popup.rs
- examples/simple-window/../common/protocols/wayland/wl_region.rs
- examples/simple-window/../common/protocols_data/wayland/wl_region.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_toplevel.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_toplevel.rs
- examples/simple-window/../common/protocols/viewporter/wp_viewport.rs
- examples/simple-window/../common/protocols_data/viewporter/wp_viewport.rs
- examples/simple-window/../common/protocols/wayland/wl_data_source.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_source.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_ring_v2.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_strip_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_ring_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_strip_v2.rs
- examples/simple-window/../common/protocols/wayland/wl_surface.rs
- examples/simple-window/../common/protocols_data/wayland/wl_surface.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_pad_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_pad_v2.rs
- examples/simple-window/../common/protocols/wayland/wl_data_offer.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_offer.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_tool_v2.rs
- examples/simple-window/../common/protocols/wayland/wl_pointer.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_tool_v2.rs
- examples/simple-window/../common/protocols_data/wayland/wl_pointer.rs
- examples/simple-window/../common/protocols/wayland/wl_data_device.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_device.rs
Sourcepub unsafe fn send_constructor(
&self,
queue: &Queue,
opcode: u32,
args: &mut [wl_argument],
interface: &'static wl_interface,
version: Option<u32>,
) -> UntypedOwnedProxy
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
opcodemust be a valid request opcode for the interface of the proxy.argsmust conform to the interface + opcode of the proxy.argsmust contain exactly onenew_idelement.interfacemust be a validwl_interface.
Examples found in repository?
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
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 }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 }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 }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 }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/wayland/wl_compositor.rs
- examples/simple-window/../common/protocols_data/wayland/wl_compositor.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_surface.rs
- examples/simple-window/../common/protocols/wayland/wl_data_device_manager.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_device_manager.rs
- examples/simple-window/../common/protocols/xdg_shell/xdg_wm_base.rs
- examples/simple-window/../common/protocols_data/xdg_shell/xdg_wm_base.rs
- examples/simple-window/../common/protocols/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols_data/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols/wayland/wl_shm.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shm.rs
- examples/simple-window/../common/protocols/tablet_v2/zwp_tablet_manager_v2.rs
- examples/simple-window/../common/protocols_data/tablet_v2/zwp_tablet_manager_v2.rs
- examples/simple-window/../common/protocols/wayland/wl_shell.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shell.rs
- examples/simple-window/../common/protocols/wayland/wl_registry.rs
- examples/simple-window/../common/protocols_data/wayland/wl_registry.rs
- examples/simple-window/../common/protocols/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
- examples/simple-window/../common/protocols_data/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
- examples/simple-window/../common/protocols/wayland/wl_shm_pool.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shm_pool.rs
- examples/simple-window/../common/protocols/wayland/wl_subcompositor.rs
- examples/simple-window/../common/protocols_data/wayland/wl_subcompositor.rs