|
Packit Service |
1d8f1c |
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
|
Packit Service |
1d8f1c |
/* vim:set et sts=4: */
|
|
Packit Service |
1d8f1c |
/* ibus - The Input Bus
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2008-2014 Peng Huang <shawn.p.huang@gmail.com>
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2017-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2008-2018 Red Hat, Inc.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
1d8f1c |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
1d8f1c |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
1d8f1c |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
1d8f1c |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
1d8f1c |
* Lesser General Public License for more details.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
1d8f1c |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
Packit Service |
1d8f1c |
* USA
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
#include "panelproxy.h"
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#include "global.h"
|
|
Packit Service |
1d8f1c |
#include "marshalers.h"
|
|
Packit Service |
1d8f1c |
#include "types.h"
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* panelproxy.c is a very simple proxy class for the panel component that does only the following:
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* 1. Handle D-Bus signals from the panel process. For the list of the D-Bus signals, you can check the bus_panel_proxy_g_signal function, or
|
|
Packit Service |
1d8f1c |
* introspection_xml in src/ibuspanelservice.c. The bus_panel_proxy_g_signal function simply emits a corresponding glib signal for each
|
|
Packit Service |
1d8f1c |
* D-Bus signal.
|
|
Packit Service |
1d8f1c |
* 2. Handle glib signals for a BusPanelProxy object (which is usually emitted by bus_panel_proxy_g_signal.) The list of such glib signals is
|
|
Packit Service |
1d8f1c |
* in the bus_panel_proxy_class_init function. The signal handler function, e.g. bus_panel_proxy_candidate_clicked, simply calls the
|
|
Packit Service |
1d8f1c |
* corresponding function in inputcontext.c, e.g. bus_input_context_candidate_clicked, using the current focused context.
|
|
Packit Service |
1d8f1c |
* 3. Provide a way to call D-Bus methods in the panel process. For the list of the D-Bus methods, you can check the header file (panelproxy.h)
|
|
Packit Service |
1d8f1c |
* or introspection_xml in src/ibuspanelservice.c. Functions that calls g_dbus_proxy_call, e.g. bus_panel_proxy_set_cursor_location, would
|
|
Packit Service |
1d8f1c |
* fall into this category.
|
|
Packit Service |
1d8f1c |
* 4. Handle glib signals for a BusInputContext object. The list of such glib signals is in the input_context_signals[] array. The signal handler
|
|
Packit Service |
1d8f1c |
* function, e.g. _context_set_cursor_location_cb, simply invokes a D-Bus method by calling a function like bus_panel_proxy_set_cursor_location.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
enum {
|
|
Packit Service |
1d8f1c |
PAGE_UP,
|
|
Packit Service |
1d8f1c |
PAGE_DOWN,
|
|
Packit Service |
1d8f1c |
CURSOR_UP,
|
|
Packit Service |
1d8f1c |
CURSOR_DOWN,
|
|
Packit Service |
1d8f1c |
CANDIDATE_CLICKED,
|
|
Packit Service |
1d8f1c |
PROPERTY_ACTIVATE,
|
|
Packit Service |
1d8f1c |
PROPERTY_SHOW,
|
|
Packit Service |
1d8f1c |
PROPERTY_HIDE,
|
|
Packit Service |
1d8f1c |
COMMIT_TEXT,
|
|
Packit Service |
1d8f1c |
PANEL_EXTENSION,
|
|
Packit Service |
1d8f1c |
PANEL_EXTENSION_REGISTER_KEYS,
|
|
Packit Service |
1d8f1c |
UPDATE_PREEDIT_TEXT_RECEIVED,
|
|
Packit Service |
1d8f1c |
UPDATE_LOOKUP_TABLE_RECEIVED,
|
|
Packit Service |
1d8f1c |
UPDATE_AUXILIARY_TEXT_RECEIVED,
|
|
Packit Service |
1d8f1c |
LAST_SIGNAL,
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
struct _BusPanelProxy {
|
|
Packit Service |
1d8f1c |
IBusProxy parent;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* instance members */
|
|
Packit Service |
1d8f1c |
BusInputContext *focused_context;
|
|
Packit Service |
1d8f1c |
PanelType panel_type;
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
struct _BusPanelProxyClass {
|
|
Packit Service |
1d8f1c |
IBusProxyClass parent;
|
|
Packit Service |
1d8f1c |
/* class members */
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void (* page_up) (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
void (* page_down) (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
void (* cursor_up) (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
void (* cursor_down) (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
void (* candidate_clicked) (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
guint index,
|
|
Packit Service |
1d8f1c |
guint button,
|
|
Packit Service |
1d8f1c |
guint state);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void (* property_activate) (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
const gchar *prop_name,
|
|
Packit Service |
1d8f1c |
gint prop_state);
|
|
Packit Service |
1d8f1c |
void (* commit_text) (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusText *text);
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static guint panel_signals[LAST_SIGNAL] = { 0 };
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* functions prototype */
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_init (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_real_destroy (IBusProxy *proxy);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_g_signal (GDBusProxy *proxy,
|
|
Packit Service |
1d8f1c |
const gchar *sender_name,
|
|
Packit Service |
1d8f1c |
const gchar *signal_name,
|
|
Packit Service |
1d8f1c |
GVariant *parameters);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_page_up (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_page_down (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_cursor_up (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_cursor_down (BusPanelProxy *panel);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_candidate_clicked
|
|
Packit Service |
1d8f1c |
(BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
guint index,
|
|
Packit Service |
1d8f1c |
guint button,
|
|
Packit Service |
1d8f1c |
guint state);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_property_activate
|
|
Packit Service |
1d8f1c |
(BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
const gchar *prop_name,
|
|
Packit Service |
1d8f1c |
gint prop_state);
|
|
Packit Service |
1d8f1c |
static void bus_panel_proxy_commit_text
|
|
Packit Service |
1d8f1c |
(BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusText *text);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
G_DEFINE_TYPE(BusPanelProxy, bus_panel_proxy, IBUS_TYPE_PROXY)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
BusPanelProxy *
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_new (BusConnection *connection,
|
|
Packit Service |
1d8f1c |
PanelType panel_type)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
const gchar *path = NULL;
|
|
Packit Service |
1d8f1c |
GObject *obj;
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_CONNECTION (connection));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
switch (panel_type) {
|
|
Packit Service |
1d8f1c |
case PANEL_TYPE_PANEL:
|
|
Packit Service |
1d8f1c |
path = IBUS_PATH_PANEL;
|
|
Packit Service |
1d8f1c |
break;
|
|
Packit Service |
1d8f1c |
case PANEL_TYPE_EXTENSION_EMOJI:
|
|
Packit Service |
1d8f1c |
path = IBUS_PATH_PANEL_EXTENSION_EMOJI;
|
|
Packit Service |
1d8f1c |
break;
|
|
Packit Service |
1d8f1c |
default:
|
|
Packit Service |
1d8f1c |
g_return_val_if_reached (NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
obj = g_initable_new (BUS_TYPE_PANEL_PROXY,
|
|
Packit Service |
1d8f1c |
NULL,
|
|
Packit Service |
1d8f1c |
NULL,
|
|
Packit Service |
1d8f1c |
"g-object-path", path,
|
|
Packit Service |
1d8f1c |
"g-interface-name", IBUS_INTERFACE_PANEL,
|
|
Packit Service |
1d8f1c |
"g-connection", bus_connection_get_dbus_connection (connection),
|
|
Packit Service |
1d8f1c |
"g-default-timeout", g_gdbus_timeout,
|
|
Packit Service |
1d8f1c |
"g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
|
|
Packit Service |
1d8f1c |
NULL);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel = BUS_PANEL_PROXY (obj);
|
|
Packit Service |
1d8f1c |
panel->panel_type = panel_type;
|
|
Packit Service |
1d8f1c |
return panel;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_class_init (BusPanelProxyClass *class)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
IBUS_PROXY_CLASS (class)->destroy = bus_panel_proxy_real_destroy;
|
|
Packit Service |
1d8f1c |
G_DBUS_PROXY_CLASS (class)->g_signal = bus_panel_proxy_g_signal;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
class->page_up = bus_panel_proxy_page_up;
|
|
Packit Service |
1d8f1c |
class->page_down = bus_panel_proxy_page_down;
|
|
Packit Service |
1d8f1c |
class->cursor_up = bus_panel_proxy_cursor_up;
|
|
Packit Service |
1d8f1c |
class->cursor_down = bus_panel_proxy_cursor_down;
|
|
Packit Service |
1d8f1c |
class->candidate_clicked = bus_panel_proxy_candidate_clicked;
|
|
Packit Service |
1d8f1c |
class->property_activate = bus_panel_proxy_property_activate;
|
|
Packit Service |
1d8f1c |
class->commit_text = bus_panel_proxy_commit_text;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* install signals */
|
|
Packit Service |
1d8f1c |
panel_signals[PAGE_UP] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("page-up"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
G_STRUCT_OFFSET(BusPanelProxyClass, page_up),
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__VOID,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 0);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[PAGE_DOWN] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("page-down"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
G_STRUCT_OFFSET(BusPanelProxyClass, page_down),
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__VOID,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 0);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[CURSOR_UP] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("cursor-up"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
G_STRUCT_OFFSET(BusPanelProxyClass, cursor_up),
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__VOID,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 0);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[CURSOR_DOWN] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("cursor-down"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
G_STRUCT_OFFSET(BusPanelProxyClass, cursor_down),
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__VOID,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 0);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[CANDIDATE_CLICKED] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("candidate-clicked"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
G_STRUCT_OFFSET(BusPanelProxyClass, candidate_clicked),
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__UINT_UINT_UINT,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 3,
|
|
Packit Service |
1d8f1c |
G_TYPE_UINT,
|
|
Packit Service |
1d8f1c |
G_TYPE_UINT,
|
|
Packit Service |
1d8f1c |
G_TYPE_UINT);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[PROPERTY_ACTIVATE] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("property-activate"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
G_STRUCT_OFFSET(BusPanelProxyClass, property_activate),
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__STRING_INT,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 2,
|
|
Packit Service |
1d8f1c |
G_TYPE_STRING,
|
|
Packit Service |
1d8f1c |
G_TYPE_INT);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[PROPERTY_SHOW] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("property-show"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
0,
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__STRING,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 1,
|
|
Packit Service |
1d8f1c |
G_TYPE_STRING);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[PROPERTY_HIDE] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("property-hide"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
0,
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__STRING,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 1,
|
|
Packit Service |
1d8f1c |
G_TYPE_STRING);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[COMMIT_TEXT] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("commit-text"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
G_STRUCT_OFFSET(BusPanelProxyClass, commit_text),
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__OBJECT,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 1,
|
|
Packit Service |
1d8f1c |
IBUS_TYPE_TEXT);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[PANEL_EXTENSION] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("panel-extension"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
0,
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__OBJECT,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 1,
|
|
Packit Service |
1d8f1c |
IBUS_TYPE_EXTENSION_EVENT);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[PANEL_EXTENSION_REGISTER_KEYS] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("panel-extension-register-keys"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
0,
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__VARIANT,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 1,
|
|
Packit Service |
1d8f1c |
G_TYPE_VARIANT);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[UPDATE_PREEDIT_TEXT_RECEIVED] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("update-preedit-text-received"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
0,
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__OBJECT_UINT_BOOLEAN,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 3,
|
|
Packit Service |
1d8f1c |
IBUS_TYPE_TEXT,
|
|
Packit Service |
1d8f1c |
G_TYPE_UINT,
|
|
Packit Service |
1d8f1c |
G_TYPE_BOOLEAN);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[UPDATE_LOOKUP_TABLE_RECEIVED] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("update-lookup-table-received"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
0,
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__OBJECT_BOOLEAN,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 2,
|
|
Packit Service |
1d8f1c |
IBUS_TYPE_LOOKUP_TABLE,
|
|
Packit Service |
1d8f1c |
G_TYPE_BOOLEAN);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
panel_signals[UPDATE_AUXILIARY_TEXT_RECEIVED] =
|
|
Packit Service |
1d8f1c |
g_signal_new (I_("update-auxiliary-text-received"),
|
|
Packit Service |
1d8f1c |
G_TYPE_FROM_CLASS (class),
|
|
Packit Service |
1d8f1c |
G_SIGNAL_RUN_LAST,
|
|
Packit Service |
1d8f1c |
0,
|
|
Packit Service |
1d8f1c |
NULL, NULL,
|
|
Packit Service |
1d8f1c |
bus_marshal_VOID__OBJECT_BOOLEAN,
|
|
Packit Service |
1d8f1c |
G_TYPE_NONE, 2,
|
|
Packit Service |
1d8f1c |
IBUS_TYPE_TEXT,
|
|
Packit Service |
1d8f1c |
G_TYPE_BOOLEAN);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_g_object_unref_if_floating (gpointer instance)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
if (g_object_is_floating (instance))
|
|
Packit Service |
1d8f1c |
g_object_unref (instance);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_init (BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
/* member variables will automatically be zero-cleared. */
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_real_destroy (IBusProxy *proxy)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel = (BusPanelProxy *)proxy;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (panel->focused_context) {
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_focus_out (panel, panel->focused_context);
|
|
Packit Service |
1d8f1c |
panel->focused_context = NULL;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
IBUS_PROXY_CLASS(bus_panel_proxy_parent_class)->
|
|
Packit Service |
1d8f1c |
destroy ((IBusProxy *)panel);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* bus_panel_proxy_g_signal:
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Handle all D-Bus signals from the panel process. This function emits a corresponding glib signal for each D-Bus signal.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_g_signal (GDBusProxy *proxy,
|
|
Packit Service |
1d8f1c |
const gchar *sender_name,
|
|
Packit Service |
1d8f1c |
const gchar *signal_name,
|
|
Packit Service |
1d8f1c |
GVariant *parameters)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel = (BusPanelProxy *)proxy;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* The list of nullary D-Bus signals. */
|
|
Packit Service |
1d8f1c |
static const struct {
|
|
Packit Service |
1d8f1c |
const gchar *signal_name;
|
|
Packit Service |
1d8f1c |
const guint signal_id;
|
|
Packit Service |
1d8f1c |
} signals [] = {
|
|
Packit Service |
1d8f1c |
{ "PageUp", PAGE_UP },
|
|
Packit Service |
1d8f1c |
{ "PageDown", PAGE_DOWN },
|
|
Packit Service |
1d8f1c |
{ "CursorUp", CURSOR_UP },
|
|
Packit Service |
1d8f1c |
{ "CursorDown", CURSOR_DOWN },
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
gint i;
|
|
Packit Service |
1d8f1c |
for (i = 0; i < G_N_ELEMENTS (signals); i++) {
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 (signal_name, signals[i].signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[signals[i].signal_id], 0);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* Handle D-Bus signals with parameters. Deserialize them and emit a glib signal. */
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("CandidateClicked", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
guint index = 0;
|
|
Packit Service |
1d8f1c |
guint button = 0;
|
|
Packit Service |
1d8f1c |
guint state = 0;
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(uuu)", &index, &button, &state);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[CANDIDATE_CLICKED], 0, index, button, state);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("PropertyActivate", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
gchar *prop_name = NULL;
|
|
Packit Service |
1d8f1c |
gint prop_state = 0;
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(&su)", &prop_name, &prop_state);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[PROPERTY_ACTIVATE], 0, prop_name, prop_state);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("PropertyShow", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
gchar *prop_name = NULL;
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(&s)", &prop_name);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[PROPERTY_SHOW], 0, prop_name);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("PropertyHide", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
gchar *prop_name = NULL;
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(&s)", &prop_name);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[PROPERTY_HIDE], 0, prop_name);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("CommitText", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
GVariant *arg0 = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(v)", &arg0);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (arg0);
|
|
Packit Service |
1d8f1c |
IBusText *text = IBUS_TEXT (ibus_serializable_deserialize (arg0));
|
|
Packit Service |
1d8f1c |
g_variant_unref (arg0);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (text);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[COMMIT_TEXT], 0, text);
|
|
Packit Service |
1d8f1c |
_g_object_unref_if_floating (text);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("PanelExtension", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
GVariant *arg0 = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(v)", &arg0);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (arg0);
|
|
Packit Service |
1d8f1c |
IBusExtensionEvent *event = IBUS_EXTENSION_EVENT (
|
|
Packit Service |
1d8f1c |
ibus_serializable_deserialize (arg0));
|
|
Packit Service |
1d8f1c |
g_variant_unref (arg0);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (event);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[PANEL_EXTENSION], 0, event);
|
|
Packit Service |
1d8f1c |
_g_object_unref_if_floating (event);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("PanelExtensionRegisterKeys", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[PANEL_EXTENSION_REGISTER_KEYS], 0,
|
|
Packit Service |
1d8f1c |
parameters);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("UpdatePreeditTextReceived", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
GVariant *variant = NULL;
|
|
Packit Service |
1d8f1c |
guint cursor_pos = 0;
|
|
Packit Service |
1d8f1c |
gboolean visible = FALSE;
|
|
Packit Service |
1d8f1c |
IBusText *text = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(vub)", &variant, &cursor_pos, &visible);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (variant);
|
|
Packit Service |
1d8f1c |
text = (IBusText *) ibus_serializable_deserialize (variant);
|
|
Packit Service |
1d8f1c |
g_variant_unref (variant);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (text);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[UPDATE_PREEDIT_TEXT_RECEIVED], 0,
|
|
Packit Service |
1d8f1c |
text, cursor_pos, visible);
|
|
Packit Service |
1d8f1c |
_g_object_unref_if_floating (text);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("UpdateLookupTableReceived", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
GVariant *variant = NULL;
|
|
Packit Service |
1d8f1c |
gboolean visible = FALSE;
|
|
Packit Service |
1d8f1c |
IBusLookupTable *table = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(vb)", &variant, &visible);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (variant);
|
|
Packit Service |
1d8f1c |
table = (IBusLookupTable *) ibus_serializable_deserialize (variant);
|
|
Packit Service |
1d8f1c |
g_variant_unref (variant);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (table);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[UPDATE_LOOKUP_TABLE_RECEIVED], 0,
|
|
Packit Service |
1d8f1c |
table, visible);
|
|
Packit Service |
1d8f1c |
_g_object_unref_if_floating (table);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 ("UpdateAuxiliaryTextReceived", signal_name) == 0) {
|
|
Packit Service |
1d8f1c |
GVariant *variant = NULL;
|
|
Packit Service |
1d8f1c |
gboolean visible = FALSE;
|
|
Packit Service |
1d8f1c |
IBusText *text = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(vb)", &variant, &visible);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (variant);
|
|
Packit Service |
1d8f1c |
text = (IBusText *) ibus_serializable_deserialize (variant);
|
|
Packit Service |
1d8f1c |
g_variant_unref (variant);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (text);
|
|
Packit Service |
1d8f1c |
g_signal_emit (panel, panel_signals[UPDATE_AUXILIARY_TEXT_RECEIVED], 0,
|
|
Packit Service |
1d8f1c |
text, visible);
|
|
Packit Service |
1d8f1c |
_g_object_unref_if_floating (text);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* shound not be reached */
|
|
Packit Service |
1d8f1c |
g_return_if_reached ();
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_set_cursor_location (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
gint x,
|
|
Packit Service |
1d8f1c |
gint y,
|
|
Packit Service |
1d8f1c |
gint w,
|
|
Packit Service |
1d8f1c |
gint h)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"SetCursorLocation",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(iiii)", x, y, w, h),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_set_cursor_location_relative (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
gint x,
|
|
Packit Service |
1d8f1c |
gint y,
|
|
Packit Service |
1d8f1c |
gint w,
|
|
Packit Service |
1d8f1c |
gint h)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"SetCursorLocationRelative",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(iiii)", x, y, w, h),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_update_preedit_text (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusText *text,
|
|
Packit Service |
1d8f1c |
guint cursor_pos,
|
|
Packit Service |
1d8f1c |
gboolean visible)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (IBUS_IS_TEXT (text));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable* )text);
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"UpdatePreeditText",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(vub)", variant, cursor_pos, visible),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_update_auxiliary_text (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusText *text,
|
|
Packit Service |
1d8f1c |
gboolean visible)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (IBUS_IS_TEXT (text));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable* )text);
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"UpdateAuxiliaryText",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(vb)", variant, visible),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_update_lookup_table (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusLookupTable *table,
|
|
Packit Service |
1d8f1c |
gboolean visible)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (IBUS_IS_LOOKUP_TABLE (table));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable* )table);
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"UpdateLookupTable",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(vb)", variant, visible),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_register_properties (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusPropList *prop_list)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (IBUS_IS_PROP_LIST (prop_list));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)prop_list);
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"RegisterProperties",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(v)", variant),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_update_property (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusProperty *prop)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (IBUS_IS_PROPERTY (prop));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
GVariant *variant = ibus_serializable_serialize ((IBusSerializable *)prop);
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"UpdateProperty",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(v)", variant),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_set_content_type (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
guint purpose,
|
|
Packit Service |
1d8f1c |
guint hints)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"ContentType",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(uu)", purpose, hints),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#define DEFINE_FUNC(name) \
|
|
Packit Service |
1d8f1c |
static void \
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_##name (BusPanelProxy *panel) \
|
|
Packit Service |
1d8f1c |
{ \
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel)); \
|
|
Packit Service |
1d8f1c |
\
|
|
Packit Service |
1d8f1c |
if (panel->focused_context) { \
|
|
Packit Service |
1d8f1c |
bus_input_context_##name (panel->focused_context); \
|
|
Packit Service |
1d8f1c |
} \
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
DEFINE_FUNC(page_up)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNC(page_down)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNC(cursor_up)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNC(cursor_down)
|
|
Packit Service |
1d8f1c |
#undef DEFINE_FUNC
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_candidate_clicked (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
guint index,
|
|
Packit Service |
1d8f1c |
guint button,
|
|
Packit Service |
1d8f1c |
guint state)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (panel->focused_context) {
|
|
Packit Service |
1d8f1c |
bus_input_context_candidate_clicked (panel->focused_context,
|
|
Packit Service |
1d8f1c |
index,
|
|
Packit Service |
1d8f1c |
button,
|
|
Packit Service |
1d8f1c |
state);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_property_activate (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
const gchar *prop_name,
|
|
Packit Service |
1d8f1c |
gint prop_state)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (panel->focused_context) {
|
|
Packit Service |
1d8f1c |
bus_input_context_property_activate (panel->focused_context, prop_name, prop_state);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_commit_text (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusText *text)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
gboolean use_extension = TRUE;
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (text != NULL);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (!panel->focused_context)
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
if (panel->panel_type != PANEL_TYPE_PANEL)
|
|
Packit Service |
1d8f1c |
use_extension = FALSE;
|
|
Packit Service |
1d8f1c |
bus_input_context_commit_text_use_extension (panel->focused_context,
|
|
Packit Service |
1d8f1c |
text,
|
|
Packit Service |
1d8f1c |
use_extension);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#define DEFINE_FUNCTION(Name, name) \
|
|
Packit Service |
1d8f1c |
void bus_panel_proxy_##name (BusPanelProxy *panel) \
|
|
Packit Service |
1d8f1c |
{ \
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel)); \
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *) panel, \
|
|
Packit Service |
1d8f1c |
#Name, \
|
|
Packit Service |
1d8f1c |
NULL, \
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE, \
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL); \
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (ShowPreeditText, show_preedit_text)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (HidePreeditText, hide_preedit_text)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (ShowAuxiliaryText, show_auxiliary_text)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (HideAuxiliaryText, hide_auxiliary_text)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (ShowLookupTable, show_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (HideLookupTable, hide_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (PageUpLookupTable, page_up_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (PageDownLookupTable, page_down_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (CursorUpLookupTable, cursor_up_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (CursorDownLookupTable, cursor_down_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (StateChanged, state_changed)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#undef DEFINE_FUNCTION
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_set_cursor_location_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
gint x,
|
|
Packit Service |
1d8f1c |
gint y,
|
|
Packit Service |
1d8f1c |
gint w,
|
|
Packit Service |
1d8f1c |
gint h,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_set_cursor_location (panel, x, y, w, h);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_set_cursor_location_relative_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
gint x,
|
|
Packit Service |
1d8f1c |
gint y,
|
|
Packit Service |
1d8f1c |
gint w,
|
|
Packit Service |
1d8f1c |
gint h,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_set_cursor_location_relative (panel, x, y, w, h);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_update_preedit_text_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
IBusText *text,
|
|
Packit Service |
1d8f1c |
guint cursor_pos,
|
|
Packit Service |
1d8f1c |
gboolean visible,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (text != NULL);
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* The callback is called with X11 applications but
|
|
Packit Service |
1d8f1c |
* the callback is not called for extensions and panel
|
|
Packit Service |
1d8f1c |
* extensions are always calls by
|
|
Packit Service |
1d8f1c |
* bus_panel_proxy_update_preedit_text() directly
|
|
Packit Service |
1d8f1c |
* because panel extensions foward UpdatePreeditText to
|
|
Packit Service |
1d8f1c |
* UpdatePreeditTextReceived and it can be an infinite
|
|
Packit Service |
1d8f1c |
* loop.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
if (panel->panel_type != PANEL_TYPE_PANEL)
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_update_preedit_text (panel,
|
|
Packit Service |
1d8f1c |
text,
|
|
Packit Service |
1d8f1c |
cursor_pos,
|
|
Packit Service |
1d8f1c |
visible);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_update_auxiliary_text_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
IBusText *text,
|
|
Packit Service |
1d8f1c |
gboolean visible,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_update_auxiliary_text (panel,
|
|
Packit Service |
1d8f1c |
text,
|
|
Packit Service |
1d8f1c |
visible);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_update_lookup_table_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
IBusLookupTable *table,
|
|
Packit Service |
1d8f1c |
gboolean visible,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_update_lookup_table (panel,
|
|
Packit Service |
1d8f1c |
table,
|
|
Packit Service |
1d8f1c |
visible);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_register_properties_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
IBusPropList *prop_list,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_register_properties (panel,
|
|
Packit Service |
1d8f1c |
prop_list);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_update_property_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
IBusProperty *prop,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_update_property (panel,
|
|
Packit Service |
1d8f1c |
prop);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_destroy_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_assert (context == panel->focused_context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_focus_out (panel, context);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
_context_set_content_type_cb (BusInputContext *context,
|
|
Packit Service |
1d8f1c |
guint purpose,
|
|
Packit Service |
1d8f1c |
guint hints,
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_set_content_type (panel, purpose, hints);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#define DEFINE_FUNCTION(name) \
|
|
Packit Service |
1d8f1c |
static void _context_##name##_cb (BusInputContext *context, \
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel) \
|
|
Packit Service |
1d8f1c |
{ \
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context)); \
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel)); \
|
|
Packit Service |
1d8f1c |
\
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context); \
|
|
Packit Service |
1d8f1c |
\
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_##name (panel); \
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#define DEFINE_FUNCTION_NO_EXTENSION(name) \
|
|
Packit Service |
1d8f1c |
static void _context_##name##_cb (BusInputContext *context, \
|
|
Packit Service |
1d8f1c |
BusPanelProxy *panel) \
|
|
Packit Service |
1d8f1c |
{ \
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context)); \
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel)); \
|
|
Packit Service |
1d8f1c |
\
|
|
Packit Service |
1d8f1c |
g_return_if_fail (panel->focused_context == context); \
|
|
Packit Service |
1d8f1c |
\
|
|
Packit Service |
1d8f1c |
/* The callback is called with X11 applications but \
|
|
Packit Service |
1d8f1c |
* the callback is not called for extensions and panel \
|
|
Packit Service |
1d8f1c |
* extensions are always calls by \
|
|
Packit Service |
1d8f1c |
* bus_panel_proxy_update_preedit_text() directly \
|
|
Packit Service |
1d8f1c |
* because panel extensions foward UpdatePreeditText to \
|
|
Packit Service |
1d8f1c |
* UpdatePreeditTextReceived and it can be an infinite \
|
|
Packit Service |
1d8f1c |
* loop. \
|
|
Packit Service |
1d8f1c |
*/ \
|
|
Packit Service |
1d8f1c |
if (panel->panel_type != PANEL_TYPE_PANEL) \
|
|
Packit Service |
1d8f1c |
return; \
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_##name (panel); \
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION_NO_EXTENSION (show_preedit_text)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION_NO_EXTENSION (hide_preedit_text)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (show_auxiliary_text)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (hide_auxiliary_text)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (show_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (hide_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (page_up_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (page_down_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (cursor_up_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (cursor_down_lookup_table)
|
|
Packit Service |
1d8f1c |
DEFINE_FUNCTION (state_changed)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#undef DEFINE_FUNCTION
|
|
Packit Service |
1d8f1c |
#undef DEFINE_FUNCTION_NO_EXTENSION
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static const struct {
|
|
Packit Service |
1d8f1c |
gchar *name;
|
|
Packit Service |
1d8f1c |
GCallback callback;
|
|
Packit Service |
1d8f1c |
} input_context_signals[] = {
|
|
Packit Service |
1d8f1c |
{ "set-cursor-location", G_CALLBACK (_context_set_cursor_location_cb) },
|
|
Packit Service |
1d8f1c |
{ "set-cursor-location-relative", G_CALLBACK (_context_set_cursor_location_relative_cb) },
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
{ "update-preedit-text", G_CALLBACK (_context_update_preedit_text_cb) },
|
|
Packit Service |
1d8f1c |
{ "show-preedit-text", G_CALLBACK (_context_show_preedit_text_cb) },
|
|
Packit Service |
1d8f1c |
{ "hide-preedit-text", G_CALLBACK (_context_hide_preedit_text_cb) },
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
{ "update-auxiliary-text", G_CALLBACK (_context_update_auxiliary_text_cb) },
|
|
Packit Service |
1d8f1c |
{ "show-auxiliary-text", G_CALLBACK (_context_show_auxiliary_text_cb) },
|
|
Packit Service |
1d8f1c |
{ "hide-auxiliary-text", G_CALLBACK (_context_hide_auxiliary_text_cb) },
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
{ "update-lookup-table", G_CALLBACK (_context_update_lookup_table_cb) },
|
|
Packit Service |
1d8f1c |
{ "show-lookup-table", G_CALLBACK (_context_show_lookup_table_cb) },
|
|
Packit Service |
1d8f1c |
{ "hide-lookup-table", G_CALLBACK (_context_hide_lookup_table_cb) },
|
|
Packit Service |
1d8f1c |
{ "page-up-lookup-table", G_CALLBACK (_context_page_up_lookup_table_cb) },
|
|
Packit Service |
1d8f1c |
{ "page-down-lookup-table", G_CALLBACK (_context_page_down_lookup_table_cb) },
|
|
Packit Service |
1d8f1c |
{ "cursor-up-lookup-table", G_CALLBACK (_context_cursor_up_lookup_table_cb) },
|
|
Packit Service |
1d8f1c |
{ "cursor-down-lookup-table", G_CALLBACK (_context_cursor_down_lookup_table_cb) },
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
{ "register-properties", G_CALLBACK (_context_register_properties_cb) },
|
|
Packit Service |
1d8f1c |
{ "update-property", G_CALLBACK (_context_update_property_cb) },
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
{ "engine-changed", G_CALLBACK (_context_state_changed_cb) },
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
{ "destroy", G_CALLBACK (_context_destroy_cb) },
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
{ "set-content-type", G_CALLBACK (_context_set_content_type_cb) },
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_focus_in (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
BusInputContext *context)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
const gchar *path;
|
|
Packit Service |
1d8f1c |
guint purpose, hints;
|
|
Packit Service |
1d8f1c |
gint i;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (panel->focused_context == context)
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (panel->focused_context != NULL)
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_focus_out (panel, panel->focused_context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_object_ref_sink (context);
|
|
Packit Service |
1d8f1c |
panel->focused_context = context;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
path = ibus_service_get_object_path ((IBusService *)context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"FocusIn",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(o)", path),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* install signal handlers */
|
|
Packit Service |
1d8f1c |
for (i = 0; i < G_N_ELEMENTS (input_context_signals); i++) {
|
|
Packit Service |
1d8f1c |
g_signal_connect (context,
|
|
Packit Service |
1d8f1c |
input_context_signals[i].name,
|
|
Packit Service |
1d8f1c |
input_context_signals[i].callback,
|
|
Packit Service |
1d8f1c |
panel);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
bus_input_context_get_content_type (context, &purpose, &hints);
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_set_content_type (panel, purpose, hints);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_focus_out (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
BusInputContext *context)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_assert (panel->focused_context == context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* uninstall signal handlers */
|
|
Packit Service |
1d8f1c |
gint i;
|
|
Packit Service |
1d8f1c |
for (i = 0; i < G_N_ELEMENTS (input_context_signals); i++) {
|
|
Packit Service |
1d8f1c |
g_signal_handlers_disconnect_by_func (context,
|
|
Packit Service |
1d8f1c |
input_context_signals[i].callback,
|
|
Packit Service |
1d8f1c |
panel);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
const gchar *path = ibus_service_get_object_path ((IBusService *)context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"FocusOut",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(o)", path),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_object_unref (panel->focused_context);
|
|
Packit Service |
1d8f1c |
panel->focused_context = NULL;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_destroy_context (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
BusInputContext *context)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
const gchar *path;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_INPUT_CONTEXT (context));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_object_ref_sink (context);
|
|
Packit Service |
1d8f1c |
path = ibus_service_get_object_path ((IBusService *)context);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"DestroyContext",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(o)", path),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_object_unref (context);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
PanelType
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_get_panel_type (BusPanelProxy *panel)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
return panel->panel_type;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_panel_extension_received (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusExtensionEvent *event)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
GVariant *data;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (event);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
data = ibus_serializable_serialize (IBUS_SERIALIZABLE (event));
|
|
Packit Service |
1d8f1c |
g_return_if_fail (data);
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"PanelExtensionReceived",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(v)", data),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_process_key_event (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
guint keyval,
|
|
Packit Service |
1d8f1c |
guint keycode,
|
|
Packit Service |
1d8f1c |
guint state,
|
|
Packit Service |
1d8f1c |
GAsyncReadyCallback callback,
|
|
Packit Service |
1d8f1c |
gpointer user_data)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"ProcessKeyEvent",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(uuu)", keyval, keycode, state),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1,
|
|
Packit Service |
1d8f1c |
NULL,
|
|
Packit Service |
1d8f1c |
callback,
|
|
Packit Service |
1d8f1c |
user_data);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_commit_text_received (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
IBusText *text)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
GVariant *variant;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
g_assert (IBUS_IS_TEXT (text));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
variant = ibus_serializable_serialize (IBUS_SERIALIZABLE (text));
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"CommitTextReceived",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(v)", variant),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
bus_panel_proxy_candidate_clicked_lookup_table (BusPanelProxy *panel,
|
|
Packit Service |
1d8f1c |
guint index,
|
|
Packit Service |
1d8f1c |
guint button,
|
|
Packit Service |
1d8f1c |
guint state)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_assert (BUS_IS_PANEL_PROXY (panel));
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_dbus_proxy_call ((GDBusProxy *)panel,
|
|
Packit Service |
1d8f1c |
"CandidateClickedLookupTable",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(uuu)", index, button, state),
|
|
Packit Service |
1d8f1c |
G_DBUS_CALL_FLAGS_NONE,
|
|
Packit Service |
1d8f1c |
-1, NULL, NULL, NULL);
|
|
Packit Service |
1d8f1c |
}
|