Unify focus listener configure options.

This commit is contained in:
Daiki Ueno
2011-06-13 14:54:10 +09:00
parent fe9a02e514
commit 606f335496
2 changed files with 17 additions and 11 deletions

View File

@ -120,6 +120,9 @@ fi
AM_CONDITIONAL(ENABLE_FAKEKEY, [test x$enable_fakekey = xyes]) AM_CONDITIONAL(ENABLE_FAKEKEY, [test x$enable_fakekey = xyes])
AC_MSG_RESULT($enable_fakekey) AC_MSG_RESULT($enable_fakekey)
focus_listeners=""
keystroke_listeners=""
dnl use AT-SPI 2 to capture focus/keystroke events dnl use AT-SPI 2 to capture focus/keystroke events
AC_MSG_CHECKING([whether you enable AT-SPI 2 event handling]) AC_MSG_CHECKING([whether you enable AT-SPI 2 event handling])
AC_ARG_ENABLE(atspi, AC_ARG_ENABLE(atspi,
@ -131,6 +134,8 @@ if test x$enable_atspi = xyes; then
PKG_CHECK_MODULES([ATSPI2], [atspi-2 dbus-glib-1], , enable_atspi=no) PKG_CHECK_MODULES([ATSPI2], [atspi-2 dbus-glib-1], , enable_atspi=no)
if test x$enable_atspi = xyes; then if test x$enable_atspi = xyes; then
AC_DEFINE([HAVE_ATSPI], [1], [Define if AT-SPI 2 is found]) AC_DEFINE([HAVE_ATSPI], [1], [Define if AT-SPI 2 is found])
focus_listeners="AT-SPI $focus_listeners"
keystroke_listeners="AT-SPI $keystroke_listeners"
fi fi
fi fi
AC_MSG_RESULT($enable_atspi) AC_MSG_RESULT($enable_atspi)
@ -147,12 +152,13 @@ if test x$enable_ibus = xyes; then
PKG_CHECK_MODULES([IBUS], [ibus-1.0 >= 1.3.99], , enable_ibus=no) PKG_CHECK_MODULES([IBUS], [ibus-1.0 >= 1.3.99], , enable_ibus=no)
if test x$enable_ibus = xyes; then if test x$enable_ibus = xyes; then
AC_DEFINE([HAVE_IBUS], [1], [Define if IBus is found]) AC_DEFINE([HAVE_IBUS], [1], [Define if IBus is found])
focus_listeners="IBus $focus_listeners"
fi fi
fi fi
AC_MSG_RESULT($enable_ibus) AC_MSG_RESULT($enable_ibus)
AM_CONDITIONAL(ENABLE_IBUS, [test x$enable_ibus = xyes]) AM_CONDITIONAL(ENABLE_IBUS, [test x$enable_ibus = xyes])
if test x$enable_atspi = xyes -o x$enable_ibus = xyes; then if test -n "$focus_listeners"; then
AC_DEFINE(ENABLE_FOCUS_LISTENER, [1], [Define if eekboard can follow focus changes]) AC_DEFINE(ENABLE_FOCUS_LISTENER, [1], [Define if eekboard can follow focus changes])
fi fi
@ -311,6 +317,6 @@ Build options:
Build Vala binding $enable_vala Build Vala binding $enable_vala
Build Python binding $enable_python Build Python binding $enable_python
Build document $enable_gtk_doc Build document $enable_gtk_doc
Support accessibility $enable_atspi Focus listeners $focus_listeners
Support IBus focus events $enable_ibus Keystroke listeners $keystroke_listeners
]) ])

View File

@ -40,7 +40,7 @@ static gchar *opt_address = NULL;
static gboolean opt_use_system_layout = FALSE; static gboolean opt_use_system_layout = FALSE;
static gboolean opt_focus = FALSE; static gboolean opt_focus = FALSE;
static gchar *opt_focus_method = NULL; static gchar *opt_focus_listener = NULL;
static gboolean opt_keystroke = FALSE; static gboolean opt_keystroke = FALSE;
static gchar *opt_keyboard = NULL; static gchar *opt_keyboard = NULL;
@ -63,8 +63,8 @@ static const GOptionEntry options[] = {
#if ENABLE_FOCUS_LISTENER #if ENABLE_FOCUS_LISTENER
{"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus, {"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
N_("Listen focus change events")}, N_("Listen focus change events")},
{"focus-method", '\0', 0, G_OPTION_ARG_STRING, &opt_focus_method, {"focus-listener", '\0', 0, G_OPTION_ARG_STRING, &opt_focus_listener,
N_("Use the given focus method (\"atspi\" or \"ibus\")")}, N_("Use the given focus listener (\"atspi\" or \"ibus\")")},
#endif /* ENABLE_FOCUS_LISTENER */ #endif /* ENABLE_FOCUS_LISTENER */
#ifdef HAVE_ATSPI #ifdef HAVE_ATSPI
{"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke, {"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke,
@ -189,14 +189,14 @@ main (int argc, char **argv)
focus = FOCUS_NONE; focus = FOCUS_NONE;
if (opt_focus) { if (opt_focus) {
if (opt_focus_method == NULL || if (opt_focus_listener == NULL ||
g_strcmp0 (opt_focus_method, "atspi") == 0) g_strcmp0 (opt_focus_listener, "atspi") == 0)
focus = FOCUS_ATSPI; focus = FOCUS_ATSPI;
else if (g_strcmp0 (opt_focus_method, "ibus") == 0) else if (g_strcmp0 (opt_focus_listener, "ibus") == 0)
focus = FOCUS_IBUS; focus = FOCUS_IBUS;
else { else {
g_printerr ("Unknown focus method \"%s\". " g_printerr ("Unknown focus listener \"%s\". "
"Try \"atspi\" or \"ibus\"\n", opt_focus_method); "Try \"atspi\" or \"ibus\"\n", opt_focus_listener);
exit (1); exit (1);
} }
} }