Commit 926d9346 authored by Daiki Ueno's avatar Daiki Ueno

Use at-spi2 instead of at-spi1.

parent ac8764b9
......@@ -117,20 +117,20 @@ fi
AM_CONDITIONAL(ENABLE_FAKEKEY, [test x$enable_fakekey = xyes])
AC_MSG_RESULT($enable_fakekey)
dnl use AT-SPI to capture focus/keystroke events
AC_MSG_CHECKING([whether you enable AT-SPI event handling])
AC_ARG_ENABLE(cspi,
AS_HELP_STRING([--enable-cspi=no/yes],
[Enable AT-SPI event handling default=no]),,
enable_cspi=no)
dnl use AT-SPI 2 to capture focus/keystroke events
AC_MSG_CHECKING([whether you enable AT-SPI 2 event handling])
AC_ARG_ENABLE(atspi,
AS_HELP_STRING([--enable-atspi=no/yes],
[Enable AT-SPI 2 event handling default=no]),,
enable_atspi=no)
if test x$enable_cspi = xyes; then
PKG_CHECK_MODULES([CSPI], [cspi-1.0 gconf-2.0], ,
[AC_MSG_ERROR([AT-SPI C not found])])
AC_DEFINE([HAVE_CSPI], [1], [Define if CSPI is found])
if test x$enable_atspi = xyes; then
PKG_CHECK_MODULES([ATSPI2], [atspi-2 dbus-glib-1], ,
[AC_MSG_ERROR([AT-SPI 2 not found])])
AC_DEFINE([HAVE_ATSPI], [1], [Define if AT-SPI 2 is found])
fi
AC_MSG_RESULT($enable_cspi)
AM_CONDITIONAL(ENABLE_CSPI, [test x$enable_cspi = xyes])
AC_MSG_RESULT($enable_atspi)
AM_CONDITIONAL(ENABLE_ATSPI, [test x$enable_atspi = xyes])
dnl Python language binding
AC_MSG_CHECKING([whether you enable Python language support])
......
......@@ -49,11 +49,11 @@ eekboard_LDADD += \
$(FAKEKEY_LIBS)
endif
if ENABLE_CSPI
if ENABLE_ATSPI
eekboard_CFLAGS += \
$(CSPI_CFLAGS)
$(ATSPI2_CFLAGS)
eekboard_LDADD += \
$(CSPI_LIBS)
$(ATSPI2_LIBS)
endif
eekboard_headers = client.h
......
......@@ -20,10 +20,10 @@
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#ifdef HAVE_CSPI
#include <cspi/spi.h>
#include <gconf/gconf-client.h>
#endif /* HAVE_CSPI */
#ifdef HAVE_ATSPI
#include <dbus/dbus.h>
#include <atspi/atspi.h>
#endif /* HAVE_ATSPI */
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "eekboard/eekboard.h"
......@@ -56,12 +56,12 @@ static const GOptionEntry options[] = {
N_("Connect to the given D-Bus address")},
{"use-system-layout", 'x', 0, G_OPTION_ARG_NONE, &opt_use_system_layout,
N_("Use system keyboard layout")},
#ifdef HAVE_CSPI
#ifdef HAVE_ATSPI
{"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
N_("Listen focus change events with AT-SPI")},
{"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke,
N_("Listen keystroke events with AT-SPI")},
#endif /* HAVE_CSPI */
#endif /* HAVE_ATSPI */
{"keyboard", 'k', 0, G_OPTION_ARG_STRING, &opt_keyboard,
N_("Specify keyboard")},
{"model", '\0', 0, G_OPTION_ARG_STRING, &opt_model,
......@@ -117,9 +117,6 @@ main (int argc, char **argv)
GBusType bus_type;
GDBusConnection *connection;
GError *error;
#ifdef HAVE_CSPI
GConfClient *gconfc;
#endif /* HAVE_CSPI */
GOptionContext *option_context;
GMainLoop *loop;
......@@ -175,30 +172,24 @@ main (int argc, char **argv)
exit (1);
}
#ifdef HAVE_CSPI
gconfc = gconf_client_get_default ();
error = NULL;
#ifdef HAVE_ATSPI
if (opt_focus || opt_keystroke) {
if (gconf_client_get_bool (gconfc,
"/desktop/gnome/interface/accessibility",
&error) ||
gconf_client_get_bool (gconfc,
"/desktop/gnome/interface/accessibility2",
&error)) {
if (SPI_init () != 0) {
g_printerr ("Can't init CSPI\n");
GSettings *settings = g_settings_new ("org.gnome.desktop.interface");
if (g_settings_get_boolean (settings, "toolkit-accessibility")) {
if (atspi_init () != 0) {
g_printerr ("Can't init AT-SPI 2\n");
exit (1);
}
if (opt_focus &&
!eekboard_client_enable_cspi_focus (client)) {
!eekboard_client_enable_atspi_focus (client)) {
g_printerr ("Can't register focus change event listeners\n");
exit (1);
}
if (opt_keystroke &&
!eekboard_client_enable_cspi_keystroke (client)) {
!eekboard_client_enable_atspi_keystroke (client)) {
g_printerr ("Can't register keystroke event listeners\n");
exit (1);
}
......@@ -207,7 +198,7 @@ main (int argc, char **argv)
exit (1);
}
}
#endif /* HAVE_CSPI */
#endif /* HAVE_ATSPI */
if (opt_use_system_layout && (opt_keyboard || opt_model || opt_layouts || opt_options)) {
g_printerr ("Can't use --use-system-layout option with keyboard options\n");
......
This diff is collapsed.
......@@ -44,14 +44,14 @@ gboolean eekboard_client_set_xkl_config (EekboardClient *client,
gboolean eekboard_client_enable_xkl (EekboardClient *client);
void eekboard_client_disable_xkl (EekboardClient *client);
gboolean eekboard_client_enable_cspi_focus
gboolean eekboard_client_enable_atspi_focus
(EekboardClient *client);
void eekboard_client_disable_cspi_focus
void eekboard_client_disable_atspi_focus
(EekboardClient *client);
gboolean eekboard_client_enable_cspi_keystroke
gboolean eekboard_client_enable_atspi_keystroke
(EekboardClient *client);
void eekboard_client_disable_cspi_keystroke
void eekboard_client_disable_atspi_keystroke
(EekboardClient *client);
gboolean eekboard_client_enable_fakekey (EekboardClient *client);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment