From: Peng Huang Date: Mon, 3 May 2010 23:27:53 +0000 (+0800) Subject: Add configure --disable-key-snooper X-Git-Tag: 1.3.3~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80c35b5fc53672a0791f847d811c71843e1c7156;p=platform%2Fupstream%2Fibus.git Add configure --disable-key-snooper --- diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index ea3daf3..afc4c93 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -76,7 +76,7 @@ static guint _signal_delete_surrounding_id = 0; static guint _signal_retrieve_surrounding_id = 0; static const gchar * const _no_snooper_apps = NO_SNOOPER_APPS; -static gboolean _use_key_snooper = TRUE; +static gboolean _use_key_snooper = ENABLE_SNOOPER; static GtkIMContext *_focus_im_context = NULL; @@ -288,21 +288,24 @@ 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 (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; + if (_use_key_snooper) { + 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 */ + const gchar * prgname = g_get_prgname (); + gchar ** apps = g_strsplit (_no_snooper_apps, ",", 0); + gchar **p; + for (p = apps; *p != NULL; p++) { + if (g_strcmp0 (*p, prgname) == 0) { + _use_key_snooper = FALSE; + break; + } } + g_strfreev (apps); } - g_strfreev (apps); } if (_use_key_snooper) { diff --git a/configure.ac b/configure.ac index b8861a5..7c38b8a 100644 --- a/configure.ac +++ b/configure.ac @@ -202,7 +202,7 @@ if test x"$enable_python" != x"no"; then AS_HELP_STRING([--disable-dbus-python-check], [Do not check dbus-python]), [enable_dbus_python_check=$enableval], - [enable_dbus_python_check=yes], + [enable_dbus_python_check=yes] ) PKG_CHECK_MODULES(DBUS_PYTHON, [dbus-python >= 0.83.0], @@ -218,6 +218,19 @@ if test x"$enable_python" != x"no"; then fi fi +# option for disable snooper applications +AC_ARG_ENABLE(key-snooper, + AS_HELP_STRING([--disable-key-snooper], + [Disable key snooper in gtk im module]), + [enable_key_snooper=$enableval], + [enable_key_snooper=yes] +) +if test x"$enable_key_snooper" != x"no"; then + AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper]) +else + AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper]) +fi + # option for no snooper applications AC_ARG_WITH(no-snooper-apps, AS_HELP_STRING([--with-no-snooper-apps[=app1,app2]], @@ -225,7 +238,7 @@ AC_ARG_WITH(no-snooper-apps, NO_SNOOPER_APPS=$with_no_snooper_apps ) AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS", - [Does not enbale snooper in thos applications]) + [Does not enbale key snooper in those applications]) # check iso-codes PKG_CHECK_MODULES(ISOCODES, [ @@ -271,13 +284,15 @@ gconf/gconf.xml.in AC_OUTPUT AC_MSG_RESULT([ Build options: - Version $VERSION - Install prefix $prefix - Build shared libs $enable_shared - Build static libs $enable_static - Gtk immodule dir $GTK_IM_MODULEDIR - Build python modules $enable_python - Build gconf modules $enable_gconf - Build document $enable_gtk_doc + Version $VERSION + Install prefix $prefix + Build shared libs $enable_shared + Build static libs $enable_static + Gtk immodule dir $GTK_IM_MODULEDIR + Build python modules $enable_python + Build gconf modules $enable_gconf + Build document $enable_gtk_doc + Enable key snooper $enable_key_snooper + No snooper apps "$NO_SNOOPER_APPS" ])