electron: Strange overflowing window when maximizing a frameless window
- Electron version:
0.37.4 - Operating system: Windows
When I maximize my frameless electron window a small part of the window in an unmaximized state is visible on a secondary monitor.
Screenshot
You can visibly see the “line between the monitors” and you can see some really strange overhanging content that is over that line.
Steps to reproduce
- Open an electron app
- Maximize the app on your secondary display
- Look closely for the overflow onto your primary display
This might take a few times to trigger, it appears to do it about 70% of the time 😕
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 69 (6 by maintainers)
Commits related to this issue
- :checkered_flag: Fix thick frame overflow onto secondary monitor. (resolves #5267) — committed to odensc/electron by deleted user 7 years ago
- :checkered_flag: Fix maximized frameless window overflow. (Fixes #5267, #8728) — committed to odensc/electron by deleted user 7 years ago
- :checkered_flag: Fix maximized frameless window overflow. (Fixes #5267, #8728) — committed to odensc/electron by deleted user 7 years ago
- Fix frameless window overflow on Windows 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 t... — committed to electron/electron by poiru 7 years ago
- Fix frameless window overflow on Windows 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. Thi... — committed to electron/electron by poiru 7 years ago
Coming on on the 4 year anniversary of this bug being reported.
Still seeing this issue on three electron apps I use. Visual Studio Code, Discord and Slack.
Still an issue with discord
Still an issue for me as well on Windows using VSCode, and Discord; however not an issue with Spotify. Manifests for me just as going past the screen edges, without bleeding onto another monitor. This is enough to miss the locations of things like errors/warnings shown on the outside of the scrollbar in VSCode.
Should note that this only happens on my non-primary 1080p monitors (100% scaling, one horizontal, one vertical), and this doesn’t happen on my primary 2160p screen at 250% scaling.
Discord shows these versions in the sidebar on the preferences screen:
VSCode:
Spotify only gives a version
1.1.37.690.g8f3b16fcin the About screen.So is this issue getting fixed or what?
Still an issue with Discord. Microsoft Teams has this exact problem aswell.
@IlanVivanco Yep, Discord has it’s header cut a bit, GitHub Desktop and others have an overflow issue.
@radencode @adi518
Perhaps we are talking about different issues. The issue adi linked (#8728) is different from this issue.
The other issue is related to the edges of frameless windows being cut off by 8 pixels. This issue is related to frameless windows overflowing onto different monitors.
You can see that my fix for this issue works, here: https://www.youtube.com/watch?v=9NG2e5UIJoA
The other issue could probably be fixed in the same part of the code I’m working on - I’ll look into that and submit a PR with both fixes if I can.
Yes it does fix the issue but it gets rid of native animations and the window will no longer be maximized on double click of nav bar.
issue will also occur on a single screen with the windows task bar on the right or left edge of the screen.
The root cause for this issue happening on multiple monitors having this issue can be read about here: https://blogs.msdn.microsoft.com/oldnewthing/20120326-00/?p=8003
When the window is maximized and the window thinks it has a frame, Windows will actually position the window offscreen (so that the “frame” doesn’t show). There are then two approaches for solving in electron:
WM_GETMINMAXINFOevent inPreHandleMSG(). You’ll be able to get the coords from thel_paramand can update them to be the expected values (x/y of 0,0 instead of -7,-7) and set*resultto 0 / return true.native_window_views.cc, unfortunatelyWS_THICKFRAME(among other styles such asWS_CAPTIONand extended styles) are passed in (which trigger incorrect frame calculations). These styles can be removed completely and resizing still does work properly (at least in my testing). This would be my suggested approach.I should note that using Better Discord is against Discord ToS for Modify of the client.
Latest information for Canary:
Canary 72828 (05bcb5a) Host 0.0.291is running on Discord’s Custom Electron/9.3.5 Code & Release of which seen here https://github.com/discord/electron.The issue has been reported on Discord’s Bug Hunting Server (Discord Testers) a few times and this has been the default reason of rejecting the report implying this isn’t a Discord issue and a known issue on Electron side. This might explain the reason for people coming here regarding the issue still existing for Discord.
Please note I am simply one of the members of Discord Bug Hunting Community and not speaking on behalf of them
Yes, Electron normally doesn’t set the process variable for security reasons, but you can modify Discord to cause it to set it, as described in /issues/18139 and SimulatedGREG/electron-vue/issues/871. BetterDiscord will also make that modification for you, as it is necessary for it to work, which is what I did to check.
Discord
The issue doesn’t appear anymore. The maximized window correctly fits the screen.
Discord
The issue appears, but they fixed (made a workaround) an oversized server/channel indications on the left when window is maximized! Meaning, now if window is maximized the indicators are not hidden (off-screen) like they were before.
Same with the Discord.
It’s impossible to view left indicators of channels when window is maximized!
I am using electron-prebuild 1.4.13, when maximize the window, the first time it works fine, but the second time, the window has a margin to the screen top.
I am using windows 10.
BTW, What’s app desktop has the same issue.
@radencode @adi518 Please try out this build. It should fix both issues.
There’s still some overflow at the bottom, but that was there before - and with this fix it’s not actually part of the page, so nothing is cut off. I’m still investigating into that.
@adi518, please try the following file. It is a copy of electron-quick-start with both versions of electron.
Opening
Start Normal Electron.batshould have the overflow issue. OpeningStart Overflow Test.batshould not have the issue.electron-quick-start.zip (big file - two versions of electron)