Skip to content

Fix frameless window overflow on Windows - #9140

Closed
poiru wants to merge 1 commit into
masterfrom
frameless-overflow
Closed

poiru wants to merge 1 commit into
masterfrom
frameless-overflow

Conversation

@poiru

@poiru poiru commented Apr 7, 2017 •

Copy link
Copy Markdown
Contributor

Tested both framed and frameless windows with 100%, 125%, 150%, 175%,
and 200% DPI on Windows 10.

The only issue is that you might get the resize cursor at the right and
bottom edge of maximized frameless windows on some DPIs (>100% DPI for
me). This might just be a VM issue though.

This fixes #5267 and #8728.

Test Plan

Windows 7

With Frame

  • 200% DPI
  • 150% DPI
  • 125% DPI
  • 100% DPI

Without Frame

  • 200% DPI
  • 150% DPI
  • 125% DPI
  • 100% DPI

Windows 8

With Frame

  • 200% DPI
  • 150% DPI
  • 125% DPI
  • 100% DPI

Without Frame

  • 200% DPI
  • 150% DPI
  • 125% DPI
  • 100% DPI

Windows 10

With Frame

  • 200% DPI
  • 150% DPI
  • 125% DPI
  • 100% DPI

Without Frame

  • 200% DPI
  • 150% DPI
  • 125% DPI
  • 100% DPI
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <style>
      body, html {
        padding: 0;
        margin: 0;
      }

      #outer {
        border: 5px solid red;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
      }

      #inner {
        border: 5px solid blue;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 20px;
      }
    </style>
  </head>
  <body>
    <div id="outer">
      <div id="inner">
        <button onclick="require('electron').remote.getCurrentWindow().maximize()">Maximize</button>
        <button onclick="require('electron').remote.getCurrentWindow().unmaximize()">Unmaximize</button>
        <button onclick="window.close()">Close</button>
      </div>
    </div>
  </body>
</html>

@poiru

poiru commented Apr 7, 2017

Copy link
Copy Markdown
Contributor Author

cc @kevinsawicki @bsclifton @mst128256 @tonyganch @juturu @TheSBros

More testing would be very much appreciated, especially on Windows 7 and Windows 8.

@kevinsawicki

kevinsawicki commented Apr 7, 2017 •

Copy link
Copy Markdown
Contributor

@poiru noticed a Windows 8 difference at 200% DPI, looks like the bottom has a small black border that is different between maximized frame/frameless windows making it looks like it doesn't sit flush against the task bar.

Maximized With Frame Maximized Without Frame
screen shot 2017-04-07 at 2 43 55 pm screen shot 2017-04-07 at 2 43 45 pm

The left, right, and top look great though 👍

@poiru

poiru commented Apr 9, 2017

Copy link
Copy Markdown
Contributor Author

@kevinsawicki I spent a bunch of time looking into this and couldn't figure out a way get perfect results across all DPIs and all taskbar configurations (you can move taskbar to the top/right/left and also have it auto-hide). The use of DIPs in views further complicates this (see https://bugs.chromium.org/p/chromium/issues/detail?id=699745).

I think the current PR is an improvement over master so what do you think about merging this after testing on Win7?

@kevinsawicki

Copy link
Copy Markdown
Contributor

I think the current PR is an improvement over master so what do you think about merging this after testing on Win7?

Yeah, huge improvement, I think it is fine to merge after some more testing, will try on Windows 7 now.

@kevinsawicki

Copy link
Copy Markdown
Contributor

Tested on Windows 7, bottom gap seemed a bit bigger than on Windows 8. Everything else looked good though across DPIs.

Maximized With Frame Maximized Without Frame
screen shot 2017-04-10 at 10 14 20 am screen shot 2017-04-10 at 10 14 07 am

@bsclifton

bsclifton commented Apr 11, 2017 •

Copy link
Copy Markdown
Contributor

@poiru great job with this! 😄 I have been meaning to revisit this and the patch that @TheSBros put together. In the next few weeks, we'll be addressing this too so I'll be able to report back then

Tested both framed and frameless windows with 100%, 125%, 150%, 175%,
and 200% DPI on Windows 10. The result is similar to frameless Chrome
Apps windows.

This fixes #5267 and #8728.
@poiru
poiru force-pushed the frameless-overflow branch from 4cdcf3d to 4adcb5d Compare April 11, 2017 20:10
@poiru

poiru commented Apr 11, 2017 •

Copy link
Copy Markdown
Contributor Author

@clarkezone Right now, using WS_CAPTION is the only way to get the window maximize/minimize/restore animations, but it makes dealing with frameless windows a little tricky due to the non-client area. Do you happen to know if there is a way (or if there could be a way in a future Windows 10 update) to enable those animations without WS_CAPTION?

@poiru

poiru commented Apr 11, 2017

Copy link
Copy Markdown
Contributor Author

Closing in favor of #9167.

@poiru poiru closed this Apr 11, 2017
@poiru
poiru deleted the frameless-overflow branch April 11, 2017 22:57
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.

Strange overflowing window when maximizing a frameless window

3 participants