[Refactor] Move window-based (Wayland) code to a separate function

This commit is contained in:
Gergely Polonkai 2022-05-24 16:20:51 +02:00
parent b2e387fbe8
commit 88ad047315
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -18,6 +18,10 @@ sctk::default_environment!(SeasonalClock, desktop);
fn main() { fn main() {
let config = get_config(); let config = get_config();
run_windowed(&config);
}
fn run_windowed(config: &Option<Config>) {
let (env, display, queue) = sctk::new_default_environment!(SeasonalClock, desktop) let (env, display, queue) = sctk::new_default_environment!(SeasonalClock, desktop)
.expect("Unable to connect to a Wayland compositor"); .expect("Unable to connect to a Wayland compositor");
@ -66,7 +70,7 @@ fn main() {
&mut pool, &mut pool,
window.surface(), window.surface(),
dimensions, dimensions,
&config, config,
&hour_name_path_cache, &hour_name_path_cache,
) )
.expect("Failed to draw"); .expect("Failed to draw");
@ -101,7 +105,7 @@ fn main() {
&mut pool, &mut pool,
window.surface(), window.surface(),
dimensions, dimensions,
&config, config,
&hour_name_path_cache, &hour_name_path_cache,
) )
.expect("Failed to draw"); .expect("Failed to draw");
@ -131,7 +135,7 @@ fn main() {
&mut pool, &mut pool,
window.surface(), window.surface(),
dimensions, dimensions,
&config, config,
&hour_name_path_cache, &hour_name_path_cache,
) )
.expect("Failed to draw") .expect("Failed to draw")