AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.05k stars 2.25k forks source link

Repaint does not occur at the proper time when a Window is resized #11360

Open graslany opened 1 year ago

graslany commented 1 year ago

Describe the bug

When I resize a window, the zone which is painted by Avalonia does not properly fit the window borders. Also, maximizing and restoring the window size does not entails proper repainting.

To Reproduce

  1. Use the default Avaliona MVVM project
  2. I tweaked it by removing the reference to ReactiveUI, and adding a second label, but this may not be relevant. The XAML code for the main window is this:
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:Avalonia_test.ViewModels"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="Avalonia_test.Views.MainWindow"
        x:DataType="vm:MainWindowViewModel"
        Icon="/Assets/avalonia-logo.ico"
        Title="Avalonia_test">

    <Design.DataContext>
        <!-- This only sets the DataContext for the previewer in an IDE,
             to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
        <vm:MainWindowViewModel/>
    </Design.DataContext>

    <StackPanel Orientation="Vertical">
        <TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center"/>
        <TextBlock Text="Youpi" HorizontalAlignment="Center"/>
    </StackPanel>

</Window>

When I run this and resize the window, the painted zone is not correct. In the example below I dragged a window corner to change the height and a row or two of transparent pixels appeared at the top :

Av1

Maximizing the window then leaves a blank area of the previous size, and the rest of the window is transparent:

Av2

Then if I restore the window to its normal size, it's fully transparent...

Av3

... and finally if I resize the window it is repainted (and as you can see, while this time i changed the width, there is a column of un-drawn pixels again, on the right side):

Av4

Expected behavior

The windows should be repainted after each size modification to fill the available windows area.

Screenshots

I posted my screenshots above as reproduction steps

Desktop (please complete the following information):

Additional context

-

kekekeks commented 1 year ago

XWayland?

graslany commented 1 year ago

XWayland?

This seems to confirm it:

$ echo $XDG_SESSION_TYPE
wayland