Bug 141684 - Groupedbar Compact changes when cursor is in table
Summary: Groupedbar Compact changes when cursor is in table
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.1.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.5.1
Keywords:
: 141486 (view as bug list)
Depends on:
Blocks: Notebookbar-Groupedbar
  Show dependency treegraph
 
Reported: 2021-04-13 20:18 UTC by libreoffice
Modified: 2023-06-29 12:29 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Views of normal and changed toolbar (104.26 KB, image/png)
2021-04-13 20:18 UTC, libreoffice
Details
Simple patch to fix the issue (564 bytes, patch)
2022-10-14 07:55 UTC, Henner Drewes
Details
2nd patch: trying to get closer to the root of the problem (1.12 KB, patch)
2022-10-14 08:10 UTC, Henner Drewes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description libreoffice 2021-04-13 20:18:32 UTC
Created attachment 171171 [details]
Views of normal and changed toolbar

Steps to reproduce:
1) Use user interface Groupedbar Compact
2) Add table
So far, toolbar is still normal (see libreoffice_focus_page.png)

3) Click anywhere in the table
Toolbar changes (see libreoffice_focus_table.png)

4) Click outside table
Toolbar stays changed

First time clicking in the table might change the Groupedbar Compact to context (table), but only once.

Might have relation to https://bugs.documentfoundation.org/show_bug.cgi?id=126632
Comment 1 Roman Kuznetsov 2021-08-04 17:07:22 UTC
confirm in

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 4677345e3695bac158bb04048b4d5c608ed764b4
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL
Comment 2 Roman Kuznetsov 2021-08-04 17:09:15 UTC
*** Bug 141486 has been marked as a duplicate of this bug. ***
Comment 3 Jérôme 2022-01-19 19:48:30 UTC
I reproduce the same behaviour.
However, after step 3, I noticed that the groupedbar is properly refreshed when I change the focus to an other window (other application) and change it back to the Writer window. I don't need to move the cursor outside the table.

Version: 7.2.4.1 / LibreOffice Community
Build ID: b8e68b5bf61ce56d972a163ea31a18aecdcd64cd
CPU threads: 4; OS: Linux 4.9; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.utf8); UI: fr-FR
Calc: threaded
Comment 4 Henner Drewes 2022-10-14 07:55:13 UTC
Created attachment 183038 [details]
Simple patch to fix the issue

In PriorityMergedHBox::Resize() the notebook bar groups are hidden or shown depending on the available width. If at least one group is hidden, the drop down button is shown. When changing the context (e.g. from text to table), resize is called multiple times with 0 width or other temporary (small) width values, so that all the groups are hidden and only the button is shown.

Therefore the control reports a height of just the button height and not the actual notebook bar height. So the the bottom rows get cut off. During the next resize, as groups are already visible, the correct height is reported, and the full height is restored, all controls are shown. 

Setting the the size twice in PriorityHBox::SetSizeFromParent() therefore fixes the problem.
Comment 5 Henner Drewes 2022-10-14 08:10:15 UTC
Created attachment 183039 [details]
2nd patch: trying to get closer to the root of the problem

Instead of resizing the control twice, it also helps to filter out the resize operations with the temporary widths.

So the repetitive showing and hiding of all the groups is avoided. 

The TEMP_WIDTH of 200 or 206 is assigned in ContextVBox::SetContext().
Comment 6 Roman Kuznetsov 2022-10-14 10:40:57 UTC
(In reply to Henner Drewes from comment #5)
> Created attachment 183039 [details]
> 2nd patch: trying to get closer to the root of the problem
> 
> Instead of resizing the control twice, it also helps to filter out the
> resize operations with the temporary widths.
> 
> So the repetitive showing and hiding of all the groups is avoided. 
> 
> The TEMP_WIDTH of 200 or 206 is assigned in ContextVBox::SetContext().

Could you please propose your patches to gerrit

https://wiki.documentfoundation.org/Development/GetInvolved
Comment 7 Henner Drewes 2022-10-24 08:08:37 UTC
I proposed to gerrit

https://gerrit.libreoffice.org/c/core/+/141612/1
Comment 8 Commit Notification 2022-11-07 13:45:40 UTC
Henner Drewes committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/801e6272dc299d4468ec094ce11b66494eb5018b

tdf#141684 fix disappearance of icons in Groupedbar and Groupedbar compact UI

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2023-02-03 07:57:03 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bcf9e47791d5b3e1d6a75c73f3b8c9940abda8eb

tdf#153078: Revert "tdf#141684 fix disappearance of icons in Groupedbar and Groupedbar compact UI"

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2023-02-03 09:49:20 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/1f8d118dd0ea63a73592a712efb364c343c71082

tdf#153078: Revert "tdf#141684 fix disappearance of icons in Groupedbar and Groupedbar compact UI"

It will be available in 7.5.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Henner Drewes 2023-02-12 10:53:44 UTC
After some additional digging: 

My first patch attached here seems to be more reliable https://bugs.documentfoundation.org/attachment.cgi?id=183038

see explanation https://bugs.documentfoundation.org/show_bug.cgi?id=141684#c4

I still consider it a hack, but apparently it does its job. 
I tried a couple of other things. But for a better solution a number of things in the logic of showing/hiding child controls during context change and resize, and reporting correct required sizes should be changed. But I am afraid that I lack a deeper knowledge of the code to do more.
Comment 12 Heiko Tietze 2023-02-13 09:40:29 UTC
Szymon, what do you think?
Comment 13 Szymon Kłos 2023-02-13 12:14:35 UTC
This one should be fixed after I fixed https://bugs.documentfoundation.org/show_bug.cgi?id=147740
Seems to be duplicate.
Comment 14 Szymon Kłos 2023-02-13 12:20:52 UTC
sorry, haven't read the last comment :)

My patch measures size (height) of the biggest element we will need to show. It prevents us not only from this bug but also jumping/resizing height of a group bar when we resize the window. I think it is the correct way to solve the bug as it always reports the same height so there is no just "luck" that it works
Comment 15 Justin L 2023-05-23 12:01:33 UTC
(In reply to Szymon Kłos from comment #13)
> This one should be fixed
I tried to confirm, but couldn't reproduce the problem in 7.6 oldest bisect (before Szymon's fix). It should be fixed in 7.5.1 and 7.4.6.

Can someone check and close this bug report if it was already resolved? If not, it might be a duplicate of bug 140557.
Comment 16 Commit Notification 2023-05-24 17:51:33 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2cdb48eee93a3a93074184c5c8a82e571fb0bd04

tdf#141684 tdf#147740 notebookbar: fix disappearing icons in groupbar #2

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Justin L 2023-05-24 17:58:36 UTC
(In reply to Commit Notification from comment #16)
> tdf#141684 tdf#147740 notebookbar: fix disappearing icons in groupbar #2
This patch does not intentionally fix this bug report. I assume it already was fixed, and that my code just cleans up the real fix.