Skip to content

Fix maximized frameless window overflow. - #8808

Closed
odensc wants to merge 2 commits into
electron:masterfrom
odensc:fix-overflow
Closed

odensc wants to merge 2 commits into
electron:masterfrom
odensc:fix-overflow

Conversation

@odensc

@odensc odensc commented Mar 1, 2017

Copy link
Copy Markdown

Fixes #5267, #8728.

@odensc odensc changed the title 🏁 Fix maximized frameless window overflow. Fix maximized frameless window overflow. Mar 1, 2017
@kevinsawicki
kevinsawicki requested a review from bsclifton March 1, 2017 23:54
@groundwater

Copy link
Copy Markdown
Contributor

cc/ @tonyganch

@bsclifton bsclifton left a comment •

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.

I grabbed this branch, redid bootstrap, did fresh compile, and launched on 125%, 150%, and 200% DPI.

125% looks great... which is kind of weird. Chromium 53 and earlier (back to 37 I believe) didn't support 125% DPI, they would force you down to 100% (which is what looks like is happening here). Presumably to not cause a change for end users, Chrome kept 125% scaled as 100% with Chrome 54+. @kevinsawicki is this expected with electron too? (Was anything done in libchromiumcontent)
125percent

150% looks like the first size I can pick which causes DPI scaling. I believe the logic in this PR is wrong, which causes the white borders that you'll see on the edges.
150percent

200% has very noticeable white borders ☹️
200percent

@bsclifton

bsclifton commented Mar 2, 2017 •

Copy link
Copy Markdown
Contributor

@TheSBros one thing you can try is basically turning non-client size calc / painting into a noop in atom/browser/native_window_views_win.cc (which I had tried in a previous commit):

+    /** Return zero (no-op) for non-client area events when window is frameless.
+     *  \see WM_NCPAINT - https://msdn.microsoft.com/en-us/library/windows/desktop/dd145212(v=vs.85).aspx
+     *  \see WM_NCCALCSIZE - https://msdn.microsoft.com/en-us/library/windows/desktop/ms632634(v=vs.85).aspx
+     */
+    case WM_NCPAINT:
+    case WM_NCCALCSIZE: {
+      if (!has_frame()) {
+        *result = 0;
+        return true;
+      }
+      return false;
+    }

Unfortunately, this caused rounded edges at 200% DPI ☹️ But maybe we need a variation of this

@odensc

odensc commented Mar 2, 2017

Copy link
Copy Markdown
Author

@bsclifton I tried that and it caused rounded edges even on 100% DPI for me. I'll try doing some testing with higher DPI to fix the borders.

Another thing I noticed while fixing this (that I did not fix) was with a normal, unmaximized frameless window on >100% DPI - the edges are cut off. This only happens in v1.5.x and higher, not on v1.4.x.

@bsclifton

bsclifton commented Mar 2, 2017 •

Copy link
Copy Markdown
Contributor

@TheSBros doh, then it definitely isn't a good fix (if it caused rounded edges). Thanks for trying it 😄

Something I did notice in WM_NCCALCSIZE was that you only set the Y. I'd suggest also setting the X like this too

@odensc

odensc commented Mar 2, 2017

Copy link
Copy Markdown
Author

@bsclifton I may have come up with a fix for the rounded edges - however it requires including Uxtheme.h. Where would I add uxtheme.lib to be linked in native_window_views_win.cc?

@tonyganch

Copy link
Copy Markdown
Contributor

cc @HitomiTenshi

@odensc

odensc commented Mar 3, 2017

Copy link
Copy Markdown
Author

I got everything working, but it requires handling WM_NCPAINT - which in turn causes rounded edges. Does anyone know how to fix this? I tried calling SetWindowTheme with empty strings as suggested elsewhere, but that causes the window to disappear.

@tonyganch

Copy link
Copy Markdown
Contributor

I got everything working

@TheSBros, do you have that part when everything except round edges is okay somewhere? I checked out your branch but seems like you haven't updated it.

@bsclifton

Copy link
Copy Markdown
Contributor

Sounds like great progress; great job @TheSBros! 😄

I'm also curious about that branch. I can help research / try a few things if you are able to make it available 😄

@odensc

odensc commented Mar 3, 2017

Copy link
Copy Markdown
Author

I've pushed the commit. I'd appreciate if someone can test it on higher DPIs (particularly 200%, 250%, 300%) - my display only goes up to 175%.

@mst128256

Copy link
Copy Markdown
Contributor

I've tested a1e012e for 150%, 175%, 200% and 225%. Works well.

@odensc

odensc commented Mar 6, 2017

Copy link
Copy Markdown
Author

@mst128256 That's good to hear. Any thoughts @bsclifton?

@tonyganch

Copy link
Copy Markdown
Contributor

Any news on that PR?

@adi-works

Copy link
Copy Markdown

@TheSBros hey, did you manage to fix the round corners?

@bsclifton

Copy link
Copy Markdown
Contributor

Hi folks- apologies I hadn't responded (I was out most of last week)

I'll try your patch @TheSBros and see if I have any ideas

@juturu

juturu commented Mar 28, 2017

Copy link
Copy Markdown
Contributor

@TheSBros - Is there any other issue blocking this PR?

@odensc

odensc commented Mar 29, 2017 •

Copy link
Copy Markdown
Author

@juturu None other than the PR itself. The fix works but has a side effect of causing rounded edges on the left/right top of the frame. My efforts to work around this have been futile, so I may have to find a different method of disabling non-client paints.

@poiru

poiru commented Apr 7, 2017 •

Copy link
Copy Markdown
Contributor

@TheSBros @bsclifton @juturu @tonyganch Could you try the patch in #9140? It should work fine at all DPIs without the rounded corners.

@poiru

poiru commented Apr 13, 2017

Copy link
Copy Markdown
Contributor

Fixed by #9167.

@poiru poiru closed this Apr 13, 2017
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.

8 participants