From: Peng Huang Date: Sat, 1 May 2010 09:22:46 +0000 (+0800) Subject: add configure option to disable keyboard snooper in some applications X-Git-Tag: 1.3.3~2^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=180371b895cc9217710220e1a2dce5d91f86cf2b;p=platform%2Fupstream%2Fibus.git add configure option to disable keyboard snooper in some applications --- diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index c723e2b..ea3daf3 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -18,6 +18,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include @@ -69,11 +74,10 @@ static guint _signal_preedit_start_id = 0; static guint _signal_preedit_end_id = 0; static guint _signal_delete_surrounding_id = 0; static guint _signal_retrieve_surrounding_id = 0; -#if 0 -static const gchar * _snooper_apps [] = { - "xchat", "pidgin", NULL }; -#endif + +static const gchar * const _no_snooper_apps = NO_SNOOPER_APPS; static gboolean _use_key_snooper = TRUE; + static GtkIMContext *_focus_im_context = NULL; /* functions prototype */ @@ -284,13 +288,22 @@ ibus_im_context_class_init (IBusIMContextClass *klass) g_signal_lookup ("retrieve-surrounding", G_TYPE_FROM_CLASS (klass)); g_assert (_signal_retrieve_surrounding_id != 0); -#if 0 - for (p = _snooper_apps; *p != NULL; p++) { - if (g_strcmp0 (*p, g_get_application_name()) == 0) { - _use_key_snooper = TRUE; + if (g_getenv ("IBUS_DISABLE_SNOOPER") != NULL) { + /* disable snooper if env IBUS_DISABLE_SNOOPER is set */ + _use_key_snooper = FALSE; + } + else { + /* disable snooper if app is in _no_snooper_apps */ + gchar ** apps = g_strsplit (_no_snooper_apps, ",", 0); + gchar **p; + for (p = apps; *p != NULL; p++) { + if (g_strcmp0 (*p, g_get_application_name ()) == 0) { + _use_key_snooper = FALSE; + break; + } } + g_strfreev (apps); } -#endif if (_use_key_snooper) { gtk_key_snooper_install (_key_snooper_cb, NULL); diff --git a/configure.ac b/configure.ac index 000cf35..4650884 100644 --- a/configure.ac +++ b/configure.ac @@ -218,6 +218,15 @@ if test x"$enable_python" != x"no"; then fi fi +# add option var +AC_ARG_WITH(no-snooper-apps, + AS_HELP_STRING([--with-no-snooper-apps[=app1,app2]], + [Does not enable keyboard snooper in those applications]), + NO_SNOOPER_APPS=$with_no_snooper_apps +) +AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS", + [Does not enbale snooper in thos applications]) + # check iso-codes PKG_CHECK_MODULES(ISOCODES, [ iso-codes