Skip to content

Commit

Permalink
fix(area_selector): scale down area selector on hi-dpi
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Sep 23, 2023
1 parent ffe51ab commit 12fde00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/area_selector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,16 @@ impl AreaSelector {
this.set_transient_for(Some(transient_for));
this.set_modal(true);

let scale_factor = 0.4 / transient_for.scale_factor() as f64;
let monitor_geometry = RootExt::display(transient_for)
.monitor_at_surface(&transient_for.surface())
.context("No monitor found")?
.geometry();
this.set_default_width(
(monitor_geometry.width() as f64 * 0.4 - ASSUMED_HEADER_BAR_HEIGHT * 2.0) as i32,
(monitor_geometry.width() as f64 * scale_factor - ASSUMED_HEADER_BAR_HEIGHT * 2.0)
as i32,
);
this.set_default_height((monitor_geometry.height() as f64 * 0.4) as i32);
this.set_default_height((monitor_geometry.height() as f64 * scale_factor) as i32);
}

imp.stack.set_visible_child(&imp.loading.get());
Expand Down

0 comments on commit 12fde00

Please sign in to comment.