Repository: alacritty/alacritty
File: alacritty/src/window.rs (Rust)

Code before:
    /// Attached Wayland surface to request new frame events.
    #[cfg(not(any(target_os = "macos", windows)))]
    pub wayland_surface: Option<Attached<WlSurface>>,

    windowed_context: WindowedContext<PossiblyCurrent>,
    current_mouse_cursor: CursorIcon,
    mouse_visible: bool,
}

impl Window {
    /// Create a new window
    ///
    /// This creates a window and fully initializes a window.
    pub fn new(
        event_loop: &EventLoop<Event>,
        config: &Config,
        size: Option<PhysicalSize<u32>>,
        #[cfg(not(any(target_os = "macos", windows)))] wayland_event_queue: Option<&EventQueue>,
    ) -> Result<Window> {
        let window_builder = Window::get_platform_window(&config.window.title, &config.window);
        // Disable vsync on Wayland
        #[cfg(not(any(target_os = "macos", windows)))]
        let vsync = !event_loop.is_wayland();
        #[cfg(any(target_os = "macos", windows))]
        let vsync = true;
        let windowed_context =
            create_gl_window(window_builder.clone(), &event_loop, false, vsync, size)
                .or_else(|_| create_gl_window(window_builder, &event_loop, true, vsync, size))?;

        // Text cursor
        let current_mouse_cursor = CursorIcon::Text;
        windowed_context.window().set_cursor_icon(current_mouse_cursor);

        // Set OpenGL symbol loader. This call MUST be after window.make_current on windows.
        gl::load_with(|symbol| windowed_context.get_proc_address(symbol) as *const _);

        #[cfg(not(any(target_os = "macos", windows)))]
        let mut wayland_surface = None;

        #[cfg(not(any(target_os = "macos", windows)))]
        {
            if event_loop.is_x11() {
                // On X11, embed the window inside another if the parent ID has been set
                if let Some(parent_window_id) = config.window.embed {
                    x_embed_window(windowed_context.window(), parent_window_id);
                }
            } else {
                // Apply CSD theme
                let theme = AlacrittyWaylandTheme::new(&config.colors);
                windowed_context.window().set_wayland_theme(theme);


Review comment (refactor):
```suggestion

        // Disable vsync on Wayland
        #[cfg(not(any(target_os = "macos", windows)))]
        let vsync = !event_loop.is_wayland();
        #[cfg(any(target_os = "macos", windows))]
        let vsync = true;
        
```

Just to clean up stuff a little bit.

Code after:
    /// Attached Wayland surface to request new frame events.
    #[cfg(not(any(target_os = "macos", windows)))]
    pub wayland_surface: Option<Attached<WlSurface>>,

    windowed_context: WindowedContext<PossiblyCurrent>,
    current_mouse_cursor: CursorIcon,
    mouse_visible: bool,
}

impl Window {
    /// Create a new window
    ///
    /// This creates a window and fully initializes a window.
    pub fn new(
        event_loop: &EventLoop<Event>,
        config: &Config,
        size: Option<PhysicalSize<u32>>,
        #[cfg(not(any(target_os = "macos", windows)))] wayland_event_queue: Option<&EventQueue>,
    ) -> Result<Window> {
        let window_builder = Window::get_platform_window(&config.window.title, &config.window);

        // Disable vsync on Wayland.
        #[cfg(not(any(target_os = "macos", windows)))]
        let vsync = !event_loop.is_wayland();
        #[cfg(any(target_os = "macos", windows))]
        let vsync = true;

        let windowed_context =
            create_gl_window(window_builder.clone(), &event_loop, false, vsync, size)
                .or_else(|_| create_gl_window(window_builder, &event_loop, true, vsync, size))?;

        // Text cursor.
        let current_mouse_cursor = CursorIcon::Text;
        windowed_context.window().set_cursor_icon(current_mouse_cursor);

        // Set OpenGL symbol loader. This call MUST be after window.make_current on windows.
        gl::load_with(|symbol| windowed_context.get_proc_address(symbol) as *const _);

        #[cfg(not(any(target_os = "macos", windows)))]
        let mut wayland_surface = None;

        #[cfg(not(any(target_os = "macos", windows)))]
        {
            if event_loop.is_x11() {
                // On X11, embed the window inside another if the parent ID has been set.
                if let Some(parent_window_id) = config.window.embed {
                    x_embed_window(windowed_context.window(), parent_window_id);
                }
            } else {
                // Apply client side decorations theme.
                let theme = AlacrittyWaylandTheme::new(&config.colors);