Skip to content

fix: improve the way frameless windows are handled on Windows - #16596

Merged
zcbenz merged 4 commits into
masterfrom
brenca/frameless-window-improvements
Jan 31, 2019
Merged

zcbenz merged 4 commits into
masterfrom
brenca/frameless-window-improvements

Conversation

@brenca

@brenca brenca commented Jan 29, 2019

Copy link
Copy Markdown
Contributor

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 a team, MarshallOfSound and nitsakh January 29, 2019 22:52
Comment thread atom/browser/native_window_views.cc Outdated
if (GetNativeWindow() && GetNativeWindow()->GetHost())
return GetNativeWindow()->GetHost()->GetAcceleratedWidget();
else
return nullptr;

Copy link
Copy Markdown
Contributor

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

release-clerk Bot commented Jan 31, 2019 •

Copy link
Copy Markdown

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.

2 participants