Skip to content
Merged
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
10 changes: 6 additions & 4 deletions core/src/capture/macos_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ impl Stream {
let frame = window.frame();
let filter = SCContentFilter::create().with_window(&window).build();
let backing_scale = f64::from(filter.point_pixel_scale());
let capture_scale = backing_scale.max(2.0);
*self.frame.lock().unwrap() = Frame {
origin_x: frame.origin.x,
origin_y: frame.origin.y,
Expand All @@ -247,8 +248,8 @@ impl Stream {
height: frame.size.height,
},
};
let native_width = (frame.size.width * backing_scale) as u32;
let native_height = (frame.size.height * backing_scale) as u32;
let native_width = (frame.size.width * capture_scale) as u32;
let native_height = (frame.size.height * capture_scale) as u32;
let (width, height) = capture_dimensions(
native_width,
native_height,
Expand Down Expand Up @@ -373,8 +374,9 @@ impl Stream {
let scale_factor = info.scale_factor.unwrap_or(1.0);
if crop_window {
if let Some(screen_rect) = info.screen_rect {
let native_width = (screen_rect.size.width * scale_factor) as u32;
let native_height = (screen_rect.size.height * scale_factor) as u32;
let capture_scale = scale_factor.max(2.0);
let native_width = (screen_rect.size.width * capture_scale) as u32;
let native_height = (screen_rect.size.height * capture_scale) as u32;
let next_resize_target = capture_dimensions(
native_width,
native_height,
Expand Down
4 changes: 2 additions & 2 deletions tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ tauri-plugin-global-shortcut = "2"
tauri-plugin-updater = "2.7.1"

[dependencies]
tauri = { version = "2.6.1", features = ["macos-private-api", "tray-icon", "image-ico"] }
tauri = { version = "2.10.1", features = ["macos-private-api", "tray-icon", "image-ico"] }
tauri-plugin-positioner = { version = "2.0.0", features = ["tray-icon"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand All @@ -50,7 +50,7 @@ tauri-plugin-notification = "2"
tauri-plugin-process = "2"
tauri-plugin-shell = "2"
tauri-plugin-dialog = "2"
tauri-plugin-clipboard-manager = "2.2.0"
tauri-plugin-clipboard-manager = "2.3.2"
tauri-plugin-os = "2"
tauri-plugin-fs = "2"
dirs = "5.0.1"
Expand Down
15 changes: 11 additions & 4 deletions tauri/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,23 @@ pub fn center_window_on_tray(window: &WebviewWindow, tray_rect: Rect, show_windo
* working as expected, probably for the same reason as the window size.
*/
let mut scale = 1.0;
/* The tray rect position is in physical units */
/* The tray rect position is in physical units. Its top edge can sit just
* outside the monitor (for example y == -2 on an external display), so
* use the icon center for monitor detection. */
let tray_pos: PhysicalPosition<i32> = tray_rect.position.to_physical(1.0);
let tray_size_at_1x: PhysicalSize<f64> = tray_rect.size.to_physical(1.0);
let tray_center = PhysicalPosition::new(
tray_pos.x + (tray_size_at_1x.width / 2.0) as i32,
tray_pos.y + (tray_size_at_1x.height / 2.0) as i32,
);
let mut found_monitor = false;
let monitors = window.available_monitors();
if let Ok(monitors) = monitors {
for monitor in monitors {
let monitor_pos = monitor.position();
let monitor_size = monitor.size();
let x_offset = tray_pos.x - monitor_pos.x;
let y_offset = tray_pos.y - monitor_pos.y;
let x_offset = tray_center.x - monitor_pos.x;
let y_offset = tray_center.y - monitor_pos.y;
if (x_offset >= 0)
&& (x_offset <= (monitor_size.width as i32))
&& (y_offset >= 0)
Expand All @@ -449,7 +456,7 @@ pub fn center_window_on_tray(window: &WebviewWindow, tray_rect: Rect, show_windo

if !found_monitor {
log::warn!(
"center_window_on_tray: Tray position {tray_pos:?} is outside all monitors, skipping"
"center_window_on_tray: Tray center {tray_center:?} is outside all monitors, skipping"
);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion tauri/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"productName": "hopp",
"mainBinaryName": "hopp",
"version": "1.0.29",
"version": "1.0.30",
"identifier": "com.hopp.app",
"plugins": {
"updater": {
Expand Down
4 changes: 2 additions & 2 deletions tauri/src/windows/settings/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,9 @@ function SettingsWindow() {

return (
<div className="h-full min-h-full overflow-hidden text-black dark:text-white flex flex-col">
<div data-tauri-drag-region className="h-[32px] min-w-full w-full" />
<div data-tauri-drag-region className="fixed inset-x-0 top-0 z-50 h-[32px]" />

<div className="flex-1 flex flex-col min-h-0 px-5 pb-5 py-4">
<div className="flex-1 flex flex-col min-h-0 px-5 pb-5 pt-12">
<h1 className="text-[22px] font-semibold mb-6 text-black dark:text-white">Settings</h1>

<div className="flex-1 flex min-h-0 gap-8">
Expand Down
Loading