#19053: Static text in bold is truncated on the wizard page (GTK3)

55 views
Skip to first unread message

wxTrac

unread,
Jan 21, 2021, 10:10:33 AM1/21/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
-------------------------------+--------------------
Reporter: Dummy | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.1.4
Keywords: wxStaticText GTK3 | Blocked By:
Blocking: | Patch: 0
-------------------------------+--------------------
A {{{wxStaticText}}} will appear truncated on wizard pages if it is in
bold.

Bold text appears correctly on the first page of the wizard, but is
truncated on other pages.
It is a GTK3-specific issue because it is displayed correctly with GTK2.

Please see the attached changes for the wizard sample, to reproduce this
issue.

With GTK2, the second wizard page looks correct:

[[Image(wizard_wx314_gtk2.png)]]

With GTK3, the text on the second wizard page is truncated:

[[Image(wizard_wx314_gtk3.png)]]

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053>

wxTrac

unread,
Jan 21, 2021, 10:10:52 AM1/21/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.1.4
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------
Changes (by Dummy):

* Attachment "wizard_wx314_gtk2.png" added.

wxTrac

unread,
Jan 21, 2021, 10:11:12 AM1/21/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.1.4
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------
Changes (by Dummy):

* Attachment "wizard_wx314_gtk3.png" added.

wxTrac

unread,
Jan 21, 2021, 10:11:47 AM1/21/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.1.4
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------
Changes (by Dummy):

* Attachment "sample_wizard.patch" added.

Changes for the wizard sample, to reproduce the issue.

wxTrac

unread,
Jan 21, 2021, 12:21:35 PM1/21/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.1.4
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by pcor):

Probably related to #16088

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:1>

wxTrac

unread,
Jun 15, 2021, 9:43:45 AM6/15/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.1.4
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by Dummy):

Commit
[https://github.com/wxWidgets/wxWidgets/commit/3217a4e8a26bf30758c00852738c0612ca931909
3217a4e8a26bf30758c00852738c0612ca931909] also had a certain positive
effect on this issue.

If you now step through the wizard several times, the second page will be
displayed in full the second time it is displayed.

But the first time the second page is displayed, the text is still
truncated.
So this issue is not completely fixed yet.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:2>

wxTrac

unread,
Dec 16, 2021, 4:42:30 PM12/16/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------
Changes (by vadz):

* status: new => confirmed
* version: 3.1.4 => 3.1.5
* milestone: => 3.2.0


Comment:

I can confirm that the bug is still present, but I'm not sure how to fix
it properly. Moreover, I think that we have a possibly pretty annoying
performance regression in this situation, but I am not sure about how to
fix it neither.

What happens is that both bold static texts get added to
`gs_sizeRevalidateList`, but when `GTKSizeRevalidate()` is called, only
the first of them gets invalidated and so recomputes its best size because
the second one is under a hidden parent and so the `w->IsShown()` test
results in it being skipped.

On one hand, this makes sense, but OTOH this means that the second label
size is only invalidated when it's too late, i.e. after `Layout()` had
been called. Moreover, until it is shown, we keep iterating over it again
and again in `GTKSizeRevalidate()` which is called on each "layout", i.e.
pretty often. I think that if we have a bunch of hidden labels with non-
default font, this could add up to a potentially noticeable delay, hence
my worry about the performance regression.

Paul, it would be really great if you could please have a look at this, as
I'm not sure I fully understand this code. But I think that we need to
either need to have per-window lists of children to revalidate, that would
be checked when the window is shown, or just invalidate best size of the
hidden windows too. It would be great to do something about this before
3.2.0.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:3>

wxTrac

unread,
Dec 17, 2021, 12:25:12 AM12/17/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by pcor):

My recollection is that style information is not valid unless the window
is shown, so invalidating the best size of a hidden window will at best
have no effect. At worst, it will prevent the proper size from being
calculated later, when the window is actually showing.

As for a performance problem, I think "layout" only occurs during
resizing. I feel pretty confident that iterating over the revalidate list
once per TLW size event is an insignificant part of the incredible amount
of crap that happens when resizing.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:4>

wxTrac

unread,
Dec 17, 2021, 3:15:35 PM12/17/21
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by vadz):

Replying to [comment:4 pcor]:
> My recollection is that style information is not valid unless the window
is shown, so invalidating the best size of a hidden window will at best
have no effect. At worst, it will prevent the proper size from being
calculated later, when the window is actually showing.

Just for the record, "at worst" is how it behaves right now, i.e. this
bug.

> As for a performance problem, I think "layout" only occurs during
resizing.

