summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-03-04 13:30:55 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-03-04 15:18:30 -0500
commit35fceca157fdc6f49ace15db31a78cf779a9112f (patch)
treebb39298004b7fd895d024e6d3ab6a6ee7eed32b0
parent97db959305cd30450dfa1dca713ee7477b792fa4 (diff)
downloadgtk+-35fceca157fdc6f49ace15db31a78cf779a9112f.tar.gz
imwayland: Pass anchor with surrounding
This was missing in the initial implementation since GtkIMContext did not have it in its api, but it was added now, so we can send the information.
-rw-r--r--gtk/gtkimcontextwayland.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index 0bee5162d9..b380a8a150 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -909,7 +909,8 @@ static void
gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
const char *text,
int len,
- int cursor_index)
+ int cursor_index,
+ int selection_bound)
{
GtkIMContextWayland *context_wayland;
@@ -918,8 +919,7 @@ gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
g_free (context_wayland->surrounding.text);
context_wayland->surrounding.text = g_strndup (text, len);
context_wayland->surrounding.cursor_idx = cursor_index;
- /* Anchor is not exposed via the set_surrounding interface, emulating. */
- context_wayland->surrounding.anchor_idx = cursor_index;
+ context_wayland->surrounding.anchor_idx = selection_bound;
notify_surrounding_text (context_wayland);
/* State changes coming from reset don't have any other opportunity to get
@@ -932,7 +932,8 @@ gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
static gboolean
gtk_im_context_wayland_get_surrounding (GtkIMContext *context,
char **text,
- int *cursor_index)
+ int *cursor_index,
+ int *selection_bound)
{
GtkIMContextWayland *context_wayland;
@@ -943,6 +944,7 @@ gtk_im_context_wayland_get_surrounding (GtkIMContext *context,
*text = context_wayland->surrounding.text;
*cursor_index = context_wayland->surrounding.cursor_idx;
+ *selection_bound = context_wayland->surrounding.anchor_idx;
return TRUE;
}
@@ -962,8 +964,8 @@ gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass)
im_context_class->reset = gtk_im_context_wayland_reset;
im_context_class->set_cursor_location = gtk_im_context_wayland_set_cursor_location;
im_context_class->set_use_preedit = gtk_im_context_wayland_set_use_preedit;
- im_context_class->set_surrounding = gtk_im_context_wayland_set_surrounding;
- im_context_class->get_surrounding = gtk_im_context_wayland_get_surrounding;
+ im_context_class->set_surrounding_with_selection = gtk_im_context_wayland_set_surrounding;
+ im_context_class->get_surrounding_with_selection = gtk_im_context_wayland_get_surrounding;
}
static void