If the recoloring would end up multiplying the alpha component with 0
anyway, just skip drawing anything altogether.
This increases the icon count in the switch demo of the fishbowl from
~260 to ~280 on my system.
Specifically it is avoided to be toggled if:
- Just received focus (in order to preserve OSK state across focus changes)
- Moving cursor around. Still allow some jitter as perfect accuracy is not
possible.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1277
We were looking at the wrong class names here, we need
to look at the owner type to match against our list.
This fixes problems where gtk-builder-tool simplify
inadvertedly loses hexpand or vexpand settings, messing
up layout, as recently happend in gtk4-widget-factory.
Rewrite the builder-tool simplify command to have
a full parse tree around, and perform simplifications
on that tree. This lets us rewrite GtkStack and turn
child properties into child meta objects.
In addition to <property name="foo">bar</property> referring
to an object with ID bar, we now also parse
<property name="foo"><object>...
to specify a property 'inline'.
The change to make widgets visible by default broke GtkInvisibles
special-cased state handling and that in turn caused picking in
the inspector to break with another recent change.
This change makes the inspector pick button work again.
Since we position the tooltip window relative to the toplevel widget and
not actually relative to the effective_toplevel, we shouldn't get the
pointer position relative to the effective_toplevel.
We previously used the pointer position (relative to the
effective_toplevel) and the anchor rect (relative to the toplevel
widget) together to calculate x_distance. This leads to wrong values in
cases where get_surface (new_tooltip_widget) != get_surface (toplevel)
Fixes#1427 in master
The event_widget is the widget that the surface belongs to which got
this event. The target widget is the one that will receive the event.
The previous terminology was confusing.
The @filename@ directive will use the full path of the file being parsed
for enumeration types; we should use @basename@, instead, as it improves
the reproducibility of the build by using only the file name.
Without this, disabling a widget that's being hovered and is a child
widget of the widget we're disabling (e.g. the GtkImage child of a
GtkButton) will retain its :hover state even though it should be
insensitive to any sort of input now.
Change the reorder api to insert after a sibling,
so that moving to first place becomes reorder (... NULL).
And add a insert_after api that can replace the common
container_add / reorder_after (... NULL) combination.
Update all callers.
The position child property is problematic, since it
requires us to emit notification for all children when
inserting a child early in the list of children.
Remove the property from all ui files.
GtkWidget saves a widget list for us, so we don't need to keep track of
them ourselves. This is okay now that we don't have a pack-type child
property anymore.
Some of the flags got lost in the meson transition or were demoted from
error flags to warning flags.
This commit reintroduces them.
It also includes fixes for the code that had warnings with those flags.
The big one being -Wshadow.
Remove the unneeded is_platform() check and just go by extension point
priority.
Also g_error() out if no im module exists, because "simple" is compiled
in and should always exist.
All built-in backend modules get a priority of 0 because they are the
default ones.
GtkIMContextSimple gets a priority of G_MININT because it's the fallback
one.
This mirrors the media modules code.
The format of the printout will be suitable for addition as a new test to
testsuite/gtk/rbtree-crash.c
by just grepping the printouts from the relevant rbtree.
We need to tell the portal what filter is supposed to be selected by
default, or it will just pick the first one, which could be wrong and
annoying.
This will require updated xdg-desktop-portal and xdg-desktop-portal-gtk
to work properly.
Fixes#1492
gtk_file_chooser_set_filter() doesn't work for GtkFileChooserNative. The
code forwards added and removed filters to the delegate dialog, but
doesn't do anything to set the selected one, so the wrong one gets
chosen. So fix that.
This only fixes the fallback dialog. The portal will be fixed in a
subsequent commit.
Partial fix for #1492
Instead of using the INCLUDE directive inside the sections file, we can
specify the default C include in the gtkdoc-mkdb arguments, and override
it inside the C sources that need it.
This gives us a better way of choosing the color of the placeholder text
(and enabled general css styling on it of course).
Closes#378 (If you want to keep the placeholder on focused and empty
entries, just don't set the placeholder opacity to 0 in
entry:focus>placeholder. This is the default behavior but this commit
includes a rule in Adwaita to hide it.
Since we now have a widget whenever we query tooltips, we can as well
get the events target_widget if we have an event (which is what we do
when coming from gtkmain.c). This keeps us from searching the entire
widget hierarchy for the target event even though we've already done
that for pointing events in gtkmain.c
This reduced the work done in gtk_tooltip_handle_event in normal motion
events to basically nothing since we already did all the heavy lifting
when handling the pointing event in gtkmain.c
As stated by the documentation, this should be called when a widget gets
updated, but in that case, one can equally use
gtk_widget_trigger_tooltip_query.
If the text style changes, or the display settings do, we need to update
the state labels to ensure that the glyphs are available in the font
we're using.
The entire color scale hack is still done in GtkRange, which draws the
color scale in the range gizmo. So, to correctly redraw the color scale
when setting a new color, we need to redraw the proper widget and that's
the trough widget.
Fixes#1453
Instead of recording the way up from the target widget to the grab
widget (or toplevel) and then walking that path upwards, just walk the
parent chain and look at the cursor.
Most of the time, the GtkSnapshot objects we create while snapshotting
widgets don't end up containing all that many nodes or states in their
respective node or state stack. This undermines the amortized allocation
behavior of the G(Ptr)Array we use for the stacks. So instead, use the
(until now unused) parent_snapshot GtkSnapshot* passed to
gtk_widget_create_render_node and reuse its node and state stack.
We do not avoid allocating a new GtkSnapshot object, but we do avoid
allocating a ton of G(Ptr)Array objects and we also avoid realloc'ing
their storage.
Even though the IEC power glyphs are part of Unicode 9.0 (released in
2016) not all fonts have them.
To avoid showing the hexbox of doom when the system font does not have
the glyphs we'd like to use, add a fallback pair, using the old glyphs
we suggested when the labels were translatable.
The refactoring of automatically updating tree->root when setting a
node's parent works very well - unless all nodes get removed and no
node's parent got updated.
The tree is not needed to walk around the nodes.
It is however still needed for anything that requires modifying the
tree.
There is no immediate benefit in changing this API, but there might be
situations in the future where we can avoid looking up the tree when we
just want to check some details about the node.
Store a link to the tree in the root node. This allows looking up the
tree in O(log N) from the node without any extra memory usage.
This is useful because code can just store a pointer to the node and
doesn't need to keep the tree pointer around. And that can (for large
trees) save quite a bit of memory.
Searching through the tree is too specific to use a general function.
All the existing code just copies and slightly adapts the same 20 lines
instead, so there's no reason to keep the complicated API.
Considering the operations that some of the rendernode constructors
do, nodes with width or height 0 (or both of course) are very well
possible. This would break in the rendernodepaintable when adding a
transform, which divides by width/height of the rendernode.
This can happen whenever the ::activate-link handler sets different
markup on the label, causing all links to be recreated. In this case,
the GtkLabelLink* passed to emit_activate_link is garbage after the
g_signal_emit call and we shouldn't try to do anything with it.
Fixes#1498
Unicode 9.0 introduced glyps for the "on" and "off" power states, in the
form of:
- U+23FD POWER ON SYMBOL, or ⏽
- U+2B58 HEAVY CIRCLE, or ⭘
With `HEAVY CIRCLE` as "power off symbol" selected to avoid adding yet
another circle to the standard.
Since we moved GtkSwitch to always show glyphs instead of (translatable)
strings, asking the localisation teams to either come up with a suitable
short string to replace the English "ON" and "OFF", or to fall back to
Unicode glyphs, we should ensure we're using the appropriate symbols to
begin with.
See also: gtk!503 for the corresponding gtk-3-24 change.
Signal emittion was added in 6f857f87dc commit and it seems that
this is only place where selected_row is set after emitting signal.
Because of this gtk_list_box_get_selected_row currently returns NULL
as selected row if selection mode is set to GTK_SELECTION_BROWSE.
The target position is irrelevant for determining if the child should be
visible. When the current position is 0, it needs to be hidden, period.
Fixes#1355
The previous fixes made it unnecessary to hardcode IM modules for
different display types. The code now automatically skips system IM
modules for other displays.
The code would technically allow loading the xim module when X11 support
was not compiled in.
This is probably an artificial concern, because it's pretty hard to
compile XIM support without X11 support, but it makes the code clearer,
so there we go.
Context IDs are dependant on the display - both because displays can use
different backends, but also because changing the GtkSetting is a
per-display operation.
So just remove the cache.
If it turns out we need a per-display cache, we can add one to
GtkSettings.
Calling the accessibility function `grab_focus()` on a `GtkCell` under
Wayland will cause the client to crash.
This is another case of `gdk_x11_get_server_time()` being called
regardless of the actual windowing backend used.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1507
So it's able to operate properly with the DnD gesture set by
gtk_drag_source_set(). We usually just react on button release,
that's the right time to claim the gesture.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1557