iTwin / appui

Monorepo for iTwin.js AppUi
MIT License
8 stars 2 forks source link

Electron: windows are "running away" on consecutive widget popouts when they were first moved to another monitor #896

Closed Juliakas closed 2 months ago

Juliakas commented 3 months ago

Describe the bug

I reproduced it on electron environment, not sure if applicable elsewhere.

This issue happens when I pop out a widget and I move it to another monitor for the first time. After closing window and popping it out consecutively, with each iteration it goes further left/right (depending what direction second monitor is). Even if I move it back to original monitor it keeps shifting, eventually it is escapes all monitors completely and it can only be brought back with "maximize" option on Windows toolbar (but still escapes afterwards).

To Reproduce

  1. Pop out any widget.
  2. Move widget to another monitor. Remember its position there.
  3. Close that widget window to return it.
  4. Pop out that widget and close it again (should be ok for now and stay in the same place at another monitor).
  5. Pop out that widget again.
  6. Note that it shifted.
  7. Keep repeating this until widget is outside of all monitors.

Expected Behavior

Widgets should stay in same place when repeatedly popped out at other monitors and not shift.

Screenshots

Stages of widget running away: image image image

Desktop (please complete the applicable information)

OS: Windows 11 Browser: Microsoft Edge Browser version: Version 126.0.2592.68 (Official build) (64-bit) Appui version: 4.15.0 (reproduced on appui source - standalone electron app)

Additional context

Would need this fixed before our Modeler's release, our feature freeze is at beggining of next month. Sometimes its confusing for user, it looks like widgets are minimized and they are cumbersome to restore.

ignas-k commented 2 months ago

This issue is fixed and released in 4.14.2 and 4.15.4.

Just an additional note: there is a semi-related issue that when a popout window is dragged to another monitor which has different scaling that window will open with different size (it adjusts for scaling) after being closed for the first time (after the first time it will be consistent). Though when dragged to the primary monitor, closed and reopened it will be of the original size. This seems to be an electron specific issue that for some reason has not been since 2017. References from electron repo: https://www.github.com/electron/electron/issues/10659, https://www.github.com/electron/electron/issues/9560, https://www.github.com/electron/electron/issues/10862. I tried a few workarounds but most of them are too convoluted or don't work. I also tried using calculations to adjust for different scaling but the window sizes are not precisely consistent with the scale. In general, this is too complex for us to work around specifically for electron (since this is not an issue on browsers) and electorn should be the ones to fix this issue. Unless there is a great need to fix this, I will leave it as it is.