Skip to content

Fix calculating min/max size in frameless view - #2979

Merged
zcbenz merged 3 commits into
electron:masterfrom
etiktin:fix_calculating_min_max_4_frameless
Oct 5, 2015
Merged

zcbenz merged 3 commits into
electron:masterfrom
etiktin:fix_calculating_min_max_4_frameless

Conversation

@etiktin

@etiktin etiktin commented Oct 3, 2015

Copy link
Copy Markdown
Contributor

The minimum size and maximum size that frameless view used, were incorrect. The sizes are treated as if they don't include border, but they did so it actually increased the window size on resize (see the reproduction code in #2945). The fix was to normalize the sizes from window size to frameless size (removing border etc.).

This resolves #2945. It also partially fixes #1806. The reason I say partially is because the issue also mention some issues with hidpi, and I'm not sure if this fixes that as well.
Edit: It also resolves #1806. At first I wasn't sure it also solved the second issue mentioned there about resizing when in hidpi doubling window size, but I manged to test it using --force-device-scale-factor=2 and it seems to have solve it.

This code was only tested on Windows. If it doesn't work on Linux or OS X, we can easily make it work only for Windows by moving the code from frameless_view.cc to win_frame_view.cc.

etiktin and others added 2 commits October 3, 2015 01:25
The minimum and maximum size that frameless windows had used, was
incorrect. It included the border, so when it was called it actually
added that to the size, so window increased in size. The fix makes sure
that the view will use the frameless size.

This fixes electron#2945 and partially fixes electron#1806 (it also refers to some other
issues with hidpi which might still exist).
@zcbenz

zcbenz commented Oct 4, 2015

Copy link
Copy Markdown
Contributor

The way Linux implements frameless window is quite different from Windows, so I think we should only use this code on Windows.

Limiting the solution to Windows only.
@etiktin

etiktin commented Oct 5, 2015

Copy link
Copy Markdown
Contributor Author

I changed it to work on Windows only.

The issue also exists on OS X (as mentioned in #2945 and #1806). I believe the solution will be similar (normalizing the min/max size using WindowSizeToFramelessSize in the relevant views), but since I can't test it (no access to a Mac) I'll leave it to someone else.

By the way, the fix works for windows with or without a frame/border.

@zcbenz

zcbenz commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

👍

zcbenz added a commit that referenced this pull request Oct 5, 2015
…less

Fix calculating min/max size in frameless view
@zcbenz
zcbenz merged commit 2b9b4c6 into electron:master Oct 5, 2015
@etiktin
etiktin deleted the fix_calculating_min_max_4_frameless branch October 5, 2015 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants