Don't hide keyboard right away

instead keep it around for 200ms. This reduces flicker a lot since
the keyboard will not hide when switching through input fields in
e.g. contacts or chatty.
This commit is contained in:
Your Name
2019-09-25 19:01:44 +01:00
committed by Guido Günther
parent 2fca71aa53
commit 3b6999f6ef

View File

@ -40,6 +40,7 @@ struct _ServerContextService {
GtkWidget *window; GtkWidget *window;
GtkWidget *widget; GtkWidget *widget;
guint hiding;
gdouble size_constraint_landscape[2]; gdouble size_constraint_landscape[2];
gdouble size_constraint_portrait[2]; gdouble size_constraint_portrait[2];
@ -245,6 +246,11 @@ server_context_service_real_show_keyboard (EekboardContextService *_context)
{ {
ServerContextService *context = SERVER_CONTEXT_SERVICE(_context); ServerContextService *context = SERVER_CONTEXT_SERVICE(_context);
if (context->hiding) {
g_source_remove (context->hiding);
context->hiding = 0;
}
if (!context->window) if (!context->window)
make_window (context); make_window (context);
if (!context->widget) if (!context->widget)
@ -255,12 +261,22 @@ server_context_service_real_show_keyboard (EekboardContextService *_context)
gtk_widget_show (context->window); gtk_widget_show (context->window);
} }
static gboolean
on_hide (ServerContextService *context)
{
gtk_widget_hide (context->window);
context->hiding = 0;
return G_SOURCE_REMOVE;
}
static void static void
server_context_service_real_hide_keyboard (EekboardContextService *_context) server_context_service_real_hide_keyboard (EekboardContextService *_context)
{ {
ServerContextService *context = SERVER_CONTEXT_SERVICE(_context); ServerContextService *context = SERVER_CONTEXT_SERVICE(_context);
gtk_widget_hide (context->window); if (!context->hiding)
context->hiding = g_timeout_add (200, (GSourceFunc) on_hide, context);
EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)-> EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)->
hide_keyboard (_context); hide_keyboard (_context);