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

Code before:
    }

    #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
    pub fn wayland_surface(&self) -> Option<&Attached<WlSurface>> {
        self.wayland_surface.as_ref()
    }

    /// Adjust the IME editor position according to the new location of the cursor.
    pub fn update_ime_position(&self, point: Point, size: &SizeInfo) {
        let nspot_x = f64::from(size.padding_x() + point.column.0 as f32 * size.cell_width());
        let nspot_y = f64::from(size.padding_y() + (point.line.0 + 1) as f32 * size.cell_height());

        self.window().set_ime_position(PhysicalPosition::new(nspot_x, nspot_y));
    }

    pub fn swap_buffers(&self) {
        self.windowed_context.swap_buffers().expect("swap buffers");
    }

    pub fn swap_buffers_with_damage(&self, damage: &[Rect]) {
        self.windowed_context.swap_buffers_with_damage(damage).expect("swap buffes with damage");
    }

    #[cfg(any(target_os = "macos", windows))]
    pub fn swap_buffers_with_damage_supported(&self) -> bool {
        // Disable damage tracking on macOS/Windows since there's no observation of it working
        false
    }

    #[cfg(not(any(target_os = "macos", windows)))]
    pub fn swap_buffers_with_damage_supported(&self) -> bool {
        // On X11 damage tracking is behaving in unexpected way on some NVIDIA systems. Given that
        // there're no compositors supporting damage tracking and there's no such thing on GLX,
        // which is used by default, disabling it.
        //
        // For more see https://github.com/alacritty/alacritty/issues/6051.
        #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
        if self.window().xlib_window().is_some() {
            return false;
        }

        self.windowed_context.swap_buffers_with_damage_supported()
    }

    pub fn resize(&self, size: PhysicalSize<u32>) {
        self.windowed_context.resize(size);
    }

    pub fn make_current(&mut self) {
        if !self.windowed_context.is_current() {
            self.windowed_context

Review comment (suggestion):
```suggestion
        // Disable damage tracking on macOS/Windows since there's no observation of it working.
```

Code after:
    }

    #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
    pub fn wayland_surface(&self) -> Option<&Attached<WlSurface>> {
        self.wayland_surface.as_ref()
    }

    /// Adjust the IME editor position according to the new location of the cursor.
    pub fn update_ime_position(&self, point: Point, size: &SizeInfo) {
        let nspot_x = f64::from(size.padding_x() + point.column.0 as f32 * size.cell_width());
        let nspot_y = f64::from(size.padding_y() + (point.line.0 + 1) as f32 * size.cell_height());

        self.window().set_ime_position(PhysicalPosition::new(nspot_x, nspot_y));
    }

    pub fn swap_buffers(&self) {
        self.windowed_context.swap_buffers().expect("swap buffers");
    }

    pub fn swap_buffers_with_damage(&self, damage: &[Rect]) {
        self.windowed_context.swap_buffers_with_damage(damage).expect("swap buffes with damage");
    }

    #[cfg(any(target_os = "macos", windows))]
    pub fn swap_buffers_with_damage_supported(&self) -> bool {
        // Disable damage tracking on macOS/Windows since there's no observation of it working.
        false
    }

    #[cfg(not(any(target_os = "macos", windows)))]
    pub fn swap_buffers_with_damage_supported(&self) -> bool {
        // On X11 damage tracking is behaving in unexpected ways on some NVIDIA systems. Since
        // there's no compositor supporting it, damage tracking is disabled on X11.
        //
        // For more see https://github.com/alacritty/alacritty/issues/6051.
        #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
        if self.window().xlib_window().is_some() {
            return false;
        }

        self.windowed_context.swap_buffers_with_damage_supported()
    }

    pub fn resize(&self, size: PhysicalSize<u32>) {
        self.windowed_context.resize(size);
    }

    pub fn make_current(&mut self) {
        if !self.windowed_context.is_current() {
            self.windowed_context
                .replace_with(|context| unsafe { context.make_current().expect("context swap") });