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

Fix - Missing Shadow - OSX and Window Position #5963

Merged
merged 10 commits into from
May 22, 2021
Merged

Conversation

danwalmsley
Copy link
Member

@danwalmsley danwalmsley commented May 21, 2021

What does the pull request do?

This fixes what happens when Show or ShowDialog is called.

  1. on osx, the contentview is set after the Window has been resized and before it is actually shown.
    this means that OSX is now happy and correctly draws the border / shadow.

  2. I noticed now that windows were showing very quickly with the above fix, that when you show a dialog or window, with CenterScreen or CenterOwner, the window would initially show up at a position and then jump to the correct position.

this must have been introduced by #1714 but not noticable on other platforms and prob had been hidden on osx due to first issue.

So I made sure the window position was set before telling the platform to show the window (in showcore and showdialog)
makes sense, you need to set the window position to set it.

  1. this broke the window centerscreen functionality on OSX... why?

On Win32 when the window is not shown yet, when we tell the backend to resize the window, we get a Resized event and that event causes clientsize to get updated. The window centering code then uses ClientSize to calculate the position of the window in the center of the screen.

On OSX however... when the window is not shown,... no resized event comes and ClientSize remained 0,0 and this means the centering on osx was not working. I fixed this by making the OSX backend raise the resized event when Resize is called and the window hasnt been shown yet.

Both Windows and OSX now behave correctly. Someone will need to test Linux.

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

@danwalmsley danwalmsley changed the title Fixes/osx shadow Fix - Missing Shadow - OSX and Window Position May 21, 2021
@danwalmsley danwalmsley marked this pull request as ready for review May 21, 2021 16:59
Dan Walmsley added 2 commits May 21, 2021 22:07
When window is not shown, and Resize is called, it will trigger a Resize event, that updates ClientSize.
@danwalmsley
Copy link
Member Author

#1714

@danwalmsley danwalmsley requested a review from grokys May 21, 2021 22:00
Copy link
Collaborator

@MarchingCube MarchingCube left a comment

Choose a reason for hiding this comment

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

Tested on Windows and Linux (Mint) and it seems to work fine. I guess in between previous PR that moved this code and now there were changes to window sizing so it just works now.

@danwalmsley danwalmsley merged commit ef38e9d into master May 22, 2021
@danwalmsley danwalmsley deleted the fixes/osx-shadow branch May 22, 2021 16:57
danwalmsley pushed a commit that referenced this pull request Jun 4, 2021
Fix - Missing Shadow - OSX and Window Position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants