Make sure to include config.h to check HAVE_CSPI and HAVE_FAKEKEY.
This commit is contained in:
@ -1,3 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||||
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <cspi/spi.h>
|
#include <cspi/spi.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
@ -15,7 +36,11 @@ gboolean opt_keystroke = FALSE;
|
|||||||
gboolean opt_fakekey = FALSE;
|
gboolean opt_fakekey = FALSE;
|
||||||
#endif /* HAVE_FAKEKEY */
|
#endif /* HAVE_FAKEKEY */
|
||||||
|
|
||||||
|
gboolean opt_all = FALSE;
|
||||||
|
|
||||||
static const GOptionEntry options[] = {
|
static const GOptionEntry options[] = {
|
||||||
|
{"all", 'a', 0, G_OPTION_ARG_NONE, &opt_all,
|
||||||
|
"Listen all events which can be captured"},
|
||||||
{"listen-keyboard", 'k', 0, G_OPTION_ARG_NONE, &opt_keyboard,
|
{"listen-keyboard", 'k', 0, G_OPTION_ARG_NONE, &opt_keyboard,
|
||||||
"Listen keyboard change events with libxklavier"},
|
"Listen keyboard change events with libxklavier"},
|
||||||
#ifdef HAVE_CSPI
|
#ifdef HAVE_CSPI
|
||||||
@ -62,7 +87,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
#ifdef HAVE_CSPI
|
#ifdef HAVE_CSPI
|
||||||
error = NULL;
|
error = NULL;
|
||||||
if (opt_focus || opt_keystroke) {
|
if (opt_all || opt_focus || opt_keystroke) {
|
||||||
if (gconf_client_get_bool (gconfc,
|
if (gconf_client_get_bool (gconfc,
|
||||||
"/desktop/gnome/interface/accessibility",
|
"/desktop/gnome/interface/accessibility",
|
||||||
&error) ||
|
&error) ||
|
||||||
@ -74,13 +99,13 @@ main (int argc, char **argv)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_focus &&
|
if ((opt_all || opt_focus) &&
|
||||||
!eekboard_system_client_enable_cspi_focus (client)) {
|
!eekboard_system_client_enable_cspi_focus (client)) {
|
||||||
g_printerr ("Can't register focus change event listeners\n");
|
g_printerr ("Can't register focus change event listeners\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_keystroke &&
|
if ((opt_all || opt_keystroke) &&
|
||||||
!eekboard_system_client_enable_cspi_keystroke (client)) {
|
!eekboard_system_client_enable_cspi_keystroke (client)) {
|
||||||
g_printerr ("Can't register keystroke event listeners\n");
|
g_printerr ("Can't register keystroke event listeners\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
@ -92,14 +117,14 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_CSPI */
|
#endif /* HAVE_CSPI */
|
||||||
|
|
||||||
if (opt_keyboard &&
|
if ((opt_all || opt_keyboard) &&
|
||||||
!eekboard_system_client_enable_xkl (client)) {
|
!eekboard_system_client_enable_xkl (client)) {
|
||||||
g_printerr ("Can't register xklavier event listeners\n");
|
g_printerr ("Can't register xklavier event listeners\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FAKEKEY
|
#ifdef HAVE_FAKEKEY
|
||||||
if (opt_fakekey &&
|
if ((opt_all || opt_fakekey) &&
|
||||||
!eekboard_system_client_enable_fakekey (client)) {
|
!eekboard_system_client_enable_fakekey (client)) {
|
||||||
g_printerr ("Can't init fakekey\n");
|
g_printerr ("Can't init fakekey\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|||||||
Reference in New Issue
Block a user