widgets: Don't show hidden tools on tooltip

The tool group tooltip was not updated when users
toggled the visibility of tools in Preferences. This patch
adds a check before adding a tool to the tooltip, to make
sure it's visible first. It also clears out tool group tooltips
on mouse over to ensure the tooltip is updated.
This commit is contained in:
Alx Sa 2025-04-25 00:51:28 +00:00
parent d164d713d7
commit 2371c04758

View file

@ -466,6 +466,10 @@ gimp_tool_button_query_tooltip (GtkWidget *widget,
{
GimpToolButton *tool_button = GIMP_TOOL_BUTTON (widget);
if (tool_button->priv->tooltip_widget &&
GIMP_IS_TOOL_GROUP (tool_button->priv->tool_item))
g_clear_object (&tool_button->priv->tooltip_widget);
if (! tool_button->priv->tooltip_widget)
{
GimpToolInfo *tool_info;
@ -549,11 +553,14 @@ gimp_tool_button_query_tooltip (GtkWidget *widget,
for (i = 0; i < n_children; i++)
{
GimpToolInfo *other_tool_info;
gboolean visible;
other_tool_info = GIMP_TOOL_INFO (
gimp_container_get_child_by_index (children, i));
if (other_tool_info != tool_info)
visible =
gimp_tool_item_get_visible (GIMP_TOOL_ITEM (other_tool_info));
if (other_tool_info != tool_info && visible)
{
gimp_tool_button_query_tooltip_add_tool (
tool_button,