Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.
Closes#4904
This allows the user to navigate via tab the links in a label and exits
the widget after the last link, when moving forward, and first link,
when moving backward.
This also ensures that ellipsised links arn't focused.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4681
The `has-tooltip` property gets set to `false` for label with links if no
link is selected. This makes sure to only change the property to `true`
but never to `false`.
clang-tidy says:
gtklabel.c:1188:15: warning: Although the value stored to 'mid' is used in the enclosing expression, the value is never actually read from 'mid'
min = mid = text_width;
^ ~~~~~~~~~~
Which seems right since mid will be assigned to at the beginning of the
next loop iteration anyway.
We only want to determine the size pixel-exact, not pango-unit-exact, so
don't spend lots of time wondering if text is half a pixel or a quarter
pixel wider.
Having a short text and a large max-width-chars should request the
natural width of the text, not the limit from max-width-chars.
This caused huge message dialogs.
Reftests added.
The width of a logical rect after line breaking is sometimes not
wide enough to cause line breaking to break at the exact same points.
(Is that by design or a bug in Pango? I don't know.)
So don't use the width, and only relyon values we actually set to
pango_layout_set_width().
The old code couldn't properly do height-for-width because it only
computed the widest and smallest layout instead of looking at the actual
passed in for-size.
The label-sizing reftest has been adapted as the label code is now smart
enough to always display the whole text and no longer requests a too
small width-for-single-row when wrapping.
This reverts commit ba44e7a228.
The change was meant to revert to old GTK3 behavior but it actually
broke new GTK4 behavior that is in use where max-width-chars is used to
determine an ideal size, but where we don't want to limit the width to
that size.
So what happens is the reintroduction of GTK3-style lots of whitepsace
bugs, and we really don't want those.
We also don't want to break backwards compat if we can avoid it.
So let's revert this.
The reftest that was made for this purpose has been adapted.
Fixes#4399
Even when we have tons of width available, still do the wrapping at
max-width-chars.
This is what happened in GTK3, too, but it happened automatically
because GTK3 did for_size = MIN (for_size, nat_size) and GTK4 does not.
So we do this manually in the label now.
Fixes the label-sizing.ui reftest.
In many cases, we have an "extra-menu" property that is used to allow
applications to join menus into the native menu for the widget. Previously,
this was done by nesting that menu in a section.
Doing so increases the complexity of the rules for GtkMenuTracker as you
may want different handling from inside of the section vs toplevel
sections.
If instead we synthetically glue the menus together, we have a much more
natural joining of menus as the application developer would expect for
their menu.
This also ports GtkLabel, GtkText, GtkPasswordEntry, and GtkTextView to
use the joined menu helper.
The joined menu helper comes originally from GNOME Builder and has had
extensive use there.
Fixes#4094
We were not handling the case right in which we
want to use underlines, but not use markup. Since
we are now using pango_parse_markup for this case,
we need to escape the xml markup.
Fixes: #4041
The intention of the code is to find a focusable ancestor,
so it needs to look at the focusable property, not at
can-focus. This is a change from GTK 3, where can-focus
was the correct property to look at.
Fixes: #3965
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.
This adds a few missing nullable annotations too.
The change in 875a92b95f made labels strip
out underlines earlier, but overlooked that this made
mnemonics not work before the timeout to show them
has passed. That was unintentional. Make mnemonics
work regardless of their visibility, again.
We were not handling mnemonics vs markup right
in all cases. Rewrite the _-stripping code to
do it during the link parsing, instead of as
a separate function. This avoids the issue of
stripping _ from attribute names in markup.
Add tests.
Fixes: 3706