Repository: microsoft/terminal
File: src/cascadia/WindowsTerminal/IslandWindow.cpp (C++)

Code before:
            // Convert to logical scaling before raising the event.
            const auto real = relative / GetCurrentDpiScale();

            const short wheelDelta = static_cast<short>(HIWORD(wparam));

            // Raise an event, so any listeners can handle the mouse wheel event manually.
            _MouseScrolledHandlers(real, wheelDelta);
            return 0;
        }
        CATCH_LOG();
    case WM_THEMECHANGED:
        UpdateWindowIconForActiveMetrics(_window.get());
        return 0;
    case WM_WINDOWPOSCHANGING:
    {
        // GH#10274 - if the quake window gets moved to another monitor via aero
        // snap (win+shift+arrows), then re-adjust the size for the new monitor.
        if (IsQuakeWindow())
        {
            // Retrieve the suggested dimensions and make a rect and size.
            LPWINDOWPOS lpwpos = (LPWINDOWPOS)lparam;

            // We only need to apply restrictions if the position is changing.
            // The SWP_ flags are confusing to read. This is
            // "if we're not NOT moving the window"
            if (!WI_IsFlagSet(lpwpos->flags, SWP_NOMOVE))
            {
                // Figure out the suggested dimensions and position.
                RECT rcSuggested;
                rcSuggested.left = lpwpos->x;
                rcSuggested.top = lpwpos->y;
                rcSuggested.right = rcSuggested.left + lpwpos->cx;
                rcSuggested.bottom = rcSuggested.top + lpwpos->cy;

                // Find the bounds of the current monitor, and the monitor that
                // we're suggested to be on.

                RECT windowRect = GetWindowRect();
                HMONITOR current = MonitorFromRect(&windowRect, MONITOR_DEFAULTTONEAREST);
                MONITORINFO currentInfo;
                currentInfo.cbSize = sizeof(MONITORINFO);
                GetMonitorInfo(current, &currentInfo);

                HMONITOR proposed = MonitorFromRect(&rcSuggested, MONITOR_DEFAULTTONEAREST);
                MONITORINFO proposedInfo;
                proposedInfo.cbSize = sizeof(MONITORINFO);
                GetMonitorInfo(proposed, &proposedInfo);

                // If the monitor changed...
                if (til::rectangle{ proposedInfo.rcMonitor } !=
                    til::rectangle{ currentInfo.rcMonitor })

Review comment (suggestion):
```suggestion
            if (WI_IsFlagClear(lpwpos->flags, SWP_NOMOVE))
```

:smile:

Code after:
            // Convert to logical scaling before raising the event.
            const auto real = relative / GetCurrentDpiScale();

            const short wheelDelta = static_cast<short>(HIWORD(wparam));

            // Raise an event, so any listeners can handle the mouse wheel event manually.
            _MouseScrolledHandlers(real, wheelDelta);
            return 0;
        }
        CATCH_LOG();
    case WM_THEMECHANGED:
        UpdateWindowIconForActiveMetrics(_window.get());
        return 0;
    case WM_WINDOWPOSCHANGING:
    {
        // GH#10274 - if the quake window gets moved to another monitor via aero
        // snap (win+shift+arrows), then re-adjust the size for the new monitor.
        if (IsQuakeWindow())
        {
            // Retrieve the suggested dimensions and make a rect and size.
            LPWINDOWPOS lpwpos = (LPWINDOWPOS)lparam;

            // We only need to apply restrictions if the position is changing.
            // The SWP_ flags are confusing to read. This is
            // "if we're not moving the window, do nothing."
            if (WI_IsFlagSet(lpwpos->flags, SWP_NOMOVE))
            {
                break;
            }
            // Figure out the suggested dimensions and position.
            RECT rcSuggested;
            rcSuggested.left = lpwpos->x;
            rcSuggested.top = lpwpos->y;
            rcSuggested.right = rcSuggested.left + lpwpos->cx;
            rcSuggested.bottom = rcSuggested.top + lpwpos->cy;

            // Find the bounds of the current monitor, and the monitor that
            // we're suggested to be on.

            HMONITOR current = MonitorFromWindow(_window.get(), MONITOR_DEFAULTTONEAREST);
            MONITORINFO currentInfo;
            currentInfo.cbSize = sizeof(MONITORINFO);
            GetMonitorInfo(current, &currentInfo);

            HMONITOR proposed = MonitorFromRect(&rcSuggested, MONITOR_DEFAULTTONEAREST);
            MONITORINFO proposedInfo;
            proposedInfo.cbSize = sizeof(MONITORINFO);
            GetMonitorInfo(proposed, &proposedInfo);

            // If the monitor changed...
            if (til::rectangle{ proposedInfo.rcMonitor } !=