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

Code before:
        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_not_current(&mut self) {
        if self.windowed_context.is_current() {
            // SAFETY due to use of multiple windows we always ensure that the context is current
            // before rendering, so treating it as current here to avoid extra complexity from
            // addign extra enum.
            self.windowed_context.replace_with(|context| unsafe {
                context.make_not_current().expect("context swap").treat_as_current()
            });
        }
    }

    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") });
        }
    }

    /// Disable macOS window shadows.
    ///
    /// This prevents rendering artifacts from showing up when the window is transparent.
    #[cfg(target_os = "macos")]
    pub fn set_has_shadow(&self, has_shadows: bool) {
        let raw_window = match self.window().raw_window_handle() {
            RawWindowHandle::AppKit(handle) => handle.ns_window as id,
            _ => return,
        };

        let value = if has_shadows { YES } else { NO };
        unsafe {

Review comment (suggestion):
```suggestion
            // adding extra enum.
```

Code after:
        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_not_current(&mut self) {
        if self.windowed_context.is_current() {
            self.windowed_context.replace_with(|context| unsafe {
                // We do ensure that context is current before any rendering operation due to multi
                // window support, so we don't need extra "type aid" from glutin here.
                context.make_not_current().expect("context swap").treat_as_current()
            });
        }
    }

    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") });
        }
    }

    /// Disable macOS window shadows.
    ///
    /// This prevents rendering artifacts from showing up when the window is transparent.
    #[cfg(target_os = "macos")]
    pub fn set_has_shadow(&self, has_shadows: bool) {
        let raw_window = match self.window().raw_window_handle() {
            RawWindowHandle::AppKit(handle) => handle.ns_window as id,
            _ => return,
        };

        let value = if has_shadows { YES } else { NO };
        unsafe {
            let _: () = msg_send![raw_window, setHasShadow: value];