zulip / zulip-desktop

Zulip Desktop client for Mac, Windows and Linux.
https://zulip.com/apps
Apache License 2.0
840 stars 422 forks source link

Window gets smaller and smaller on each close (might be only on extended monitor) #1330

Open mtgtnt opened 12 months ago

mtgtnt commented 12 months ago

Window does not open at the last saved size.

To Reproduce

Open Zulip, size it very large (not full screen). Close Zulip. Open Zulip, it will now be smaller than what you closed it at. Close Zulip. Open Zulip, it will now be even smaller. Repeat as many times as you want.

If you monitor the window-state.json, you will see the size changing.

{"width":1913,"height":1043,"x":2053,"y":295,"displayBounds":{"x":2048,"y":288,"width":1920,"height":1080},"isMaximized":false,"isFullScreen":false}
{"width":1531,"height":835,"x":2053,"y":295,"displayBounds":{"x":2048,"y":288,"width":1920,"height":1080},"isMaximized":false,"isFullScreen":false}
{"width":1226,"height":669,"x":2053,"y":295,"displayBounds":{"x":2048,"y":288,"width":1920,"height":1080},"isMaximized":false,"isFullScreen":false}
{"width":982,"height":537,"x":2053,"y":295,"displayBounds":{"x":2048,"y":288,"width":1920,"height":1080},"isMaximized":false,"isFullScreen":false}
{"width":787,"height":430,"x":2053,"y":295,"displayBounds":{"x":2048,"y":288,"width":1920,"height":1080},"isMaximized":false,"isFullScreen":false}
{"width":630,"height":372,"x":2053,"y":295,"displayBounds":{"x":2048,"y":288,"width":1920,"height":1080},"isMaximized":false,"isFullScreen":false}
{"width":506,"height":372,"x":2053,"y":295,"displayBounds":{"x":2048,"y":288,"width":1920,"height":1080},"isMaximized":false,"isFullScreen":false}

Im sure there is a pattern there that someone will see and know exactly what to fix. (hint: its reduced in size by 20% every time)

andersk commented 11 months ago

Possibly related to

andersk commented 11 months ago

@mtgtnt Please note that that’s an issue in a third-party library that’s not affiliated with Zulip. They’re likely to be confused if you post comments about Zulip there.

mtgtnt commented 11 months ago

Oops, thanks for the catch. I will paste it here:

I do have 2k main monitor, but Zulip is on an 1080 monitor, that does make the 20% reduction in size match the problem.

mtgtnt commented 11 months ago

I took some time today to confirm that if I open and close on main monitor running at 2560x1440, Zulip will remain the correct size. If I open and close on my second monitor running at 1920x1080, Zulip will reduce in size by 20%

G0maa commented 6 months ago

Hello @mtgtnt, is this issue still present?

I've been trying to see if it's reproducible on Linux (ZorinOS - Development Environment), I haven't been getting the same results:

  1. Different scaling & same resolution as in the mentioned issue, when Zulip is in full-screen mode it always starts on the main monitor. Even if I move it to the second monitor (and put it to full-screen mode).
  2. When it's windowed (on main or secondary monitor) the window itself "goes down" by a few tens of pixels, yet keeps the same ratio.

https://github.com/zulip/zulip-desktop/assets/12874707/21a2fd2b-af6b-4ada-8273-c746e06ac6b3

~I will be trying this on Windows 10 (non-development environment) shortly.~ EDIT: I've been playing around with this on Windows for a bit, different scaling (125%, 100%), different resolution (1080p, 720p). I haven't been able to reproduce it.

mtgtnt commented 6 months ago

Hi @G0maa

Yes, its very easily reproducible. Win10.

image Monitor 1 (main): image Monitor 3: image

Open Zulip and move it to Monitor 3. Make it close to full screen to see the resizing happen. Quit Zulip. It will now remember the details in window-state.json with the correct sizes. Open Zulip again. What is happening is that it will initially open on Monitor 1 (You may not see it happen), with the sizes saved in window-state.json. It will then move it to Monitor 3, scaling the size down exactly 20% (difference in res between the monitors). You can then Quit Zulip again. Remember its still on Monitor 3. New sizes are saved to window-state.json. Rinse and repeat until its VERY tiny window.

I just did this to confirm its still happening.