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: improve the way frameless windows are handled on Windows #16596

Merged
merged 4 commits into from Jan 31, 2019

Conversation

brenca
Copy link
Contributor

@brenca brenca commented Jan 29, 2019

Description of Change

Fixes #15816.

Most of the ideas implemented here come from this post, which is mentioned in several comments. Particularly the idea to use insets on the RootView comes from this part:

When the window is maximized, Windows will clip out the border on the app’s behalf if a clipping region hasn’t been applied. In this scenario there’s no reason to have done that, but the thing to watch out for is if glass isn’t extended as deeply into the borders as Windows would have (SM_CXFRAME (+ SM_CXPADDEDBORDER on Vista)) then a maximized window will clip the edges of your client region. The simplest way to work around this is to just place a Border around the window’s content that has a thickness of clipping region, and make its Visibility collapsed when not maximized.

I also took inspiration from this repo, but decided to not mess with undocumented events.

I tested these changes when I put this PR together on Windows 10, 8.1, and 7.

Checklist

Release Notes

Notes:
Improved the way frameless windows are handled on Windows.

@brenca brenca requested review from nitsakh, MarshallOfSound and a team January 29, 2019 22:52
if (GetNativeWindow() && GetNativeWindow()->GetHost())
return GetNativeWindow()->GetHost()->GetAcceleratedWidget();
else
return nullptr;
Copy link
Member

Choose a reason for hiding this comment

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

CI failed on Linux with:

../../electron/atom/browser/native_window_views.cc:1103:12: error: cannot initialize return object of type 'gfx::AcceleratedWidget' (aka 'unsigned long') with an rvalue of type 'nullptr_t'
    return nullptr;

@brenca brenca force-pushed the brenca/frameless-window-improvements branch from 08e4555 to abff521 Compare January 30, 2019 12:55
@zcbenz zcbenz merged commit cbb5164 into master Jan 31, 2019
@release-clerk
Copy link

release-clerk bot commented Jan 31, 2019

Release Notes Persisted

Improved the way frameless windows are handled on Windows.

@zcbenz zcbenz deleted the brenca/frameless-window-improvements branch January 31, 2019 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants