mirror of
https://github.com/brl/mutter.git
synced 2025-07-29 04:58:03 +00:00
clutter: Enable negative offsets in delete surrounding text
The input method can assign a negative value to clutter_input_method_delete_surrounding() to move the cursor to the left. But Wayland protocol accepts positive values in delete_surrounding() and GTK converts the values to the negative ones in text_input_delete_surrounding_text_apply(). https://gitlab.gnome.org/GNOME/mutter/issues/539
This commit is contained in:

committed by
Carlos Garnacho

parent
9f31e7252c
commit
2cfdbbd730
@@ -94,17 +94,23 @@ meta_wayland_text_input_focus_request_surrounding (ClutterInputFocus *focus)
|
||||
|
||||
static void
|
||||
meta_wayland_text_input_focus_delete_surrounding (ClutterInputFocus *focus,
|
||||
guint cursor,
|
||||
int offset,
|
||||
guint len)
|
||||
{
|
||||
MetaWaylandGtkTextInput *text_input;
|
||||
uint32_t before_length;
|
||||
uint32_t after_length;
|
||||
struct wl_resource *resource;
|
||||
|
||||
text_input = META_WAYLAND_GTK_TEXT_INPUT_FOCUS (focus)->text_input;
|
||||
before_length = offset <= 0 ? -offset : offset;
|
||||
after_length = len >= before_length ? (len - before_length) : len + before_length;
|
||||
|
||||
wl_resource_for_each (resource, &text_input->focus_resource_list)
|
||||
{
|
||||
gtk_text_input_send_delete_surrounding_text (resource, cursor, len);
|
||||
gtk_text_input_send_delete_surrounding_text (resource,
|
||||
before_length,
|
||||
after_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user