forked from AuroraMiddleware/gtk
imwayland: Don't reset serial while text-input is alive
The serial number is a persistent property of the text-input object.
This commit is contained in:
parent
c4b4e90f98
commit
12ac9f351e
@ -41,6 +41,8 @@ struct _GtkIMContextWaylandGlobal
|
|||||||
struct zwp_text_input_v3 *text_input;
|
struct zwp_text_input_v3 *text_input;
|
||||||
|
|
||||||
GtkIMContext *current;
|
GtkIMContext *current;
|
||||||
|
|
||||||
|
guint serial;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkIMContextWaylandClass
|
struct _GtkIMContextWaylandClass
|
||||||
@ -76,8 +78,6 @@ struct _GtkIMContextWayland
|
|||||||
|
|
||||||
enum zwp_text_input_v3_change_cause surrounding_change;
|
enum zwp_text_input_v3_change_cause surrounding_change;
|
||||||
|
|
||||||
guint serial;
|
|
||||||
|
|
||||||
struct surrounding_delete pending_surrounding_delete;
|
struct surrounding_delete pending_surrounding_delete;
|
||||||
|
|
||||||
struct preedit current_preedit;
|
struct preedit current_preedit;
|
||||||
@ -244,7 +244,6 @@ text_input_done (void *data,
|
|||||||
struct zwp_text_input_v3 *text_input,
|
struct zwp_text_input_v3 *text_input,
|
||||||
uint32_t serial)
|
uint32_t serial)
|
||||||
{
|
{
|
||||||
GtkIMContextWayland *context;
|
|
||||||
GtkIMContextWaylandGlobal *global = data;
|
GtkIMContextWaylandGlobal *global = data;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
gboolean valid;
|
gboolean valid;
|
||||||
@ -252,9 +251,7 @@ text_input_done (void *data,
|
|||||||
if (!global->current)
|
if (!global->current)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context = GTK_IM_CONTEXT_WAYLAND (global->current);
|
valid = serial == global->serial;
|
||||||
|
|
||||||
valid = serial == context->serial;
|
|
||||||
text_input_delete_surrounding_text_apply(global, valid);
|
text_input_delete_surrounding_text_apply(global, valid);
|
||||||
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);
|
||||||
@ -289,6 +286,7 @@ registry_handle_global (void *data,
|
|||||||
global->text_input =
|
global->text_input =
|
||||||
zwp_text_input_manager_v3_get_text_input (global->text_input_manager,
|
zwp_text_input_manager_v3_get_text_input (global->text_input_manager,
|
||||||
gdk_wayland_seat_get_wl_seat (seat));
|
gdk_wayland_seat_get_wl_seat (seat));
|
||||||
|
global->serial = 0;
|
||||||
zwp_text_input_v3_add_listener (global->text_input,
|
zwp_text_input_v3_add_listener (global->text_input,
|
||||||
&text_input_listener, global);
|
&text_input_listener, global);
|
||||||
}
|
}
|
||||||
@ -452,7 +450,7 @@ commit_state (GtkIMContextWayland *context)
|
|||||||
{
|
{
|
||||||
if (global->current != GTK_IM_CONTEXT (context))
|
if (global->current != GTK_IM_CONTEXT (context))
|
||||||
return;
|
return;
|
||||||
context->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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user