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/simple-window/../common/protocols/wayland/wl_subsurface.rs (line 290)
287 pub fn place_above(&self, sibling: &WlSurfaceRef) {
288 let (arg0,) = (sibling,);
289 let obj0_lock = proxy::lock(arg0);
290 let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
291 let mut args = [wl_argument { o: obj0 }];
292 // SAFETY: - self.proxy has the interface INTERFACE
293 // - 2 < INTERFACE.method_count = 6
294 // - the request signature is `o`
295 unsafe {
296 self.proxy.send_request(2, &mut args);
297 }
298 }
299
300 /// restack the sub-surface
301 ///
302 /// The sub-surface is placed just below the reference surface.
303 /// See wl_subsurface.place_above.
304 ///
305 /// # Arguments
306 ///
307 /// - `sibling`: the reference surface
308 #[inline]
309 pub fn place_below(&self, sibling: &WlSurfaceRef) {
310 let (arg0,) = (sibling,);
311 let obj0_lock = proxy::lock(arg0);
312 let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
313 let mut args = [wl_argument { o: obj0 }];
314 // SAFETY: - self.proxy has the interface INTERFACE
315 // - 3 < INTERFACE.method_count = 6
316 // - the request signature is `o`
317 unsafe {
318 self.proxy.send_request(3, &mut args);
319 }
320 }More examples
examples/simple-window/../common/protocols_data/wayland/wl_subsurface.rs (line 290)
287 pub fn place_above(&self, sibling: &WlSurfaceRef) {
288 let (arg0,) = (sibling,);
289 let obj0_lock = proxy::lock(arg0);
290 let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
291 let mut args = [wl_argument { o: obj0 }];
292 // SAFETY: - self.proxy has the interface INTERFACE
293 // - 2 < INTERFACE.method_count = 6
294 // - the request signature is `o`
295 unsafe {
296 self.proxy.send_request(2, &mut args);
297 }
298 }
299
300 /// restack the sub-surface
301 ///
302 /// The sub-surface is placed just below the reference surface.
303 /// See wl_subsurface.place_above.
304 ///
305 /// # Arguments
306 ///
307 /// - `sibling`: the reference surface
308 #[inline]
309 pub fn place_below(&self, sibling: &WlSurfaceRef) {
310 let (arg0,) = (sibling,);
311 let obj0_lock = proxy::lock(arg0);
312 let obj0 = check_argument_proxy("sibling", obj0_lock.wl_proxy());
313 let mut args = [wl_argument { o: obj0 }];
314 // SAFETY: - self.proxy has the interface INTERFACE
315 // - 3 < INTERFACE.method_count = 6
316 // - the request signature is `o`
317 unsafe {
318 self.proxy.send_request(3, &mut args);
319 }
320 }examples/simple-window/../common/protocols/wayland/wl_fixes.rs (line 165)
162 pub fn destroy_registry(&self, registry: &WlRegistryRef) {
163 let (arg0,) = (registry,);
164 let obj0_lock = proxy::lock(arg0);
165 let obj0 = check_argument_proxy("registry", obj0_lock.wl_proxy());
166 let mut args = [wl_argument { o: obj0 }];
167 // SAFETY: - self.proxy has the interface INTERFACE
168 // - 1 < INTERFACE.method_count = 2
169 // - the request signature is `o`
170 unsafe {
171 self.proxy.send_request(1, &mut args);
172 }
173 }examples/simple-window/../common/protocols_data/wayland/wl_fixes.rs (line 165)
162 pub fn destroy_registry(&self, registry: &WlRegistryRef) {
163 let (arg0,) = (registry,);
164 let obj0_lock = proxy::lock(arg0);
165 let obj0 = check_argument_proxy("registry", obj0_lock.wl_proxy());
166 let mut args = [wl_argument { o: obj0 }];
167 // SAFETY: - self.proxy has the interface INTERFACE
168 // - 1 < INTERFACE.method_count = 2
169 // - the request signature is `o`
170 unsafe {
171 self.proxy.send_request(1, &mut args);
172 }
173 }examples/simple-window/../common/protocols/xdg_shell/xdg_popup.rs (line 259)
256 pub fn grab(&self, seat: &WlSeatRef, serial: u32) {
257 let (arg0, arg1) = (seat, serial);
258 let obj0_lock = proxy::lock(arg0);
259 let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
260 let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
261 // SAFETY: - self.proxy has the interface INTERFACE
262 // - 1 < INTERFACE.method_count = 3
263 // - the request signature is `ou`
264 unsafe {
265 self.proxy.send_request(1, &mut args);
266 }
267 }
268
269 /// recalculate the popup's location
270 ///
271 /// Reposition an already-mapped popup. The popup will be placed given the
272 /// details in the passed xdg_positioner object, and a
273 /// xdg_popup.repositioned followed by xdg_popup.configure and
274 /// xdg_surface.configure will be emitted in response. Any parameters set
275 /// by the previous positioner will be discarded.
276 ///
277 /// The passed token will be sent in the corresponding
278 /// xdg_popup.repositioned event. The new popup position will not take
279 /// effect until the corresponding configure event is acknowledged by the
280 /// client. See xdg_popup.repositioned for details. The token itself is
281 /// opaque, and has no other special meaning.
282 ///
283 /// If multiple reposition requests are sent, the compositor may skip all
284 /// but the last one.
285 ///
286 /// If the popup is repositioned in response to a configure event for its
287 /// parent, the client should send an xdg_positioner.set_parent_configure
288 /// and possibly an xdg_positioner.set_parent_size request to allow the
289 /// compositor to properly constrain the popup.
290 ///
291 /// If the popup is repositioned together with a parent that is being
292 /// resized, but not in response to a configure event, the client should
293 /// send an xdg_positioner.set_parent_size request.
294 ///
295 /// # Arguments
296 ///
297 /// - `positioner`:
298 /// - `token`: reposition request token
299 #[inline]
300 pub fn reposition(&self, positioner: &XdgPositionerRef, token: u32) {
301 let (arg0, arg1) = (positioner, token);
302 let obj0_lock = proxy::lock(arg0);
303 let obj0 = check_argument_proxy("positioner", obj0_lock.wl_proxy());
304 let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
305 // SAFETY: - self.proxy has the interface INTERFACE
306 // - 2 < INTERFACE.method_count = 3
307 // - the request signature is `ou`
308 unsafe {
309 self.proxy.send_request(2, &mut args);
310 }
311 }examples/simple-window/../common/protocols_data/xdg_shell/xdg_popup.rs (line 259)
256 pub fn grab(&self, seat: &WlSeatRef, serial: u32) {
257 let (arg0, arg1) = (seat, serial);
258 let obj0_lock = proxy::lock(arg0);
259 let obj0 = check_argument_proxy("seat", obj0_lock.wl_proxy());
260 let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
261 // SAFETY: - self.proxy has the interface INTERFACE
262 // - 1 < INTERFACE.method_count = 3
263 // - the request signature is `ou`
264 unsafe {
265 self.proxy.send_request(1, &mut args);
266 }
267 }
268
269 /// recalculate the popup's location
270 ///
271 /// Reposition an already-mapped popup. The popup will be placed given the
272 /// details in the passed xdg_positioner object, and a
273 /// xdg_popup.repositioned followed by xdg_popup.configure and
274 /// xdg_surface.configure will be emitted in response. Any parameters set
275 /// by the previous positioner will be discarded.
276 ///
277 /// The passed token will be sent in the corresponding
278 /// xdg_popup.repositioned event. The new popup position will not take
279 /// effect until the corresponding configure event is acknowledged by the
280 /// client. See xdg_popup.repositioned for details. The token itself is
281 /// opaque, and has no other special meaning.
282 ///
283 /// If multiple reposition requests are sent, the compositor may skip all
284 /// but the last one.
285 ///
286 /// If the popup is repositioned in response to a configure event for its
287 /// parent, the client should send an xdg_positioner.set_parent_configure
288 /// and possibly an xdg_positioner.set_parent_size request to allow the
289 /// compositor to properly constrain the popup.
290 ///
291 /// If the popup is repositioned together with a parent that is being
292 /// resized, but not in response to a configure event, the client should
293 /// send an xdg_positioner.set_parent_size request.
294 ///
295 /// # Arguments
296 ///
297 /// - `positioner`:
298 /// - `token`: reposition request token
299 #[inline]
300 pub fn reposition(&self, positioner: &XdgPositionerRef, token: u32) {
301 let (arg0, arg1) = (positioner, token);
302 let obj0_lock = proxy::lock(arg0);
303 let obj0 = check_argument_proxy("positioner", obj0_lock.wl_proxy());
304 let mut args = [wl_argument { o: obj0 }, wl_argument { u: arg1 }];
305 // SAFETY: - self.proxy has the interface INTERFACE
306 // - 2 < INTERFACE.method_count = 3
307 // - the request signature is `ou`
308 unsafe {
309 self.proxy.send_request(2, &mut args);
310 }
311 }Additional examples can be found in:
- examples/simple-window/../common/protocols/wayland/wl_shell_surface.rs
- examples/simple-window/../common/protocols_data/wayland/wl_shell_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/wayland/wl_surface.rs
- examples/simple-window/../common/protocols_data/wayland/wl_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/viewporter/wp_viewporter.rs
- examples/simple-window/../common/protocols_data/viewporter/wp_viewporter.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/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/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/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_subcompositor.rs
- examples/simple-window/../common/protocols_data/wayland/wl_subcompositor.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.rs
- examples/simple-window/../common/protocols_data/wayland/wl_data_device.rs
Auto Trait Implementations§
impl<'a> Freeze for BorrowedProxyLock<'a>
impl<'a> !RefUnwindSafe for BorrowedProxyLock<'a>
impl<'a> !Send for BorrowedProxyLock<'a>
impl<'a> Sync for BorrowedProxyLock<'a>
impl<'a> Unpin for BorrowedProxyLock<'a>
impl<'a> !UnwindSafe for BorrowedProxyLock<'a>
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