lxqt/lximage-qt

Top of image gets corrupted when toolbar extension popup slides back

ArrayBolt3 opened this issue · 3 comments

Expected Behavior

When the LXImage window is somewhat small, there's a button at the far right of the toolbar that make a drop down appear where the overflowed buttons are located. When this drop down slides back up, the image should cleanly reappear where the drop down was covering it.

Current Behavior

The part of the image that got covered by the drop down gets pretty badly mangled as the drop down slides back up. The top of the image ends up getting overwritten by what appears to be multiple highly vertically compressed copies of the image stacked on top of each other. This only happens with certain window sizes (though it's quite easy to replicate), and only happens if the drop down covers part of the image. It also vanishes fairly quickly if there's enough blank window area above the image, whereas it appears to stick if the image top is close to the image area border.

Possible Solution

Looks like the thing is writing the whole entire image every redraw, but only writing it to the redrawn area. If this is the case, it might be possible to shrink the image as the drop down descends, and then grow it as it slides up, or make the redraw only happen once when the drop down is fully ascended. Or maybe do it the hard way by using complex math tricks to figure out what portion of the image needs redrawn and only just redraw that, so that the drop down appears to uncover the image. I'd guess this last one is what LXImage tries to do based on its behavior with certain window sizes, but that there's a bug somewhere in it. This is all just my guesswork - I've not actually looked at the code.

Steps to Reproduce (for bugs)
  1. Open the Application Menu, hover over Graphics, and click LXImage.
  2. Click "File", then "Capture Screenshot".
  3. Ensure that you're capturing the whole screen with a delay of 0 seconds, then click "OK".
  4. Grab the lower-right corner of the LXImage window, and shrink it somewhat. Ensure the top of the image is touching the top of the image viewing boundary, and that the right-most button of the toolbar looks like a right angle bracket.
  5. Click the right angle bracket button to cause the drop down to descend, then click it again to slide it up. Bam, image goes glitchy.
Context

Glitchy image = weird, annoying, wrong. Non-glitchy image = yay.

System Information
  • LXimage-qt version: 1.1.0
  • Distribution & Version: Lubuntu 22.10 Alpha
  • Qt Version: 5.15.4
  • liblxqt Version: 1.1.0-0ubuntu2

This video shows the problem:

It may happen only when the image is scaled down, usually to a size that's much smaller than its real size.

We don't draw that popup; Qt does. I'll see if a workaround is possible. But the bug is ours.

Thanks for the report!

It turned out to be an important bug, whose effect could be seen only in special cases like this.

The fix is here: #558

On a side node, I always saw a weird repainting problem in lximage-qt with Kvantum's transient scroll-bars. Now I know that it was caused by this bug in lximage-qt; it's fixed by #558 too :)