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

Use the owner window's screen as the constraint. #15910

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

grokys
Copy link
Member

@grokys grokys commented Jun 4, 2024

What does the pull request do?

#14982 added some logic from WPF to contrain a window showed with WindowStartupLocation.CenterOwner to the screen, but it had a bug: the screen used was the screen that the window being shown is currently on, not the owner window.

This means that if the owner window is on a different screen to the window being shown then it will be constrained to the wrong screen.

You can see this on Windows by showing a child Window with CenterOwner when the owner window is on a secondary screen: the child window will initially be shown on the primary screen and so the constraint will be wrong, resulting in the child window being shown on the wrong screen.

#14982 added some logic from WPF to contrain a window showed with `WindowStartupLocation.CenterOwner` to the screen, but it had a bug: the screen used was the screen that the window being _shown) is currently on, not the _owner_ window.

This means that if the owner window is on a different screen to the window being shown then it will be constrained to the wrong screen.

You can see this on Windows by showing a child `Window` with `CenterOwner` when the owner window is on a secondary screen: the child window will initially be shown on the primary screen and so the constraint will be wrong, resulting in the child window being shown on the wrong screen.
@grokys grokys added bug backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Jun 4, 2024
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048783-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Jun 5, 2024
Merged via the queue into master with commit f0226b7 Jun 5, 2024
12 checks passed
@maxkatz6 maxkatz6 deleted the fixes/window-centerowner-secondary-screen branch June 5, 2024 01:27
@grokys grokys added customer-priority Issue reported by a customer with a support agreement. and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Aug 8, 2024
grokys added a commit that referenced this pull request Aug 8, 2024
#14982 added some logic from WPF to contrain a window showed with `WindowStartupLocation.CenterOwner` to the screen, but it had a bug: the screen used was the screen that the window being _shown) is currently on, not the _owner_ window.

This means that if the owner window is on a different screen to the window being shown then it will be constrained to the wrong screen.

You can see this on Windows by showing a child `Window` with `CenterOwner` when the owner window is on a secondary screen: the child window will initially be shown on the primary screen and so the constraint will be wrong, resulting in the child window being shown on the wrong screen.
maxkatz6 pushed a commit that referenced this pull request Aug 12, 2024
#14982 added some logic from WPF to contrain a window showed with `WindowStartupLocation.CenterOwner` to the screen, but it had a bug: the screen used was the screen that the window being _shown) is currently on, not the _owner_ window.

This means that if the owner window is on a different screen to the window being shown then it will be constrained to the wrong screen.

You can see this on Windows by showing a child `Window` with `CenterOwner` when the owner window is on a secondary screen: the child window will initially be shown on the primary screen and so the constraint will be wrong, resulting in the child window being shown on the wrong screen.
@maxkatz6 maxkatz6 added backported-11.1.x and removed backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported-11.1.x bug customer-priority Issue reported by a customer with a support agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants