Disable snooper by default.
This commit is contained in:
Родитель
79438c1322
Коммит
7e71514679
|
@ -75,7 +75,7 @@ static guint _signal_preedit_end_id = 0;
|
|||
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 const gchar * const _snooper_apps = SNOOPER_APPS;
|
||||
static gboolean _use_key_snooper = ENABLE_SNOOPER;
|
||||
|
||||
static GtkIMContext *_focus_im_context = NULL;
|
||||
|
@ -288,19 +288,29 @@ 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 (_use_key_snooper) {
|
||||
if (g_getenv ("IBUS_DISABLE_SNOOPER") != NULL) {
|
||||
/* disable snooper if env IBUS_DISABLE_SNOOPER is set */
|
||||
const gchar *ibus_snooper = g_getenv ("IBUS_SNOOPER");
|
||||
if (ibus_snooper) {
|
||||
/* env IBUS_SNOOPER exist */
|
||||
if (g_strcmp0 (ibus_snooper, "") == 0 ||
|
||||
g_strcmp0 (ibus_snooper, "0") == 0 ||
|
||||
g_strcmp0 (ibus_snooper, "false") == 0 ||
|
||||
g_strcmp0 (ibus_snooper, "FALSE") == 0) {
|
||||
_use_key_snooper = FALSE;
|
||||
}
|
||||
else {
|
||||
_use_key_snooper = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* env IBUS_SNOOPER does not exist */
|
||||
if (!_use_key_snooper) {
|
||||
/* disable snooper if app is in _no_snooper_apps */
|
||||
const gchar * prgname = g_get_prgname ();
|
||||
gchar ** apps = g_strsplit (_no_snooper_apps, ",", 0);
|
||||
gchar ** apps = g_strsplit (_snooper_apps, ",", 0);
|
||||
gchar **p;
|
||||
for (p = apps; *p != NULL; p++) {
|
||||
if (g_regex_match_simple (*p, prgname, 0, 0)) {
|
||||
_use_key_snooper = FALSE;
|
||||
_use_key_snooper = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -308,6 +318,7 @@ ibus_im_context_class_init (IBusIMContextClass *klass)
|
|||
}
|
||||
}
|
||||
|
||||
IDEBUG ("snooper = %d", _use_key_snooper);
|
||||
if (_use_key_snooper) {
|
||||
gtk_key_snooper_install (_key_snooper_cb, NULL);
|
||||
}
|
||||
|
|
26
configure.ac
26
configure.ac
|
@ -24,7 +24,7 @@
|
|||
m4_define([ibus_released], [1])
|
||||
m4_define([ibus_major_version], [1])
|
||||
m4_define([ibus_minor_version], [3])
|
||||
m4_define([ibus_micro_version], [4])
|
||||
m4_define([ibus_micro_version], [5])
|
||||
m4_define(ibus_maybe_datestamp,
|
||||
m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
|
||||
|
||||
|
@ -288,12 +288,12 @@ if test x"$enable_python" = x"yes"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# option for disable snooper applications
|
||||
# option for always enable snooper applications
|
||||
AC_ARG_ENABLE(key-snooper,
|
||||
AS_HELP_STRING([--disable-key-snooper],
|
||||
[Disable key snooper in gtk im module]),
|
||||
AS_HELP_STRING([--enable-key-snooper],
|
||||
[Always enable key snooper in gtk im module]),
|
||||
[enable_key_snooper=$enableval],
|
||||
[enable_key_snooper=yes]
|
||||
[enable_key_snooper=no]
|
||||
)
|
||||
if test x"$enable_key_snooper" = x"yes"; then
|
||||
AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
|
||||
|
@ -303,14 +303,14 @@ else
|
|||
fi
|
||||
|
||||
# option for no snooper applications
|
||||
AC_ARG_WITH(no-snooper-apps,
|
||||
AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
|
||||
[Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
|
||||
NO_SNOOPER_APPS=$with_no_snooper_apps,
|
||||
NO_SNOOPER_APPS=.*chrome
|
||||
AC_ARG_WITH(snooper-apps,
|
||||
AS_HELP_STRING([--with-snooper-apps[=regex1,regex2]],
|
||||
[Enable keyboard snooper in those applications (default: xchat,pidgin,empathy)]),
|
||||
SNOOPER_APPS=$with_snooper_apps,
|
||||
SNOOPER_APPS=[xchat,pidgin,empathy]
|
||||
)
|
||||
AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
|
||||
[Does not enbale key snooper in those applications])
|
||||
AC_DEFINE_UNQUOTED(SNOOPER_APPS, "$SNOOPER_APPS",
|
||||
[Enbale keyboard snooper in those applications])
|
||||
|
||||
# check iso-codes
|
||||
PKG_CHECK_MODULES(ISOCODES, [
|
||||
|
@ -375,6 +375,6 @@ Build options:
|
|||
Build vala binding $enable_vala
|
||||
Build document $enable_gtk_doc
|
||||
Enable key snooper $enable_key_snooper
|
||||
No snooper regexes "$NO_SNOOPER_APPS"
|
||||
Snooper regexes "$SNOOPER_APPS"
|
||||
])
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче