fn apply_diff(mut self, window: HWND, mut new: WindowFlags) {
        self = self.mask();
        new = new.mask();

        let diff = self ^ new;
        if diff == WindowFlags::empty() {
            return;
        }

        if diff.contains(WindowFlags::VISIBLE) {
            unsafe {
                ShowWindow(
                    window,
                    match new.contains(WindowFlags::VISIBLE) {
                        true => SW_SHOW,
                        false => SW_HIDE,
                    },
                );
            }
        }
        if diff.contains(WindowFlags::ALWAYS_ON_TOP) {
            unsafe {
                SetWindowPos(
                    window,
                    match new.contains(WindowFlags::ALWAYS_ON_TOP) {
                        true => HWND_TOPMOST,
                        false => HWND_NOTOPMOST,
                    },
                    0,
                    0,
                    0,
                    0,
                    SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE,
                );
                InvalidateRgn(window, 0, false.into());
            }
        }

        if diff.contains(WindowFlags::MAXIMIZED) || new.contains(WindowFlags::MAXIMIZED) {
            unsafe {
                ShowWindow(
                    window,
                    match new.contains(WindowFlags::MAXIMIZED) {
                        true => SW_MAXIMIZE,
                        false => SW_RESTORE,
                    },
                );
            }
        }

        // Minimize operations should execute after maximize for proper window animations
        if diff.contains(WindowFlags::MINIMIZED) {
            unsafe {
                ShowWindow(
                    window,
                    match new.contains(WindowFlags::MINIMIZED) {
                        true => SW_MINIMIZE,
                        false => SW_RESTORE,
                    },
                );
            }
        }

        if diff != WindowFlags::empty() {
            let (style, style_ex) = new.to_window_styles();

            unsafe {
                SendMessageW(window, *event_loop::SET_RETAIN_STATE_ON_SIZE_MSG_ID, 1, 0);

                // This condition is necessary to avoid having an unrestorable window
                if !new.contains(WindowFlags::MINIMIZED) {
                    SetWindowLongW(window, GWL_STYLE, style as i32);
                    SetWindowLongW(window, GWL_EXSTYLE, style_ex as i32);
                }

                let mut flags = SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED;

                // We generally don't want style changes here to affect window
                // focus, but for fullscreen windows they must be activated
                // (i.e. focused) so that they appear on top of the taskbar
                if !new.contains(WindowFlags::MARKER_EXCLUSIVE_FULLSCREEN)
                    && !new.contains(WindowFlags::MARKER_BORDERLESS_FULLSCREEN)
                {
                    flags |= SWP_NOACTIVATE;
                }

                // Refresh the window frame
                SetWindowPos(window, 0, 0, 0, 0, 0, flags);
                SendMessageW(window, *event_loop::SET_RETAIN_STATE_ON_SIZE_MSG_ID, 0, 0);
            }
        }
    }
/// Adjust the window client rectangle to the return value, if present.
Adjust the window client rectangle to the return value, if present.
Adjust the window client rectangle to the return value if present .
fn apply_diff(mut self, window: HWND, mut new: WindowFlags) {
        self = self.mask();
        new = new.mask();
        let diff = self ^ new;
        if diff == WindowFlags::empty() {
            return;
        }
        if diff.contains(WindowFlags::VISIBLE) {
            unsafe {
                ShowWindow(
                    window,
                    match new.contains(WindowFlags::VISIBLE) {
                        true => SW_SHOW,
                        false => SW_HIDE,
                    },
                );
            }
        }
        if diff.contains(WindowFlags::ALWAYS_ON_TOP) {
            unsafe {
                SetWindowPos(
                    window,
                    match new.contains(WindowFlags::ALWAYS_ON_TOP) {
                        true => HWND_TOPMOST,
                        false => HWND_NOTOPMOST,
                    },
                    0,
                    0,
                    0,
                    0,
                    SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE,
                );
                InvalidateRgn(window, 0, false.into());
            }
        }
        if diff.contains(WindowFlags::MAXIMIZED) || new.contains(WindowFlags::MAXIMIZED) {
            unsafe {
                ShowWindow(
                    window,
                    match new.contains(WindowFlags::MAXIMIZED) {
                        true => SW_MAXIMIZE,
                        false => SW_RESTORE,
                    },
                );
            }
        }
        // Minimize operations should execute after maximize for proper window animations
        if diff.contains(WindowFlags::MINIMIZED) {
            unsafe {
                ShowWindow(
                    window,
                    match new.contains(WindowFlags::MINIMIZED) {
                        true => SW_MINIMIZE,
                        false => SW_RESTORE,
                    },
                );
            }
        }
        if diff != WindowFlags::empty() {
            let (style, style_ex) = new.to_window_styles();
            unsafe {
                SendMessageW(window, *event_loop::SET_RETAIN_STATE_ON_SIZE_MSG_ID, 1, 0);
                // This condition is necessary to avoid having an unrestorable window
                if !new.contains(WindowFlags::MINIMIZED) {
                    SetWindowLongW(window, GWL_STYLE, style as i32);
                    SetWindowLongW(window, GWL_EXSTYLE, style_ex as i32);
                }
                let mut flags = SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED;
                // We generally don't want style changes here to affect window
                // focus, but for fullscreen windows they must be activated
                // (i.e. focused) so that they appear on top of the taskbar
                if !new.contains(WindowFlags::MARKER_EXCLUSIVE_FULLSCREEN)
                    && !new.contains(WindowFlags::MARKER_BORDERLESS_FULLSCREEN)
                {
                    flags |= SWP_NOACTIVATE;
                }
                // Refresh the window frame
                SetWindowPos(window, 0, 0, 0, 0, 0, flags);
                SendMessageW(window, *event_loop::SET_RETAIN_STATE_ON_SIZE_MSG_ID, 0, 0);
            }
        }
    }
