summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxVerevkin <maxxverrr@gmail.com>2023-08-10 17:01:21 +0300
committerMaxVerevkin <maxxverrr@gmail.com>2023-08-10 17:01:21 +0300
commitaced219954a31ee18ccb58a06047a96a07a2c26a (patch)
tree3afbc0d6e63a7703a5fe8eb1a68cc8a7bd698983
parente36c1aaff019b2d4633763ddf191aa2192cba4c4 (diff)
downloadi3bar-mango-aced219954a31ee18ccb58a06047a96a07a2c26a.tar.gz
fix hidpi
-rw-r--r--src/bar.rs7
-rw-r--r--src/output.rs3
-rw-r--r--src/state.rs3
3 files changed, 6 insertions, 7 deletions
diff --git a/src/bar.rs b/src/bar.rs
index e6ae583..b0c9e83 100644
--- a/src/bar.rs
+++ b/src/bar.rs
@@ -23,7 +23,6 @@ pub struct Bar {
pub frame_cb: Option<WlCallback>,
pub width: u32,
pub height: u32,
- pub scale: u32,
pub scale120: Option<u32>,
pub surface: WlSurface,
pub layer_surface: ZwlrLayerSurfaceV1,
@@ -86,9 +85,9 @@ impl Bar {
scale120 as f64 / 120.0,
),
None => (
- self.width * self.scale,
- self.height * self.scale,
- self.scale as f64,
+ self.width * self.output.scale,
+ self.height * self.output.scale,
+ self.output.scale as f64,
),
};
diff --git a/src/output.rs b/src/output.rs
index 9e1b78c..be9a29a 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -4,6 +4,7 @@ use wayrs_client::Connection;
use crate::state::State;
+#[derive(Debug)]
pub struct Output {
pub wl: WlOutput,
pub reg_name: u32,
@@ -44,7 +45,7 @@ fn wl_output_cb(
}
wl_output::Event::Scale(scale) => {
if let Some(bar) = state.bars.iter_mut().find(|bar| bar.output.wl == output) {
- bar.scale = scale as u32;
+ bar.output.scale = scale as u32;
} else if let Some(output) = state.pending_outputs.iter_mut().find(|o| o.wl == output) {
output.scale = scale as u32;
}
diff --git a/src/state.rs b/src/state.rs
index 5ad4511..2c55e2d 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -170,7 +170,6 @@ impl State {
frame_cb: None,
width: 0,
height: self.shared_state.config.height,
- scale: 1,
scale120: None,
surface,
viewport: self.viewporter.get_viewport(conn, surface),
@@ -380,7 +379,7 @@ fn wl_pointer_cb(
conn,
&mut state.shared_state.shm,
default_cursor,
- bar.scale,
+ bar.output.scale,
args.serial,
);
}