yeeting Output struct
This commit is contained in:
parent
c37824fbd2
commit
cf1b262066
27
src/main.rs
27
src/main.rs
@ -9,26 +9,10 @@ use crate::wayland::river_status_unstable_v1::zriver_output_status_v1;
|
|||||||
use wayland_client::{Display, GlobalManager, Main};
|
use wayland_client::{Display, GlobalManager, Main};
|
||||||
|
|
||||||
struct Globals {
|
struct Globals {
|
||||||
outputs: Vec<Output>,
|
outputs: Vec<WlOutput>,
|
||||||
status_manager: Option<Main<ZriverStatusManagerV1>>
|
status_manager: Option<Main<ZriverStatusManagerV1>>
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Output {
|
|
||||||
pub name: String,
|
|
||||||
pub output: WlOutput,
|
|
||||||
pub output_status: Option<Main<ZriverOutputStatusV1>>
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Output {
|
|
||||||
pub fn new(output:WlOutput)->Output {
|
|
||||||
{ Output {
|
|
||||||
name: String::new(),
|
|
||||||
output: output,
|
|
||||||
output_status: None,
|
|
||||||
} }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let display = Display::connect_to_env().unwrap();
|
let display = Display::connect_to_env().unwrap();
|
||||||
|
|
||||||
@ -83,8 +67,7 @@ fn main() {
|
|||||||
3,
|
3,
|
||||||
|output: Main<WlOutput>, mut globals: DispatchData| {
|
|output: Main<WlOutput>, mut globals: DispatchData| {
|
||||||
output.quick_assign(move |_, _, _| {});
|
output.quick_assign(move |_, _, _| {});
|
||||||
let output = Output::new(output.detach());
|
globals.get::<Globals>().unwrap().outputs.push(output.detach());
|
||||||
globals.get::<Globals>().unwrap().outputs.push(output);
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
@ -103,11 +86,11 @@ fn main() {
|
|||||||
None => assign = true
|
None => assign = true
|
||||||
}
|
}
|
||||||
if assign {
|
if assign {
|
||||||
output.output_status = Some(globals.status_manager
|
let output_status = globals.status_manager
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.expect("Compositor doesn't implement river_status_unstable_v1")
|
.expect("Compositor doesn't implement river_status_unstable_v1")
|
||||||
.get_river_output_status(&output.output));
|
.get_river_output_status(&output);
|
||||||
output.output_status.as_mut().unwrap().quick_assign(move |_, event, _| match event {
|
output_status.quick_assign(move |_, event, _| match event {
|
||||||
zriver_output_status_v1::Event::FocusedTags { tags } => {
|
zriver_output_status_v1::Event::FocusedTags { tags } => {
|
||||||
if enable_tag {
|
if enable_tag {
|
||||||
base10(tags);
|
base10(tags);
|
||||||
|
Loading…
Reference in New Issue
Block a user