Drop IBus dependency when compiling.
This commit is contained in:
23
configure.ac
23
configure.ac
@ -112,10 +112,7 @@ fi
|
|||||||
AM_CONDITIONAL(ENABLE_XDOCK, [test x$enable_x_dock = xyes])
|
AM_CONDITIONAL(ENABLE_XDOCK, [test x$enable_x_dock = xyes])
|
||||||
AC_MSG_RESULT($enable_x_dock)
|
AC_MSG_RESULT($enable_x_dock)
|
||||||
|
|
||||||
focus_listeners=""
|
focus_listeners="ibus"
|
||||||
keystroke_listeners=""
|
|
||||||
|
|
||||||
focus_listeners=""
|
|
||||||
keystroke_listeners=""
|
keystroke_listeners=""
|
||||||
|
|
||||||
dnl use AT-SPI 2 to capture focus/keystroke events
|
dnl use AT-SPI 2 to capture focus/keystroke events
|
||||||
@ -137,24 +134,6 @@ fi
|
|||||||
AC_MSG_RESULT($enable_atspi)
|
AC_MSG_RESULT($enable_atspi)
|
||||||
AM_CONDITIONAL(ENABLE_ATSPI, [test x$enable_atspi = xyes])
|
AM_CONDITIONAL(ENABLE_ATSPI, [test x$enable_atspi = xyes])
|
||||||
|
|
||||||
dnl use IBus to capture focus events
|
|
||||||
AC_MSG_CHECKING([whether you enable IBus focus tracking])
|
|
||||||
AC_ARG_ENABLE(ibus,
|
|
||||||
AS_HELP_STRING([--enable-ibus=no/yes],
|
|
||||||
[Enable IBus focus tracking default=yes]),
|
|
||||||
enable_ibus=$enableval,
|
|
||||||
enable_ibus=yes)
|
|
||||||
|
|
||||||
if test x$enable_ibus = xyes; then
|
|
||||||
PKG_CHECK_MODULES([IBUS], [ibus-1.0 >= 1.3.99], , enable_ibus=no)
|
|
||||||
if test x$enable_ibus = xyes; then
|
|
||||||
AC_DEFINE([HAVE_IBUS], [1], [Define if IBus is found])
|
|
||||||
focus_listeners="ibus $focus_listeners"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT($enable_ibus)
|
|
||||||
AM_CONDITIONAL(ENABLE_IBUS, [test x$enable_ibus = xyes])
|
|
||||||
|
|
||||||
if test -n "$focus_listeners"; 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
|
||||||
|
|||||||
@ -54,11 +54,6 @@ eekboard_CFLAGS += $(ATSPI2_CFLAGS)
|
|||||||
eekboard_LDADD += $(ATSPI2_LIBS)
|
eekboard_LDADD += $(ATSPI2_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ENABLE_IBUS
|
|
||||||
eekboard_CFLAGS += $(IBUS_CFLAGS)
|
|
||||||
eekboard_LDADD += $(IBUS_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
eekboard_headers = \
|
eekboard_headers = \
|
||||||
client.h \
|
client.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|||||||
71
src/client.c
71
src/client.c
@ -33,10 +33,6 @@
|
|||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#endif /* HAVE_XTEST */
|
#endif /* HAVE_XTEST */
|
||||||
|
|
||||||
#ifdef HAVE_IBUS
|
|
||||||
#include <ibus.h>
|
|
||||||
#endif /* HAVE_IBUS */
|
|
||||||
|
|
||||||
#include "eek/eek.h"
|
#include "eek/eek.h"
|
||||||
#include "eek/eek-xkl.h"
|
#include "eek/eek-xkl.h"
|
||||||
#include "eekboard/eekboard-client.h"
|
#include "eekboard/eekboard-client.h"
|
||||||
@ -48,6 +44,8 @@
|
|||||||
#define CSW 640
|
#define CSW 640
|
||||||
#define CSH 480
|
#define CSH 480
|
||||||
|
|
||||||
|
#define IBUS_INTERFACE_PANEL "org.freedesktop.IBus.Panel"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_CONNECTION,
|
PROP_CONNECTION,
|
||||||
@ -79,16 +77,14 @@ struct _Client {
|
|||||||
gboolean follows_focus;
|
gboolean follows_focus;
|
||||||
guint hide_keyboard_timeout_id;
|
guint hide_keyboard_timeout_id;
|
||||||
|
|
||||||
|
GDBusConnection *ibus_connection;
|
||||||
|
guint ibus_focus_message_filter;
|
||||||
|
|
||||||
#ifdef HAVE_ATSPI
|
#ifdef HAVE_ATSPI
|
||||||
AtspiAccessible *acc;
|
AtspiAccessible *acc;
|
||||||
AtspiDeviceListener *keystroke_listener;
|
AtspiDeviceListener *keystroke_listener;
|
||||||
#endif /* HAVE_ATSPI */
|
#endif /* HAVE_ATSPI */
|
||||||
|
|
||||||
#ifdef HAVE_IBUS
|
|
||||||
IBusBus *ibus_bus;
|
|
||||||
guint ibus_focus_message_filter;
|
|
||||||
#endif /* HAVE_IBUS */
|
|
||||||
|
|
||||||
#ifdef HAVE_XTEST
|
#ifdef HAVE_XTEST
|
||||||
guint modifier_keycodes[8];
|
guint modifier_keycodes[8];
|
||||||
XkbDescRec *xkb;
|
XkbDescRec *xkb;
|
||||||
@ -211,13 +207,11 @@ client_dispose (GObject *object)
|
|||||||
client_disable_atspi_keystroke (client);
|
client_disable_atspi_keystroke (client);
|
||||||
#endif /* HAVE_ATSPI */
|
#endif /* HAVE_ATSPI */
|
||||||
|
|
||||||
#ifdef HAVE_IBUS
|
|
||||||
client_disable_ibus_focus (client);
|
client_disable_ibus_focus (client);
|
||||||
if (client->ibus_bus) {
|
if (client->ibus_connection) {
|
||||||
g_object_unref (client->ibus_bus);
|
g_object_unref (client->ibus_connection);
|
||||||
client->ibus_bus = NULL;
|
client->ibus_connection = NULL;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_IBUS */
|
|
||||||
|
|
||||||
#ifdef HAVE_XTEST
|
#ifdef HAVE_XTEST
|
||||||
client_disable_xtest (client);
|
client_disable_xtest (client);
|
||||||
@ -590,7 +584,6 @@ keystroke_listener_cb (const AtspiDeviceEvent *stroke,
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_ATSPI */
|
#endif /* HAVE_ATSPI */
|
||||||
|
|
||||||
#ifdef HAVE_IBUS
|
|
||||||
static void
|
static void
|
||||||
add_match_rule (GDBusConnection *connection,
|
add_match_rule (GDBusConnection *connection,
|
||||||
const gchar *match_rule)
|
const gchar *match_rule)
|
||||||
@ -658,12 +651,10 @@ focus_message_filter (GDBusConnection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ibus_connect_focus_handlers (IBusBus *bus, gpointer user_data)
|
_ibus_connect_focus_handlers (GDBusConnection *connection, gpointer user_data)
|
||||||
{
|
{
|
||||||
Client *client = user_data;
|
Client *client = user_data;
|
||||||
GDBusConnection *connection;
|
|
||||||
|
|
||||||
connection = ibus_bus_get_connection (bus);
|
|
||||||
add_match_rule (connection,
|
add_match_rule (connection,
|
||||||
"type='method_call',"
|
"type='method_call',"
|
||||||
"interface='" IBUS_INTERFACE_PANEL "',"
|
"interface='" IBUS_INTERFACE_PANEL "',"
|
||||||
@ -682,16 +673,30 @@ _ibus_connect_focus_handlers (IBusBus *bus, gpointer user_data)
|
|||||||
gboolean
|
gboolean
|
||||||
client_enable_ibus_focus (Client *client)
|
client_enable_ibus_focus (Client *client)
|
||||||
{
|
{
|
||||||
if (!client->ibus_bus) {
|
if (client->ibus_connection == NULL) {
|
||||||
client->ibus_bus = ibus_bus_new ();
|
const gchar *ibus_address;
|
||||||
g_object_ref (client->ibus_bus);
|
GError *error;
|
||||||
g_signal_connect (client->ibus_bus, "connected",
|
|
||||||
G_CALLBACK(_ibus_connect_focus_handlers),
|
|
||||||
client);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ibus_bus_is_connected (client->ibus_bus))
|
ibus_address = g_getenv ("IBUS_ADDRESS");
|
||||||
_ibus_connect_focus_handlers (client->ibus_bus, client);
|
if (ibus_address == NULL) {
|
||||||
|
g_warning ("Can't get IBus address; set IBUS_ADDRESS");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = NULL;
|
||||||
|
client->ibus_connection =
|
||||||
|
g_dbus_connection_new_for_address_sync (ibus_address,
|
||||||
|
G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&error);
|
||||||
|
if (client->ibus_connection == NULL) {
|
||||||
|
g_warning ("Can't open connection to IBus: %s", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ibus_connect_focus_handlers (client->ibus_connection, client);
|
||||||
|
|
||||||
client->follows_focus = TRUE;
|
client->follows_focus = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -700,21 +705,17 @@ client_enable_ibus_focus (Client *client)
|
|||||||
void
|
void
|
||||||
client_disable_ibus_focus (Client *client)
|
client_disable_ibus_focus (Client *client)
|
||||||
{
|
{
|
||||||
GDBusConnection *connection;
|
|
||||||
|
|
||||||
client->follows_focus = FALSE;
|
client->follows_focus = FALSE;
|
||||||
|
|
||||||
if (client->ibus_bus) {
|
if (client->ibus_connection) {
|
||||||
if (client->ibus_focus_message_filter != 0) {
|
if (client->ibus_focus_message_filter != 0) {
|
||||||
connection = ibus_bus_get_connection (client->ibus_bus);
|
g_dbus_connection_remove_filter (client->ibus_connection,
|
||||||
g_dbus_connection_remove_filter (connection,
|
|
||||||
client->ibus_focus_message_filter);
|
client->ibus_focus_message_filter);
|
||||||
}
|
}
|
||||||
g_object_unref (client->ibus_bus);
|
g_object_unref (client->ibus_connection);
|
||||||
client->ibus_bus = NULL;
|
client->ibus_connection = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ATSPI */
|
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
client_new (GDBusConnection *connection)
|
client_new (GDBusConnection *connection)
|
||||||
|
|||||||
Reference in New Issue
Block a user