UniGetUI icon indicating copy to clipboard operation
UniGetUI copied to clipboard

[BUG] Window size and position is reset after restart of WingetUI

Open min7-i opened this issue 1 year ago • 5 comments

Please confirm these before moving forward

  • [X] I have searched for my issue and not found a work-in-progress/duplicate/resolved issue.
  • [X] I have tested that this issue has not been fixed in the latest (beta or stable) release.
  • [X] I have checked the FAQ section for solutions
  • [X] This issue is about a bug (if it is not, please use the correct template)

Describe your issue

When repositioning and resizing the window, this is only remembered while WingetUI is open or minimized and reopened. After restarting WingetUI, however, the window position and size is reset.

Steps to reproduce the issue

  1. Change the window size and position.
  2. Close the program.
  3. Restart it.
  4. Check the size and position of the window.

WingetUI Log

N/A - If you need the logs, just let me know.

Package Managers Logs

N/A - If you need the logs, just let me know.

Relevant information

This happens on two Win10 computers both of which have WingetUI 3.0.0 Beta 0 installed.

Screenshots and videos

No response

min7-i avatar Mar 06 '24 21:03 min7-i

In addition, can last selected navigation tab (Discover Packages, Software Updates, etc.) also be remembered/persisted?

mahara avatar Mar 24 '24 19:03 mahara

Quite annoying. Hope this will be fixed soon, thanks.

OS Name: Microsoft Windows 11 Pro, v10.0.22631 Build 22631 WingetUI v3.0.2

tnilzon avatar Apr 18 '24 08:04 tnilzon

I have ultrawide monitor and this is very annoying as it opens up very wide. Must be set to use x% of screen on open. I have to shrink it a lot as the width is crazy. Then when I open the app again to check, wham super larger again.

WalterB-MAMC avatar May 01 '24 21:05 WalterB-MAMC

I have ultrawide monitor and this is very annoying as it opens up very wide. Must be set to use x% of screen on open. I have to shrink it a lot as the width is crazy. Then when I open the app again to check, wham super larger again.

Confirmed, this happens to mine too. Screen Res is 5120x1440 and on restart of the app, it opens at 3826x1016

infuriatedcodex avatar May 07 '24 10:05 infuriatedcodex

Annoying thing. The same problem.

ishvedov avatar May 20 '24 14:05 ishvedov

Yes please fix/modify this, very annoying behaviour on ultra wide screens.

Basti-Fantasti avatar May 31 '24 06:05 Basti-Fantasti

@marticliment, position only saved while resizing. If I just move window, position does not saved.

ishvedov avatar Jun 05 '24 01:06 ishvedov

Hi @ishvedov, position is only saved when resizing the window or when closing it. As far as I have been able to find, apparently there is no way to detect when a window has been moved across the desktop

marticliment avatar Jun 05 '24 06:06 marticliment

It's does not save on exit. I'm using 3.1.0 alpha 1.

ishvedov avatar Jun 05 '24 14:06 ishvedov

Maybe we could try https://stackoverflow.com/questions/10330470/c-sharp-window-positioning?

aaronliu0130 avatar Jun 05 '24 15:06 aaronliu0130

This is Windows Forms, UniGetUI is built with WinUI3, which has nothing to do with WinForms

marticliment avatar Jun 05 '24 15:06 marticliment

Sorry. What about https://stackoverflow.com/questions/76399809/in-winui-3-is-there-a-way-to-dynamically-set-a-windows-size-and-position?

aaronliu0130 avatar Jun 05 '24 15:06 aaronliu0130

No, the issue is not with moving the actual window, since this is quite doable. The issue is when detecting when a window has been dragged by the user

marticliment avatar Jun 05 '24 15:06 marticliment

Just save the position and dimensions when the window is closed or the application exists. That's common practice and I don't see why you'd need to know when the window is moved or resized.

siewers avatar Jun 05 '24 15:06 siewers

That is what actually happens, but it seems to not be working properly for @ishvedov

marticliment avatar Jun 05 '24 15:06 marticliment

Sorry, yes you're right, I should have read the thread. I haven't tested the alpha version yet, but I'll try to reproduce it later.

siewers avatar Jun 05 '24 15:06 siewers

I cannot reproduce this on 3.1.0 alpha 1.

  • closing the window (minimizing to tray) - works
  • closing the window (minimizing to tray), right-click to quit - works
  • right-click to quit with window open - works

@ishvedov Is the window completely reset each time you start the application, or does it only/also happen when you restore it from the tray?

siewers avatar Jun 05 '24 18:06 siewers

I build app from main branch. This line have a problem. Process exits. If I comment this line, all works as expected.

https://github.com/marticliment/WingetUI/blob/d3521feed774363057a555a0d8d1e06f7165620b/src/UniGetUI/Interface/MainWindow.xaml.cs#L484

ishvedov avatar Jun 05 '24 20:06 ishvedov

This line should not have a problem... It is a simple wait command.

Which NET version are you using? Which Visual Studio?

marticliment avatar Jun 05 '24 20:06 marticliment

I know it, but... SDK 9.0.100-preview.4.24267.66 SDK 8.0.300 Visual Studio 17.11 preview 1.1 Dotnet runtime for UnigetUI: 8.0.6

ishvedov avatar Jun 05 '24 20:06 ishvedov

I don't see why it would crash on that line... Which is the error triggered? the thread crashes? The code does not compile?

marticliment avatar Jun 05 '24 20:06 marticliment

Problem with Delay in handle of Closing event. I add Task.Delay() to event handler, and app exit too on this line. Program just exit from line with Task.Delay(). Error code 0. No exceptions.

ishvedov avatar Jun 05 '24 21:06 ishvedov

Oh, I see what the issue is now

marticliment avatar Jun 06 '24 07:06 marticliment