Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mm-client/src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
};

Expand Down
10 changes: 7 additions & 3 deletions mm-client/src/bin/mmclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -595,7 +599,7 @@ impl AttachmentWindow {
let pos: winit::dpi::PhysicalPosition<f64> = (x, y).into();
self.window.set_cursor_position(pos)?;
}

#[cfg(target_vendor = "apple")]
self.window
.set_cursor_grab(winit::window::CursorGrabMode::Locked)?;
Expand Down