1
1
mirror of https://github.com/wez/wezterm.git synced 2024-10-27 08:09:45 +03:00

wayland: return effective_dpi in wezterm.gui.screens

Note that this also does not respect dpi_by_screen; this is for
consistency in behavior and reported values.

Once we can produce the correct overridden value in
dispatch_pending_event, we can update these functions to return
the same data.

refs: #4096
This commit is contained in:
Wez Furlong 2023-08-06 09:31:11 -07:00
parent 06046c4319
commit 1bbd56d469
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
2 changed files with 11 additions and 2 deletions

View File

@ -479,6 +479,7 @@ impl ConnectionOps for WaylandConnection {
let mut by_name = HashMap::new();
let mut virtual_rect: ScreenRect = euclid::rect(0, 0, 0, 0);
let config = config::configuration();
for output in self.environment.get_all_outputs() {
toolkit::output::with_output_info(&output, |info| {
let name = if info.name.is_empty() {
@ -503,6 +504,10 @@ impl ConnectionOps for WaylandConnection {
let scale = info.scale_factor as f64;
// FIXME: teach this how to resolve dpi_by_screen once
// dispatch_pending_event knows how to do the same
let effective_dpi = Some(config.dpi.unwrap_or(scale * crate::DEFAULT_DPI));
virtual_rect = virtual_rect.union(&rect);
by_name.insert(
name.clone(),
@ -511,7 +516,7 @@ impl ConnectionOps for WaylandConnection {
rect,
scale,
max_fps: None,
effective_dpi: None,
effective_dpi,
},
);
});

View File

@ -206,6 +206,7 @@ impl OutputHandler {
let mut by_name = HashMap::new();
let mut virtual_rect: ScreenRect = euclid::rect(0, 0, 0, 0);
let config = config::configuration();
log::debug!("zwlr_head_info: {:#?}", inner.zwlr_head_info);
@ -227,6 +228,9 @@ impl OutputHandler {
height as isize,
);
virtual_rect = virtual_rect.union(&rect);
// FIXME: teach this how to resolve dpi_by_screen once
// dispatch_pending_event knows how to do the same
let effective_dpi = Some(config.dpi.unwrap_or(scale * crate::DEFAULT_DPI));
by_name.insert(
name.clone(),
ScreenInfo {
@ -234,7 +238,7 @@ impl OutputHandler {
rect,
scale,
max_fps: None,
effective_dpi: None,
effective_dpi,
},
);
}