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

Improved external dialog to no longer extend onto other monitors #3695

Merged
merged 5 commits into from
Nov 21, 2019
Merged

Improved external dialog to no longer extend onto other monitors #3695

merged 5 commits into from
Nov 21, 2019

Conversation

AKruimink
Copy link

@AKruimink AKruimink commented Nov 17, 2019

Describe the changes you have made to improve this project

  • Added a check for window state in CreateModalExternalWindow
  • Added a border offset to take in account the overhang on both sides of the window when maximized causing a dialog to extend outside of the screen bounds.
  • Fix SetupExternalDialogWindow
    Use the monitor from where the owner stays and use the working area for the dialog size properties and remove also the left and right border.
  • Simplify getting the working area from current monitor with new extension method GetMonitorWorkSize
    Use this method in both variants SetupExternalDialogWindow and CreateModalExternalWindow which also fixes the main issue without calculating an offset by hand.

external-dialog-fix

Closed Issues

Closes #3538

@AKruimink
Copy link
Author

AKruimink commented Nov 17, 2019

Few things.

  1. With the way it currently works the offset is always calculated, this could still be changed to only get calulated on Maximized state, any preference?

  2. SetupExternalDialogWindow seems to maximize at all times, i wasnt sure if it required the change as well and thus has been left out, a minor issue with the current setup is when a user has monitors with different resolutions the PrimaryScreenWidth might not fit.

@AKruimink
Copy link
Author

Changed the check regardless, might be less pretty to look at, but it's not worth creating an offset each time when most of the time it's not used anyways.

@AKruimink AKruimink changed the title Improved external dialog to no longer extend onto other monitors [RFC] Improved external dialog to no longer extend onto other monitors Nov 19, 2019
@punker76 punker76 modified the milestones: 2.0 doc, 1.3.0, 2.0.0 Nov 20, 2019
@punker76 punker76 changed the title [RFC] Improved external dialog to no longer extend onto other monitors WIP Improved external dialog to no longer extend onto other monitors Nov 20, 2019
@AKruimink
Copy link
Author

AKruimink commented Nov 20, 2019

@punker76 or @timunie The CreateModalExternalWindow has been fixed and seems to be working.

For the SetupExternalDialogWindow i can't really find a proper way of doing it. The only ways i could come up with us by using Screen but would require Windows.Forms which i think is a bad idea, or you end up having to wrap around pinvoke and do it that way, which doesnt seem great either.

So the only options im further left with is.

  1. leave it as is, SystemParameters.PrimaryScreen(Width/Height) will be set, and if a user has a smaller secondary screen you will have the overlap onto the other monitor (or the opposite if the screen is bigger).

  2. Add optional parameters to the method that allows for custom sizes, or if left empty just use the SystemParameters.PrimaryScreen(Width/Height) .

option 2 would not persé fix the issue but would offer more flexibility at the least.

Any input would be appreciated

@punker76
Copy link
Member

@AKruimink I have a solution for it and will check in later.

Use the monitor from where the owner stays and use the working area for the dialog size properties and remove also the left and right border.
… new extension method GetMonitorWorkSize

Use this method in both variants SetupExternalDialogWindow and CreateModalExternalWindow which also fixes the main issue without calculating an offset by hand.
@punker76 punker76 changed the title WIP Improved external dialog to no longer extend onto other monitors Improved external dialog to no longer extend onto other monitors Nov 21, 2019
@punker76 punker76 merged commit 872dc4c into MahApps:develop Nov 21, 2019
@punker76
Copy link
Member

@AKruimink your changes have been merged, thanks for your contribution 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

In full-screen mode, the dialog window pops out on 2 monitor
2 participants