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

Screen geometry #3222

Closed
vomikan opened this issue Apr 10, 2021 · 22 comments
Closed

Screen geometry #3222

vomikan opened this issue Apr 10, 2021 · 22 comments
Assignees
Milestone

Comments

@vomikan
Copy link
Member

vomikan commented Apr 10, 2021

Hi

I test each new version on my 3 screens.
Since the last MMEX versions, MMEX no longer starts on the screen on
which it was last closed.
MMEX starts on the screen (landscape, 1920x1080) defined for the main
Windows display.

Greetings @renato-mmex

#2877
#2826

@vomikan vomikan added this to the v1.5.1 milestone Apr 10, 2021
@whalley
Copy link
Member

whalley commented Apr 10, 2021

I can't seem to reproduce this on my Mac. Tried with just laptop screen and saves/recovers position, tried with attached display and it saves/recovers on which ever screen I choose. Have opened and closed on external monitor, disconnected external, opened and it detects no screen position and opens on laptop correctly.

@vomikan
Copy link
Member Author

vomikan commented Apr 10, 2021

The same for me.

@vomikan vomikan closed this as completed Apr 10, 2021
@vomikan
Copy link
Member Author

vomikan commented Apr 14, 2021

@vomikan vomikan reopened this Apr 14, 2021
@vomikan
Copy link
Member Author

vomikan commented Apr 16, 2021

image

@whalley
Copy link
Member

whalley commented Apr 16, 2021

Added diagnostics menu under Help Menu that we can enable/disable as needed and update code to collect more info if we need to investigate fault further. May help in this case.

@vomikan
Copy link
Member Author

vomikan commented Apr 17, 2021

I have tested again.

  1. MMEX full screen always opens on main screen.
  2. MMEX partial image is always opened at the previously closed location.

Maybe this helps.
regards Renato use MMEX since 2009

vomikan added a commit that referenced this issue Apr 17, 2021
fix(#3222): added diagnostics menu
@whalley
Copy link
Member

whalley commented Apr 17, 2021

Never thought of checking that..... that may indeed be the source of the issue. Will check.

@renato-mmex
Copy link

I have tested again:
When MMEX is docked at the edge of the screen, MMEX is subsequently opened on the main screen

@renato-mmex
Copy link

I also notice that the screen resolution of the main screen is always listed under "About":

Money Manager Ex
Version: 1.5.1-RC.1 64-bit
• Build on Apr 17 2021 19:26:39
• Database version: 7 • (aes128cbc)
MMEX is using the following support products:
• wxWidgets 3.1.4 (wxMSW 10.0)
• wxSQLite3 4.6.0 (SQLite 3.31.1) • RapidJSON 1.1.0
• Lua 5.3.5
• lunasvg
• libcurl/7.61.0-DEV WinSSL
• gettext 0.19.8.1
• apexcharts.js
Build using:
• CMake 3.16.2
• MSBuild 15.9.21.664
• Microsoft Visual Studio 15.0
• Microsoft Visual C++ 19.16.27035.0
• Windows SDK 10.0.14393.0
Running on:
• Windows 10 (build 21359), 64-bit edition
• German (Swiss) (windows-1252)
• 1920x1080 32bit 96x96ppi

@vomikan vomikan changed the title Always Opens on Wrong Monitor Screen geometry Apr 18, 2021
@vomikan
Copy link
Member Author

vomikan commented Apr 18, 2021

{675644} normal block at 0x00000204D3E8B380, 8 bytes long.
Data: <@ > 40 A2 98 CD 04 02 00 00
Object dump complete.

Solution:
wxSharedPtr<wxDisplay> display(new wxDisplay(i));

vomikan added a commit to vomikan/moneymanagerex that referenced this issue Apr 18, 2021
vomikan added a commit to vomikan/moneymanagerex that referenced this issue Apr 18, 2021
vomikan added a commit that referenced this issue Apr 18, 2021
fix(#3222): current geometry added
@vomikan
Copy link
Member Author

vomikan commented Apr 18, 2021

When MMEX is docked at the edge of the screen, MMEX is subsequently opened on the main screen

image

Possible fix is:

    // Check if it fits into any of the windows
    bool itFits = false;
    for (unsigned int i = 0; i < wxDisplay::GetCount(); i++) {
        display = new wxDisplay(i);
        if (display->GetGeometry().Contains(wxRect(valX + 8, valY + 8, valW - 16, valH - 16))) itFits = true;
    }

@vomikan
Copy link
Member Author

vomikan commented Apr 18, 2021

The app has been docked to the left side

image

@vomikan vomikan added solution found workaround or user side solution avaiable and removed needs more info labels Apr 18, 2021
@vomikan
Copy link
Member Author

vomikan commented Apr 18, 2021

Full screen

image

image

PS full screen is opening OK

whalley pushed a commit that referenced this issue Apr 18, 2021
fix(#3222): current geometry added
@renato-mmex
Copy link

What I still don't understand is why it depends on the resolution of the screen.
What is important is on which screen the window was closed in order to open it again, of course in the same resolution.

@whalley
Copy link
Member

whalley commented Apr 18, 2021

The screen layout may have changed between saving last and opening. E.g laptop may be connected to or not an external display. We need to make sure we don’t open in a place that would be off any screen.

@renato-mmex
Copy link

Of course, MMEX cannot be opened on a screen that does not exist, then it must be opened on the main screen.
Let's assume that the picture opened on 2 screens (in my case, for example, No. 3+2), then this should also work. From my point of view, the upper left corner is always the reference position. All office programmes and many other software do this correctly.

@vomikan
Copy link
Member Author

vomikan commented Apr 21, 2021

I only see a problem in negative values when the app is pressed to the edge of the screen. It is difficult to understand the nature and magnitude of these values. But we must somehow allow such a small exit over the edges. This will solve some of the problems.
About the different screens. We can probably save the geometry for all screens. If the screen is not available, then use the main one.

{
    "Dafault": 3,
    {
        "Monitor":  1,
        "Geometry":  [
            0,
            0,
            100,
            100
        ]
    },
    {
        "Monitor":  2,
        "Geometry":  [
            0,
            0,
            200,
            200
        ]
    },
    {
        "Monitor":  3,
        "Geometry":  [
            0,
            0,
            300,
            200
        ]
    },
    
}

@renato-mmex
Copy link

I used to program many such solutions, but I am an old school programmer (software), because I retired 23 years ago.

I would save the following items when exiting MMEX:
a) Screen number
b) position of the upper left corner of the MMEX window
c) the size of the MMEX window

