Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow zoom past monitor size #2743

Merged
merged 2 commits into from Apr 18, 2024
Merged

allow zoom past monitor size #2743

merged 2 commits into from Apr 18, 2024

Conversation

adipose
Copy link

@adipose adipose commented Apr 17, 2024

This solves one or more of the zoom issues. Namely, it will zoom past the monitor size by changing back to bottom right growth once it is out of monitor. I chose that option somewhat arbitrarily, but if the window has already zoomed to its max size within the monitor, it keeps the upper left on that monitor, which is helpful for accessing the menus etc.

@adipose
Copy link
Author

adipose commented Apr 17, 2024

I also added a function to standardize the working rect code. I observe that there are multiple code blocks throughout mainfrm.cpp with the same or similar purpose, and they are not all written the same:

        CRect areaRect;
        CMonitors::GetNearestMonitor(this).GetWorkAreaRect(areaRect);
        const CRect invisibleBorderSize = GetInvisibleBorderSize();
        areaRect.InflateRect(invisibleBorderSize);
    if (bZoomed) {
        CMonitors::GetNearestMonitor(this).GetWorkAreaRect(windowRect);
    } else {
        VERIFY(AdjustWindowRectEx(windowRect, GetWindowStyle(m_hWnd), dwMenuFlags == AFX_MBV_KEEPVISIBLE, GetWindowExStyle(m_hWnd)));
    }
        CRect workRect;
        CMonitors::GetNearestMonitor(this).GetWorkAreaRect(workRect);

        if (workRect.Width() && workRect.Height()) {
            // account for invisible borders on Windows 10 by allowing
            // the window to go out of screen a bit
            if (IsWindows10OrGreater()) {
                workRect.InflateRect(GetInvisibleBorderSize());
            }

Here's the one I adopted, but only because it was in a function affected by this patch.

    MONITORINFO mi = { sizeof(mi) };
    if (GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi)) {
        work = mi.rcWork;
        // account for invisible borders on Windows 10 by allowing
        // the window to go out of screen a bit
        if (IsWindows10OrGreater()) {
            work.InflateRect(GetInvisibleBorderSize());
        }

Copy link

@Sp3EdeR Sp3EdeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! This would close the first 2 points of the #2740 issue, in my opinion.

@clsid2 clsid2 merged commit f5471bd into clsid2:develop Apr 18, 2024
@adipose adipose deleted the patch405 branch May 24, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants