diff options
Diffstat (limited to 'alacritty_terminal/src/window.rs')
-rw-r--r-- | alacritty_terminal/src/window.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/alacritty_terminal/src/window.rs b/alacritty_terminal/src/window.rs index e269a7b6..97f29c5b 100644 --- a/alacritty_terminal/src/window.rs +++ b/alacritty_terminal/src/window.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. use std::convert::From; +#[cfg(not(any(target_os = "macos", target_os = "windows")))] use std::ffi::c_void; use std::fmt::Display; @@ -30,7 +31,7 @@ use glutin::{ #[cfg(not(target_os = "macos"))] use image::ImageFormat; -use crate::config::{Options, Decorations, StartupMode, WindowConfig}; +use crate::config::{Config, Decorations, StartupMode, WindowConfig}; // It's required to be in this directory due to the `windows.rc` file #[cfg(not(target_os = "macos"))] @@ -146,13 +147,13 @@ impl Window { /// This creates a window and fully initializes a window. pub fn new( event_loop: EventsLoop, - options: &Options, - window_config: &WindowConfig, + config: &Config, dimensions: Option<LogicalSize>, ) -> Result<Window> { - let title = options.title.as_ref().map_or(DEFAULT_NAME, |t| t); - let class = options.class.as_ref().map_or(DEFAULT_NAME, |c| c); - let window_builder = Window::get_platform_window(title, class, window_config); + let title = config.window.title.as_ref().map_or(DEFAULT_NAME, |t| t); + let class = config.window.class.as_ref().map_or(DEFAULT_NAME, |c| c); + + let window_builder = Window::get_platform_window(title, class, &config.window); let windowed_context = create_gl_window(window_builder.clone(), &event_loop, false, dimensions) .or_else(|_| create_gl_window(window_builder, &event_loop, true, dimensions))?; @@ -162,7 +163,7 @@ impl Window { // Maximize window after mapping in X11 #[cfg(not(any(target_os = "macos", windows)))] { - if event_loop.is_x11() && window_config.startup_mode() == StartupMode::Maximized { + if event_loop.is_x11() && config.window.startup_mode() == StartupMode::Maximized { window.set_maximized(true); } } @@ -171,21 +172,20 @@ impl Window { // // TODO: replace `set_position` with `with_position` once available // Upstream issue: https://github.com/tomaka/winit/issues/806 - let position = options.position().or_else(|| window_config.position()); - if let Some(position) = position { + if let Some(position) = config.window.position { let physical = PhysicalPosition::from((position.x, position.y)); let logical = physical.to_logical(window.get_hidpi_factor()); window.set_position(logical); } - if let StartupMode::Fullscreen = window_config.startup_mode() { + if let StartupMode::Fullscreen = config.window.startup_mode() { let current_monitor = window.get_current_monitor(); window.set_fullscreen(Some(current_monitor)); } #[cfg(target_os = "macos")] { - if let StartupMode::SimpleFullscreen = window_config.startup_mode() { + if let StartupMode::SimpleFullscreen = config.window.startup_mode() { use glutin::os::macos::WindowExt; window.set_simple_fullscreen(true); } @@ -286,7 +286,7 @@ impl Window { ) -> WindowBuilder { use glutin::os::unix::WindowBuilderExt; - let decorations = match window_config.decorations() { + let decorations = match window_config.decorations { Decorations::None => false, _ => true, }; @@ -312,7 +312,7 @@ impl Window { _class: &str, window_config: &WindowConfig, ) -> WindowBuilder { - let decorations = match window_config.decorations() { + let decorations = match window_config.decorations { Decorations::None => false, _ => true, }; @@ -342,7 +342,7 @@ impl Window { .with_transparency(true) .with_maximized(window_config.startup_mode() == StartupMode::Maximized); - match window_config.decorations() { + match window_config.decorations { Decorations::Full => window, Decorations::Transparent => window .with_title_hidden(true) |