Unfortunately this isn't true, it seems to occur whenever anything is
redrawn, i.e. hovering over a scrollbar results in a stream of these calls
as can be seen with
{{{
#!diff
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
index 91be0c33c3..49fe0396a9 100644
--- a/src/gtk/window.cpp
+++ b/src/gtk/window.cpp
@@ -2315,6 +2315,7 @@ static void unrealize(GtkWidget*, wxWindow* win)

static void frame_clock_layout(GdkFrameClock*, wxWindow* win)
{
+ wxLogDebug("frame_clock_layout() for %s", wxDumpWindow(win));
win->GTKSizeRevalidate();
}

}}}

But you're right, it's probably not that bad if it's just done on refresh
and not all the time as I initially thought (because I did have several
refreshes while debugging, sorry).

However this bug still remains and the only way to fix it that I see is
to:

1. When iterating over the elements of `gs_sizeRevalidateList`, ''move''
the windows with hidden parents into a list of windows to update in this
parent itself. If the window itself is hidden, set some flag in it.
2. When showing the window, check the value of the flag above and
invalidate the window best size if necessary.
3. Also check the list of children that need to be revalidated and do it
and also re-layout the window itself to use the new sizes.

AFAICS this should work, but I could still be missing something here. What
do you think?

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:5>

wxTrac

unread,
Jan 2, 2022, 6:38:47 PM1/2/22
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by pcor):

> However this bug still remains and the only way to fix it that I see is
to:

Everything you describe here pretty much happens already. When the second
page is shown, the static text best size is invalidated, and the TLW gets
a size event, which results in `wxSizer::Layout()` getting called. The
problem here is that nothing actually happens, apparently because
(unsurprisingly) `wxWizard` wasn't designed to deal with anything changing
size. I think to fix this particular problem, the `wxWizard` code would
have to be changed.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:6>

wxTrac

unread,
Jan 3, 2022, 3:30:16 PM1/3/22
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by vadz):

I'll double check it later, but I'm pretty sure that currently the best
size of the static text is '''not''' invalidated when the second page is
shown. Where/why do you think it would happen?

Also, changing `wxWizard` is almost certainly not a solution because a
similar problem could arise in the user code not using this class. It's
enough for a window whose best size needs to be invalidated to be a child
of an initially hidden parent for this to happen and it should be possible
to have the same bug with a single page too.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:7>

wxTrac

unread,
Jan 3, 2022, 10:12:02 PM1/3/22
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by pcor):

Replying to [comment:7 vadz]:
> I'll double check it later, but I'm pretty sure that currently the best
size of the static text is '''not''' invalidated when the second page is
shown.

I'm quite sure that it is. I checked.

> Where/why do you think it would happen?

I designed it to work that way. Why do you think it wouldn't?

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:8>

wxTrac

unread,
Jan 4, 2022, 9:05:16 AM1/4/22
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by vadz):

Replying to [comment:8 pcor]:
> Replying to [comment:7 vadz]:
> > I'll double check it later, but I'm pretty sure that currently the
best size of the static text is '''not''' invalidated when the second page
is shown.
>
> I'm quite sure that it is. I checked.

OK, I didn't realize you had checked it. I must have been wrong then.

> > Where/why do you think it would happen?
>
> I designed it to work that way. Why do you think it wouldn't?

Because I added debug printfs to the size-related functions and didn't see
them triggered and from my understanding of the code it made sense:
invalidation doesn't seem to happen for the windows in this situation
because the `w == this` check in `wxWindowGTK::GTKSizeRevalidate()` is
false for them as the loop exits earlier when there is a hidden parent, as
I wrote in comment:3.

I may (must?) be wrong, but I still don't understand why to be honest. Nor
do I understand where does "everything I proposed in the comment:5 already
happens" because I definitely didn't see it happen when I was debugging
this.

Of course, the fact that I don't understand is is not the most important
thing. The real question is whether we can do anything to fix this or if
we are just going to close it and maybe document some kind of workaround
(although I don't even know what workaround could be recommended here)
somewhere?

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:9>

wxTrac

unread,
Jan 4, 2022, 3:33:24 PM1/4/22
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by pcor):

Replying to [comment:9 vadz]:
> I may (must?) be wrong, but I still don't understand why to be honest.

Maybe the part you are missing is that when a hidden window is shown,
another "layout" will occur and the re-validate list will be examined
again.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:10>

wxTrac

unread,
Jan 5, 2022, 6:17:38 PM1/5/22
to wx-...@googlegroups.com
#19053: Static text in bold is truncated on the wizard page (GTK3)
---------------------+-------------------------------
Reporter: Dummy | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.2.0
Component: wxGTK | Version: 3.1.5
Resolution: | Keywords: wxStaticText GTK3
Blocked By: | Blocking:
Patch: 0 |
---------------------+-------------------------------

Comment (by vadz):

If this is really `wxWizard`-specific and doesn't risk happening in other
places, I'm going to look at it after 3.1.6.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19053#comment:11>
Reply all
Reply to author
Forward
0 new messages