Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't remember maximized window state #1560

Open
pundoo opened this issue Mar 29, 2019 · 5 comments
Open

Doesn't remember maximized window state #1560

pundoo opened this issue Mar 29, 2019 · 5 comments

Comments

@pundoo
Copy link

pundoo commented Mar 29, 2019

What version of WebTorrent Desktop?
0.20.0 (0.98.21) (64bit)

What operating system and version?
Window 10 (v1809)

What did you do?

  • Open WebTorrent Desktop
  • Maximize the Window
  • Close (completely)
  • Re-open

What did you expect to happen?
Remember the maximized window state after reopening

What actually happened?
Opened in resized (default) window state

@stale
Copy link

stale bot commented Jun 27, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Jun 27, 2019
@stale stale bot closed this as completed Jul 4, 2019
@feross
Copy link
Member

feross commented Jul 31, 2019

Confirmed that this is an issue on Mac as well.

@hicom150
Copy link
Contributor

hicom150 commented Aug 1, 2019

I can see that isMaximized property is not saved in the state so we cannot recover and apply in the next run 😅

I can propose two possible solutions.

  1. On resize or move event get isMaximized property along with bounds and create a new object windowState to save in state.saved
    const windowState = {
      isMaximized: e.sender.isMaximized(),
      bounds: e.sender.getBounds()
    }
  1. Listen to maximize event and send a new windowStateChanged event where we save isMaximized property in state.saved

If you find a good way to go, I can make a PR with the best approach 😉

@mathiasvr
Copy link
Contributor

I think combining bounds and isMaximized in your first option is a good idea.
Does the resize/move events fire when maximizing/unmaximizing the window? Otherwise we probably need the maximize event.

In general the current bounds control could use some refactoring, and this could be a good excuse if you are up for it. 😉

However, IMO any approach would be a step in the right direction, so it would be great if you could create a PR 👍

@hicom150
Copy link
Contributor

hicom150 commented Aug 4, 2019

After some tries, I'm not been able to reproduce this issue in OSX Yosemite (10.10.5) nor in Ubuntu 18.04.2 LTS 😅

As far as I can understand, been maximized or minimized is not a state itself, and setting correctly the bounds of the window is enough to preserve the correct size and position.

So at least in my case if I open the app, maximize and close, in the next start the correct bounds are applied and even checking isMaximized() returns true

In the other hand, as @mathiasvr suggested I try to refactor and simplify bound control code in #1638 Any suggestion is more than welcomed 😉

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

No branches or pull requests

4 participants