lxqt / lxqt-panel

The LXQt desktop panel
https://lxqt-project.org
GNU Lesser General Public License v2.1
194 stars 135 forks source link

Task Manager plugin: buttons shifting position when opening or closing windows #2065

Closed isf63 closed 3 months ago

isf63 commented 6 months ago
Current Behavior

Taskbar buttons shift slightly when opening or closing windows

Possible Solution
Steps to Reproduce (for bugs)
  1. Set Maximum button width low enough in Task Manager settings to have all buttons stay at maximum width.
  2. Open 2 to 4 windows and then open another.

There is a subtle shift in the buttons position.

Context

Minor UX issue Sometimes displayed eliding is affected

Affects all LXQt themes, except KDE-Plasma for me.

System Information
isf63 commented 6 months ago

I can confirm this is unrelated to themeing by creating a blank theme (mkdir ~/.local/share/lxqt/themes/blank; touch ~/.local/share/lxqt/themes/blank/lxqt-panel.qss, and then inspecting the button widths with GammaRay. With Maximum button width set to 200px, 2 windows open the widths are: (200, 200) and 3 windows (200, 201, 200).

tsujan commented 6 months ago

Yes, that may be a sign of a small miscalculation somewhere. It isn't easy to find where but, fortunately, it hasn't had a serious side effect.

tsujan commented 3 months ago

Related to https://github.com/lxqt/lxqt-panel/issues/2083 indirectly.

tsujan commented 3 months ago

My wild guess is that, in some line(s) of code, the special property of QRect::right() (see Qt doc's note) may have been ignored, resulting in a one-pixel miscalculation. I already found and fixed one case, but it wasn't related to this report.

tsujan commented 3 months ago

OK, the problem wasn't in lxqt-panel but in liblxqt → GridLayout::setGeometry(). After I changed its strange calculations to what looked reasonable to me, the shifting was gone.

I should check those calculations several times to make sure that I haven't missed anything. Then I'll make a PR. But in short, for a reason unknown to me, an extra one pixel was added in some places without being considered in others. I just removed it for testing.

tsujan commented 3 months ago

@isf63 If you use git, please test https://github.com/lxqt/liblxqt/pull/351. The panel should be restarted.