From 927e9f58da9b4a9898403c8e339109e2ad2fa966 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 13 May 2013 11:47:29 +0900 Subject: [PATCH] Check GtkIMContext:input-purpose to disable IM on lock screen Recent GtkIMContext has "input-purpose" property, which can be used to check if the target widget is a password entry, in a more reliable way. BUG=none R=Shawn.P.Huang@gmail.com Review URL: https://codereview.appspot.com/7064059 --- client/gtk2/ibusimcontext.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index 49598b4..3694dd4 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -803,6 +803,18 @@ ibus_im_context_focus_in (GtkIMContext *context) return; /* don't set focus on password entry */ +#if GTK_CHECK_VERSION (3, 6, 0) + { + GtkInputPurpose purpose; + + g_object_get (G_OBJECT (context), + "input-purpose", &purpose, + NULL); + + if (purpose == GTK_INPUT_PURPOSE_PASSWORD) + return; + } +#endif if (ibusimcontext->client_window != NULL) { GtkWidget *widget; -- 2.7.4