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 ...@@ -93,6 +93,7 @@ struct _GtkIMContextWayland
cairo_rectangle_int_t cursor_rect; cairo_rectangle_int_t cursor_rect;
guint use_preedit : 1; guint use_preedit : 1;
guint enabled : 1; guint enabled : 1;
guint commit_deferred : 1;
}; };
GType type_wayland = 0; GType type_wayland = 0;
...@@ -114,6 +115,7 @@ static const GtkIMContextInfo *info_list[] = ...@@ -114,6 +115,7 @@ static const GtkIMContextInfo *info_list[] =
}; };
static void gtk_im_context_wayland_focus_out (GtkIMContext *context); 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)) #define GTK_IM_CONTEXT_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), type_wayland, GtkIMContextWayland))
...@@ -259,17 +261,21 @@ text_input_done (void *data, ...@@ -259,17 +261,21 @@ text_input_done (void *data,
uint32_t serial) uint32_t serial)
{ {
GtkIMContextWaylandGlobal *global = data; GtkIMContextWaylandGlobal *global = data;
GtkIMContextWayland *context;
gboolean result; gboolean result;
gboolean valid; gboolean valid;
if (!global->current) if (!global->current)
return; return;
valid = serial == global->serial; valid = serial == global->serial;
text_input_delete_surrounding_text_apply(global, valid); 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); text_input_commit_apply(global, valid);
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result); g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
text_input_preedit_apply(global); text_input_preedit_apply(global);
context->commit_deferred = FALSE;
commit_state(context);
} }
static void static void
...@@ -461,6 +467,8 @@ commit_state (GtkIMContextWayland *context) ...@@ -461,6 +467,8 @@ commit_state (GtkIMContextWayland *context)
return; return;
if (!context->enabled) if (!context->enabled)
return; return;
if (context->commit_deferred)
return;
global->serial++; global->serial++;
zwp_text_input_v3_commit (global->text_input); zwp_text_input_v3_commit (global->text_input);
context->surrounding_change = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD; 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