mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
gtk-demo: Improve the tag implementation
Add margins and make it so that clicking on margins next to links does not activate them.
This commit is contained in:
parent
a3a5cf1087
commit
7ad6043478
@ -173,8 +173,7 @@ event_after (GtkWidget *text_view,
|
||||
GTK_TEXT_WINDOW_WIDGET,
|
||||
ex, ey, &x, &y);
|
||||
|
||||
gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y);
|
||||
|
||||
if (gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y))
|
||||
follow_if_link (text_view, &iter);
|
||||
|
||||
return TRUE;
|
||||
@ -197,8 +196,8 @@ set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
GtkTextIter iter;
|
||||
gboolean hovering = FALSE;
|
||||
|
||||
gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
|
||||
|
||||
if (gtk_text_view_get_iter_at_location (text_view, &iter, x, y))
|
||||
{
|
||||
tags = gtk_text_iter_get_tags (&iter);
|
||||
for (tagp = tags; tagp != NULL; tagp = tagp->next)
|
||||
{
|
||||
@ -211,6 +210,7 @@ set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hovering != hovering_over_link)
|
||||
{
|
||||
@ -272,6 +272,8 @@ do_hypertext (GtkWidget *do_widget)
|
||||
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
|
||||
g_signal_connect (view, "key-press-event",
|
||||
G_CALLBACK (key_press_event), NULL);
|
||||
g_signal_connect (view, "event-after",
|
||||
|
Loading…
Reference in New Issue
Block a user