fn apply_diff ( mut self , window : HWND , mut new : WindowFlags ) { self = self . mask ( ) ; new = new . mask ( ) ; let diff = self ^ new ; if diff == WindowFlags :: empty ( ) { return ; } if diff . contains ( WindowFlags :: VISIBLE ) { unsafe { ShowWindow ( window , match new . contains ( WindowFlags :: VISIBLE ) { true => SW_SHOW , false => SW_HIDE , } , ) ; } } if diff . contains ( WindowFlags :: ALWAYS_ON_TOP ) { unsafe { SetWindowPos ( window , match new . contains ( WindowFlags :: ALWAYS_ON_TOP ) { true => HWND_TOPMOST , false => HWND_NOTOPMOST , } , 0 , 0 , 0 , 0 , SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE , ) ; InvalidateRgn ( window , 0 , false . into ( ) ) ; } } if diff . contains ( WindowFlags :: MAXIMIZED ) || new . contains ( WindowFlags :: MAXIMIZED ) { unsafe { ShowWindow ( window , match new . contains ( WindowFlags :: MAXIMIZED ) { true => SW_MAXIMIZE , false => SW_RESTORE , } , ) ; } } // Minimize operations should execute after maximize for proper window animations if diff . contains ( WindowFlags :: MINIMIZED ) { unsafe { ShowWindow ( window , match new . contains ( WindowFlags :: MINIMIZED ) { true => SW_MINIMIZE , false => SW_RESTORE , } , ) ; } } if diff != WindowFlags :: empty ( ) { let ( style , style_ex ) = new . to_window_styles ( ) ; unsafe { SendMessageW ( window , * event_loop :: SET_RETAIN_STATE_ON_SIZE_MSG_ID , 1 , 0 ) ; // This condition is necessary to avoid having an unrestorable window if ! new . contains ( WindowFlags :: MINIMIZED ) { SetWindowLongW ( window , GWL_STYLE , style as i32 ) ; SetWindowLongW ( window , GWL_EXSTYLE , style_ex as i32 ) ; } let mut flags = SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED ; // We generally don't want style changes here to affect window // focus, but for fullscreen windows they must be activated // (i.e. focused) so that they appear on top of the taskbar if ! new . contains ( WindowFlags :: MARKER_EXCLUSIVE_FULLSCREEN ) && ! new . contains ( WindowFlags :: MARKER_BORDERLESS_FULLSCREEN ) { flags |= SWP_NOACTIVATE ; } // Refresh the window frame SetWindowPos ( window , 0 , 0 , 0 , 0 , 0 , flags ) ; SendMessageW ( window , * event_loop :: SET_RETAIN_STATE_ON_SIZE_MSG_ID , 0 , 0 ) ; } } }
Adjust the window client rectangle to the return value, if present.
Adjust the window client rectangle to the return value if present .
mut self
window
HWND
new
WindowFlags