diff --git a/mm-client/src/audio.rs b/mm-client/src/audio.rs index e0f6afb..7ec33e7 100644 --- a/mm-client/src/audio.rs +++ b/mm-client/src/audio.rs @@ -358,7 +358,12 @@ fn select_conf( let buffer_size = match conf_range.buffer_size() { cpal::SupportedBufferSize::Unknown => cpal::BufferSize::Default, cpal::SupportedBufferSize::Range { min, .. } => { - cpal::BufferSize::Fixed(std::cmp::max(*min, sample_rate / 100)) + let size = std::cmp::max(*min, sample_rate / 100); + let mut buffer_size = 2; + while buffer_size < size { + buffer_size *= 2; + } + cpal::BufferSize::Fixed(buffer_size) } }; diff --git a/mm-client/src/bin/mmclient.rs b/mm-client/src/bin/mmclient.rs index 8de56c5..8bb0632 100644 --- a/mm-client/src/bin/mmclient.rs +++ b/mm-client/src/bin/mmclient.rs @@ -568,13 +568,17 @@ impl AttachmentWindow { } } LockPointer(x, y) => { - debug!(x, y, "cursor locked"); + debug!(x, y, "Locking cursor."); // On most platforms, we have to lock the cursor before we // warp it. On mac, it's the other way around. #[cfg(not(target_vendor = "apple"))] self.window - .set_cursor_grab(winit::window::CursorGrabMode::Locked)?; + .set_cursor_grab(winit::window::CursorGrabMode::Locked) + .or_else(|_| { + debug!("Could not lock cursor. Falling back to confining cursor."); + self.window.set_cursor_grab(winit::window::CursorGrabMode::Confined) + })?; if let Some(aspect) = self.renderer.get_texture_aspect() { let width = self.attachment_config.width; @@ -595,7 +599,7 @@ impl AttachmentWindow { let pos: winit::dpi::PhysicalPosition = (x, y).into(); self.window.set_cursor_position(pos)?; } - + #[cfg(target_vendor = "apple")] self.window .set_cursor_grab(winit::window::CursorGrabMode::Locked)?;