kikipoulet/SukiUI

Window resizing behavior broken on 6.0.0-beta5

pmichale opened this issue · 14 comments

Describe the bug
The window can't be resized using the mouse at all. This happens when the app's window starts in maximized mode on Windows. Same behavior is affecting macOS regardless of the window's state upon startup.
The only thing that can change the window size seems to be the maximize button (or title bar double click). The window also has a few pixels of margin on each side when maximized on Windows.

To Reproduce
Windows:
Set the WindowState to Maximized in App.axaml.cs

desktop.MainWindow = viewLocator?.Build(mainVm) as Window;
if (desktop.MainWindow != null)
{
    desktop.MainWindow.WindowState = WindowState.Maximized;
}

macOS: Just launch any app using SukiUI beta, no extra steps needed.

Expected behavior
The window should be resizable using the mouse cursor just as in the previous versions of SukiUI. The window should not have any margin in maximized state (Windows).

Screenshots
The red lines show the margin in maximized state on Windows 10.
image

Environment

  • Windows 10 22H2, macOS Ventura, macOS Sonoma
  • Avalonia 11.1.0-beta2, SukiUI 6.0.0-beta5

The latest fix addresses the inability to resize the window when started in maximized mode [Windows].

The issue persists on macOS.

I also found one minor undesired behavior where the window will overlay the Windows taskbar if the user maximizes it using the snapping gesture (dragging the window using the title bar to the top of the screen and letting go of the mouse button).

that works for me to resize (windows 11), but the window's position is inaccurate indeed

i need help to solve this problem_(:з」∠)_

I also noticed the new undesired behavior you mentioned. I've tried to use Style with FullScreen selector but not work (adjusting the margin or padding from the codebehind may work?)

The update to Avalonia 11.1 triggered weird thing with the window, the bordered disappeared (being quite ugly), so i fixed it quickly at the time. (30262b4)

I just made slight changes (91ebce4) , can you test it and tell if it's better, notably on macOS ?

I also noticed the new undesired behavior you mentioned. I've tried to use Style with FullScreen selector but not work (adjusting the margin or padding from the codebehind may work?)

The SystemDecoration property is quite broken since 11.1, I don't remember if it's BorderOnly or another value that has disappeared since then but the behavior changed.

Here I tried to just switch between "None" and "BorderOnly" depending if the window is maximized, as the "BorderOnly" seem to behave correctly when not maximized, and the "None" property do the opposite :|

I just made slight changes (91ebce4) , can you test it and tell if it's better, notably on macOS ?

I've just tested it on macOS and Linux (Kubuntu) and the window can't be resized using the mouse (only maximized). The cursor that indicates the ability to resize a window does not even come up.

Does it mean to resize the window by dragging the edges of the window with the mouse while the window is maximized?

On Unix based systems the window can't be resized at all by dragging the edges no matter if it is maximized or not.

So, if I understand well, at this point everything works fine except on Unix systems we can't do this :

windowresize

Is it correct ?

Yes, that's exactly the issue.

Plus one minor thing on Windows, that I think is potentially undesired behavior: The window overlaps the taskbar when you drag it to the top of the screen.

file.mp4

Window would also exceed the edge of the screen

Avalonia#5581

I think the best way to fix that is to rollback avalonia version to 11.0.5, where the function works well.
The solutions above CANNOT fix the bug.

11.0.10 to 11.1.0-beta just seemed to have a lot of breaking changes (including SkiaSharp 3.0), and a lot of Avalonia libraries were updated for that. I prefer to wait for Avalonia to fix the bugs.

I think the best way to fix that is to rollback avalonia version to 11.0.5, where the function works well.
The solutions above CANNOT fix the bug.

AvaloniaUI/Avalonia#15532