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

Code before:

        // 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;

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

                let surface = windowed_context.window().wayland_surface().unwrap();
                let proxy: Proxy<WlSurface> = unsafe { Proxy::from_c_ptr(surface as _) };
                wayland_surface = Some(proxy.attach(wayland_event_queue.as_ref().unwrap().token()));
            }
        }

        Ok(Self {
            current_mouse_cursor,
            mouse_visible: true,
            windowed_context,
            #[cfg(not(any(target_os = "macos", windows)))]
            should_draw: Arc::new(AtomicBool::new(true)),
            #[cfg(not(any(target_os = "macos", windows)))]
            wayland_surface,
        })
    }

    pub fn set_inner_size(&mut self, size: PhysicalSize<u32>) {
        self.window().set_inner_size(size);
    }

    pub fn inner_size(&self) -> PhysicalSize<u32> {
        self.window().inner_size()
    }

    pub fn scale_factor(&self) -> f64 {
        self.window().scale_factor()
    }

    #[inline]
    pub fn set_visible(&self, visibility: bool) {
        self.window().set_visible(visibility);
    }

Review comment (suggestion):
Two short comments on each of these blocks might be useful? Since they do two completely different things unrelated to each other.

Code after:
        // 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);
                windowed_context.window().set_wayland_theme(theme);

                // Attach surface to Alacritty's internal wayland queue to handle frame callbacks.
                let surface = windowed_context.window().wayland_surface().unwrap();
                let proxy: Proxy<WlSurface> = unsafe { Proxy::from_c_ptr(surface as _) };
                wayland_surface = Some(proxy.attach(wayland_event_queue.as_ref().unwrap().token()));
            }
        }

        Ok(Self {
            current_mouse_cursor,
            mouse_visible: true,
            windowed_context,
            #[cfg(not(any(target_os = "macos", windows)))]
            should_draw: Arc::new(AtomicBool::new(true)),
            #[cfg(not(any(target_os = "macos", windows)))]
            wayland_surface,
        })
    }

    pub fn set_inner_size(&mut self, size: PhysicalSize<u32>) {
        self.window().set_inner_size(size);
    }

    pub fn inner_size(&self) -> PhysicalSize<u32> {
        self.window().inner_size()
    }

    pub fn scale_factor(&self) -> f64 {
        self.window().scale_factor()
    }