summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorMax Verevkin <maxxverrr@gmail.com>2022-07-19 12:39:41 +0300
committerMax Verevkin <maxxverrr@gmail.com>2022-07-19 12:39:41 +0300
commitf78774137b146647a4024e1305c7dfbd89b39f18 (patch)
treec515785cda3244a55212072177fab4606bff0292 /src/main.rs
parent2504e7207009d7fd3c1a19f15e4295b6a2579650 (diff)
downloadi3bar-mango-f78774137b146647a4024e1305c7dfbd89b39f18.tar.gz
some refactoring
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/main.rs b/src/main.rs
index 823a137..730edf6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,7 +12,7 @@ use smithay_client_toolkit::{
output::{with_output_info, OutputInfo},
reexports::{
calloop,
- client::protocol::{wl_output, wl_pointer},
+ client::protocol::{wl_output::WlOutput, wl_pointer},
protocols::wlr::unstable::layer_shell::v1::client::zwlr_layer_shell_v1,
},
seat::pointer,
@@ -66,21 +66,15 @@ fn main() {
let mut bar_state = BarState::new(&env);
let env_handle = env.clone();
- let output_handler =
- move |output: wl_output::WlOutput, info: &OutputInfo, bar_state: &mut BarState| {
- if info.obsolete {
- info!("Output removed");
- bar_state.remove_surface(info.id);
- output.release();
- } else {
- info!("Output detected");
- let surface = env_handle.create_surface();
- let pool = env_handle
- .create_auto_pool()
- .expect("Failed to create a memory pool!");
- bar_state.add_surface(&output, info.id, surface, pool);
- }
- };
+ let output_handler = move |output: WlOutput, info: &OutputInfo, bar_state: &mut BarState| {
+ if info.obsolete {
+ info!("Output {} removed", info.id);
+ output.release();
+ } else {
+ info!("Output {} detected", info.id);
+ bar_state.add_surface(&output, info.id, &env_handle);
+ }
+ };
// Process currently existing outputs
for output in env.get_all_outputs() {