diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-11-06 14:30:18 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-11-06 14:30:18 +0100 |
commit | 4751ac1ac821740d94a323c559ef28e2aec5c52a (patch) | |
tree | bc1a95c4c7014505a61a8b651269c5815eee14d9 /gtk/gtktextview.c | |
parent | 9d56c56117b6dd83fad8a7a49a2266a3ab0ba789 (diff) | |
download | gtk+-4751ac1ac821740d94a323c559ef28e2aec5c52a.tar.gz |
gtk/textview: Improve check for cursor-mode
Check the text handle role, instead of looking for the other handle
visibility. The other handle may be invisible during selection mode
(e.g. pointing to offscreen contents). This fixes both this code
switching to cursor mode out of the blue, and possible crashes later
on as this handle might be hidden in the process, while its own event
controller is handling events on the parent surface.
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r-- | gtk/gtktextview.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index dec6ec64da..22f6d84b71 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -5116,7 +5116,7 @@ gtk_text_view_handle_dragged (GtkTextHandle *handle, *old_iter = iter; if (handle == priv->text_handles[TEXT_HANDLE_CURSOR] && - !gtk_widget_is_visible (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]))) + gtk_text_handle_get_role (priv->text_handles[TEXT_HANDLE_CURSOR]) == GTK_TEXT_HANDLE_ROLE_CURSOR) gtk_text_buffer_place_cursor (buffer, &cursor); else gtk_text_buffer_select_range (buffer, &cursor, &bound); |