From 88ad0473158d7af9480d8a9df1101013af4c2f4c Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 24 May 2022 16:20:51 +0200 Subject: [PATCH] [Refactor] Move window-based (Wayland) code to a separate function --- src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 78d87d4..7327d04 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,10 @@ sctk::default_environment!(SeasonalClock, desktop); fn main() { let config = get_config(); + run_windowed(&config); +} + +fn run_windowed(config: &Option) { let (env, display, queue) = sctk::new_default_environment!(SeasonalClock, desktop) .expect("Unable to connect to a Wayland compositor"); @@ -66,7 +70,7 @@ fn main() { &mut pool, window.surface(), dimensions, - &config, + config, &hour_name_path_cache, ) .expect("Failed to draw"); @@ -101,7 +105,7 @@ fn main() { &mut pool, window.surface(), dimensions, - &config, + config, &hour_name_path_cache, ) .expect("Failed to draw"); @@ -131,7 +135,7 @@ fn main() { &mut pool, window.surface(), dimensions, - &config, + config, &hour_name_path_cache, ) .expect("Failed to draw")