When starting MMEX:

the saved screen is not present
Open MMEX in fullscreen on the main monitor.

If the screen is present:
Open MMEX with the saved positions a), b), c).

However, problems could arise if the saved screen has a different (too small) resolution in the meantime. this could be solved by saving the resolution of this screen and comparing it when starting MMEX, if it does not match, MMEX should be opened on the main monitor.

@whalley
Copy link
Member

whalley commented Apr 21, 2021

At present we do something very similar but instead of holding onto screen numbers we check if the logical window co-ords fit into any window. As @vomikan notes there is an issue with window geometry in wxWidgets reporting -ve numbers off the screen co-ords when windows are pressed to the edge.

We will look to get a fix in there for the 1.5.1 release.

@renato-mmex
Copy link

would be happy if you can solve this problem.
gladly help with the tests
Greetings Renato

@vomikan vomikan modified the milestones: v1.5.1, v1.5.2 Apr 23, 2021
@whalley whalley self-assigned this Apr 27, 2021
@whalley
Copy link
Member

whalley commented Apr 27, 2021

A looser match to check if the window 'fits' onto a screen has been implemented. Now if the window has at least 50% of its real estate on any screen then it will be opened in the saved position, otherwise a default position on the main screen will be used. This solves the original main problem of it potentially opening on a screen that no longer exists whilst allowing some flexibility on location. Now you can save the position when it spans screens, is slightly off screen, or the reported geometry is slightly off!

Change is in master at present. @renato-mmex @vomikan - Please test.
https://ci.appveyor.com/project/moneymanagerex/moneymanagerex/builds/38900648/job/uogeb9fn5bcs5iyy/artifacts

@whalley whalley added the fixed label Apr 27, 2021
@renato-mmex
Copy link

renato-mmex commented Apr 27, 2021 via email

whalley pushed a commit that referenced this issue Apr 27, 2021
fix(#3222): more 'loose' fit for screen
whalley pushed a commit that referenced this issue Apr 28, 2021
fix(#3222): more 'loose' fit for screen
@vomikan vomikan removed the solution found workaround or user side solution avaiable label Apr 28, 2021
@vomikan vomikan closed this as completed Apr 28, 2021
whalley pushed a commit that referenced this issue May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants