pub struct BorrowedProxyLock<'a> { /* private fields */ }Expand description
A lock that ensures that a UntypedBorrowedProxy is not changed.
You can acquire it by calling proxy::lock.
This lock can be acquired multiple times across multiple threads.
Implementations§
Source§impl BorrowedProxyLock<'_>
impl BorrowedProxyLock<'_>
Sourcepub fn wl_proxy(&self) -> Option<NonNull<wl_proxy>>
pub fn wl_proxy(&self) -> Option<NonNull<wl_proxy>>
Returns the wl_proxy pointer or None if the proxy is destroyed.
If this function returns a pointer, then the pointer will remain valid while the lock is being held.
§Example
use wl_client::test_protocols::core::wl_display::WlDisplay;
let lib = Libwayland::open().unwrap();
let con = lib.connect_to_default_display().unwrap();
let queue = con.create_queue(c"queue name");
let display: WlDisplay = queue.display();
let sync = display.sync();
let lock = proxy::lock(&*sync);
assert!(lock.wl_proxy().is_some());
// This would deadlock.
// proxy::destroy(&sync);Examples found in repository?
examples/get-registry/../common/protocols/wayland/wl_subsurface.rs (line 314)
311 pub fn place_above(&self, sibling: &WlSurfaceRef) {
312 let (arg0,) = (sibling,);
313 let obj0_lock = proxy::lock(arg0);
314 let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
315 let mut args = [wl_argument { o: obj0 }];
316 // SAFETY: - self.proxy has the interface INTERFACE
317 // - 2 < INTERFACE.method_count = 6
318 // - the request signature is `o`
319 unsafe {
320 self.proxy.send_request(2, &mut args);
321 }
322 }
323
324 /// restack the sub-surface
325 ///
326 /// The sub-surface is placed just below the reference surface.
327 /// See wl_subsurface.place_above.
328 ///
329 /// # Arguments
330 ///
331 /// - `sibling`: the reference surface
332 #[inline]
333 pub fn place_below(&self, sibling: &WlSurfaceRef) {
334 let (arg0,) = (sibling,);
335 let obj0_lock = proxy::lock(arg0);
336 let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
337 let mut args = [wl_argument { o: obj0 }];
338 // SAFETY: - self.proxy has the interface INTERFACE
339 // - 3 < INTERFACE.method_count = 6
340 // - the request signature is `o`
341 unsafe {
342 self.proxy.send_request(3, &mut args);
343 }
344 }More examples
examples/get-registry/../common/protocols_data/wayland/wl_subsurface.rs (line 314)
311 pub fn place_above(&self, sibling: &WlSurfaceRef) {
312 let (arg0,) = (sibling,);
313 let obj0_lock = proxy::lock(arg0);
314 let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
315 let mut args = [wl_argument { o: obj0 }];
316 // SAFETY: - self.proxy has the interface INTERFACE
317 // - 2 < INTERFACE.method_count = 6
318 // - the request signature is `o`
319 unsafe {
320 self.proxy.send_request(2, &mut args);
321 }
322 }
323
324 /// restack the sub-surface
325 ///
326 /// The sub-surface is placed just below the reference surface.
327 /// See wl_subsurface.place_above.
328 ///
329 /// # Arguments
330 ///
331 /// - `sibling`: the reference surface
332 #[inline]
333 pub fn place_below(&self, sibling: &WlSurfaceRef) {
334 let (arg0,) = (sibling,);
335 let obj0_lock = proxy::lock(arg0);
336 let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
337 let mut args = [wl_argument { o: obj0 }];
338 // SAFETY: - self.proxy has the interface INTERFACE
339 // - 3 < INTERFACE.method_count = 6
340 // - the request signature is `o`
341 unsafe {
342 self.proxy.send_request(3, &mut args);
343 }
344 }examples/get-registry/../common/protocols/wayland/wl_fixes.rs (line 173)
170 pub fn destroy_registry(&self, registry: &WlRegistryRef) {
171 let (arg0,) = (registry,);
172 let obj0_lock = proxy::lock(arg0);
173 let obj0 = check_argument_proxy("registry", obj0_lock.wl_proxy());
174 let mut args = [wl_argument { o: obj0 }];
175 // SAFETY: - self.proxy has the interface INTERFACE
176 // - 1 < INTERFACE.method_count = 2
177 // - the request signature is `o`
178 unsafe {
179 self.proxy.send_request(1, &mut args);
180 }
181 }examples/get-registry/../common/protocols_data/wayland/wl_fixes.rs (line 173)
170 pub fn destroy_registry(&self, registry: &WlRegistryRef) {
171 let (arg0,) = (registry,);
172 let obj0_lock = proxy::lock(arg0);
173 let obj0 = check_argument_proxy("registry", obj0_lock.wl_proxy());
174 let mut args = [wl_argument { o: obj0 }];
175 // SAFETY: - self.proxy has the interface INTERFACE
176 // - 1 < INTERFACE.method_count = 2
177 // - the request signature is `o`
178 unsafe {
179 self.proxy.send_request(1, &mut args);
180 }
181 }examples/get-registry/../common/protocols/xdg_shell/xdg_popup.rs (line 271)
268 pub fn grab(&self, seat: &WlSeatRef, serial: u32) {
269 let (arg0, arg1) = (seat, serial);
270 let obj0_lock = proxy::lock(arg0);
271 let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
272 let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
273 // SAFETY: - self.proxy has the interface INTERFACE
274 // - 1 < INTERFACE.method_count = 3
275 // - the request signature is `ou`
276 unsafe {
277 self.proxy.send_request(1, &mut args);
278 }
279 }
280
281 /// recalculate the popup's location
282 ///
283 /// Reposition an already-mapped popup. The popup will be placed given the
284 /// details in the passed xdg_positioner object, and a
285 /// xdg_popup.repositioned followed by xdg_popup.configure and
286 /// xdg_surface.configure will be emitted in response. Any parameters set
287 /// by the previous positioner will be discarded.
288 ///
289 /// The passed token will be sent in the corresponding
290 /// xdg_popup.repositioned event. The new popup position will not take
291 /// effect until the corresponding configure event is acknowledged by the
292 /// client. See xdg_popup.repositioned for details. The token itself is
293 /// opaque, and has no other special meaning.
294 ///
295 /// If multiple reposition requests are sent, the compositor may skip all
296 /// but the last one.
297 ///
298 /// If the popup is repositioned in response to a configure event for its
299 /// parent, the client should send an xdg_positioner.set_parent_configure
300 /// and possibly an xdg_positioner.set_parent_size request to allow the
301 /// compositor to properly constrain the popup.
302 ///
303 /// If the popup is repositioned together with a parent that is being
304 /// resized, but not in response to a configure event, the client should
305 /// send an xdg_positioner.set_parent_size request.
306 ///
307 /// # Arguments
308 ///
309 /// - `positioner`:
310 /// - `token`: reposition request token
311 #[inline]
312 pub fn reposition(&self, positioner: &XdgPositionerRef, token: u32) {
313 let (arg0, arg1) = (positioner, token);
314 let obj0_lock = proxy::lock(arg0);
315 let obj0 = check_argument_proxy("positioner", obj0_lock.wl_proxy());
316 let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
317 // SAFETY: - self.proxy has the interface INTERFACE
318 // - 2 < INTERFACE.method_count = 3
319 // - the request signature is `ou`
320 unsafe {
321 self.proxy.send_request(2, &mut args);
322 }
323 }examples/get-registry/../common/protocols_data/xdg_shell/xdg_popup.rs (line 271)
268 pub fn grab(&self, seat: &WlSeatRef, serial: u32) {
269 let (arg0, arg1) = (seat, serial);
270 let obj0_lock = proxy::lock(arg0);
271 let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
272 let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
273 // SAFETY: - self.proxy has the interface INTERFACE
274 // - 1 < INTERFACE.method_count = 3
275 // - the request signature is `ou`
276 unsafe {
277 self.proxy.send_request(1, &mut args);
278 }
279 }
280
281 /// recalculate the popup's location
282 ///
283 /// Reposition an already-mapped popup. The popup will be placed given the
284 /// details in the passed xdg_positioner object, and a
285 /// xdg_popup.repositioned followed by xdg_popup.configure and
286 /// xdg_surface.configure will be emitted in response. Any parameters set
287 /// by the previous positioner will be discarded.
288 ///
289 /// The passed token will be sent in the corresponding
290 /// xdg_popup.repositioned event. The new popup position will not take
291 /// effect until the corresponding configure event is acknowledged by the
292 /// client. See xdg_popup.repositioned for details. The token itself is
293 /// opaque, and has no other special meaning.
294 ///
295 /// If multiple reposition requests are sent, the compositor may skip all
296 /// but the last one.
297 ///
298 /// If the popup is repositioned in response to a configure event for its
299 /// parent, the client should send an xdg_positioner.set_parent_configure
300 /// and possibly an xdg_positioner.set_parent_size request to allow the
301 /// compositor to properly constrain the popup.
302 ///
303 /// If the popup is repositioned together with a parent that is being
304 /// resized, but not in response to a configure event, the client should
305 /// send an xdg_positioner.set_parent_size request.
306 ///
307 /// # Arguments
308 ///
309 /// - `positioner`:
310 /// - `token`: reposition request token
311 #[inline]
312 pub fn reposition(&self, positioner: &XdgPositionerRef, token: u32) {
313 let (arg0, arg1) = (positioner, token);
314 let obj0_lock = proxy::lock(arg0);
315 let obj0 = check_argument_proxy("positioner", obj0_lock.wl_proxy());
316 let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
317 // SAFETY: - self.proxy has the interface INTERFACE
318 // - 2 < INTERFACE.method_count = 3
319 // - the request signature is `ou`
320 unsafe {
321 self.proxy.send_request(2, &mut args);
322 }
323 }Additional examples can be found in:
- examples/get-registry/../common/protocols/wayland/wl_shell_surface.rs
- examples/get-registry/../common/protocols_data/wayland/wl_shell_surface.rs
- examples/get-registry/../common/protocols/xdg_shell/xdg_toplevel.rs
- examples/get-registry/../common/protocols_data/xdg_shell/xdg_toplevel.rs
- examples/get-registry/../common/protocols/wayland/wl_surface.rs
- examples/get-registry/../common/protocols_data/wayland/wl_surface.rs
- examples/get-registry/../common/protocols/wayland/wl_data_device_manager.rs
- examples/get-registry/../common/protocols_data/wayland/wl_data_device_manager.rs
- examples/get-registry/../common/protocols/viewporter/wp_viewporter.rs
- examples/get-registry/../common/protocols_data/viewporter/wp_viewporter.rs
- examples/get-registry/../common/protocols/xdg_shell/xdg_wm_base.rs
- examples/get-registry/../common/protocols_data/xdg_shell/xdg_wm_base.rs
- examples/get-registry/../common/protocols/tablet_v2/zwp_tablet_manager_v2.rs
- examples/get-registry/../common/protocols_data/tablet_v2/zwp_tablet_manager_v2.rs
- examples/get-registry/../common/protocols/wayland/wl_shell.rs
- examples/get-registry/../common/protocols_data/wayland/wl_shell.rs
- examples/get-registry/../common/protocols/tablet_v2/zwp_tablet_tool_v2.rs
- examples/get-registry/../common/protocols/wayland/wl_pointer.rs
- examples/get-registry/../common/protocols_data/tablet_v2/zwp_tablet_tool_v2.rs
- examples/get-registry/../common/protocols_data/wayland/wl_pointer.rs
- examples/get-registry/../common/protocols/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
- examples/get-registry/../common/protocols_data/cursor_shape_v1/wp_cursor_shape_manager_v1.rs
- examples/get-registry/../common/protocols/wayland/wl_subcompositor.rs
- examples/get-registry/../common/protocols_data/wayland/wl_subcompositor.rs
- examples/get-registry/../common/protocols/xdg_shell/xdg_surface.rs
- examples/get-registry/../common/protocols_data/xdg_shell/xdg_surface.rs
- examples/get-registry/../common/protocols/wayland/wl_data_device.rs
- examples/get-registry/../common/protocols_data/wayland/wl_data_device.rs
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for BorrowedProxyLock<'a>
impl<'a> !Send for BorrowedProxyLock<'a>
impl<'a> !UnwindSafe for BorrowedProxyLock<'a>
impl<'a> Forget for BorrowedProxyLock<'a>
impl<'a> Freeze for BorrowedProxyLock<'a>
impl<'a> Move for BorrowedProxyLock<'a>
impl<'a> Sync for BorrowedProxyLock<'a>
impl<'a> Unpin for BorrowedProxyLock<'a>
impl<'a> UnsafeUnpin for BorrowedProxyLock<'a>where
&'a RwLock<RawRwLock, ()>: UnsafeUnpin,
PhantomData<(&'a (), GuardNoSend)>: UnsafeUnpin,
*mut wl_proxy: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more