Bug 130841 - kf5 main window loses status bar on macro triggered resize
Summary: kf5 main window loses status bar on macro triggered resize
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Armin Le Grand (allotropia)
URL:
Whiteboard: target:7.0.0 target:6.4.2
Keywords:
Depends on:
Blocks: KDE, KF5
  Show dependency treegraph
 
Reported: 2020-02-21 14:01 UTC by Jan-Marek Glogowski
Modified: 2021-03-23 08:41 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Document with onLoad resize macro (9.89 KB, application/vnd.oasis.opendocument.text)
2020-02-21 14:01 UTC, Jan-Marek Glogowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan-Marek Glogowski 2020-02-21 14:01:52 UTC
Created attachment 158077 [details]
Document with onLoad resize macro

The origin of this problem is the native menu bar, which results in a different "client area" / drawable area in comparison to the frame geometry from LO's POV. This isn't really supported in VCL - or I missed some interface. At least kf5 and gtk3 currently use a hack to do this. No other backends uses native menu bars inside the frame.

It's also easily verifiable by changing the user interface to tabbed or resizing the window.

The attached macro should just non-resizes the Window on load via:

Sub Main
  window = StarDesktop.currentComponent.CurrentController.frame.ContainerWindow
  rect = window.getPosSize()
  window.setPosSize(0, 0, rect.width(), rect.height(), com.sun.star.awt.PosSize.SIZE)
End Sub

But it doesn't. At this point the kf5 window shows two problems:

1. the window shrinks in height by the menu bar height
2. the window doesn't paint its status bar correctly, as that is now outside the window

The first one is a kf5 only problem, while the 2nd one also happens for gtk3. Actually gtk3 had the same first problem, until commit e3a002c53a54 ("get native gtk widgets in sidebars working") forced a relayout of weld'ed native widgets to fix an other problems with the sidebar. That corrects the "hack" again.

For kf5, the first problem can be fixed by applying the hack from: https://gerrit.libreoffice.org/c/core/+/89202

FWIW: this bug was exposed by the WollMux Java extension, where scrolling after the resize also creates massive drawing artifacts. I didn't figure out what else it interfering here.
Comment 1 Michael Weghorn 2020-02-21 14:42:02 UTC
I can reproduce that after

* opening the document in Writer
* having the window in non-maximized mode
* clicking the "Resize" button

the status bar is lost and appears again when forcing a repaint, e.g. by changing window size.

Version: 7.0.0.0.alpha0+
Build ID: 796aeeb0f4c26824f3477b45e0d3bae9cf2c4648
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: kf5; 
Locale: en-GB (en_GB.UTF-8); UI-Language: en-US
Calc: threaded
Comment 2 Commit Notification 2020-02-22 03:09:32 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#130841 resize to client size after SetPosSize

It will be available in 7.0.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 3 Commit Notification 2020-02-22 09:03:28 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

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

tdf#130841 resize to client size after SetPosSize

It will be available in 6.4.2.

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 4 Jan-Marek Glogowski 2020-02-24 03:33:33 UTC
The lost status bar for kf5 is fixed. See bug 130893 for the 2nd problem.
Comment 5 Armin Le Grand (allotropia) 2021-03-17 09:30:03 UTC
Was killed by tdf#131031, will check there for a better/alternative solution.
Comment 6 Armin Le Grand (allotropia) 2021-03-23 08:41:37 UTC
tdf#131031 got better/alternative solution, done.