Skip to content

Electron 6 - restore after minimize has wrong window size #19816

Closed

Description

@whyboris
  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 6.0.2
  • Operating System:
    • Windows 10 (1903)
  • Last Known Working Electron version:
    • 5.0.7

Expected Behavior

  1. App is not maximized
  2. click minimize
  3. click on taskbar icon
  4. app restores to original size

Actual Behavior

  1. App is not maximized
  2. click minimize
  3. click on taskbar icon
  4. screen flickers as the app returns from minimum allowed window size to the original (not maximized) size.

To Reproduce

I logged the behavior:

  win.on('minimize', (e) => {
    console.log('minimizing');
    const bounds: any = win.getBounds();
    console.log(bounds);
  });

  win.on('restore', (e) => {
    console.log('restoring');
    const bounds: any = win.getBounds();
    console.log(bounds);
  });

Result:

minimizing
{ x: 100, y: 200, width: 1400, height: 800 }
restoring
{ x: 100, y: 200, width: 420, height: 250 }

The dimensions come from

  win = new BrowserWindow({
    ...
    minWidth: 420,
    minHeight: 250,
    frame: false // this line might be relevant for the current issue

I have the problem happening in my app, in master - tracking with whyboris/Video-Hub-App#260

Can be reproduced by cloning the repository, running npm install, having Angular CLI installed (npm i -g @angular/cli), and running the app npm start. Needless to say the error occurs in the built version of the app (npm run electron:windows).

Note: the error does not occur when the window is maximized, minimized, and restored.

Error might not occur on Mac -- can't be sure because the Mac has a stupid minimize/maximize animation 🤷‍♂

Thank you Electron Team for your amazing work 🙇 my app would be impossible without you ❤️

Possibly related tickets:

#19423
#13043
#16900

Possible solution:

#19423 (comment)

Activity

  1. whyboris commented on Aug 29, 2019

    @whyboris
    Author

    @zcbenz -- I'm sorry but the above-described ⚠️ bug persists ⚠️ in 6.0.5 and this Issue should be re-opened 🙇

    Thank you to @brenca for working on it, but it seems that he tried to close 2 different bugs with 1 PR and the code was manually back-ported by someone else; seems like this bug didn't get solved.

    minimizing
    { x: 409, y: 945, width: 1990, height: 937 }
    restoring
    { x: 409, y: 945, width: 420, height: 250 }
    

    I have a branch remove-flicker for anyone to try. Just clone my repository, npm install, switch to branch, and run; minimze/maximize to see the logging show the problem.

    Relevant testig code: https://github.com/whyboris/Video-Hub-App/blob/remove-flicker/main.ts#L122

  2. zcbenz commented on Aug 30, 2019

    @zcbenz
    Contributor

    @whyboris The fix will be included in next 6.x release, 6.0.5 does not have it yet.

  3. whyboris commented on Aug 30, 2019

    @whyboris
    Author

    @zcbenz thank you so much for the quick response 🙇
    I see it now: version 6.0.6 has it 🎉 🎉 🎉
    I tested, and my app works beautifully 👍 👍 👍
    ❤️ https://github.com/electron/electron/releases/tag/v6.0.6 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions