From: Chris Mayo Date: Mon, 24 Apr 2023 18:35:47 +0000 (+0100) Subject: Fix hovered link URI not returned by gtk_label_get_current_uri X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~377^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=66cfeb3ad14846f688afc2232cb3e153f175425f;p=gtk4.git Fix hovered link URI not returned by gtk_label_get_current_uri This is needed for a query-tooltip handler, as mentioned in the documentation, when there has been a hover timeout. Maintain the previous behaviour when the link is clicked and follow the existing documentation regarding selectable labels. A notify::cursor handler can now also be used to retrieve the URI of the link under the cursor. --- diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index ccc9b9a85e..75878a5d3d 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -5773,10 +5773,10 @@ gtk_label_get_current_uri (GtkLabel *self) if (!self->select_info) return NULL; - if (self->select_info->link_clicked) - link = self->select_info->active_link; - else + if (!self->select_info->link_clicked && self->select_info->selectable) link = gtk_label_get_focus_link (self, NULL); + else + link = self->select_info->active_link; if (link) return link->uri;