Commit 92536243 authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz
Browse files

imwayland: Include surrounding text in the atomic update after hanling a done

Without it, some properties were updated correctly, and some (surrounding text) were updated together with the next batch due to not being followedby an immediate commit.
parent cae5e601
Pipeline #62966 failed with stages
in 0 seconds
......@@ -93,6 +93,7 @@ struct _GtkIMContextWayland
cairo_rectangle_int_t cursor_rect;
guint use_preedit : 1;
guint enabled : 1;
guint commit_deferred : 1;
};
GType type_wayland = 0;
......@@ -114,6 +115,7 @@ static const GtkIMContextInfo *info_list[] =
};
static void gtk_im_context_wayland_focus_out (GtkIMContext *context);
static void commit_state (GtkIMContextWayland *context);
#define GTK_IM_CONTEXT_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), type_wayland, GtkIMContextWayland))
......@@ -259,17 +261,21 @@ text_input_done (void *data,
uint32_t serial)
{
GtkIMContextWaylandGlobal *global = data;
GtkIMContextWayland *context;
gboolean result;
gboolean valid;
if (!global->current)
return;
valid = serial == global->serial;
text_input_delete_surrounding_text_apply(global, valid);
context = GTK_IM_CONTEXT_WAYLAND (global->current);
context->commit_deferred = TRUE;
text_input_commit_apply(global, valid);
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
text_input_preedit_apply(global);
context->commit_deferred = FALSE;
commit_state(context);
}
static void
......@@ -461,6 +467,8 @@ commit_state (GtkIMContextWayland *context)
return;
if (!context->enabled)
return;
if (context->commit_deferred)
return;
global->serial++;
zwp_text_input_v3_commit (global->text_input);
context->surrounding_change = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment