Rename EekboardProxy to EekboardDevice.
This commit is contained in:
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
lib_LTLIBRARIES = libeekboard.la
|
lib_LTLIBRARIES = libeekboard.la
|
||||||
|
|
||||||
libeekboard_headers = eekboard.h eekboard-proxy.h
|
libeekboard_headers = eekboard.h eekboard-device.h
|
||||||
libeekboard_sources = eekboard-proxy.c
|
libeekboard_sources = eekboard-device.c
|
||||||
|
|
||||||
libeekboard_la_SOURCES = $(libeekboard_sources)
|
libeekboard_la_SOURCES = $(libeekboard_sources)
|
||||||
libeekboard_la_CFLAGS = -I$(top_srcdir) $(GIO2_CFLAGS)
|
libeekboard_la_CFLAGS = -I$(top_srcdir) $(GIO2_CFLAGS)
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif /* HAVE_CONFIG_H */
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
|
||||||
#include "eekboard-proxy.h"
|
#include "eekboard-device.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
KEY_PRESSED,
|
KEY_PRESSED,
|
||||||
@ -29,35 +29,35 @@ enum {
|
|||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0, };
|
static guint signals[LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
struct _EekboardProxy {
|
struct _EekboardDevice {
|
||||||
GDBusProxy parent;
|
GDBusProxy parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _EekboardProxyClass {
|
struct _EekboardDeviceClass {
|
||||||
GDBusProxyClass parent_class;
|
GDBusProxyClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (EekboardProxy, eekboard_proxy, G_TYPE_DBUS_PROXY);
|
G_DEFINE_TYPE (EekboardDevice, eekboard_device, G_TYPE_DBUS_PROXY);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eekboard_proxy_real_g_signal (GDBusProxy *self,
|
eekboard_device_real_g_signal (GDBusProxy *self,
|
||||||
const gchar *sender_name,
|
const gchar *sender_name,
|
||||||
const gchar *signal_name,
|
const gchar *signal_name,
|
||||||
GVariant *parameters)
|
GVariant *parameters)
|
||||||
{
|
{
|
||||||
EekboardProxy *proxy = EEKBOARD_PROXY (self);
|
EekboardDevice *device = EEKBOARD_DEVICE (self);
|
||||||
guint *keycode;
|
guint *keycode;
|
||||||
|
|
||||||
if (g_strcmp0 (signal_name, "KeyPressed") == 0) {
|
if (g_strcmp0 (signal_name, "KeyPressed") == 0) {
|
||||||
|
|
||||||
g_variant_get (parameters, "(u)", &keycode);
|
g_variant_get (parameters, "(u)", &keycode);
|
||||||
g_signal_emit_by_name (proxy, "key-pressed", keycode);
|
g_signal_emit_by_name (device, "key-pressed", keycode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_strcmp0 (signal_name, "KeyReleased") == 0) {
|
if (g_strcmp0 (signal_name, "KeyReleased") == 0) {
|
||||||
g_variant_get (parameters, "(u)", &keycode);
|
g_variant_get (parameters, "(u)", &keycode);
|
||||||
g_signal_emit_by_name (proxy, "key-released", keycode);
|
g_signal_emit_by_name (device, "key-released", keycode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,12 +65,12 @@ eekboard_proxy_real_g_signal (GDBusProxy *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eekboard_proxy_class_init (EekboardProxyClass *klass)
|
eekboard_device_class_init (EekboardDeviceClass *klass)
|
||||||
{
|
{
|
||||||
GDBusProxyClass *proxy_class = G_DBUS_PROXY_CLASS (klass);
|
GDBusProxyClass *proxy_class = G_DBUS_PROXY_CLASS (klass);
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
proxy_class->g_signal = eekboard_proxy_real_g_signal;
|
proxy_class->g_signal = eekboard_device_real_g_signal;
|
||||||
|
|
||||||
signals[KEY_PRESSED] =
|
signals[KEY_PRESSED] =
|
||||||
g_signal_new ("key-pressed",
|
g_signal_new ("key-pressed",
|
||||||
@ -98,15 +98,15 @@ eekboard_proxy_class_init (EekboardProxyClass *klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eekboard_proxy_init (EekboardProxy *proxy)
|
eekboard_device_init (EekboardDevice *device)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EekboardProxy *
|
EekboardDevice *
|
||||||
eekboard_proxy_new (const gchar *path,
|
eekboard_device_new (const gchar *path,
|
||||||
GDBusConnection *connection,
|
GDBusConnection *connection,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GInitable *initable;
|
GInitable *initable;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ eekboard_proxy_new (const gchar *path,
|
|||||||
g_assert (G_IS_DBUS_CONNECTION(connection));
|
g_assert (G_IS_DBUS_CONNECTION(connection));
|
||||||
|
|
||||||
initable =
|
initable =
|
||||||
g_initable_new (EEKBOARD_TYPE_PROXY,
|
g_initable_new (EEKBOARD_TYPE_DEVICE,
|
||||||
cancellable,
|
cancellable,
|
||||||
error,
|
error,
|
||||||
"g-connection", connection,
|
"g-connection", connection,
|
||||||
@ -125,7 +125,7 @@ eekboard_proxy_new (const gchar *path,
|
|||||||
"g-object-path", path,
|
"g-object-path", path,
|
||||||
NULL);
|
NULL);
|
||||||
if (initable != NULL)
|
if (initable != NULL)
|
||||||
return EEKBOARD_PROXY (initable);
|
return EEKBOARD_DEVICE (initable);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,12 +146,12 @@ proxy_call_async_ready_cb (GObject *source_object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
eekboard_proxy_set_keyboard (EekboardProxy *proxy, EekKeyboard *keyboard)
|
eekboard_device_set_keyboard (EekboardDevice *device, EekKeyboard *keyboard)
|
||||||
{
|
{
|
||||||
GVariant *variant;
|
GVariant *variant;
|
||||||
|
|
||||||
variant = eek_serializable_serialize (EEK_SERIALIZABLE(keyboard));
|
variant = eek_serializable_serialize (EEK_SERIALIZABLE(keyboard));
|
||||||
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
|
g_dbus_proxy_call (G_DBUS_PROXY(device),
|
||||||
"SetKeyboard",
|
"SetKeyboard",
|
||||||
g_variant_new ("(v)", variant),
|
g_variant_new ("(v)", variant),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -163,9 +163,10 @@ eekboard_proxy_set_keyboard (EekboardProxy *proxy, EekKeyboard *keyboard)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
eekboard_proxy_set_group (EekboardProxy *proxy, gint group)
|
eekboard_device_set_group (EekboardDevice *device,
|
||||||
|
gint group)
|
||||||
{
|
{
|
||||||
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
|
g_dbus_proxy_call (G_DBUS_PROXY(device),
|
||||||
"SetGroup",
|
"SetGroup",
|
||||||
g_variant_new ("(i)", group),
|
g_variant_new ("(i)", group),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -176,9 +177,9 @@ eekboard_proxy_set_group (EekboardProxy *proxy, gint group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
eekboard_proxy_show (EekboardProxy *proxy)
|
eekboard_device_show (EekboardDevice *device)
|
||||||
{
|
{
|
||||||
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
|
g_dbus_proxy_call (G_DBUS_PROXY(device),
|
||||||
"Show",
|
"Show",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -189,9 +190,9 @@ eekboard_proxy_show (EekboardProxy *proxy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
eekboard_proxy_hide (EekboardProxy *proxy)
|
eekboard_device_hide (EekboardDevice *device)
|
||||||
{
|
{
|
||||||
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
|
g_dbus_proxy_call (G_DBUS_PROXY(device),
|
||||||
"Hide",
|
"Hide",
|
||||||
NULL,
|
NULL,
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -202,10 +203,10 @@ eekboard_proxy_hide (EekboardProxy *proxy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
eekboard_proxy_press_key (EekboardProxy *proxy,
|
eekboard_device_press_key (EekboardDevice *device,
|
||||||
guint keycode)
|
guint keycode)
|
||||||
{
|
{
|
||||||
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
|
g_dbus_proxy_call (G_DBUS_PROXY(device),
|
||||||
"PressKey",
|
"PressKey",
|
||||||
g_variant_new ("(u)", keycode),
|
g_variant_new ("(u)", keycode),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
@ -216,10 +217,10 @@ eekboard_proxy_press_key (EekboardProxy *proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
eekboard_proxy_release_key (EekboardProxy *proxy,
|
eekboard_device_release_key (EekboardDevice *device,
|
||||||
guint keycode)
|
guint keycode)
|
||||||
{
|
{
|
||||||
g_dbus_proxy_call (G_DBUS_PROXY(proxy),
|
g_dbus_proxy_call (G_DBUS_PROXY(device),
|
||||||
"ReleaseKey",
|
"ReleaseKey",
|
||||||
g_variant_new ("(u)", keycode),
|
g_variant_new ("(u)", keycode),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
52
eekboard/eekboard-device.h
Normal file
52
eekboard/eekboard-device.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
#ifndef EEKBOARD_DEVICE_H
|
||||||
|
#define EEKBOARD_DEVICE_H 1
|
||||||
|
|
||||||
|
#include <gio/gio.h>
|
||||||
|
#include "eek/eek.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define EEKBOARD_TYPE_DEVICE (eekboard_device_get_type())
|
||||||
|
#define EEKBOARD_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_DEVICE, EekboardDevice))
|
||||||
|
#define EEKBOARD_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_DEVICE, EekboardDeviceClass))
|
||||||
|
#define EEKBOARD_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_DEVICE))
|
||||||
|
#define EEKBOARD_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_DEVICE))
|
||||||
|
#define EEKBOARD_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_DEVICE, EekboardDeviceClass))
|
||||||
|
|
||||||
|
typedef struct _EekboardDevice EekboardDevice;
|
||||||
|
typedef struct _EekboardDeviceClass EekboardDeviceClass;
|
||||||
|
|
||||||
|
EekboardDevice *eekboard_device_new (const gchar *path,
|
||||||
|
GDBusConnection *connection,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
void eekboard_device_set_keyboard (EekboardDevice *device,
|
||||||
|
EekKeyboard *keyboard);
|
||||||
|
void eekboard_device_set_group (EekboardDevice *device,
|
||||||
|
gint group);
|
||||||
|
void eekboard_device_show (EekboardDevice *device);
|
||||||
|
void eekboard_device_hide (EekboardDevice *device);
|
||||||
|
void eekboard_device_press_key (EekboardDevice *device,
|
||||||
|
guint keycode);
|
||||||
|
void eekboard_device_release_key (EekboardDevice *device,
|
||||||
|
guint keycode);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
#endif /* EEKBOARD_DEVICE_H */
|
||||||
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
#ifndef EEKBOARD_PROXY_H
|
|
||||||
#define EEKBOARD_PROXY_H 1
|
|
||||||
|
|
||||||
#include <gio/gio.h>
|
|
||||||
#include "eek/eek.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define EEKBOARD_TYPE_PROXY (eekboard_proxy_get_type())
|
|
||||||
#define EEKBOARD_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEKBOARD_TYPE_PROXY, EekboardProxy))
|
|
||||||
#define EEKBOARD_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEKBOARD_TYPE_PROXY, EekboardProxyClass))
|
|
||||||
#define EEKBOARD_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEKBOARD_TYPE_PROXY))
|
|
||||||
#define EEKBOARD_IS_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEKBOARD_TYPE_PROXY))
|
|
||||||
#define EEKBOARD_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEKBOARD_TYPE_PROXY, EekboardProxyClass))
|
|
||||||
|
|
||||||
typedef struct _EekboardProxy EekboardProxy;
|
|
||||||
typedef struct _EekboardProxyClass EekboardProxyClass;
|
|
||||||
|
|
||||||
EekboardProxy *eekboard_proxy_new (const gchar *path,
|
|
||||||
GDBusConnection *connection,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
void eekboard_proxy_set_keyboard (EekboardProxy *proxy,
|
|
||||||
EekKeyboard *keyboard);
|
|
||||||
void eekboard_proxy_set_group (EekboardProxy *proxy,
|
|
||||||
gint group);
|
|
||||||
void eekboard_proxy_show (EekboardProxy *proxy);
|
|
||||||
void eekboard_proxy_hide (EekboardProxy *proxy);
|
|
||||||
void eekboard_proxy_press_key (EekboardProxy *proxy,
|
|
||||||
guint keycode);
|
|
||||||
void eekboard_proxy_release_key (EekboardProxy *proxy,
|
|
||||||
guint keycode);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
#endif /* EEKBOARD_PROXY_H */
|
|
||||||
@ -18,6 +18,6 @@
|
|||||||
#ifndef EEKBOARD_H
|
#ifndef EEKBOARD_H
|
||||||
#define EEKBOARD_H 1
|
#define EEKBOARD_H 1
|
||||||
|
|
||||||
#include "eekboard/eekboard-proxy.h"
|
#include "eekboard/eekboard-device.h"
|
||||||
|
|
||||||
#endif /* EEKBOARD_H */
|
#endif /* EEKBOARD_H */
|
||||||
|
|||||||
@ -62,7 +62,7 @@ on_key_released (guint keycode, gpointer user_data)
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
EekboardProxy *proxy = NULL;
|
EekboardDevice *device = NULL;
|
||||||
GDBusConnection *connection = NULL;
|
GDBusConnection *connection = NULL;
|
||||||
GError *error;
|
GError *error;
|
||||||
GOptionContext *context;
|
GOptionContext *context;
|
||||||
@ -86,10 +86,10 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
proxy = eekboard_proxy_new ("/com/redhat/eekboard/Keyboard",
|
device = eekboard_device_new ("/com/redhat/eekboard/Device",
|
||||||
connection,
|
connection,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (error) {
|
if (error) {
|
||||||
g_printerr ("%s\n", error->message);
|
g_printerr ("%s\n", error->message);
|
||||||
retval = 1;
|
retval = 1;
|
||||||
@ -118,42 +118,42 @@ main (int argc, char **argv)
|
|||||||
g_object_unref (input);
|
g_object_unref (input);
|
||||||
keyboard = eek_keyboard_new (layout, 640, 480);
|
keyboard = eek_keyboard_new (layout, 640, 480);
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
eekboard_proxy_set_keyboard (proxy, keyboard);
|
eekboard_device_set_keyboard (device, keyboard);
|
||||||
g_object_unref (keyboard);
|
g_object_unref (keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_set_group >= 0) {
|
if (opt_set_group >= 0) {
|
||||||
eekboard_proxy_set_group (proxy, opt_set_group);
|
eekboard_device_set_group (device, opt_set_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_show) {
|
if (opt_show) {
|
||||||
eekboard_proxy_show (proxy);
|
eekboard_device_show (device);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_hide) {
|
if (opt_hide) {
|
||||||
eekboard_proxy_hide (proxy);
|
eekboard_device_hide (device);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_press_key >= 0) {
|
if (opt_press_key >= 0) {
|
||||||
eekboard_proxy_press_key (proxy, opt_press_key);
|
eekboard_device_press_key (device, opt_press_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_release_key >= 0) {
|
if (opt_release_key >= 0) {
|
||||||
eekboard_proxy_release_key (proxy, opt_release_key);
|
eekboard_device_release_key (device, opt_release_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_listen) {
|
if (opt_listen) {
|
||||||
g_signal_connect (proxy, "key-pressed",
|
g_signal_connect (device, "key-pressed",
|
||||||
G_CALLBACK(on_key_pressed), NULL);
|
G_CALLBACK(on_key_pressed), NULL);
|
||||||
g_signal_connect (proxy, "key-released",
|
g_signal_connect (device, "key-released",
|
||||||
G_CALLBACK(on_key_released), NULL);
|
G_CALLBACK(on_key_released), NULL);
|
||||||
loop = g_main_loop_new (NULL, FALSE);
|
loop = g_main_loop_new (NULL, FALSE);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (proxy)
|
if (device)
|
||||||
g_object_unref (proxy);
|
g_object_unref (device);
|
||||||
if (connection)
|
if (connection)
|
||||||
g_object_unref (connection);
|
g_object_unref (connection);
|
||||||
if (loop)
|
if (loop)
|
||||||
|
|||||||
1696
src/eekboard.c
1696
src/eekboard.c
File diff suppressed because it is too large
Load Diff
18
src/server.c
18
src/server.c
@ -43,7 +43,7 @@ enum {
|
|||||||
|
|
||||||
static const gchar introspection_xml[] =
|
static const gchar introspection_xml[] =
|
||||||
"<node>"
|
"<node>"
|
||||||
" <interface name='com.redhat.eekboard.Keyboard'>"
|
" <interface name='com.redhat.eekboard.Device'>"
|
||||||
" <method name='SetKeyboard'>"
|
" <method name='SetKeyboard'>"
|
||||||
" <arg type='v' name='keyboard'/>"
|
" <arg type='v' name='keyboard'/>"
|
||||||
" </method>"
|
" </method>"
|
||||||
@ -253,9 +253,9 @@ on_key_pressed (EekKeyboard *keyboard,
|
|||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
g_dbus_connection_emit_signal (server->connection,
|
g_dbus_connection_emit_signal (server->connection,
|
||||||
"com.redhat.eekboard.Keyboard",
|
"com.redhat.eekboard.Device",
|
||||||
"/com/redhat/eekboard/Keyboard",
|
"/com/redhat/eekboard/Device",
|
||||||
"com.redhat.eekboard.Keyboard",
|
"com.redhat.eekboard.Device",
|
||||||
"KeyPressed",
|
"KeyPressed",
|
||||||
g_variant_new ("(u)",
|
g_variant_new ("(u)",
|
||||||
eek_key_get_keycode (key)),
|
eek_key_get_keycode (key)),
|
||||||
@ -273,9 +273,9 @@ on_key_released (EekKeyboard *keyboard,
|
|||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
g_dbus_connection_emit_signal (server->connection,
|
g_dbus_connection_emit_signal (server->connection,
|
||||||
"com.redhat.eekboard.Keyboard",
|
"com.redhat.eekboard.Device",
|
||||||
"/com/redhat/eekboard/Keyboard",
|
"/com/redhat/eekboard/Device",
|
||||||
"com.redhat.eekboard.Keyboard",
|
"com.redhat.eekboard.Device",
|
||||||
"KeyReleased",
|
"KeyReleased",
|
||||||
g_variant_new ("(u)",
|
g_variant_new ("(u)",
|
||||||
eek_key_get_keycode (key)),
|
eek_key_get_keycode (key)),
|
||||||
@ -481,7 +481,7 @@ eekboard_server_start (EekboardServer *server)
|
|||||||
error = NULL;
|
error = NULL;
|
||||||
registration_id = g_dbus_connection_register_object
|
registration_id = g_dbus_connection_register_object
|
||||||
(server->connection,
|
(server->connection,
|
||||||
"/com/redhat/eekboard/Keyboard",
|
"/com/redhat/eekboard/Device",
|
||||||
server->introspection_data->interfaces[0],
|
server->introspection_data->interfaces[0],
|
||||||
&interface_vtable,
|
&interface_vtable,
|
||||||
server,
|
server,
|
||||||
@ -493,7 +493,7 @@ eekboard_server_start (EekboardServer *server)
|
|||||||
|
|
||||||
server->owner_id =
|
server->owner_id =
|
||||||
g_bus_own_name_on_connection (server->connection,
|
g_bus_own_name_on_connection (server->connection,
|
||||||
"com.redhat.eekboard.Keyboard",
|
"com.redhat.eekboard.Device",
|
||||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||||
on_name_acquired,
|
on_name_acquired,
|
||||||
on_name_lost,
|
on_name_lost,
|
||||||
|
|||||||
@ -50,7 +50,7 @@ typedef struct _EekboardSystemClientClass EekboardSystemClientClass;
|
|||||||
struct _EekboardSystemClient {
|
struct _EekboardSystemClient {
|
||||||
GObject parent;
|
GObject parent;
|
||||||
|
|
||||||
EekboardProxy *proxy;
|
EekboardDevice *device;
|
||||||
|
|
||||||
EekKeyboard *keyboard;
|
EekKeyboard *keyboard;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
@ -117,7 +117,7 @@ eekboard_system_client_set_property (GObject *object,
|
|||||||
case PROP_CONNECTION:
|
case PROP_CONNECTION:
|
||||||
connection = g_value_get_object (value);
|
connection = g_value_get_object (value);
|
||||||
error = NULL;
|
error = NULL;
|
||||||
client->proxy = eekboard_proxy_new ("/com/redhat/eekboard/Keyboard",
|
client->device = eekboard_device_new ("/com/redhat/eekboard/Device",
|
||||||
connection,
|
connection,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
@ -146,9 +146,9 @@ eekboard_system_client_dispose (GObject *object)
|
|||||||
eekboard_system_client_disable_fakekey (client);
|
eekboard_system_client_disable_fakekey (client);
|
||||||
#endif /* HAVE_FAKEKEY */
|
#endif /* HAVE_FAKEKEY */
|
||||||
|
|
||||||
if (client->proxy) {
|
if (client->device) {
|
||||||
g_object_unref (client->proxy);
|
g_object_unref (client->device);
|
||||||
client->proxy = NULL;
|
client->device = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FAKEKEY
|
#ifdef HAVE_FAKEKEY
|
||||||
@ -191,7 +191,7 @@ eekboard_system_client_init (EekboardSystemClient *client)
|
|||||||
client->display = NULL;
|
client->display = NULL;
|
||||||
client->xkl_engine = NULL;
|
client->xkl_engine = NULL;
|
||||||
client->xkl_config_registry = NULL;
|
client->xkl_config_registry = NULL;
|
||||||
client->proxy = NULL;
|
client->device = NULL;
|
||||||
client->key_pressed_handler = 0;
|
client->key_pressed_handler = 0;
|
||||||
client->key_released_handler = 0;
|
client->key_released_handler = 0;
|
||||||
client->xkl_config_changed_handler = 0;
|
client->xkl_config_changed_handler = 0;
|
||||||
@ -337,12 +337,12 @@ focus_listener_cb (const AccessibleEvent *event,
|
|||||||
case SPI_ROLE_TERMINAL:
|
case SPI_ROLE_TERMINAL:
|
||||||
case SPI_ROLE_ENTRY:
|
case SPI_ROLE_ENTRY:
|
||||||
if (g_strcmp0 (event->type, "focus") == 0 || event->detail1 == 1)
|
if (g_strcmp0 (event->type, "focus") == 0 || event->detail1 == 1)
|
||||||
eekboard_proxy_show (client->proxy);
|
eekboard_device_show (client->device);
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
eekboard_proxy_hide (client->proxy);
|
eekboard_device_hide (client->device);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -364,9 +364,9 @@ keystroke_listener_cb (const AccessibleKeystroke *stroke,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stroke->type == SPI_KEY_PRESSED)
|
if (stroke->type == SPI_KEY_PRESSED)
|
||||||
eekboard_proxy_press_key (client->proxy, stroke->keycode);
|
eekboard_device_press_key (client->device, stroke->keycode);
|
||||||
else
|
else
|
||||||
eekboard_proxy_release_key (client->proxy, stroke->keycode);
|
eekboard_device_release_key (client->device, stroke->keycode);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_CSPI */
|
#endif /* HAVE_CSPI */
|
||||||
@ -422,7 +422,7 @@ set_keyboard (EekboardSystemClient *client)
|
|||||||
keyboard_name = g_strdup_printf ("keyboard%d", keyboard_serial++);
|
keyboard_name = g_strdup_printf ("keyboard%d", keyboard_serial++);
|
||||||
eek_element_set_name (EEK_ELEMENT(client->keyboard), keyboard_name);
|
eek_element_set_name (EEK_ELEMENT(client->keyboard), keyboard_name);
|
||||||
|
|
||||||
eekboard_proxy_set_keyboard (client->proxy, client->keyboard);
|
eekboard_device_set_keyboard (client->device, client->keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -438,7 +438,7 @@ on_xkl_state_changed (XklEngine *xklengine,
|
|||||||
gint group = eek_keyboard_get_group (client->keyboard);
|
gint group = eek_keyboard_get_group (client->keyboard);
|
||||||
if (group != value) {
|
if (group != value) {
|
||||||
eek_keyboard_set_group (client->keyboard, value);
|
eek_keyboard_set_group (client->keyboard, value);
|
||||||
eekboard_proxy_set_group (client->proxy, value);
|
eekboard_device_set_group (client->device, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -462,7 +462,7 @@ get_fakekey_modifiers (EekModifierType modifiers)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_key_pressed (EekboardProxy *proxy,
|
on_key_pressed (EekboardDevice *device,
|
||||||
guint keycode,
|
guint keycode,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -495,7 +495,7 @@ on_key_pressed (EekboardProxy *proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_key_released (EekboardProxy *proxy,
|
on_key_released (EekboardDevice *device,
|
||||||
guint keycode,
|
guint keycode,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -526,10 +526,10 @@ eekboard_system_client_enable_fakekey (EekboardSystemClient *client)
|
|||||||
g_assert (client->fakekey);
|
g_assert (client->fakekey);
|
||||||
|
|
||||||
client->key_pressed_handler =
|
client->key_pressed_handler =
|
||||||
g_signal_connect (client->proxy, "key-pressed",
|
g_signal_connect (client->device, "key-pressed",
|
||||||
G_CALLBACK(on_key_pressed), client);
|
G_CALLBACK(on_key_pressed), client);
|
||||||
client->key_released_handler =
|
client->key_released_handler =
|
||||||
g_signal_connect (client->proxy, "key-pressed",
|
g_signal_connect (client->device, "key-pressed",
|
||||||
G_CALLBACK(on_key_released), client);
|
G_CALLBACK(on_key_released), client);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -541,13 +541,13 @@ eekboard_system_client_disable_fakekey (EekboardSystemClient *client)
|
|||||||
if (client->fakekey)
|
if (client->fakekey)
|
||||||
fakekey_release (client->fakekey);
|
fakekey_release (client->fakekey);
|
||||||
|
|
||||||
if (g_signal_handler_is_connected (client->proxy,
|
if (g_signal_handler_is_connected (client->device,
|
||||||
client->key_pressed_handler))
|
client->key_pressed_handler))
|
||||||
g_signal_handler_disconnect (client->proxy,
|
g_signal_handler_disconnect (client->device,
|
||||||
client->key_pressed_handler);
|
client->key_pressed_handler);
|
||||||
if (g_signal_handler_is_connected (client->proxy,
|
if (g_signal_handler_is_connected (client->device,
|
||||||
client->key_released_handler))
|
client->key_released_handler))
|
||||||
g_signal_handler_disconnect (client->proxy,
|
g_signal_handler_disconnect (client->device,
|
||||||
client->key_released_handler);
|
client->key_released_handler);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_FAKEKEY */
|
#endif /* HAVE_FAKEKEY */
|
||||||
|
|||||||
Reference in New Issue
Block a user