How to grab window from 0.19.1 wgpu create_surface? #5213
-
I'm trying to make sure I can resize the surface to match my window when the user resizes the window and am not sure how to grab the window's internal size after creating the surface with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You can't, you need to retain a handle to the window yourself - the general way to do this is to hand us an Arc and keep an arc for yourself. |
Beta Was this translation helpful? Give feedback.
-
for those looking at this in the future, i cloned the Arc to pass to create_surface: let surface: Surface = instance.create_surface(window_arc.clone()).unwrap(); i then grab the window handle with as_ref: let size: PhysicalSize<u32> = window_arc.as_ref().inner_size(); |
Beta Was this translation helpful? Give feedback.
You can't, you need to retain a handle to the window yourself - the general way to do this is to hand us an Arc and keep an arc for yourself.