[PATCH] Recompute column widths in BackingWindow::Resize() to partially fix #34392

Gábor Stefanik netrolller.3d at gmail.com
Mon Apr 9 09:31:58 PDT 2012


2012/4/9 Andras Timar <timar74 at gmail.com>:
> Gábor Stefanik <netrolller.3d at gmail.com> írta (2012. április 7. 2:13):
>> With this patch, the start screen displays correctly on startup with
>> scaling set to 130% (tested on OpenSUSE 11.4 x86-64).
>>
>> However, if you start LibreOffice with scaling @ 100%, then change
>> scaling to 130% with the start screen still open, the bug remains.
>> I've looked into it, and this appears to be a separate issue -
>> Resize() is called too early on scaling change, before the new scaling
>> factor is available. As a result, GetTextWidth() uses the old scaling
>> factor to compute widths.
>>
>> If anyone can point me towards where Resize() is called on the scaling
>> change codepath, that would be greatly appreciated.
>>
>
> Even without your patch, resizing works in the following scenario:
> 1. Set scaling to 130% (and observe the clipped text)
> 2. Press e.g. Text Document button to start Writer.
> 3. Close Writer with the X control at the top right of the window.
> 4. Observe that the start center buttons are resized correctly.
>
> So basically you are right, the scaling information is missing in the
> first call, and it is present in subsequent calls.
> http://opengrok.libreoffice.org/xref/core/framework/source/services/backingwindow.cxx#627
> calculates the text width. It is always 100% when called first,
> regardless of the scaling factor. You need to find out why, e.g. by
> setting a breakpoint to BackingWindow::initControls() and see the
> backtrace at each call.
>
> Andras

Yes, the case that this patch fixes is the following:
1. Set scaling to 130% (and observe the clipped text)
2. Press e.g. Text Document button to start Writer.
3. Close Writer with the X control at the top right of the window.
4. Observe that the start center buttons are resized correctly.
5. Close and re-open LibreOffice.

After step 5, without the patch, the buttons are misrendered. With the
patch, they are resized correctly.

Another interesting effect I noticed:
1. Start up with scaling set to 100%. (Correct rendering.)
2. Set scaling to 130%. (Clipped text - the buttons do not grow.)
3. Set scaling back to 100%. (Now the buttons are too large - they are
sized as if the scaling was still 130%.)

I've done some debugging (Is there any way to set "make debugrun" to
use something other than plain gdb? I usually use kdbg.), and found
that GenericSalLayout::GetTextWidth() is using incorrect glyph width
values. Apparently the font size is being set only after
BackingWindow::Resize().

(Debugging is further complicated by the fact that as I try to
rearrange the code calling Resize() to test various possible fixes, I
often get mysterious segfaults which gdb often maps to blank lines in
the source code between function definitions. Go figure.)

--Gábor


More information about the LibreOffice mailing list