summaryrefslogtreecommitdiff
path: root/src/output.rs
diff options
context:
space:
mode:
authorMaxVerevkin <maxxverrr@gmail.com>2023-09-07 00:47:28 +0300
committerMaxVerevkin <maxxverrr@gmail.com>2023-09-07 00:47:28 +0300
commit74cc46a2383db5538d7e0392e4b79b7287775e9b (patch)
tree6f5c2c026c0822dd71a645836eb085677a090d4c /src/output.rs
parenteefff9a9cc2ee6f17eab3431cc808d5a5e7d31fc (diff)
downloadi3bar-mango-74cc46a2383db5538d7e0392e4b79b7287775e9b.tar.gz
hyprland again
Diffstat (limited to 'src/output.rs')
-rw-r--r--src/output.rs24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/output.rs b/src/output.rs
index 7c492ed..d243d52 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -9,9 +9,16 @@ pub struct Output {
pub wl: WlOutput,
pub reg_name: u32,
pub scale: u32,
+ pub name: String,
}
-impl Output {
+pub struct PendingOutput {
+ pub wl: WlOutput,
+ pub reg_name: u32,
+ pub scale: u32,
+}
+
+impl PendingOutput {
pub fn bind(conn: &mut Connection<State>, global: &Global) -> Self {
Self {
wl: global
@@ -21,7 +28,9 @@ impl Output {
scale: 1,
}
}
+}
+impl Output {
pub fn destroy(self, conn: &mut Connection<State>) {
self.wl.release(conn);
}
@@ -37,11 +46,14 @@ fn wl_output_cb(ctx: EventCtx<State, WlOutput>) {
.position(|o| o.wl == ctx.proxy)
.unwrap();
let output = ctx.state.pending_outputs.swap_remove(i);
- ctx.state.register_output(
- ctx.conn,
- output,
- name.to_str().expect("invalid output name"),
- );
+ let name = String::from_utf8(name.into_bytes()).expect("invalid output name");
+ let output = Output {
+ wl: output.wl,
+ reg_name: output.reg_name,
+ scale: output.scale,
+ name,
+ };
+ ctx.state.register_output(ctx.conn, output);
}
wl_output::Event::Scale(scale) => {
if let Some(bar) = ctx