[Refactor] Move window-based (Wayland) code to a separate function
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/main.rs
									
									
									
									
									
								
							| @@ -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") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user