-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Refactored Window Positioning #2250
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For conversions between `PixelSize` and `Size` use a scaling factor by default; rename the DPI overloads to have a `WithDpi` suffix.
In addition to `PixelSize`.
The affected members are: - `IWindowBaseImpl.Position` - `IWindowBaseImpl.PositionChanged` - `ITopLevelImpl.PointToClient` - `ITopLevelImpl.PointToScreen` - `IMouseDevice.Position` - `Screen.Bounds` - `Screen.WorkingArea`
`SetWindowStartupLocation` needs to be called _after_ the window is shown as is done in `Show`. In addition, the owner window needs to be passed so we can get the correct screen. Renamed the `parent` parameter to `ShowDialog` to `owner` as its `WindowStartupLocation.CenterOwner` not `CenterParent`.
We probably want to change this and pass the owner to the `Show` method as we do for dialogs: having owner specified in different places for dialogs vs non-dialogs is not a good API.
kekekeks
approved these changes
Jan 18, 2019
Member
kekekeks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/Avalonia.Controls/ToolTip.cs
Outdated
|
|
||
| _popup = new PopupRoot { Content = this, }; | ||
| ((ISetLogicalParent)_popup).SetParent(control); | ||
|
|
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: whitespace
This was referenced Jan 18, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on a comment on #1979 from @kekekeks this PR refactors window positioning a little, and hopefully fixes the bugs we've been seeing around that. It does the following:
PixelSizeaccept a scaling factor for conversions: conversions that accept DPI are still present for the moment but with aWithDpisuffixPixelPointandPixelRectto represent device pixel points and rectsIWindowBaseImpl.PositionIWindowBaseImpl.PositionChangedITopLevelImpl.PointToClientITopLevelImpl.PointToScreenIMouseDevice.PositionScreen.BoundsScreen.WorkingAreaShowDialogrespect WindowStartupLocation: supersedes WIP: Make ShowDialog respect WindowStartupLocation. #2246ShowandShowDialogrespectWindowStartupLocationDPI-awareness: supersedes WindowStartupLocation DPI-awareness #1979DialogsPageto allow testing of startup location.Note: this is a breaking change
Still TODO:
Window.Ownerand pass the owner to theShowmethod as we do for dialogs: having owner specified in different places for dialogs vs non-dialogs is not a good APIFixes #1961
Fixes #2207